commit cc202c713be60355dbcf4e5ea87603c5e16a92db (HEAD, refs/remotes/origin/master) Merge: fecc4c0f79 394209c1a0 Author: Glenn Morris Date: Sat Oct 9 07:50:36 2021 -0700 Merge from origin/emacs-28 394209c1a0 (origin/emacs-28) ; Fix indentation in etc/NEWS 81f20e8b89 Fix thinko in ls-lisp--insert-directory ec9f25bd35 Mention that RET means "yes" in y-or-n-p 00eb21c897 ; * src/dispextern.h (struct glyph_string): Comment on NCH... 20eb3644ba Rewrite Antinews for Emacs 28 3a9b881603 ; * etc/NEWS: Rearrange the "incompatible changes" sections. ebb7e26013 ; * etc/NEWS: Fix a typo. 315fe20086 ; * src/Makefile.in (../native-lisp): Add comment. 47cbd103f5 * lisp/bindings.el (mode-line-position): Improve tooltip. 35a752863a * lisp/progmodes/xref.el: Bump the version. bbcd8cc1a9 Slight simplificaiton e139dd1b1e Fix doc strings of 2 categories 59782839cb (xref--collect-matches-1): Remove some intermediate alloca... 1c7d056f4d ; Fix two typos where em dash was written as en dash # Conflicts: # etc/NEWS commit fecc4c0f79bbfcae3c6dd0ad8331a8ef6faa4034 Author: Stefan Monnier Date: Sat Oct 9 10:42:49 2021 -0400 * lisp/progmodes/bug-reference.el: Use new `eql` specializer syntax diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index fd014a38d9..c6327c1a3f 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -269,7 +269,7 @@ via the internet it might also be http.") ;; pull/17 page if 17 is a PR. Explicit user/project#17 links to ;; possibly different projects are also supported. (cl-defmethod bug-reference--build-forge-setup-entry - (host-domain (_forge-type (eql github)) protocol) + (host-domain (_forge-type (eql 'github)) protocol) `(,(concat "[/@]" host-domain "[/:]\\([.A-Za-z0-9_/-]+\\)\\.git") "\\(\\([.A-Za-z0-9_/-]+\\)?\\(?:#\\)\\([0-9]+\\)\\)\\>" ,(lambda (groups) @@ -284,7 +284,7 @@ via the internet it might also be http.") ;; namespace/project#18 or namespace/project!17 references to possibly ;; different projects are also supported. (cl-defmethod bug-reference--build-forge-setup-entry - (host-domain (_forge-type (eql gitlab)) protocol) + (host-domain (_forge-type (eql 'gitlab)) protocol) `(,(concat "[/@]" (regexp-quote host-domain) "[/:]\\([.A-Za-z0-9_/-]+\\)\\.git") "\\(\\([.A-Za-z0-9_/-]+\\)?\\([#!]\\)\\([0-9]+\\)\\)\\>" @@ -301,7 +301,7 @@ via the internet it might also be http.") ;; Gitea: The systematics is exactly as for Github projects. (cl-defmethod bug-reference--build-forge-setup-entry - (host-domain (_forge-type (eql gitea)) protocol) + (host-domain (_forge-type (eql 'gitea)) protocol) `(,(concat "[/@]" (regexp-quote host-domain) "[/:]\\([.A-Za-z0-9_/-]+\\)\\.git") "\\(\\([.A-Za-z0-9_/-]+\\)?\\(?:#\\)\\([0-9]+\\)\\)\\>" @@ -322,7 +322,7 @@ via the internet it might also be http.") ;; repo without tracker, or a repo with a tracker using a different ;; name, etc. So we can only try to make a good guess. (cl-defmethod bug-reference--build-forge-setup-entry - (host-domain (_forge-type (eql sourcehut)) protocol) + (host-domain (_forge-type (eql 'sourcehut)) protocol) `(,(concat "[/@]\\(?:git\\|hg\\)." (regexp-quote host-domain) "[/:]\\(~[.A-Za-z0-9_/-]+\\)") "\\(\\(~[.A-Za-z0-9_/-]+\\)?\\(?:#\\)\\([0-9]+\\)\\)\\>" commit 394209c1a012ec0d24cbef031101c82a79ceea83 Author: Michael Albinus Date: Sat Oct 9 16:42:00 2021 +0200 ; Fix indentation in etc/NEWS diff --git a/etc/NEWS b/etc/NEWS index 16fa36bd5f..09537d7d31 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -947,8 +947,8 @@ previous section for how to get back the old bindings. Alternatively, if you only want these two commands to have global bindings they had before, you can add the following to your init file: - (define-key global-map "\M-o\M-s" 'center-line) - (define-key global-map "\M-o\M-S" 'center-paragraph) + (define-key global-map "\M-o\M-s" 'center-line) + (define-key global-map "\M-o\M-S" 'center-paragraph) --- ** The 'M-o M-o' global binding has been removed. commit 81f20e8b89d6333cbc796e92df5aa3df4f5712db Author: Michael Albinus Date: Sat Oct 9 16:18:53 2021 +0200 Fix thinko in ls-lisp--insert-directory * lisp/ls-lisp.el (ls-lisp--insert-directory): Ensure that SWITCHES is a string. diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el index 8e81f79e42..82153ff0ad 100644 --- a/lisp/ls-lisp.el +++ b/lisp/ls-lisp.el @@ -283,6 +283,7 @@ are also supported; unsupported long options are silently ignored." (funcall orig-fun file switches wildcard full-directory-p) ;; We need the directory in order to find the right handler. + (setq switches (or switches "")) (let ((handler (find-file-name-handler (expand-file-name file) 'insert-directory)) (orig-file file) commit ec9f25bd356c7c81d94c78f11100b97d6d52ce97 Author: Lars Ingebrigtsen Date: Sat Oct 9 15:04:11 2021 +0200 Mention that RET means "yes" in y-or-n-p * lisp/subr.el (y-or-n-p): Mention that RET also means yes (bug#51101). diff --git a/lisp/subr.el b/lisp/subr.el index f8f446c6a9..78767b259d 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3218,7 +3218,7 @@ PROMPT is also updated to show `help-char' like \"(y, n or C-h) \", where `help-char' is automatically bound to `help-form-show'. No confirmation of the answer is requested; a single character is -enough. SPC also means yes, and DEL means no. +enough. RET and SPC also means yes, and DEL means no. To be precise, this function translates user input into responses by consulting the bindings in `query-replace-map'; see the commit 13411346202f86e950bee076a5d528e98695fbb4 Author: F. Jason Park Date: Sat Oct 9 14:59:43 2021 +0200 Add ERC version to protocol log * lisp/erc/erc.el (erc-toggle-debug-irc-protocol): Include the erc version in the debug logs (bug#51107). diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 3462aa4db0..4a86fa712a 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -2388,6 +2388,7 @@ If ARG is non-nil, show the *erc-protocol* buffer." (let ((inhibit-read-only t) (msg (list (concat "Version: " erc-debug-irc-protocol-version) + (concat "ERC-Version: " erc-version) (concat "Emacs-Version: " emacs-version) (erc-make-notice (concat "This buffer displays all IRC protocol " commit 22704345f7dd1175444ce591bb53a4cf908762b9 Author: Lars Ingebrigtsen Date: Sat Oct 9 14:49:38 2021 +0200 Remove mistaken dired-x entry from previous info-look patch. diff --git a/lisp/info-look.el b/lisp/info-look.el index 881f63c140..4812035919 100644 --- a/lisp/info-look.el +++ b/lisp/info-look.el @@ -979,8 +979,7 @@ Return nil if there is nothing appropriate in the buffer near point." ;; sort of fallback match scheme existed. ("(elisp)Index" nil "^ -+ .*: " "\\( \\|$\\)") ("(cl)Function Index" nil "^ -+ .*: " "\\( \\|$\\)") - ("(cl)Variable Index" nil "^ -+ .*: " "\\( \\|$\\)") - ("(dired-x)Index" nil "^ -+ .*: " "\\( \\|$\\)"))) + ("(cl)Variable Index" nil "^ -+ .*: " "\\( \\|$\\)"))) (mapc (lambda (elem) commit f839c7f2c00d95a96994adbcd862cc58d761ea69 Author: Lars Ingebrigtsen Date: Sat Oct 9 14:44:21 2021 +0200 Make `C-h S' work on symbols from most of the manuals in Emacs * lisp/info-look.el (lambda): Add `C-h S' lookup for all the "misc" manuals in Emacs (bug#42753). diff --git a/lisp/info-look.el b/lisp/info-look.el index 309f2e8d63..881f63c140 100644 --- a/lisp/info-look.el +++ b/lisp/info-look.el @@ -358,9 +358,19 @@ If optional argument QUERY is non-nil, query for the help mode." (error "No %s help available for `%s'" topic mode)) (setq info-lookup-mode mode))) +(defun info-lookup--item-to-mode (item mode) + (let ((spec (cons mode (car (split-string (if (stringp item) + item + (symbol-name item)) + "-"))))) + (if (assoc spec (cdr (assq 'symbol info-lookup-alist))) + spec + mode))) + (defun info-lookup (topic item mode) "Display the documentation of a help item." (or mode (setq mode (info-lookup-select-mode))) + (setq mode (info-lookup--item-to-mode item mode)) (if-let ((info (info-lookup->mode-value topic mode))) (info-lookup--expand-info info) (error "No %s help available for `%s'" topic mode)) @@ -969,7 +979,69 @@ Return nil if there is nothing appropriate in the buffer near point." ;; sort of fallback match scheme existed. ("(elisp)Index" nil "^ -+ .*: " "\\( \\|$\\)") ("(cl)Function Index" nil "^ -+ .*: " "\\( \\|$\\)") - ("(cl)Variable Index" nil "^ -+ .*: " "\\( \\|$\\)"))) + ("(cl)Variable Index" nil "^ -+ .*: " "\\( \\|$\\)") + ("(dired-x)Index" nil "^ -+ .*: " "\\( \\|$\\)"))) + +(mapc + (lambda (elem) + (let* ((prefix (car elem))) + (info-lookup-add-help + :mode (cons 'emacs-lisp-mode prefix) + :regexp (concat "\\b" prefix "-[^][()`'‘’,\" \t\n]+") + :doc-spec (cl-loop for node in (cdr elem) + collect + (list (if (string-match-p "^(" node) + node + (format "(%s)%s" prefix node)) + nil "^ -+ .*: " "\\( \\|$\\)"))))) + ;; Below we have a list of prefixes (used to match on symbols in + ;; `emacs-lisp-mode') and the nodes where the function/variable + ;; indices live. If the prefix is different than the name of the + ;; manual, then the full "(manual)Node" name has to be used. + '(("auth" "Function Index" "Variable Index") + ("autotype" "Command Index" "Variable Index") + ("calc" "Lisp Function Index" "Variable Index") + ;;("cc-mode" "Variable Index" "Command and Function Index") + ("dbus" "Index") + ("ediff" "Index") + ("eieio" "Function Index") + ("gnutls" "(emacs-gnutls)Variable Index" "(emacs-gnutls)Function Index") + ("mm" "(emacs-mime)Index") + ("epa" "Variable Index" "Function Index") + ("ert" "Index") + ("eshell" "Function and Variable Index") + ("eudc" "Index") + ("eww" "Variable Index" "Lisp Function Index") + ("flymake" "Index") + ("forms" "Index") + ("gnus" "Index") + ("htmlfontify" "Functions" "Variables & Customization") + ("idlwave" "Index") + ("ido" "Variable Index" "Function Index") + ("info" "Index") + ("mairix" "(mairix-el)Variable Index" "(mairix-el)Function Index") + ("message" "Index") + ("mh" "(mh-e)Option Index" "(mh-e)Command Index") + ("newsticker" "Index") + ("octave" "(octave-mode)Variable Index" "(octave-mode)Lisp Function Index") + ("org" "Variable Index" "Command and Function Index") + ("pgg" "Variable Index" "Function Index") + ("rcirc" "Variable Index" "Index") + ("reftex" "Index") + ("sasl" "Variable Index" "Function Index") + ("sc" "Variable Index") + ("semantic" "Index") + ("ses" "Index") + ("sieve" "Index") + ("smtpmail" "Function and Variable Index") + ("srecode" "Index") + ("tramp" "Variable Index" "Function Index") + ("url" "Variable Index" "Function Index") + ("vhdl" "(vhdl-mode)Variable Index" "(vhdl-mode)Command Index") + ("viper" "Variable Index" "Function Index") + ("widget" "Index") + ("wisent" "Index") + ("woman" "Variable Index" "Command Index"))) ;; docstrings talk about elisp, so have apropos-mode follow emacs-lisp-mode (info-lookup-maybe-add-help commit 72a959c132fb0e9338c70688d6e85da0f81ae2ae Author: Lars Ingebrigtsen Date: Sat Oct 9 14:43:47 2021 +0200 Add indices to mairix-el * doc/misc/mairix-el.texi (Function Index): Add indices. diff --git a/doc/misc/mairix-el.texi b/doc/misc/mairix-el.texi index d0ec552145..99e71b2e42 100644 --- a/doc/misc/mairix-el.texi +++ b/doc/misc/mairix-el.texi @@ -59,6 +59,8 @@ database. * Setting up the mairix interface:: Set up mairix.el. * Using:: List of interactive functions * Extending:: Support your favorite mail reader! +* Function Index: Function Index. +* Variable Index: Variable Index. * GNU Free Documentation License:: The license for this documentation. @end menu @@ -339,4 +341,14 @@ And that's it! @appendix GNU Free Documentation License @include doclicense.texi +@node Function Index +@unnumbered Function Index + +@printindex fn + +@node Variable Index +@unnumbered Variable Index + +@printindex vr + @bye commit 00eb21c8979f4e53345fdc021d32307d102afda9 Author: Eli Zaretskii Date: Sat Oct 9 14:38:06 2021 +0300 ; * src/dispextern.h (struct glyph_string): Comment on NCHARS. (Bug#51105) diff --git a/src/dispextern.h b/src/dispextern.h index 6aefe43e19..08dac5d455 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1326,7 +1326,9 @@ struct glyph_string /* The area within row. */ enum glyph_row_area area; - /* Characters to be drawn, and number of characters. */ + /* Characters to be drawn, and number of characters. Note that + NCHARS can be zero if this is a composition glyph string, as + evidenced by FIRST_GLYPH->type. */ unsigned *char2b; int nchars; commit 20eb3644ba8d17977bba586782c6d165bc9c5b21 Author: Eli Zaretskii Date: Sat Oct 9 14:32:28 2021 +0300 Rewrite Antinews for Emacs 28 * doc/lispref/anti.texi (Antinews): * doc/emacs/anti.texi (Antinews): Rewrite for Emacs 28. * doc/lispref/elisp.texi (Top): * doc/emacs/emacs.texi (Top): Update menu accordingly. diff --git a/doc/emacs/anti.texi b/doc/emacs/anti.texi index 49da473fa5..354f20e757 100644 --- a/doc/emacs/anti.texi +++ b/doc/emacs/anti.texi @@ -4,156 +4,138 @@ @c See file emacs.texi for copying conditions. @node Antinews -@appendix Emacs 26 Antinews +@appendix Emacs 27 Antinews @c Update the emacs.texi Antinews menu entry with the above version number. For those users who live backwards in time, here is information -about downgrading to Emacs version 26.3. We hope you will enjoy the +about downgrading to Emacs version 27.2. We hope you will enjoy the greater simplicity that results from the absence of many @w{Emacs @value{EMACSVER}} features. @itemize @bullet @item -Emacs no longer uses @acronym{GMP}, the GNU Multiple Precision -library, and doesn't support Lisp integers greater than -@code{most-positive-fixnum} or smaller than -@code{most-negative-fixnum}. We now have only one kind of a Lisp -integer. This simplifies many Lisp programs that use integers, and -makes integer calculations always fast. If you want larger values, -use Lisp floats, as Emacs has done since day one. +Emacs can no longer be built with support of native compilation of +Lisp programs. This means Emacs builds much faster, and the problems +that came with native compilation: the need to have GCC and Binutils +installed, the complications of managing your @file{eln-cache} +directories---all of that is now future history. The simplicity and +elegance of the Emacs byte-compiled code is now restored in all of its +pristine beauty. @item -Emacs no longer supports HarfBuzz as the engine for shaping complex -text. As you move back in time, we will gradually shed off all traces -of support for complex text shaping, and this is one step in that -direction. +Emacs no longer builds by default with Cairo, even if it's present. +The warnings about not using HarfBuzz are also gone, in preparation +for complete removal of HarfBuzz support in previous Emacs versions. +Fancy text shaping and display is becoming less important as you move +back in time. The @code{ftx} font backend is again part of Emacs, for +the same reasons. @item -We have removed support for building with the Jansson library, and -consequently the native support for JSON parsing is gone. The -importance of JSON decreases as we go back in time, so for now using -the Lisp code for handling it should be good enough; in one of the -past Emacs versions, we intend to remove even that, as useless bloat. - -The library for supporting JSONRPC applications was removed for the -same reason. +As Motif becomes more and more important with moving farther into the +past, we've reinstated the code which supports Motif in Emacs. @item -The ``portable dumper'' feature is gone. We are once again using the -field-proven ``unexec'' way of dumping Emacs. With that, the hope for -being able to re-dump your customized Emacs session is also gone: why -would anyone want to record their random customization experiments on -disk, and restore them the next time they start Emacs? And true -Emacsers don't restart their Emacs sessions anyway. +Emacs once again supports versions 5.3 and older OpenBSD system, which +will be needed as you move back in time. @item -We dropped the support for @acronym{XDG}-style configuration -directories and the @env{XDG_CONFIG_HOME} environment variable. -There's once again only one place where Emacs looks for its init -files: the @file{~/.emacs.d} directory, with the @file{~/.emacs} file -as fallback. We think this will go a long way towards preventing -confusion among users who for some reason have @env{XDG_CONFIG_HOME} -set, thus risking to have their init files randomly spread between two -places. In one of the past Emacs versions, we intend to further -simplify this, removing the @file{~/.emacs.d} place and leaving only -@file{~/.emacs}; stay tuned. - -For similar reasons, we've removed the ``early init'' file. You can -now again use all the tricks you want to initialize variables like -@code{package-user-dir} and @code{package-load-list} just in time for -the packages to load. +We've dropped support for Secure Computing filter on GNU/Linux. The +past world is much more secure than the present, so the complexities +related with this stuff, which can only be explained by severe +paranoia, are no longer justified. -@command{emacsclient} no longer supports @acronym{XDG}-style directory -trees, either. +@item +Emacs reverted back to supporting Unicode 13.x, since the following +versions of the standards are not yet published where you are going. +The @samp{emoji} script and the support for displaying Emoji sequences +were removed for the same reasons: no one will produce them in the +past. @item -TLS connections are back to their lenient security settings. We -decided that too tight security settings are an annoyance for users, -and make little sense considering the world-wide tendency to have -fewer and fewer network security problems as we move back in time -(those issues will be completely gone when networks disappear in some -distant past). +Mode-specific commands and the @kbd{M-S-x} command that invokes them +were removed. As you move back in time, the command set in Emacs +becomes smaller, so any such filtering of applicable commands just +gets in the way. @item -The @code{server-after-make-frame-hook} hook was deleted, in -preparation for removing the entire daemon business in some past Emacs -version. You will be glad to learn that setting up the GUI -customizations of your sessions is now once again as easy as it ever -was, with just the @code{after-make-frame-functions} to use. +We have removed the system for displaying documentation of groups of +related functions, the @kbd{shortdoc-display-group} command to go with +it, and the corresponding ``See also'' button in the @file{*Help*} +buffer. That should make searching for certain functions simpler: +just use the venerable @samp{apropos} commands. @item -The @code{flex} completion style was removed. We feel that it -unnecessarily complicates the Emacs user experience, and therefore -will continue to remove other tricky completion styles, until in some -past Emacs version we get to a single original style Emacs pioneered -decades ago. Long live simplicity; down with complications! +The @code{context-menu-mode} was removed, and with it the context +menus popped by pressing the right mouse button. This is one small +step towards freeing Emacs (and eventually, the whole world of +computing) from the tyranny of the GUI pointing devices in general, +and moving back to the simplicity of text-mode user interfaces. +Down with mice and other rodents! @item -The optional display of the fill-column indicator is no longer -supported. With the display sizes becoming smaller and smaller as you -move back in time, we feel that the display itself will always show -you where to fill or wrap your text, and do this much more easily and -reliably than any such display indicator. +The commands @kbd{C-x 4 4} and @kbd{C-x 5 5} for displaying the +results in a new window/frame re gone. We are quite certain that +creating a new window/frame before running a command is much simpler, +and doesn't require a complication of a new prefix. @item -We removed the features that made visiting large files easier. Thus, -Emacs will no longer suggest visiting a large file literally, nor -offer the @code{so-long} mode to deal with overly-long lines. We -decided that this simplification is worthwhile, given that the general -tendency of having very large files is becoming a rarity as we move -back in time. +The behavior of active minibuffers when switching frames is now the +perfect mess it should be: sometimes the minibuffer moves to the new +selected frame, sometimes it doesn't, and sometimes you get an error. +This makes Emacs usage much more fun, as you get to guess the result, +instead of having it boringly consistent. @item -We have removed the feature that displayed echo-area messages without -hiding content of the active minibuffer. This should prevent user -confusion from having two unrelated pieces of text staring at them, -with no clear separation between them. Users with good memories (and -Emacs users are all expected to be of that kind) will have no trouble -keeping the minibuffer text in their minds, and typing the responses -without actually seeing the prompts. +Compact mode-line display mode has been removed. The items displayed +on the mode line are now always in the same place, and if there's not +enough space for them, they are not displayed at all, instead of being +confusingly displayed in a different position. You no longer need to +think twice where to find a particular mode-line element on display. @item -Horizontal scrolling using the mouse or touchpad has been removed. In -the past, wide monitors will become less popular, so horizontal -scrolling will no longer be needed. Removal of the mouse support for -horizontal scrolling is the first step towards its complete removal in -prior Emacs versions. +Many commands and options related to tab bars were removed, including +(but not limited to) frame-specific appearance of tab bars, the +@code{tab-bar-format} option, the @kbd{C-x t n}, @kbd{C-x t N}, +@kbd{C-x t M}, and @kbd{C-x t G} commands, and many mouse gestures on +the tab bar. We are going to delete the tab bar support from Emacs in +one of the past versions, and this is a step in that direction. @item -The @code{main-thread} variable and @code{list-threads} were removed, -and @code{thread-join} no longer returns the result of the finished -thread. We intend to remove the support for Lisp threads in some past -Emacs version, so we continue removing the associated complexities and -features as we go back in time. +The ``transient'' input methods have been removed; use @kbd{C-\} to +turn input methods on and off instead. This is in preparation for +complete removal of input methods from Emacs in version 19, and +consistent with the fact that the number of input methods we support +becomes smaller as you move back in time. @item -Tab bar and window tab-lines were removed. This should make the Emacs -display simpler and less cluttered, and help those users who disable -menu bar and tool bar in their GUI sessions. The fashion to provide -tabs in every GUI application out there is gaining less and less -popularity as we move back in time, and will completely disappear at -some past point; removing the tabs from Emacs is the step in that -direction. +We disabled @code{show-paren-mode} by default, since we think the +venerable @code{blink-matching-paren} feature is more than enough, and +better fits the simplicity of past Emacs versions. It will definitely +be better when colors are removed from Emacs in the distant past. + +For the same reason, sub-groups in interactive regexp searches are no +longer highlighted in distinct colors. @item -Displaying line numbers for a buffer is only possibly using add-on -features, such as @code{linum-mode}, which can only display the -numbers in the display margins. Line-number display using these -features is also slow, as we firmly believe such a feature is -un-Emacsy and should not have been included in Emacs to begin with. -Consequently, @code{display-line-numbers-mode} was removed. +On our permanent quest for simplifying Emacs, we've removed the Ispell +command @code{ispell-comment-or-string-at-point}; the old-time friend +@code{ispell-comments-and-strings} should suffice. @item -On our permanent quest for simplifying Emacs, we've removed the -support for changing the font size by turning the mouse wheel. +Many Gnus commands and options were deemed to unnecessarily complicate +the use of Gnus (which is too complex to begin with), and thus were +removed. This includes @code{gnus-topic-display-predicate}, +@code{gnus-process-mark-toggle}, @code{gnus-registry-register-all}, +@code{gnus-paging-select-next}, and many others. The @code{nnselect} +backend was deleted for the same reason. @item -Several commands, deemed to be unnecessary complications, have been -removed. Examples include @code{make-empty-file}, -@code{font-lock-refontify}, @code{xref-find-definitions-at-mouse}, -@code{make-frame-on-monitor}, and @code{diff-buffers}. +The @file{project.el} package have been redesigned to remove many +unnecessary features, so that just the bare essentials remain. We +plan on removing this package from Emacs in a previous version, but +decided to begin with removing some extra features first. @item To keep up with decreasing computer memory capacity and disk space, many -other functions and files have been eliminated in Emacs 26.3. +other functions and files have been eliminated in Emacs 27.2. @end itemize diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 2fafb43e9f..83847fb8f1 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -219,7 +219,7 @@ Appendices * GNU Free Documentation License:: The license for this documentation. * Emacs Invocation:: Hairy startup options. * X Resources:: X resources for customizing Emacs. -* Antinews:: Information about Emacs version 26. +* Antinews:: Information about Emacs version 27. * Mac OS / GNUstep:: Using Emacs under macOS and GNUstep. * Microsoft Windows:: Using Emacs on Microsoft Windows and MS-DOS. * Manifesto:: What's GNU? Gnu's Not Unix! diff --git a/doc/lispref/anti.texi b/doc/lispref/anti.texi index ced8082f6a..118df05c79 100644 --- a/doc/lispref/anti.texi +++ b/doc/lispref/anti.texi @@ -6,186 +6,179 @@ @c This node must have no pointers. @node Antinews -@appendix Emacs 26 Antinews +@appendix Emacs 27 Antinews @c Update the elisp.texi Antinews menu entry with the above version number. For those users who live backwards in time, here is information about -downgrading to Emacs version 26.3. We hope you will enjoy the greater +downgrading to Emacs version 27.2. We hope you will enjoy the greater simplicity that results from the absence of many @w{Emacs @value{EMACSVER}} features. @itemize @bullet @item -Lisp objects are again implemented on the C level as integer types, -not as pointers. This might be a small step for Emacs Lisp users, but -it's a giant leap for the Emacs developers who work on the C level, -since it is now again easy to print Lisp object in the debugger in the -decimal format, which is so much easier for debugging. It also makes -calling Emacs functions from the debugger easier, and allows us to -freely mix integers and Lisp objects in the C code. +The annoying @code{lexical-binding} local variable now heeds the +value of @code{enable-local-variables}: if it's @code{nil}, the +@code{lexical-binding} cookie is ignored. We are working hard on +removing the lexical-binding support in some past Emacs version, and +this small step advances us back to that change. @item -The test suite was removed from the distribution tarball. We believe -that tests need seldom if ever be run, certainly not by the end -users. Removing the tests from the tarball makes it much smaller, -which is important since disk space becomes more and more at premium -as you move back in time. +The @code{load-dangerous-libraries} variable is not obsolete, as it +must be used to allow loading Lisp compiled by XEmacs, which will +become more and more important as you move back in time. @item -Dynamic module support is disabled by default. This both makes Emacs -smaller (a worthy goal by itself), and removes the complications and -additional complexity related with installing module support files and -letting random shared objects an opportunity to be loaded into Emacs -and mess with it. +The optional @var{modes} argument of @code{interactive} is not +supported, and every command is deemed applicable to any major mode. +We believe this makes the life of Lisp programmers much simpler, as +there's now no need to tag commands with the modes where they make +sense. @item -You now must activate any installed packages only after loading your -init files. That requires an explicit call to -@code{package-initialize} in your init file, which is a Good Thing, as -it makes you think seriously where and indeed whether you'd like your -packages to become available to your sessions. Simplicity should -tramp convenience! +Shorthands for Lisp symbols have been removed, which makes loading +Lisp files and handling Lisp symbols much simpler and more efficient. +This is important for decent performance on slower CPUs as you move +back in time. @item To reduce the amount of code in Emacs related to unimportant features, -we've removed native rotation and resizing of images. You will have -to build Emacs with ImageMagick if you want to resize or rotate images -inside Emacs. We don't expect anyone to miss that. +we've removed the variables @code{global-minor-modes} and +@code{local-minor-modes}. If your Lisp program needs to determine +whether some minor mode is in effect, it will have to test explicitly +for every mode. We don't expect anyone to miss those fancy variables. @item -We've re-enabled color fonts usage by the XFT font back-end. We -consider the availability of these fonts more important than a random -crash here and there, especially since the use of these fonts for -displaying Emoji will become less and less important as we travel back -in time, and will completely disappear in some past Emacs version. +The default preference for servicing sub-processes that produce output +at a high rate, and the associated variable +@code{process-prioritize-lower-fds}, have been removed. Moving back +in time means fewer and fewer programs can produce such high-rate +output, so this features becomes just useless crud. @item -The function @code{network-interface-list} can now return only IPv4 -addresses. We consider the complexity introduced by IPv6 to be too -much to be justified, and on the other hand its removal is the step in -the right direction, given that IPv6 is expected to be completely -removed as we move back in time. +The encodings that are variants of EBCDIC were removed. This includes +@code{ibm256}, @code{ibm273}, and others---variants of the EBCDIC +encoding tailored for some Japanese and European locales. You won't +need those where you are going. @item -The limit on repetitions in regular expressions was reduced to -@ifnottex -2**15 @minus{} 1. -@end ifnottex -@tex -@math{2^{15}-1}. -@end tex -We envision that regular expressions will become more and more simple -as we move towards the distant past. +The ``Bindat type expression'' description language has been removed, +as the existing data layout specifications are perfectly suited for +this job. @item To simplify code and reduce complexity, we removed the capability of -searching programs on remote hosts in @code{executable-find}. If you -really need this feature (why would you?), you can always write your -own shell script and run it on the remote. +specifying the success handler in @code{condition-case} via the +@code{:success} keyword. If you really need this feature (why would +you?), you can always write some simple Lisp that has the same effect. @item -The @code{:extend} face attribute is no longer available; all faces -have their background color extended by default past end of line. -This should significantly simplify face management and remove -unnecessary code bloat, as well as make faces significantly simpler to -understand and use. +Emacs modules can no longer provide interactive functions, or install +finalizers, nor open channels to existing pipe sub-processes. All +this is extra ballast, especially since we plan on removing modules in +some past Emacs version. The @code{make_unibyte_string} module API +was removed for the same reason. @item -The predicates @code{display-blink-cursor-p} and -@code{display-symbol-keys-p} were deleted. They are rarely if ever -needed, and can easily be substituted by appropriate calls to old and -proven APIs like @code{display-graphic-p}. As an additional bonus, -writing Lisp programs that depend on this functionality will make sure -the programmer understands better what exactly is the required -features of the display terminal. +To keep Emacs clean and elegant, we've removed the +@code{print-integers-as-characters} option. Recognizing characters by +their decimal codes is a basic requirement for Emacs Lisp programmers, +and with the expected decrease in use of Unicode characters, this will +be soon limited to ASCII only: surely something you all can master! @item -Relative directories in the value of the @env{HOME} environment -variable are once again interpreted relative to the -@code{default-directory} of the current buffer. This is much simpler, -and also allows @env{HOME} to resolve to a different place in -different buffers, which allows some interesting applications. +The optional @var{count} argument of the @code{directory-files} +function has been removed. Extracting the first @var{n} members from +the full list is trivial, so this is a significant simplification for +an insignificant cost. -For the same reasons, @code{file-name-absolute-p} now again considers -@file{~foo} an absolute file name, even if there's no known user -@samp{foo}. This means a Lisp program which uses such file names will -always work the same on any system, regardless of its known users. +@item +Functions that create sub-processes and network connections no longer +accept the @code{:coding} argument; use +@code{set-process-coding-system} or bind +@code{coding-system-for-read/write} instead: again, a significant +reduction in Emacs complexity for little or no cost. + +@item +We deleted from the macros @code{define-derived-mode} and +@code{define-minor-mode} the code which allowed using the +@code{:interactive} argument. The possibility of marking a mode +non-interactive makes very little sense, + +@item +The possibility of having links to man pages in doc strings has been +removed. Use plain text instead, if you need such references. + +@item +Temporary buffers are no longer exempt from running any buffer-related +hooks. Programs that don't want such hooks in some buffer can always +disable it locally, whereas making that simpler complicates Emacs for +no good reason. @item -File-related primitives like @code{file-attributes}, -@code{file-modes}, @code{file-newer-than-file-p}, and some others once -again return @code{nil} when the underlying low-level APIs fail, -instead of signaling an error. We decided that functions which signal -errors require more complex code from Lisp programs which use them, -and found this complexity unjustified when returning @code{nil} will -do. +Several features that complicated the byte compiler have been removed: +@itemize @minus @item -Similarly, old-style backquotes no longer signal errors; they generate -warnings instead. You can remove error handling from programs that -use backquotes. +The checks for missing declarations of dynamic variables. This will +continue making less and less sense as we move away of lexical-binding +support. @item -Formatting floating-point numbers has been sped up by letting the -underlying implementation produce unpredictable values, instead of -signaling errors when the number is too large to format correctly. We -believe the Emacs Lisp programmers should always know what they are -doing when they deal with floating-point values. +The ability of compiling symlinked @file{*.el} files, which is really +gross: copy the files instead. @item -The function @code{read-char-from-minibuffer} was deleted. We decided -that @code{read-char} should be enough for any Lisp program that needs -to ask the user for a single-character input, in recognition of the -fact that nothing makes Emacs Lisp hackers rejoice more than the need -to sit down and write yet another interactive question-and-answer -function, and make it optimal for each specific case. Consequently, -no history is provided for such responses (why would someone want -history of single-key strokes, anyway?). +The warnings about too-wide doc strings---that is just a nuisance, as +the programmers should be trusted to know what they are doing. +@end itemize + + +@item +We deleted several features of the @code{pcase} macro, in accordance +with our general plane to remove @code{pcase} from Emacs: +@itemize @minus @item -The function @code{ngettext} was deleted. Non-English languages will -become less and less widespread, let alone useful, as you move back in -time, so we took this small step in that direction, and simplified -Emacs as a nice bonus. +The @code{cl-type} pattern. @item -Focus-change notifications on text-mode frames are no longer -recognized or supported. You can now safely disregard the possibility -of receiving such notifications on TTY frames. This is one small step -on the long road of removing all non-character input events Emacs -supports on TTY frames. +the @code{pcase-setq} macro. + +@item +The @code{pcase-compile-patterns} function. +@end itemize @item -Face specifications in @code{face-remapping-alist} now have to be -buffer-specific, without any differences between windows showing the -same buffers. This allowed us to remove a lot of unneeded code bloat -from Emacs, and make the face handling much simpler. +Some of the keywords used in Edebug specification lists were deemed to +be of little use, and were therefore removed: @code{&interpose}, +@code{&error}, and @code{&name}. The long-term plane is for Emacs to +drop Edebug entirely, leaving only the trusted Lisp debugger, and we +continue working according to that plan. @item -The @samp{%o} and @samp{%x} formats now always produce unsigned -values, as you'd expect. This allows you to reveal the underlying -machine representation, which is different on each architecture, -something we consider a valuable feature. +The function @code{object-intervals} was dropped, as a Lisp program +can easily collect the intervals of a buffer or a string by iterating +through them one by one. @item -We no longer highlight in @code{font-lock-warning-face} symbols with -confusable quote characters, such as U+2018. Detecting them -needed non-trivial amount of code, and we firmly believe that Lisp -programmers always know what they are doing, and don't need to be -annoyed with typefaces that stand out and distract. +We decided that the @code{require-theme} function is an unnecessary +complication, so we deleted it. Lisp programs can easily search along +@code{custom-theme-load-path} instead. @item -The function @code{file-system-info} was dropped on Posix platforms, -since you can always invoke @command{df} instead and parse its -output. +The convenience functions @code{length<}, @code{length>}, and +@code{length=} were removed, as using @code{length} followed by a +comparison should be good enough for everyone, especially considering +that the typical length of a list keeps going down as you move back +through time. @item -The functions that implement the @samp{base64url} encoding were -removed, as they can always be emulated by suitable tweaking of the -normal base-64 encoding. No need to bloat Emacs and force Lisp -programmers learn more interfaces on this account. +The variable @code{current-minibuffer-command} is no longer available, +as we found little justification for keeping it. @item As part of the ongoing quest for simplicity, many other functions and -variables have been eliminated. +variables have been eliminated. Other functions and variables, that +were declared obsolete since Emacs 23, have been added back, in +preparation for releasing Emacs 23 in some distant past. @end itemize diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index e9e306fa0d..da3a3a84e9 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -234,7 +234,7 @@ To view this manual in other formats, click Appendices -* Antinews:: Info for users downgrading to Emacs 26. +* Antinews:: Info for users downgrading to Emacs 27. * GNU Free Documentation License:: The license for this documentation. * GPL:: Conditions for copying and changing GNU Emacs. * Tips:: Advice and coding conventions for Emacs Lisp. commit 3a9b881603b627480c85496a2a2ba74ad63952b5 Author: Eli Zaretskii Date: Sat Oct 9 14:30:31 2021 +0300 ; * etc/NEWS: Rearrange the "incompatible changes" sections. diff --git a/etc/NEWS b/etc/NEWS index 7fb424f2a2..16fa36bd5f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -911,6 +911,109 @@ now been updated to point to Libera.Chat. https://lists.gnu.org/archive/html/info-gnu-emacs/2021-06/msg00000.html + +* Incompatible Editing Changes in Emacs 28.1 + +--- +** 'toggle-truncate-lines' now disables 'visual-line-mode'. +This is for symmetry with 'visual-line-mode', which disables +'truncate-lines'. + +--- +** 'electric-indent-mode' now also indents inside strings and comments. +(This only happens when indentation function also supports this.) + +To recover the previous behavior you can use: + + (add-hook 'electric-indent-functions + (lambda (_) (if (nth 8 (syntax-ppss)) 'no-indent))) + +--- +** The 'M-o' ('facemenu-keymap') global binding has been removed. +To restore the old binding, say something like: + + (require 'facemenu) + (define-key global-map "\M-o" 'facemenu-keymap) + (define-key facemenu-keymap "\es" 'center-line) + (define-key facemenu-keymap "\eS" 'center-paragraph) + +The last two lines are not strictly necessary if you don't care about +having those two commands on the 'M-o' keymap; see the next section. + +--- +** The 'M-o M-s' and 'M-o M-S' global bindings have been removed. +Use 'M-x center-line' and 'M-x center-paragraph' instead. See the +previous section for how to get back the old bindings. Alternatively, +if you only want these two commands to have global bindings they had +before, you can add the following to your init file: + + (define-key global-map "\M-o\M-s" 'center-line) + (define-key global-map "\M-o\M-S" 'center-paragraph) + +--- +** The 'M-o M-o' global binding has been removed. +Use 'M-x font-lock-fontify-block' instead, or the new 'C-x x f' +command, which updates the syntax highlighting in the current buffer. + +--- +** The escape sequence '\e[29~' in Xterm is now mapped to 'menu'. +Xterm sends this sequence for both 'F16' and 'Menu' keys +It used to be mapped to 'print' but we couldn't find a terminal +that uses this sequence for any kind of 'Print' key. +This makes the Menu key (see https://en.wikipedia.org/wiki/Menu_key) +work for 'context-menu-mode' in Xterm. + +--- +** New user option 'xterm-store-paste-on-kill-ring'. +If non-nil (the default), Emacs pushes pasted text onto the kill ring +(if using an xterm-like terminal that supports bracketed paste). +Setting this to nil inhibits that. + +--- +** 'vc-print-branch-log' shows the change log from its root directory. +It previously used to use the default directory. + +--- +** 'project-shell' and 'shell' now use 'pop-to-buffer-same-window'. +This is to keep the same behavior as Eshell. + +--- +** In 'nroff-mode', 'center-line' is no longer bound to a key. +The original key binding was 'M-s', which interfered with I-search, +since the latter uses 'M-s' as a prefix key of the search prefix map. + +--- +** In 'f90-mode', the backslash character ('\') no longer escapes. +For about a decade, the backslash character has no longer had a +special escape syntax in Fortran F90. To get the old behavior back, +say something like: + + (modify-syntax-entry ?\\ "\\" f90-mode-syntax-table) + ++++ +** Setting 'fill-column' to nil is obsolete. +This undocumented use of 'fill-column' is now obsolete. To disable +auto filling, turn off 'auto-fill-mode' instead. + +For instance, you could add something like the following to your init +file: + + (add-hook 'foo-mode-hook (lambda () (auto-fill-mode -1)) + +** Xref migrated from EIEIO to cl-defstruct for its core objects. +This means that 'oref' and 'with-slots' no longer works on them, and +'make-instance' can no longer be used to create those instances (which +wasn't recommended anyway). Packages should keep to using the +functions like 'xref-make', 'xref-make-match', 'xref-make-*-location', +as well as accessor functions 'xref-item-summary' and +'xref-item-location'. + +Among the benefits are better performance (noticeable when there are a +lot of matches) and improved flexibility: 'xref-match-item' instances +do not require that 'location' inherits from 'xref-location' anymore +(that class was removed), so packages can create new location types to +use with "match items" without adding EIEIO as a dependency. + * Editing Changes in Emacs 28.1 @@ -3169,109 +3272,6 @@ structures. This new 'etc-authors-mode' provides font-locking for displaying the "etc/AUTHORS" file from the Emacs distribution, and not much else. - -* Incompatible Editing Changes in Emacs 28.1 - ---- -** 'toggle-truncate-lines' now disables 'visual-line-mode'. -This is for symmetry with 'visual-line-mode', which disables -'truncate-lines'. - ---- -** 'electric-indent-mode' now also indents inside strings and comments. -(This only happens when indentation function also supports this.) - -To recover the previous behavior you can use: - - (add-hook 'electric-indent-functions - (lambda (_) (if (nth 8 (syntax-ppss)) 'no-indent))) - ---- -** The 'M-o' ('facemenu-keymap') global binding has been removed. -To restore the old binding, say something like: - - (require 'facemenu) - (define-key global-map "\M-o" 'facemenu-keymap) - (define-key facemenu-keymap "\es" 'center-line) - (define-key facemenu-keymap "\eS" 'center-paragraph) - -The last two lines are not strictly necessary if you don't care about -having those two commands on the 'M-o' keymap; see the next section. - ---- -** The 'M-o M-s' and 'M-o M-S' global bindings have been removed. -Use 'M-x center-line' and 'M-x center-paragraph' instead. See the -previous section for how to get back the old bindings. Alternatively, -if you only want these two commands to have global bindings they had -before, you can add the following to your init file: - - (define-key global-map "\M-o\M-s" 'center-line) - (define-key global-map "\M-o\M-S" 'center-paragraph) - ---- -** The 'M-o M-o' global binding has been removed. -Use 'M-x font-lock-fontify-block' instead, or the new 'C-x x f' -command, which updates the syntax highlighting in the current buffer. - ---- -** The escape sequence '\e[29~' in Xterm is now mapped to 'menu'. -Xterm sends this sequence for both 'F16' and 'Menu' keys -It used to be mapped to 'print' but we couldn't find a terminal -that uses this sequence for any kind of 'Print' key. -This makes the Menu key (see https://en.wikipedia.org/wiki/Menu_key) -work for 'context-menu-mode' in Xterm. - ---- -** New user option 'xterm-store-paste-on-kill-ring'. -If non-nil (the default), Emacs pushes pasted text onto the kill ring -(if using an xterm-like terminal that supports bracketed paste). -Setting this to nil inhibits that. - ---- -** 'vc-print-branch-log' shows the change log from its root directory. -It previously used to use the default directory. - ---- -** 'project-shell' and 'shell' now use 'pop-to-buffer-same-window'. -This is to keep the same behavior as Eshell. - ---- -** In 'nroff-mode', 'center-line' is no longer bound to a key. -The original key binding was 'M-s', which interfered with I-search, -since the latter uses 'M-s' as a prefix key of the search prefix map. - ---- -** In 'f90-mode', the backslash character ('\') no longer escapes. -For about a decade, the backslash character has no longer had a -special escape syntax in Fortran F90. To get the old behavior back, -say something like: - - (modify-syntax-entry ?\\ "\\" f90-mode-syntax-table) - -+++ -** Setting 'fill-column' to nil is obsolete. -This undocumented use of 'fill-column' is now obsolete. To disable -auto filling, turn off 'auto-fill-mode' instead. - -For instance, you could add something like the following to your init -file: - - (add-hook 'foo-mode-hook (lambda () (auto-fill-mode -1)) - -** Xref migrated from EIEIO to cl-defstruct for its core objects. -This means that 'oref' and 'with-slots' no longer works on them, and -'make-instance' can no longer be used to create those instances (which -wasn't recommended anyway). Packages should keep to using the -functions like 'xref-make', 'xref-make-match', 'xref-make-*-location', -as well as accessor functions 'xref-item-summary' and -'xref-item-location'. - -Among the benefits are better performance (noticeable when there are a -lot of matches) and improved flexibility: 'xref-match-item' instances -do not require that 'location' inherits from 'xref-location' anymore -(that class was removed), so packages can create new location types to -use with "match items" without adding EIEIO as a dependency. - * Incompatible Lisp Changes in Emacs 28.1 commit f43a3a7cd7cfae10d7c29b1f84eb3b842ca0a83a Author: Lars Ingebrigtsen Date: Sat Oct 9 13:12:33 2021 +0200 Simplify `clean-mode' * lisp/simple.el (clean-mode): Simplify the property exclusion. diff --git a/lisp/simple.el b/lisp/simple.el index f7e62e06ce..841983a3b6 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -534,10 +534,7 @@ Other major modes are defined by comparison with this one." (dolist (overlay (overlays-in (point-min) (point-max))) (delete-overlay overlay)) (set-text-properties (point-min) (point-max) nil) - (setq-local after-change-functions - (list - (lambda (begin end _length) - (set-text-properties begin end nil)))))) + (setq-local yank-excluded-properties t))) ;; Special major modes to view specially formatted data rather than files. commit ebb7e26013c6874b13313f94359280451388ea7d Author: Eli Zaretskii Date: Sat Oct 9 12:49:38 2021 +0300 ; * etc/NEWS: Fix a typo. diff --git a/etc/NEWS b/etc/NEWS index 8f49d67ba9..7fb424f2a2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1090,7 +1090,7 @@ buffer to be able to move point to the inaccessible portion. 'goto-line-relative' is bound to 'C-x n g'. +++ -** 'got-char' prompts for the character position. +** 'goto-char' prompts for the character position. When called interactively, 'goto-char' now offers the position at point as the default. commit 315fe20086ae1cd784e097c0b93e7fa5aca7a6c5 Author: Eli Zaretskii Date: Sat Oct 9 11:23:44 2021 +0300 ; * src/Makefile.in (../native-lisp): Add comment. diff --git a/src/Makefile.in b/src/Makefile.in index 0326b4a8f2..6d75e3537a 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -803,6 +803,15 @@ elnlisp := $(addprefix ${lispsource}/,${elnlisp}) $(lisp:.elc=.eln) @$(MAKE) $(AM_V_NO_PD) -C ../lisp EMACS="../src/emacs$(EXEEXT)"\ THEFILE=$< $ Date: Sat Oct 9 08:48:34 2021 +0200 Remove duplicate definition of x-display-color-p * lisp/emulation/viper-init.el (x-display-color-p): Remove duplicate definition. This would just overwrite the alias defined in faces.el. diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index a170d677d2..e3790b7453 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el @@ -44,11 +44,6 @@ (define-obsolete-function-alias 'viper-device-type #'window-system "27.1") -(defun x-display-color-p () - (condition-case nil - (display-color-p) - (error nil))) - ;; in XEmacs: device-type is tty on tty and stream in batch. (defun viper-window-display-p () (and window-system (not (memq window-system '(tty stream pc))))) commit 47cbd103f56f4a6bf36aceff3619f3fdd296f502 Author: Stefan Kangas Date: Sat Oct 9 08:32:25 2021 +0200 * lisp/bindings.el (mode-line-position): Improve tooltip. diff --git a/lisp/bindings.el b/lisp/bindings.el index 1cd22167c5..e397e44b2f 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -505,7 +505,7 @@ mouse-1: Display Line and Column Mode Menu")) local-map ,mode-line-column-line-number-mode-map mouse-face mode-line-highlight ;; XXX needs better description - help-echo "Size indication mode\n\ + help-echo "Buffer Position mouse-1: Display Line and Column Mode Menu") (size-indication-mode (8 ,(propertize commit 35a752863afc9f9075473e34c395d36e0bd18bff Author: Dmitry Gutov Date: Sat Oct 9 04:38:11 2021 +0300 * lisp/progmodes/xref.el: Bump the version. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 093e3d36d5..46922a3f3b 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1,7 +1,7 @@ ;;; xref.el --- Cross-referencing commands -*-lexical-binding:t-*- ;; Copyright (C) 2014-2021 Free Software Foundation, Inc. -;; Version: 1.2.2 +;; Version: 1.3.0 ;; Package-Requires: ((emacs "26.1")) ;; This is a GNU ELPA :core package. Avoid functionality that is not commit bbcd8cc1a9768e8f0411a44540671a6694e73e37 Author: Dmitry Gutov Date: Sat Oct 9 03:33:57 2021 +0300 Slight simplificaiton * lisp/progmodes/xref.el (xref--insert-xrefs): Compute log only once. Use 'dolist'. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 980ef4c8d5..093e3d36d5 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -956,13 +956,11 @@ GROUP is a string for decoration purposes and XREF is an `xref-item' object." (require 'compile) ; For the compilation faces. (cl-loop for (group . xrefs) in xref-alist - for max-line-width = - (cl-loop for xref in xrefs - maximize (let ((line (xref-location-line - (xref-item-location xref)))) - (and line (1+ (floor (log line 10)))))) - for line-format = (and max-line-width - (format "%%%dd: " max-line-width)) + for max-line = (cl-loop for xref in xrefs + maximize (xref-location-line + (xref-item-location xref))) + for line-format = (and max-line + (format "%%%dd: " (1+ (floor (log max-line 10))))) with item-text-props = (list 'mouse-face 'highlight 'keymap xref--button-map 'help-echo @@ -973,27 +971,27 @@ GROUP is a string for decoration purposes and XREF is an do (xref--insert-propertized '(face xref-file-header xref-group t) group "\n") - (cl-loop for xref in xrefs do - (pcase-let (((cl-struct xref-item summary location) xref)) - (let* ((line (xref-location-line location)) - (prefix - (cond - ((not line) " ") - ((and (equal line prev-line) - (equal prev-group group)) - "") - (t (propertize (format line-format line) - 'face 'xref-line-number))))) - ;; Render multiple matches on the same line, together. - (when (and (equal prev-group group) - (or (null line) - (not (equal prev-line line)))) - (insert "\n")) - (xref--insert-propertized (nconc (list 'xref-item xref) - item-text-props) - prefix summary) - (setq prev-line line - prev-group group)))) + (dolist (xref xrefs) + (pcase-let (((cl-struct xref-item summary location) xref)) + (let* ((line (xref-location-line location)) + (prefix + (cond + ((not line) " ") + ((and (equal line prev-line) + (equal prev-group group)) + "") + (t (propertize (format line-format line) + 'face 'xref-line-number))))) + ;; Render multiple matches on the same line, together. + (when (and (equal prev-group group) + (or (null line) + (not (equal prev-line line)))) + (insert "\n")) + (xref--insert-propertized (nconc (list 'xref-item xref) + item-text-props) + prefix summary) + (setq prev-line line + prev-group group)))) (insert "\n")) (add-to-invisibility-spec '(ellipsis . t)) (save-excursion commit 5c0a512ef4b4cf8a6dcb36284860a6bf4618334a Author: Stefan Kangas Date: Sat Oct 9 03:09:20 2021 +0200 Remove some unnecessary calls to mh-funcall-if-exists * lisp/mh-e/mh-acros.el (mh-do-at-event-location): * lisp/mh-e/mh-mime.el (mh-mime-cleanup, mh-display-smileys) (mh-insert-mime-security-button, mh-insert-mime-button): * lisp/mh-e/mh-show.el (mh-defun-show-buffer): * lisp/mh-e/mh-xface.el (mh-x-image-url-fetch-image) (mh-x-image-display, mh-picon-image-types): Remove unnecessary calls to mh-funcall-if-exists; these functions always exist as they are autoloaded. diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el index f3447aa80b..6a0342407d 100644 --- a/lisp/mh-e/mh-acros.el +++ b/lisp/mh-e/mh-acros.el @@ -162,12 +162,8 @@ preserved." (original-position (make-symbol "original-position")) (modified-flag (make-symbol "modified-flag"))) `(save-excursion - (let* ((,event-window - (or (mh-funcall-if-exists posn-window (event-start ,event)) - (mh-funcall-if-exists event-window ,event))) - (,event-position - (or (mh-funcall-if-exists posn-point (event-start ,event)) - (mh-funcall-if-exists event-closest-point ,event))) + (let* ((,event-window (posn-window (event-start ,event))) + (,event-position (posn-point (event-start ,event))) (,original-window (selected-window)) (,original-position (progn (set-buffer (window-buffer ,event-window)) diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el index 289b430d66..ed65395c94 100644 --- a/lisp/mh-e/mh-folder.el +++ b/lisp/mh-e/mh-folder.el @@ -516,10 +516,6 @@ font-lock is done highlighting.") (when (and (boundp 'which-func-modes) (listp which-func-modes)) (add-to-list 'which-func-modes 'mh-folder-mode)) -;; Shush compiler. -(defvar desktop-save-buffer) -(defvar font-lock-auto-fontify) - ;; Ensure new buffers won't get this mode if default major-mode is nil. (put 'mh-folder-mode 'mode-class 'special) diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el index 6b109715cc..0dbf8f0da1 100644 --- a/lisp/mh-e/mh-mime.el +++ b/lisp/mh-e/mh-mime.el @@ -859,12 +859,8 @@ by commands like \"K v\" which operate on individual MIME parts." :button-keymap mh-mime-button-map :help-echo "Mouse-2 click or press RET (in show buffer) to toggle display") - (dolist (ov (mh-funcall-if-exists overlays-in begin end)) - (mh-funcall-if-exists overlay-put ov 'evaporate t)))) - -;; Shush compiler. -(defvar mm-verify-function-alist) ; < Emacs 22 -(defvar mm-decrypt-function-alist) ; < Emacs 22 + (dolist (ov (overlays-in begin end)) + (overlay-put ov 'evaporate t)))) (defun mh-insert-mime-security-button (handle) "Display buttons for PGP message, HANDLE." @@ -905,8 +901,8 @@ by commands like \"K v\" which operate on individual MIME parts." :button-keymap mh-mime-security-button-map :button-face face :help-echo "Mouse-2 click or press RET (in show buffer) to see security details.") - (dolist (ov (mh-funcall-if-exists overlays-in begin end)) - (mh-funcall-if-exists overlay-put ov 'evaporate t)) + (dolist (ov (overlays-in begin end)) + (overlay-put ov 'evaporate t)) (when (equal info "Failed") (let* ((type (if (equal (car handle) "multipart/signed") "verification" "decryption")) @@ -1140,7 +1136,7 @@ this ;-)" (defun mh-display-smileys () "Display smileys." (when (and mh-graphical-smileys-flag (mh-small-show-buffer-p)) - (mh-funcall-if-exists smiley-region (point-min) (point-max)))) + (smiley-region (point-min) (point-max)))) ;;;###mh-autoload (defun mh-display-emphasis () @@ -1796,8 +1792,7 @@ initialized. Always use the command `mh-have-file-command'.") (defun mh-mime-cleanup () "Free the decoded MIME parts." (let ((mime-data (gethash (current-buffer) mh-globals-hash))) - ;; This is for Emacs, what about XEmacs? - (mh-funcall-if-exists remove-images (point-min) (point-max)) + (remove-images (point-min) (point-max)) (when mime-data (mm-destroy-parts (mh-mime-handles mime-data)) (remhash (current-buffer) mh-globals-hash)))) diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el index e3cd688c59..23f0f5a7c2 100644 --- a/lisp/mh-e/mh-search.el +++ b/lisp/mh-e/mh-search.el @@ -1413,9 +1413,6 @@ being the list of messages originally from that folder." (eval-and-compile (require 'which-func nil t)) -;; Shush compiler. -(defvar which-func-mode) ; < Emacs 22, XEmacs - ;;;###mh-autoload (defun mh-index-create-imenu-index () "Create alist of folder names and positions in index folder buffers." diff --git a/lisp/mh-e/mh-seq.el b/lisp/mh-e/mh-seq.el index a7a395acbc..c8df75dbc7 100644 --- a/lisp/mh-e/mh-seq.el +++ b/lisp/mh-e/mh-seq.el @@ -193,9 +193,6 @@ MESSAGE appears." (mh-list-to-string (mh-seq-containing-msg message t)) " ")))) -;; Shush compiler. -(defvar tool-bar-map) - ;;;###mh-autoload (defun mh-narrow-to-seq (sequence) "Restrict display to messages in SEQUENCE. diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el index 781f63e506..25b83b2ff8 100644 --- a/lisp/mh-e/mh-show.el +++ b/lisp/mh-e/mh-show.el @@ -363,11 +363,11 @@ still visible.\n") folder-buffer) (delete-other-windows)) (mh-goto-cur-msg t) - (mh-funcall-if-exists deactivate-mark) + (deactivate-mark) (unwind-protect (prog1 (call-interactively (function ,original-function)) (setq normal-exit t)) - (mh-funcall-if-exists deactivate-mark) + (deactivate-mark) (when (eq major-mode 'mh-folder-mode) (mh-funcall-if-exists hl-line-highlight)) (cond ((not normal-exit) @@ -817,9 +817,6 @@ operation." ;; Ensure new buffers won't get this mode if default major-mode is nil. (put 'mh-show-mode 'mode-class 'special) -;; Shush compiler. -(defvar font-lock-auto-fontify) - ;;;###mh-autoload (define-derived-mode mh-show-mode text-mode "MH-Show" "Major mode for showing messages in MH-E.\\ diff --git a/lisp/mh-e/mh-tool-bar.el b/lisp/mh-e/mh-tool-bar.el index e4cd01c222..805408cfc7 100644 --- a/lisp/mh-e/mh-tool-bar.el +++ b/lisp/mh-e/mh-tool-bar.el @@ -77,9 +77,6 @@ When INCLUDE-FLAG is non-nil, include message body being replied to." ;;; Tool Bar Creation -;; Shush compiler. -(defvar image-load-path) - (defmacro mh-tool-bar-define (defaults &rest buttons) "Define a tool bar for MH-E. DEFAULTS is the list of buttons that are present by default. It diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index 65286bdccc..93bc7f8d39 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el @@ -121,9 +121,6 @@ Ignores case when searching for OLD." (defvar mh-logo-cache nil) -;; Shush compiler. -(defvar image-load-path) - ;;;###mh-autoload (defun mh-logo-display () "Modify mode line to display MH-E logo." diff --git a/lisp/mh-e/mh-xface.el b/lisp/mh-e/mh-xface.el index d4c5481976..5983353b3d 100644 --- a/lisp/mh-e/mh-xface.el +++ b/lisp/mh-e/mh-xface.el @@ -145,7 +145,7 @@ The directories are searched for in the order they appear in the list.") (cl-loop for type in '(xpm xbm gif) when (or (mh-do-in-gnu-emacs (ignore-errors - (mh-funcall-if-exists image-type-available-p type)))) + (image-type-available-p type)))) collect type)) (autoload 'message-tokenize-header "sendmail") @@ -371,7 +371,7 @@ filenames. In addition, replaces * with %2a. See URL (eq marker mh-x-image-marker)) (goto-char marker) (mh-do-in-gnu-emacs - (mh-funcall-if-exists insert-image (create-image image 'png)))) + (insert-image (create-image image 'png)))) (set-buffer-modified-p buffer-modified-flag))))) (defun mh-x-image-url-fetch-image (url cache-file marker sentinel) @@ -381,8 +381,7 @@ be displayed in a buffer and position specified by MARKER. The actual display is carried out by the SENTINEL function." (if mh-wget-executable (let ((buffer (generate-new-buffer mh-temp-fetch-buffer)) - (filename (or (mh-funcall-if-exists make-temp-file "mhe-fetch") - (expand-file-name (make-temp-name "~/mhe-fetch"))))) + (filename (make-temp-file "mhe-fetch"))) (with-current-buffer buffer (set (make-local-variable 'mh-x-image-url-cache-file) cache-file) (set (make-local-variable 'mh-x-image-marker) marker) commit 9a934c4c0f841915b2f99228b5365587892c13fe Author: Stefan Kangas Date: Sat Oct 9 03:00:00 2021 +0200 Remove old Gnus compat code from MH-E * lisp/mh-e/mh-gnus.el (mh-mm-merge-handles) (mh-mm-set-handle-multipart-parameter, mh-mm-inline-text-vcard) (mh-mm-possibly-verify-or-decrypt) (mh-mm-handle-multipart-ctl-parameter, mh-mm-readable-p) (mh-mm-long-lines-p, mh-mm-keep-viewer-alive-p) (mh-mm-destroy-parts, mh-mm-uu-dissect-text-parts) (mh-mml-minibuffer-read-disposition): Make into obsolete aliases for functions without the 'mh-' prefix. Update callers. (mh-gnus-local-map-property): Remove Emacs 20 compat code. diff --git a/lisp/mh-e/mh-gnus.el b/lisp/mh-e/mh-gnus.el index d7f88c6bf1..b096cd6b88 100644 --- a/lisp/mh-e/mh-gnus.el +++ b/lisp/mh-e/mh-gnus.el @@ -39,99 +39,40 @@ ;; TODO This is not in Gnus 5.11. (defun-mh mh-gnus-local-map-property gnus-local-map-property (map) "Return a list suitable for a text property list specifying keymap MAP." - (cond ((>= emacs-major-version 21) (list 'keymap map)) - (t (list 'local-map map)))) - -;; Copy of function from mm-decode.el. -(defun-mh mh-mm-merge-handles mm-merge-handles (handles1 handles2) - (append - (if (listp (car handles1)) - handles1 - (list handles1)) - (if (listp (car handles2)) - handles2 - (list handles2)))) - -;; Copy of function from mm-decode.el. -(defun-mh mh-mm-set-handle-multipart-parameter - mm-set-handle-multipart-parameter (handle parameter value) - ;; HANDLE could be a CTL. - (when handle - (put-text-property 0 (length (car handle)) parameter value - (car handle)))) - -;; Copy of function from mm-view.el. -(defun-mh mh-mm-inline-text-vcard mm-inline-text-vcard (handle) - (let ((inhibit-read-only t)) - (mm-insert-inline - handle - (concat "\n-- \n" - (ignore-errors - (if (fboundp 'vcard-pretty-print) - (vcard-pretty-print (mm-get-part handle)) - (vcard-format-string - (vcard-parse-string (mm-get-part handle) - 'vcard-standard-filter)))))))) - -;; Function from mm-decode.el used in PGP messages. Just define it with older -;; Gnus to avoid compiler warning. -(defun-mh mh-mm-possibly-verify-or-decrypt - mm-possibly-verify-or-decrypt (_parts _ctl) - nil) - -;; Copy of macro in mm-decode.el. -(defmacro-mh mh-mm-handle-multipart-ctl-parameter - mm-handle-multipart-ctl-parameter (handle parameter) - `(get-text-property 0 ,parameter (car ,handle))) - -;; Copy of function in mm-decode.el. -(defun-mh mh-mm-readable-p mm-readable-p (handle) - "Say whether the content of HANDLE is readable." - (and (< (with-current-buffer (mm-handle-buffer handle) - (buffer-size)) 10000) - (mm-with-unibyte-buffer - (mm-insert-part handle) - (and (eq (mm-body-7-or-8) '7bit) - (not (mh-mm-long-lines-p 76)))))) - -;; Copy of function in mm-bodies.el. -(defun-mh mh-mm-long-lines-p mm-long-lines-p (length) - "Say whether any of the lines in the buffer is longer than LENGTH." - (save-excursion - (goto-char (point-min)) - (end-of-line) - (while (and (not (eobp)) - (not (> (current-column) length))) - (forward-line 1) - (end-of-line)) - (and (> (current-column) length) - (current-column)))) - -(defun-mh mh-mm-keep-viewer-alive-p mm-keep-viewer-alive-p (_handle) - ;; Released Gnus doesn't keep handles associated with externally displayed - ;; MIME parts. So this will always return nil. - nil) - -(defun-mh mh-mm-destroy-parts mm-destroy-parts (_list) - "Older versions of Emacs don't have this function." - nil) - -(defun-mh mh-mm-uu-dissect-text-parts mm-uu-dissect-text-parts (_handles) - "Emacs 21 and XEmacs don't have this function." - nil) - -;; Copy of function in mml.el. -(defun-mh mh-mml-minibuffer-read-disposition - mml-minibuffer-read-disposition (type &optional default filename) - (unless default - (setq default (mml-content-disposition type filename))) - (let ((disposition (completing-read - (format-prompt "Disposition" default) - '(("attachment") ("inline") ("")) - nil t nil nil default))) - (if (not (equal disposition "")) - disposition - default))) + (list 'keymap map)) + +(define-obsolete-function-alias 'mh-mm-merge-handles + #'mm-merge-handles "29.1") + +(define-obsolete-function-alias 'mh-mm-set-handle-multipart-parameter + #'mm-set-handle-multipart-parameter "29.1") + +(define-obsolete-function-alias 'mh-mm-inline-text-vcard + #'mm-inline-text-vcard "29.1") + +(define-obsolete-function-alias 'mh-mm-possibly-verify-or-decrypt + #'mm-possibly-verify-or-decrypt "29.1") + +(define-obsolete-function-alias 'mh-mm-handle-multipart-ctl-parameter + #'mm-handle-multipart-ctl-parameter "29.1") + +(define-obsolete-function-alias 'mh-mm-readable-p + #'mm-readable-p "29.1") + +(define-obsolete-function-alias 'mh-mm-long-lines-p + #'mm-long-lines-p "29.1") + +(define-obsolete-function-alias 'mh-mm-keep-viewer-alive-p + #'mm-keep-viewer-alive-p "29.1") + +(define-obsolete-function-alias 'mh-mm-destroy-parts + #'mm-destroy-parts "29.1") + +(define-obsolete-function-alias 'mh-mm-uu-dissect-text-parts + #'mm-uu-dissect-text-parts "29.1") + +(define-obsolete-function-alias 'mh-mml-minibuffer-read-disposition + #'mml-minibuffer-read-disposition "29.1") ;; This is mm-save-part from Gnus 5.11 since that function in Emacs ;; 21.2 is buggy (the args to read-file-name are incorrect) and the diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el index a34753731c..6b109715cc 100644 --- a/lisp/mh-e/mh-mime.el +++ b/lisp/mh-e/mh-mime.el @@ -141,7 +141,7 @@ mm-inline-text-html-renderer) (and (boundp 'mm-text-html-renderer) mm-text-html-renderer)))) ("text/x-vcard" - mh-mm-inline-text-vcard + mm-inline-text-vcard (lambda (handle) (or (featurep 'vcard) (locate-library "vcard")))) @@ -171,7 +171,7 @@ ("audio/.*" ignore ignore) ("image/.*" ignore ignore) ;; Default to displaying as text - (".*" mm-inline-text mh-mm-readable-p)) + (".*" mm-inline-text mm-readable-p)) "Alist of media types/tests saying whether types can be displayed inline.") (defvar mh-mime-save-parts-directory nil @@ -454,10 +454,10 @@ decoding the same message multiple times." (setf (gethash handle (mh-mime-handles-cache (mh-buffer-data))) (let ((handles (mm-dissect-buffer nil))) (if handles - (mh-mm-uu-dissect-text-parts handles) + (mm-uu-dissect-text-parts handles) (setq handles (mm-uu-dissect))) (setf (mh-mime-handles (mh-buffer-data)) - (mh-mm-merge-handles + (mm-merge-handles handles (mh-mime-handles (mh-buffer-data)))) handles)))) @@ -528,10 +528,10 @@ parsed and then displayed." (if pre-dissected-handles (setq handles pre-dissected-handles) (if (setq handles (mm-dissect-buffer nil)) - (mh-mm-uu-dissect-text-parts handles) + (mm-uu-dissect-text-parts handles) (setq handles (mm-uu-dissect))) (setf (mh-mime-handles (mh-buffer-data)) - (mh-mm-merge-handles handles + (mm-merge-handles handles (mh-mime-handles (mh-buffer-data)))) (unless handles (mh-decode-message-body))) @@ -637,7 +637,7 @@ buttons for alternative parts that are usually suppressed." (let ((mh-mime-security-button-line-format mh-mime-security-button-end-line-format)) (mh-insert-mime-security-button handle)) - (mh-mm-set-handle-multipart-parameter + (mm-set-handle-multipart-parameter handle 'mh-region (cons (point-min-marker) (point-max-marker))))) (defun mh-mime-display-single (handle) @@ -868,7 +868,7 @@ by commands like \"K v\" which operate on individual MIME parts." (defun mh-insert-mime-security-button (handle) "Display buttons for PGP message, HANDLE." - (let* ((protocol (mh-mm-handle-multipart-ctl-parameter handle 'protocol)) + (let* ((protocol (mm-handle-multipart-ctl-parameter handle 'protocol)) (crypto-type (or (nth 2 (assoc protocol mm-verify-function-alist)) (nth 2 (assoc protocol mm-decrypt-function-alist)) "Unknown")) @@ -879,10 +879,10 @@ by commands like \"K v\" which operate on individual MIME parts." (if (equal (car handle) "multipart/signed") " Signed" " Encrypted") " Part")) - (info (or (mh-mm-handle-multipart-ctl-parameter + (info (or (mm-handle-multipart-ctl-parameter handle 'gnus-info) "Undecided")) - (details (mh-mm-handle-multipart-ctl-parameter + (details (mm-handle-multipart-ctl-parameter handle 'gnus-details)) pressed-details) (setq details (if details (concat "\n" details) "")) @@ -1063,7 +1063,7 @@ This is only called in recent versions of Gnus. The MIME handles are stored in data structures corresponding to MH-E folder buffer FOLDER instead of in Gnus (as in the original). The MIME part, HANDLE is associated with the undisplayer FUNCTION." - (if (mh-mm-keep-viewer-alive-p handle) + (if (mm-keep-viewer-alive-p handle) (let ((new-handle (copy-sequence handle))) (mm-handle-set-undisplayer new-handle function) (mm-handle-set-undisplayer handle nil) @@ -1073,19 +1073,19 @@ HANDLE is associated with the undisplayer FUNCTION." (defun mh-mime-security-press-button (handle) "Callback from security button for part HANDLE." - (if (mh-mm-handle-multipart-ctl-parameter handle 'gnus-info) + (if (mm-handle-multipart-ctl-parameter handle 'gnus-info) (mh-mime-security-show-details handle) - (let ((region (mh-mm-handle-multipart-ctl-parameter handle 'mh-region)) + (let ((region (mm-handle-multipart-ctl-parameter handle 'mh-region)) point) (setq point (point)) (goto-char (car region)) (delete-region (car region) (cdr region)) - (with-current-buffer (mh-mm-handle-multipart-ctl-parameter handle 'buffer) + (with-current-buffer (mm-handle-multipart-ctl-parameter handle 'buffer) (let* ((mm-verify-option 'known) (mm-decrypt-option 'known) - (new (mh-mm-possibly-verify-or-decrypt (cdr handle) handle))) + (new (mm-possibly-verify-or-decrypt (cdr handle) handle))) (unless (eq new (cdr handle)) - (mh-mm-destroy-parts (cdr handle)) + (mm-destroy-parts (cdr handle)) (setcdr handle new)))) (mh-mime-display-security handle) (goto-char point)))) @@ -1095,7 +1095,7 @@ HANDLE is associated with the undisplayer FUNCTION." ;; to be no way of getting rid of the inserted text. (defun mh-mime-security-show-details (handle) "Toggle display of detailed security info for HANDLE." - (let ((details (mh-mm-handle-multipart-ctl-parameter handle 'gnus-details))) + (let ((details (mm-handle-multipart-ctl-parameter handle 'gnus-details))) (when details (let ((mh-mime-security-button-pressed (not (get-text-property (point) 'mh-button-pressed))) @@ -1285,7 +1285,7 @@ automatically." (type (mh-minibuffer-read-type file)) (description (mml-minibuffer-read-description)) (dispos (or disposition - (mh-mml-minibuffer-read-disposition type)))) + (mml-minibuffer-read-disposition type)))) (mml-insert-empty-tag 'part 'type type 'filename file 'disposition dispos 'description description))) @@ -1799,7 +1799,7 @@ initialized. Always use the command `mh-have-file-command'.") ;; This is for Emacs, what about XEmacs? (mh-funcall-if-exists remove-images (point-min) (point-max)) (when mime-data - (mh-mm-destroy-parts (mh-mime-handles mime-data)) + (mm-destroy-parts (mh-mime-handles mime-data)) (remhash (current-buffer) mh-globals-hash)))) ;;;###mh-autoload @@ -1807,7 +1807,7 @@ initialized. Always use the command `mh-have-file-command'.") "Free MIME data for externally displayed MIME parts." (let ((mime-data (mh-buffer-data))) (when mime-data - (mh-mm-destroy-parts (mh-mime-handles mime-data))) + (mm-destroy-parts (mh-mime-handles mime-data))) (remhash (current-buffer) mh-globals-hash))) (provide 'mh-mime) commit 3ae275eedc1c8d2a61a4a549c39c88bb08fd8ff2 Author: Stefan Monnier Date: Fri Oct 8 18:36:29 2021 -0400 test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el: Lexbind Add the usual lexical-binding cookie. diff --git a/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el b/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el index 14c8e845d1..9b41fb5426 100644 --- a/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el +++ b/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el @@ -1,3 +1,5 @@ +;;; simple-shorthand-test.el --- -*- lexical-binding: t; -*- + (defun f-test () (let ((read-symbol-shorthands '(("foo-" . "bar-")))) (with-temp-buffer commit d51f684aef8e4283377014cc544c1b214a958d35 Author: Stefan Kangas Date: Fri Oct 8 22:50:49 2021 +0200 Remove XEmacs compat code from lisp/obsolete/*.el * lisp/obsolete/crisp.el (crisp-kill-region) (crisp-region-active): * lisp/obsolete/eudcb-ph.el (eudc-ph-open-session): * lisp/obsolete/fast-lock.el (fast-lock-save-faces): * lisp/obsolete/iswitchb.el (iswitchb-completion-help) (iswitchb-case): * lisp/obsolete/otodo-mode.el (todo-mode): * lisp/obsolete/pgg-parse.el (pgg-parse-armor): * lisp/obsolete/pgg.el (pgg-verify-region): * lisp/obsolete/tpu-edt.el (activate-mark-hook, tpu-mark) (tpu-set-mark, tpu-load-xkeys): * lisp/obsolete/tpu-mapper.el (tpu-map-key, tpu-mapper): Remove XEmacs compat code. diff --git a/lisp/obsolete/crisp.el b/lisp/obsolete/crisp.el index 69bf3ed12b..ccf9aaa2b6 100644 --- a/lisp/obsolete/crisp.el +++ b/lisp/obsolete/crisp.el @@ -231,27 +231,13 @@ does not load the scroll-all package." ;; The cut and paste routines are different between XEmacs and Emacs ;; so we need to set up aliases for the functions. - -(defalias 'crisp-set-clipboard - (if (fboundp 'clipboard-kill-ring-save) - 'clipboard-kill-ring-save - 'copy-primary-selection)) - -(defalias 'crisp-kill-region - (if (fboundp 'clipboard-kill-region) - 'clipboard-kill-region - 'kill-primary-selection)) - -(defalias 'crisp-yank-clipboard - (if (fboundp 'clipboard-yank) - 'clipboard-yank - 'yank-clipboard-selection)) +(defalias 'crisp-set-clipboard 'clipboard-kill-ring-save) +(defalias 'crisp-kill-region 'clipboard-kill-region) +(defalias 'crisp-yank-clipboard 'clipboard-yank) (defun crisp-region-active () "Compatibility function to test for an active region." - (if (featurep 'xemacs) - zmacs-region-active-p - mark-active)) + mark-active) (defun crisp-version (&optional arg) "Version number of the CRiSP emulator package. diff --git a/lisp/obsolete/eudcb-ph.el b/lisp/obsolete/eudcb-ph.el index 187879ce2f..51a6780d90 100644 --- a/lisp/obsolete/eudcb-ph.el +++ b/lisp/obsolete/eudcb-ph.el @@ -176,9 +176,7 @@ SERVER is either a string naming the server or a list (NAME PORT)." (setq eudc-ph-process-buffer (get-buffer-create (format " *PH-%s*" host))) (with-current-buffer eudc-ph-process-buffer (erase-buffer) - (setq eudc-ph-read-point (point)) - (and (featurep 'xemacs) (featurep 'mule) - (set-buffer-file-coding-system 'binary t))) + (setq eudc-ph-read-point (point))) (setq process (open-network-stream "ph" eudc-ph-process-buffer host port)) (if (null process) (throw 'done nil)) diff --git a/lisp/obsolete/fast-lock.el b/lisp/obsolete/fast-lock.el index 960233d562..1dee7120c0 100644 --- a/lisp/obsolete/fast-lock.el +++ b/lisp/obsolete/fast-lock.el @@ -283,10 +283,7 @@ If a number, only buffers greater than this size have processing messages." (other :tag "always" t) (integer :tag "size"))) -(defvar fast-lock-save-faces - (when (featurep 'xemacs) - ;; XEmacs uses extents for everything, so we have to pick the right ones. - font-lock-face-list) +(defvar fast-lock-save-faces nil "Faces that will be saved in a Font Lock cache file. If nil, means information for all faces will be saved.") @@ -707,35 +704,7 @@ See `fast-lock-get-face-properties'." (while regions (add-text-properties (nth 0 regions) (nth 1 regions) plist) (setq regions (nthcdr 2 regions)))))))) - -;; Functions for XEmacs: - -(unless (boundp 'font-lock-syntactic-keywords) - (defvar font-lock-syntactic-keywords nil)) - -(unless (boundp 'font-lock-inhibit-thing-lock) - (defvar font-lock-inhibit-thing-lock nil)) - -(unless (fboundp 'font-lock-compile-keywords) - (defalias 'font-lock-compile-keywords #'identity)) - -(unless (fboundp 'font-lock-eval-keywords) - (defun font-lock-eval-keywords (keywords) - (if (symbolp keywords) - (font-lock-eval-keywords (if (fboundp keywords) - (funcall keywords) - (eval keywords t))) - keywords))) - -(unless (fboundp 'font-lock-value-in-major-mode) - (defun font-lock-value-in-major-mode (alist) - (if (consp alist) - (cdr (or (assq major-mode alist) (assq t alist))) - alist))) - -(unless (fboundp 'current-message) - (defun current-message () - "")) + ;; Install ourselves: diff --git a/lisp/obsolete/iswitchb.el b/lisp/obsolete/iswitchb.el index a630baf354..807f5485d5 100644 --- a/lisp/obsolete/iswitchb.el +++ b/lisp/obsolete/iswitchb.el @@ -977,17 +977,7 @@ Return the modified list with the last element prepended to it." (set-buffer buf)) (with-output-to-temp-buffer temp-buf - (if (featurep 'xemacs) - - ;; XEmacs extents are put on by default, doesn't seem to be - ;; any way of switching them off. - (display-completion-list (or iswitchb-matches iswitchb-buflist) - :help-string "iswitchb " - :activate-callback - (lambda (_x _y _z) - (message "doesn't work yet, sorry!"))) - ;; else running Emacs - (display-completion-list (or iswitchb-matches iswitchb-buflist)))) + (display-completion-list (or iswitchb-matches iswitchb-buflist))) (setq iswitchb-common-match-inserted nil)))) ;;; KILL CURRENT BUFFER @@ -1326,9 +1316,7 @@ This is an example function which can be hooked on to "Return non-nil if we should ignore case when matching. See the variable `iswitchb-case' for details." (if iswitchb-case - (if (featurep 'xemacs) - (isearch-no-upper-case-p iswitchb-text) - (isearch-no-upper-case-p iswitchb-text t)))) + (isearch-no-upper-case-p iswitchb-text t))) ;;;###autoload (define-minor-mode iswitchb-mode diff --git a/lisp/obsolete/otodo-mode.el b/lisp/obsolete/otodo-mode.el index 47f5089452..a71d2b82e4 100644 --- a/lisp/obsolete/otodo-mode.el +++ b/lisp/obsolete/otodo-mode.el @@ -908,8 +908,7 @@ If INCLUDE-SEP is non-nil, return point after the separator." ;;;###autoload (define-derived-mode todo-mode nil "TODO" "Major mode for editing TODO lists." - (when (featurep 'xemacs) - (easy-menu-add todo-menu))) + nil) (with-suppressed-warnings ((lexical date entry)) (defvar date) diff --git a/lisp/obsolete/pgg-parse.el b/lisp/obsolete/pgg-parse.el index 2c76365a41..3e4c216abe 100644 --- a/lisp/obsolete/pgg-parse.el +++ b/lisp/obsolete/pgg-parse.el @@ -496,8 +496,7 @@ (defun pgg-parse-armor (string) (with-temp-buffer (buffer-disable-undo) - (unless (featurep 'xemacs) - (set-buffer-multibyte nil)) + (set-buffer-multibyte nil) (insert string) (pgg-decode-armor-region (point-min)(point)))) diff --git a/lisp/obsolete/pgg.el b/lisp/obsolete/pgg.el index 5ed59933f2..127e1dc15c 100644 --- a/lisp/obsolete/pgg.el +++ b/lisp/obsolete/pgg.el @@ -376,8 +376,7 @@ signer's public key from `pgg-default-keyserver-address'." (if (null signature) nil (with-temp-buffer (buffer-disable-undo) - (unless (featurep 'xemacs) - (set-buffer-multibyte nil)) + (set-buffer-multibyte nil) (insert-file-contents signature) (cdr (assq 2 (pgg-decode-armor-region (point-min)(point-max))))))) diff --git a/lisp/obsolete/tpu-edt.el b/lisp/obsolete/tpu-edt.el index e0e89c390e..b59fb8c868 100644 --- a/lisp/obsolete/tpu-edt.el +++ b/lisp/obsolete/tpu-edt.el @@ -650,12 +650,8 @@ GOLD is the ASCII 7-bit escape sequence OP.") (setq tpu-mark-flag (if transient-mark-mode "" (if (tpu-mark) " @" " "))) (force-mode-line-update)) -(cond ((featurep 'xemacs) - (add-hook 'zmacs-deactivate-region-hook 'tpu-update-mode-line) - (add-hook 'zmacs-activate-region-hook 'tpu-update-mode-line)) - (t - (add-hook 'activate-mark-hook 'tpu-update-mode-line) - (add-hook 'deactivate-mark-hook 'tpu-update-mode-line))) +(add-hook 'activate-mark-hook 'tpu-update-mode-line) +(add-hook 'deactivate-mark-hook 'tpu-update-mode-line) ;;; @@ -727,15 +723,13 @@ Otherwise sets the tpu-match markers to nil and returns nil." "TPU-edt version of the mark function. Return the appropriate value of the mark for the current version of Emacs." - (cond ((featurep 'xemacs) (mark (not zmacs-regions))) - (t (and mark-active (mark (not transient-mark-mode)))))) + (and mark-active (mark (not transient-mark-mode)))) (defun tpu-set-mark (pos) "TPU-edt version of the `set-mark' function. Sets the mark at POS and activates the region according to the current version of Emacs." - (set-mark pos) - (when (featurep 'xemacs) (when pos (zmacs-activate-region)))) + (set-mark pos)) (defun tpu-string-prompt (prompt history-symbol) "Read a string with PROMPT." @@ -2306,17 +2300,14 @@ Accepts a prefix argument for the number of tpu-pan-columns to scroll." ;;; (defun tpu-load-xkeys (file) "Load the TPU-edt X-windows key definitions FILE. -If FILE is nil, try to load a default file. The default file names are -`~/.tpu-lucid-keys' for XEmacs, and `~/.tpu-keys' for Emacs." +If FILE is nil, try to load a default file. The default file name is +`~/.tpu-keys'." (interactive "fX key definition file: ") (cond (file (setq file (expand-file-name file))) (tpu-xkeys-file (setq file (expand-file-name tpu-xkeys-file))) - ((featurep 'xemacs) - (setq file (convert-standard-filename - (expand-file-name "~/.tpu-lucid-keys")))) - (t + (t (setq file (convert-standard-filename (expand-file-name "~/.tpu-keys"))) (and (not (file-exists-p file)) diff --git a/lisp/obsolete/tpu-mapper.el b/lisp/obsolete/tpu-mapper.el index 5ae0a6558d..02ba363250 100644 --- a/lisp/obsolete/tpu-mapper.el +++ b/lisp/obsolete/tpu-mapper.el @@ -46,24 +46,14 @@ ;;; (defun tpu-map-key (ident descrip func gold-func) (interactive) - (if (featurep 'xemacs) - (progn - (setq tpu-key-seq (read-key-sequence - (format "Press %s%s: " ident descrip)) - tpu-key (format "[%s]" (event-key (aref tpu-key-seq 0)))) - (unless (equal tpu-key tpu-return) - (set-buffer "Keys") - (insert (format"(global-set-key %s %s)\n" tpu-key func)) - (set-buffer "Gold-Keys") - (insert (format "(define-key tpu-gold-map %s %s)\n" tpu-key gold-func)))) - (message "Press %s%s: " ident descrip) - (setq tpu-key-seq (read-event) - tpu-key (format "[%s]" tpu-key-seq)) - (unless (equal tpu-key tpu-return) - (set-buffer "Keys") - (insert (format"(define-key tpu-global-map %s %s)\n" tpu-key func)) - (set-buffer "Gold-Keys") - (insert (format "(define-key tpu-gold-map %s %s)\n" tpu-key gold-func)))) + (message "Press %s%s: " ident descrip) + (setq tpu-key-seq (read-event) + tpu-key (format "[%s]" tpu-key-seq)) + (unless (equal tpu-key tpu-return) + (set-buffer "Keys") + (insert (format"(define-key tpu-global-map %s %s)\n" tpu-key func)) + (set-buffer "Gold-Keys") + (insert (format "(define-key tpu-gold-map %s %s)\n" tpu-key gold-func))) (set-buffer "Directions") tpu-key) @@ -103,8 +93,7 @@ your local X guru can try to figure out why the key is being ignored." ;; Make sure the window is big enough to display the instructions - (if (featurep 'xemacs) (set-screen-size (selected-screen) 80 36) - (set-frame-size (selected-frame) 80 36)) + (set-frame-size (selected-frame) 80 36) ;; Create buffers - Directions, Keys, Gold-Keys @@ -162,14 +151,9 @@ your local X guru can try to figure out why the key is being ignored." ;; Save for future reference - (cond - ((featurep 'xemacs) - (setq tpu-return-seq (read-key-sequence "Hit carriage-return to continue ")) - (setq tpu-return (concat "[" (format "%s" (event-key (aref tpu-return-seq 0))) "]"))) - (t - (message "Hit carriage-return to continue ") - (setq tpu-return-seq (read-event)) - (setq tpu-return (concat "[" (format "%s" tpu-return-seq) "]")))) + (message "Hit carriage-return to continue ") + (setq tpu-return-seq (read-event)) + (setq tpu-return (concat "[" (format "%s" tpu-return-seq) "]")) ;; Build the keymap file @@ -308,24 +292,14 @@ your local X guru can try to figure out why the key is being ignored." ;; ") - (cond ((featurep 'xemacs) - (insert (format "(setq tpu-help-enter \"%s\")\n" tpu-enter-seq)) - (insert (format "(setq tpu-help-return \"%s\")\n" tpu-return-seq)) - (insert "(setq tpu-help-N \"[#]\")\n") - (insert "(setq tpu-help-n \"[#]\")\n") - (insert "(setq tpu-help-P \"[#]\")\n") - (insert "(setq tpu-help-p \"[#]\")\n")) - (t - (insert (format "(setq tpu-help-enter \"%s\")\n" tpu-enter)))) + (insert (format "(setq tpu-help-enter \"%s\")\n" tpu-enter)) (append-to-buffer "Keys" 1 (point)) (set-buffer "Keys") ;; Save the key mapping program - (let ((file - (convert-standard-filename - (if (featurep 'xemacs) "~/.tpu-lucid-keys" "~/.tpu-keys")))) + (let ((file (convert-standard-filename "~/.tpu-keys"))) (set-visited-file-name (read-file-name (format "Save key mapping to file (default %s): " file) "" file))) (save-buffer) commit bf5b95d9327cfc564bfe6ff8f884b3d8e0b798ea Author: Stefan Kangas Date: Fri Oct 8 21:04:04 2021 +0200 Remove XEmacs compat code from sql.el * lisp/progmodes/sql.el (sql-interactive-mode-map, sql-mode) (sql-interactive-mode): Remove XEmacs compat code. (Bug#51096) diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index d0e0a1154e..f55115e902 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -1352,8 +1352,6 @@ specified, it's `sql-product' or `sql-connection' must match." (defvar sql-interactive-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map comint-mode-map) - (if (fboundp 'set-keymap-name) - (set-keymap-name map 'sql-interactive-mode-map)); XEmacs (define-key map (kbd "C-j") 'sql-accumulate-and-indent) (define-key map (kbd "C-c C-w") 'sql-copy-column) (define-key map (kbd "O") 'sql-magic-go) @@ -4160,10 +4158,6 @@ must tell Emacs. Here's how to do that in your init file: (modify-syntax-entry ?\\\\ \"\\\\\" sql-mode-syntax-table)))" :abbrev-table sql-mode-abbrev-table - (when (and (featurep 'xemacs) - sql-mode-menu) - (easy-menu-add sql-mode-menu)) - ;; (smie-setup sql-smie-grammar #'sql-smie-rules) (setq-local comment-start "--") ;; Make each buffer in sql-mode remember the "current" SQLi buffer. @@ -4286,9 +4280,6 @@ you entered, right above the output it created. (setq mode-name (concat "SQLi[" (or (sql-get-product-feature sql-product :name) (symbol-name sql-product)) "]")) - (when (and (featurep 'xemacs) - sql-interactive-mode-menu) - (easy-menu-add sql-interactive-mode-menu)) ;; Note that making KEYWORDS-ONLY nil will cause havoc if you try ;; SELECT 'x' FROM DUAL with SQL*Plus, because the title of the column commit e139dd1b1e8d531bb36e74af920215346bdb453a Author: Eli Zaretskii Date: Fri Oct 8 22:20:19 2021 +0300 Fix doc strings of 2 categories * lisp/international/characters.el (?R, ?L): Make the first line of the categories' doc string shorter, to fit into 15 columns. diff --git a/lisp/international/characters.el b/lisp/international/characters.el index 475a669dc4..5aefda2328 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el @@ -116,11 +116,11 @@ Base characters (Unicode General Category L,N,P,S,Zs)") Combining diacritic or mark (Unicode General Category M)") ;; bidi types -(define-category ?R "Right-to-left (strong) +(define-category ?R "Strong R2L Characters with \"strong\" right-to-left directionality, i.e. with R, AL, RLE, or RLO Unicode bidi character type.") -(define-category ?L "Left-to-right (strong) +(define-category ?L "Strong L2R Characters with \"strong\" left-to-right directionality, i.e. with L, LRE, or LRO Unicode bidi character type.") commit e73c9ac4ed4ce0a4b423dae6acbfb384c1afbce0 Author: Stefan Kangas Date: Fri Oct 8 21:02:14 2021 +0200 Remove Emacs 20 compat code from sql.el * lisp/progmodes/sql.el (sql-input-ring-separator) (sql-product-font-lock): Remove Emacs 20 compat code. diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 454279ca17..d0e0a1154e 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -963,12 +963,7 @@ If set to \"\\n\", each line in the history file will be interpreted as one command. Multi-line commands are split into several commands when the input ring is initialized from a history file. -This variable used to initialize `comint-input-ring-separator'. -`comint-input-ring-separator' is part of Emacs 21; if your Emacs -does not have it, setting `sql-input-ring-separator' will have no -effect. In that case multiline commands will be split into several -commands when the input history is read, as if you had set -`sql-input-ring-separator' to \"\\n\"." +This variable used to initialize `comint-input-ring-separator'." :type 'string) ;; The usual hooks @@ -2832,16 +2827,6 @@ configured." (font-lock-mode-internal nil) (font-lock-mode-internal t)) - (add-hook 'font-lock-mode-hook - (lambda () - ;; Provide defaults for new font-lock faces. - (defvar font-lock-builtin-face - (if (boundp 'font-lock-preprocessor-face) - font-lock-preprocessor-face - font-lock-keyword-face)) - (defvar font-lock-doc-face font-lock-string-face)) - nil t) - ;; Setup imenu; it needs the same syntax-alist. (when imenu (setq imenu-syntax-alist syntax-alist)))) commit 519f9e144f1c1719156d98b67d5e5d78eb932f72 Author: Stefan Kangas Date: Fri Oct 8 20:41:50 2021 +0200 Remove some additional XEmacs compat code from viper * lisp/emulation/viper-util.el (viper-memq-char): Make into obsolete function alias for 'memq'. Update callers. (viper-char-equal): Make into obsolete function alias for 'eq'. Update callers. (viper-color-display-p): Make into obsolete function alias for 'x-display-color-p'. Update callers. diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 9f3d515bc6..59be3f4846 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -35,9 +35,7 @@ (defvar viper--key-maps) (defvar viper--intercept-key-maps) (defvar iso-accents-mode) -(defvar quail-mode) (defvar quail-current-str) -(defvar mark-even-if-inactive) (defvar viper--init-message) (defvar viper-initial) (defvar undo-beg-posn) @@ -69,8 +67,7 @@ (nm-p (intern (concat snm "-p"))) (nms (intern (concat snm "s")))) `(defun ,nm-p (com) - (consp (viper-memq-char com ,nms) - )))) + (consp (memq com ,nms))))) ;; Variables for defining VI commands @@ -1035,23 +1032,23 @@ as a Meta key and any number of multiple escapes are allowed." cmd-info cmd-to-exec-at-end) (while (and cont - (viper-memq-char char - (list ?c ?d ?y ?! ?< ?> ?= ?# ?r ?R ?\" - viper-buffer-search-char))) + (memq char + (list ?c ?d ?y ?! ?< ?> ?= ?# ?r ?R ?\" + viper-buffer-search-char))) (if com ;; this means that we already have a command character, so we ;; construct a com list and exit while. however, if char is " ;; it is an error. (progn ;; new com is (CHAR . OLDCOM) - (if (viper-memq-char char '(?# ?\")) (user-error viper-ViperBell)) + (if (memq char '(?# ?\")) (user-error viper-ViperBell)) (setq com (cons char com)) (setq cont nil)) ;; If com is nil we set com as char, and read more. Again, if char is ;; ", we read the name of register and store it in viper-use-register. ;; if char is !, =, or #, a complete com is formed so we exit the while ;; loop. - (cond ((viper-memq-char char '(?! ?=)) + (cond ((memq char '(?! ?=)) (setq com char) (setq char (read-char)) (setq cont nil)) @@ -1091,7 +1088,7 @@ as a Meta key and any number of multiple escapes are allowed." `(key-binding (char-to-string ,char))))) ;; as com is non-nil, this means that we have a command to execute - (if (viper-memq-char (car com) '(?r ?R)) + (if (memq (car com) '(?r ?R)) ;; execute appropriate region command. (let ((char (car com)) (com (cdr com))) (setq prefix-arg (cons value com)) @@ -2603,12 +2600,12 @@ On reaching beginning of line, stop and signal error." (let ((prev-char (viper-char-at-pos 'backward)) (saved-point (point))) ;; skip non-newline separators backward - (while (and (not (viper-memq-char prev-char '(nil \n))) + (while (and (not (memq prev-char '(nil \n))) (< lim (point)) ;; must be non-newline separator (if (eq viper-syntax-preference 'strict-vi) - (viper-memq-char prev-char '(?\ ?\t)) - (viper-memq-char (char-syntax prev-char) '(?\ ?-)))) + (memq prev-char '(?\ ?\t)) + (memq (char-syntax prev-char) '(?\ ?-)))) (viper-backward-char-carefully) (setq prev-char (viper-char-at-pos 'backward))) @@ -2622,12 +2619,12 @@ On reaching beginning of line, stop and signal error." ;; skip again, but make sure we don't overshoot the limit (if twice - (while (and (not (viper-memq-char prev-char '(nil \n))) + (while (and (not (memq prev-char '(nil \n))) (< lim (point)) ;; must be non-newline separator (if (eq viper-syntax-preference 'strict-vi) - (viper-memq-char prev-char '(?\ ?\t)) - (viper-memq-char (char-syntax prev-char) '(?\ ?-)))) + (memq prev-char '(?\ ?\t)) + (memq (char-syntax prev-char) '(?\ ?-)))) (viper-backward-char-carefully) (setq prev-char (viper-char-at-pos 'backward)))) @@ -2645,10 +2642,10 @@ On reaching beginning of line, stop and signal error." (viper-forward-word-kernel val) (if com (progn - (cond ((viper-char-equal com ?c) + (cond ((eq com ?c) (viper-separator-skipback-special 'twice viper-com-point)) ;; Yank words including the whitespace, but not newline - ((viper-char-equal com ?y) + ((eq com ?y) (viper-separator-skipback-special nil viper-com-point)) ((viper-dotable-command-p com) (viper-separator-skipback-special nil viper-com-point))) @@ -2666,10 +2663,10 @@ On reaching beginning of line, stop and signal error." (viper-skip-nonseparators 'forward) (viper-skip-separators t)) (if com (progn - (cond ((viper-char-equal com ?c) + (cond ((eq com ?c) (viper-separator-skipback-special 'twice viper-com-point)) ;; Yank words including the whitespace, but not newline - ((viper-char-equal com ?y) + ((eq com ?y) (viper-separator-skipback-special nil viper-com-point)) ((viper-dotable-command-p com) (viper-separator-skipback-special nil viper-com-point))) @@ -4714,15 +4711,15 @@ Please, specify your level now: ")) (defun viper-submit-report () "Submit bug report on Viper." (interactive) - (defvar viper-color-display-p) + (defvar x-display-color-p) (defvar viper-frame-parameters) (defvar viper-minibuffer-emacs-face) (defvar viper-minibuffer-vi-face) (defvar viper-minibuffer-insert-face) (let ((reporter-prompt-for-summary-p t) - (viper-color-display-p (if (viper-window-display-p) - (viper-color-display-p) - 'non-x)) + (x-display-color-p (if (viper-window-display-p) + (x-display-color-p) + 'non-x)) (viper-frame-parameters (frame-parameters (selected-frame))) (viper-minibuffer-emacs-face (if (viper-has-face-support-p) (facep @@ -4780,7 +4777,7 @@ Please, specify your level now: ")) 'viper-expert-level 'major-mode 'window-system - 'viper-color-display-p + 'x-display-color-p 'viper-frame-parameters 'viper-minibuffer-vi-face 'viper-minibuffer-insert-face diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el index ef15779e1b..85c8b87b9a 100644 --- a/lisp/emulation/viper-ex.el +++ b/lisp/emulation/viper-ex.el @@ -25,7 +25,6 @@ ;;; Code: ;; Compiler pacifier -(defvar read-file-name-map) (defvar viper-use-register) (defvar viper-s-string) (defvar viper-shift-width) diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index fe3704841a..a170d677d2 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el @@ -25,16 +25,12 @@ ;;; Code: ;; compiler pacifier -(defvar mark-even-if-inactive) -(defvar quail-mode) (defvar iso-accents-mode) (defvar viper-current-state) (defvar viper-version) (defvar viper-expert-level) (defvar current-input-method) (defvar default-input-method) -(defvar describe-current-input-method-function) -(defvar bar-cursor) (defvar cursor-type) ;; end pacifier @@ -48,7 +44,7 @@ (define-obsolete-function-alias 'viper-device-type #'window-system "27.1") -(defun viper-color-display-p () +(defun x-display-color-p () (condition-case nil (display-color-p) (error nil))) @@ -81,7 +77,7 @@ In all likelihood, you don't need to bother with this setting." (defun viper-has-face-support-p () (cond ((viper-window-display-p)) (viper-force-faces) - ((viper-color-display-p)) + ((x-display-color-p)) (t (memq window-system '(pc))))) diff --git a/lisp/emulation/viper-mous.el b/lisp/emulation/viper-mous.el index 02db39f1cb..3d55690bd6 100644 --- a/lisp/emulation/viper-mous.el +++ b/lisp/emulation/viper-mous.el @@ -26,7 +26,6 @@ ;; compiler pacifier (defvar double-click-time) -(defvar mouse-track-multi-click-time) (defvar viper-search-start-marker) (defvar viper-local-search-start-marker) (defvar viper-search-history) @@ -76,8 +75,8 @@ or a triple-click." ;; remembers prefix argument to pass along to commands invoked by second ;; click. -;; This is needed because in Emacs (not XEmacs), assigning to prefix-arg -;; causes Emacs to count the second click as if it was a single click +;; This is needed because assigning to prefix-arg causes Emacs to +;; count the second click as if it was a single click (defvar viper-global-prefix-argument nil) diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index 0f6dceb13c..71043b189d 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el @@ -29,9 +29,6 @@ ;; Compiler pacifier (defvar viper-minibuffer-current-face) -(defvar viper-minibuffer-insert-face) -(defvar viper-minibuffer-vi-face) -(defvar viper-minibuffer-emacs-face) (defvar viper-replace-overlay-face) (defvar viper-fast-keyseq-timeout) (defvar ex-unix-type-shell) @@ -64,22 +61,8 @@ (define-obsolete-function-alias 'viper-iconify #'iconify-or-deiconify-frame "27.1") - -;; CHAR is supposed to be a char or an integer (positive or negative) -;; LIST is a list of chars, nil, and negative numbers -;; Check if CHAR is a member by trying to convert in characters, if necessary. -;; Introduced for compatibility with XEmacs, where integers are not the same as -;; chars. -(defun viper-memq-char (char list) - (cond ((and (integerp char) (>= char 0)) - (memq char list)) - ((memq char list)))) - -;; Check if char-or-int and char are the same as characters -(defun viper-char-equal (char-or-int char) - (cond ((and (integerp char-or-int) (>= char-or-int 0)) - (= char-or-int char)) - ((eq char-or-int char)))) +(define-obsolete-function-alias 'viper-memq-char #'memq "29.1") +(define-obsolete-function-alias 'viper-char-equal #'eq "29.1") ;; Like =, but accommodates null and also is t for eq-objects (defun viper= (char char1) @@ -88,8 +71,7 @@ (= char char1)) (t nil))) -(defsubst viper-color-display-p () - (x-display-color-p)) +(define-obsolete-function-alias 'viper-color-display-p #'x-display-color-p "29.1") (defun viper-get-cursor-color (&optional _frame) (cdr (assoc 'cursor-color (frame-parameters)))) @@ -110,7 +92,7 @@ Otherwise return the normal value." ;; cursor colors (defun viper-change-cursor-color (new-color &optional frame) - (if (and (viper-window-display-p) (viper-color-display-p) + (if (and (viper-window-display-p) (x-display-color-p) (stringp new-color) (x-color-defined-p new-color) (not (string= new-color (viper-get-cursor-color)))) (modify-frame-parameters @@ -142,7 +124,7 @@ Otherwise return the normal value." ;; By default, saves current frame cursor color before changing viper state (defun viper-save-cursor-color (before-which-mode) - (if (and (viper-window-display-p) (viper-color-display-p)) + (if (and (viper-window-display-p) (x-display-color-p)) (let ((color (viper-get-cursor-color))) (if (and (stringp color) (x-color-defined-p color) ;; there is something fishy in that the color is not saved if @@ -1183,25 +1165,23 @@ This option is appropriate if you like Emacs-style words." (looking-at (concat "[" viper-strict-ALPHA-chars addl-chars "]")) (or ;; or one of the additional chars being asked to include - (viper-memq-char char (viper-string-to-list addl-chars)) + (memq char (viper-string-to-list addl-chars)) (and ;; not one of the excluded word chars (note: ;; viper-non-word-characters is a list) - (not (viper-memq-char char viper-non-word-characters)) + (not (memq char viper-non-word-characters)) ;; char of the Viper-word syntax class - (viper-memq-char (char-syntax char) - (viper-string-to-list viper-ALPHA-char-class)))))) - )) + (memq (char-syntax char) + (viper-string-to-list viper-ALPHA-char-class)))))))) (defun viper-looking-at-separator () (let ((char (char-after (point)))) (if char (if (eq viper-syntax-preference 'strict-vi) - (viper-memq-char char (viper-string-to-list viper-strict-SEP-chars)) + (memq char (viper-string-to-list viper-strict-SEP-chars)) (or (eq char ?\n) ; RET is always a separator in Vi - (viper-memq-char (char-syntax char) - (viper-string-to-list viper-SEP-char-class))))) - )) + (memq (char-syntax char) + (viper-string-to-list viper-SEP-char-class))))))) (defsubst viper-looking-at-alphasep (&optional addl-chars) (or (viper-looking-at-separator) (viper-looking-at-alpha addl-chars))) @@ -1327,8 +1307,7 @@ This option is appropriate if you like Emacs-style words." ;; of the excluded characters (if (and (eq syntax-of-char-looked-at ?w) (not negated-syntax)) - (not (viper-memq-char - char-looked-at viper-non-word-characters)) + (not (memq char-looked-at viper-non-word-characters)) t)) (funcall skip-syntax-func 1) 0) diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index e9c0fb5e24..1ee5365126 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el @@ -304,7 +304,6 @@ ;; compiler pacifier (defvar mark-even-if-inactive) -(defvar quail-mode) (defvar viper-expert-level) (defvar viper-mode-string) (defvar viper-major-mode-modifier-list) commit f146325bd1556d1acafe26f6c263b83a92d3cd20 Author: Stefan Kangas Date: Fri Oct 8 20:25:52 2021 +0200 Obsolete XEmacs compat convention in erc-button-press-button * lisp/erc/erc-button.el (erc-button-press-button): Advertise new calling convention without XEmacs compatibility. diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el index 17d5b6129d..2c1d7000e9 100644 --- a/lisp/erc/erc-button.el +++ b/lisp/erc/erc-button.el @@ -389,12 +389,11 @@ REGEXP is the regular expression which matched for this button." (mouse-set-point event) (erc-button-press-button))) -;; XEmacs calls this via widget-button-press with a bunch of arguments -;; which we don't care about. (defun erc-button-press-button (&rest _ignore) "Check text at point for a callback function. If the text at point has a `erc-callback' property, call it with the value of the `erc-data' text property." + (declare (advertised-calling-convention () "29.1")) (interactive) (let* ((data (get-text-property (point) 'erc-data)) (fun (get-text-property (point) 'erc-callback))) commit 59782839cb9ca7f3bc37bf00773db9ddc4cde61b Author: Dmitry Gutov Date: Fri Oct 8 18:25:55 2021 +0300 (xref--collect-matches-1): Remove some intermediate allocations * lisp/progmodes/xref.el: (xref--collect-matches-1): Rewrite to remove some intermediate allocations. Modest performance improvement. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index d6e20c5416..980ef4c8d5 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1878,34 +1878,36 @@ Such as the current syntax table and the applied syntax properties." syntax-needed))))) (defun xref--collect-matches-1 (regexp file line line-beg line-end syntax-needed) - (let (match-pairs matches) + (let (matches + stop beg end + last-beg last-end + summary-end) (when syntax-needed (syntax-propertize line-end)) - (while (and - ;; REGEXP might match an empty string. Or line. - (or (null match-pairs) - (> (point) line-beg)) - (re-search-forward regexp line-end t)) - (push (cons (match-beginning 0) - (match-end 0)) - match-pairs)) - (setq match-pairs (nreverse match-pairs)) - (while match-pairs - (let* ((beg-end (pop match-pairs)) - (beg-column (- (car beg-end) line-beg)) - (end-column (- (cdr beg-end) line-beg)) - (loc (xref-make-file-location file line beg-column)) - (summary (buffer-substring (if matches (car beg-end) line-beg) - (if match-pairs - (caar match-pairs) - line-end)))) - (when matches - (cl-decf beg-column (- (car beg-end) line-beg)) - (cl-decf end-column (- (car beg-end) line-beg))) - (add-face-text-property beg-column end-column 'xref-match - t summary) - (push (xref-make-match summary loc (- end-column beg-column)) - matches))) + (while (not stop) + (if (and + ;; REGEXP might match an empty string. Or line. + (not (and last-beg (eql end line-beg))) + (re-search-forward regexp line-end t)) + (setq beg (match-beginning 0) + end (match-end 0) + summary-end beg) + (setq stop t + summary-end line-end)) + (when last-beg + (let* ((beg-column (- last-beg line-beg)) + (end-column (- last-end line-beg)) + (summary-start (if matches last-beg line-beg)) + (summary (buffer-substring summary-start + summary-end)) + (loc (xref-make-file-location file line beg-column))) + (add-face-text-property (- last-beg summary-start) + (- last-end summary-start) + 'xref-match t summary) + (push (xref-make-match summary loc (- end-column beg-column)) + matches))) + (setq last-beg beg + last-end end)) (nreverse matches))) (defun xref--find-file-buffer (file) commit 1c7d056f4d38d212b23353f0d98d288bfa74f755 Author: Stefan Kangas Date: Fri Oct 8 16:50:32 2021 +0200 ; Fix two typos where em dash was written as en dash diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 7e8b0e5914..d1380bc297 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -945,7 +945,7 @@ the author's description of the changes in the revision on the current line. @item w -Annotate the working revision--the one you are editing. If you used +Annotate the working revision---the one you are editing. If you used @kbd{p} and @kbd{n} to browse to other revisions, use this key to return to your working revision. diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index 19f2d7d609..5153829e2d 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -415,7 +415,7 @@ emacs -batch -l ert -l my-tests.el \ @end example By default, ERT test failure summaries are quite brief in batch -mode--only the names of the failed tests are listed. If the +mode---only the names of the failed tests are listed. If the EMACS_TEST_VERBOSE environment variable is set, the failure summaries will also include the data from the failing test. commit 2bc37c14dbdf3fdf337862caa31fabfe69476e70 Merge: b506c5b217 af01b674ce Author: Glenn Morris Date: Fri Oct 8 07:50:28 2021 -0700 Merge from origin/emacs-28 af01b674ce (origin/emacs-28) ; Fix spacing in previous commit 915e044d60 Use the correct label in the warning 6e83a4100a ; * admin/make-tarball.txt: Should configure --with-native... 525602d682 ; * etc/TODO (display): Add entry about Default_Ignorables. 65de510c16 ; Fix 'restore-buffer-modified-p' doc string typo 9d8202b45e Add Emacs 27 compatibility hack 89d64fca75 Pacify GCC 10.3 -Wmaybe-uninitialized bb8ef1aa30 * lisp/tab-bar.el (tab-detach, tab-window-detach): New ali... 7ae70054aa ; * src/composite.h (LGSTRING_FONT): Add comment about its... 1af00e67d6 Include the refcards in the release tarball 3c29fb705c ; * src/Makefile.in (../native-lisp): Make the long recipe... commit af01b674cec1ea7e9dd801f40c1ca8221f5cc8da Author: Tassilo Horn Date: Fri Oct 8 13:03:45 2021 +0200 ; Fix spacing in previous commit diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el index 26ae833828..b5f53ba86e 100644 --- a/lisp/textmodes/reftex-toc.el +++ b/lisp/textmodes/reftex-toc.el @@ -856,7 +856,7 @@ label prefix determines the wording of a reference." (label (car toc)) newlabel) (if (not (stringp label)) (error "This is not a label entry")) - (setq newlabel (read-string (format "Rename label \"%s\" to :" label))) + (setq newlabel (read-string (format "Rename label \"%s\" to: " label))) (if (assoc newlabel (symbol-value reftex-docstruct-symbol)) (if (not (y-or-n-p (format-message "Label `%s' exists. Use anyway? " newlabel))) commit 915e044d60dfde0953327cb9cbfe8bb0f69e5dd4 Author: Arash Esbati Date: Fri Oct 8 11:12:30 2021 +0200 Use the correct label in the warning * lisp/textmodes/reftex-toc.el (reftex-toc-rename-label): Add missing space in the prompt. Use the new user defined label in the warning (bug#36235). diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el index 7ca2fb827e..26ae833828 100644 --- a/lisp/textmodes/reftex-toc.el +++ b/lisp/textmodes/reftex-toc.el @@ -856,10 +856,10 @@ label prefix determines the wording of a reference." (label (car toc)) newlabel) (if (not (stringp label)) (error "This is not a label entry")) - (setq newlabel (read-string (format "Rename label \"%s\" to:" label))) + (setq newlabel (read-string (format "Rename label \"%s\" to :" label))) (if (assoc newlabel (symbol-value reftex-docstruct-symbol)) (if (not (y-or-n-p - (format-message "Label `%s' exists. Use anyway? " label))) + (format-message "Label `%s' exists. Use anyway? " newlabel))) (error "Abort"))) (save-excursion (save-window-excursion commit 6e83a4100a7c4d528a1b88dab49327102f833c4a Author: Eli Zaretskii Date: Fri Oct 8 10:31:17 2021 +0300 ; * admin/make-tarball.txt: Should configure --with-native-compilation. diff --git a/admin/make-tarball.txt b/admin/make-tarball.txt index ae007d76b0..22276080c5 100644 --- a/admin/make-tarball.txt +++ b/admin/make-tarball.txt @@ -42,6 +42,12 @@ General steps (for each step, check for possible errors): because some of the commands below run Make, so they need Makefiles to be present. + For Emacs 28, and as long as --with-native-compilation is not the + default, the tree needs to be configured with native-compilation + enabled, to ensure all the pertinent *.elc files will end up in + the tarball. Otherwise, the *.eln files might not build correctly + on the user's system. + 2. Regenerate the etc/AUTHORS file: M-: (require 'authors) RET M-x authors RET commit 525602d68200ae79d853e8f2bf525b3d966dd819 Author: Eli Zaretskii Date: Fri Oct 8 10:27:03 2021 +0300 ; * etc/TODO (display): Add entry about Default_Ignorables. diff --git a/etc/TODO b/etc/TODO index ffc5ef304b..cd06b1ea26 100644 --- a/etc/TODO +++ b/etc/TODO @@ -444,6 +444,25 @@ consistency checks that make sure the new code computes the same results as the old code. And once that works well, we can remove the old code and old fields. +** Implement Unicode-compliant display of "default-ignorable" characters +See the "Characters Ignored for Display" section of paragraph 5.21 in +the Unicode Standard for the details. + +The implementation would import the data from Unicode UCD file +DerivedCoreProperties.txt, and provide a minor mode that arranges for +the characters with the Default_Ignorable_Code_Point (DI) property to +be hidden on display. One way of implementing that could be via +glyphless-char-display-control; that one is global, but maybe there's +a way of making it buffer-local. Alternatively, this could be +implemented in C in the display engine. + +An additional aspect of this is the display of U+00AD SOFT HYPHEN as +invisible except at line boundaries. Note that this would need to +support hard (physical) newlines in the buffer as well as soft +wrapping of long lines under 'visual-line-mode'. The algorithm for +selecting the wrap point may also need be changed to break at the soft +hyphen. + ** FFI (foreign function interface) See eg https://lists.gnu.org/r/emacs-devel/2013-10/msg00246.html commit 65de510c1663994dcbdec219ab1889d0f71a7be6 Author: Stephen Gildea Date: Thu Oct 7 20:10:09 2021 -0700 ; Fix 'restore-buffer-modified-p' doc string typo * src/buffer.c (restore-buffer-modified-p): Fix typo in doc string: "and" for "or" regarding lock/unlock. Note that 'set-buffer-modified-p' doc string already uses the correct "or". diff --git a/src/buffer.c b/src/buffer.c index 4eb7ab6d6b..f405bcb583 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1434,7 +1434,7 @@ and `buffer-file-truename' are non-nil. */) DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p, Srestore_buffer_modified_p, 1, 1, 0, doc: /* Like `set-buffer-modified-p', but doesn't redisplay buffer's mode line. -This function also locks and unlocks the file visited by the buffer, +This function also locks or unlocks the file visited by the buffer, if both `buffer-file-truename' and `buffer-file-name' are non-nil. It is not ensured that mode lines will be updated to show the modified commit 9d8202b45e6beae31f2952d653c0ba7b788c4975 Author: Dmitry Gutov Date: Fri Oct 8 05:23:19 2021 +0300 Add Emacs 27 compatibility hack * lisp/progmodes/xref.el: Add Emacs 27 compatibility hack, for the standalone version of this package. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 1feb6ef915..d6e20c5416 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -74,6 +74,20 @@ (require 'ring) (require 'project) +(eval-and-compile + (when (version< emacs-version "28") + ;; etags.el in Emacs 26 and 27 uses EIEIO, and its location type + ;; inherits from `xref-location'. + (require 'eieio) + + ;; Suppressing byte-compilation warnings (in Emacs 28+) about + ;; `defclass' not being defined, which happens because the + ;; `require' statement above is not evaluated either. + ;; FIXME: Use `with-suppressed-warnings' when we stop supporting Emacs 26. + (with-no-warnings + (defclass xref-location () () + :documentation "(Obsolete) location represents a position in a file or buffer.")))) + (defgroup xref nil "Cross-referencing commands." :version "25.1" :group 'tools) commit b506c5b217d4adf68013c15be0d1b16189de089b Author: Stefan Kangas Date: Thu Oct 7 17:10:07 2021 +0200 Make mh-* XEmacs compat aliases obsolete * lisp/mh-e/mh-acros.el (mh-make-local-hook): Make XEmacs and Emacs 20 macro obsolete. Update all callers * lisp/mh-e/mh-compat.el (mh-require): Make XEmacs compat alias obsolete. Update all callers (mh-write-file-functions): Make XEmacs compat macro obsolete. Update all callers (mh-assoc-string, mh-display-color-cells, mh-face-foreground) (mh-face-foreground, mh-face-background) (mh-font-lock-add-keywords, mh-image-load-path-for-library) (mh-image-search-load-path, mh-line-beginning-position) (mh-line-end-position, mh-mail-abbrev-make-syntax-table) (mh-define-obsolete-variable-alias, mh-make-obsolete-variable) (mh-match-string-no-properties, mh-replace-regexp-in-string) (mh-test-completion, mh-url-hexify-string, mh-view-mode-enter) (mh-window-full-height-p): Make XEmacs compat definitions into obsolete function aliases for the same names but without the "mh-" prefix. Update all callers. diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el index 5ea7bca6f9..f3447aa80b 100644 --- a/lisp/mh-e/mh-acros.el +++ b/lisp/mh-e/mh-acros.el @@ -99,6 +99,7 @@ Otherwise, create macro NAME with ARG-LIST and BODY." "Make HOOK local if needed. XEmacs and versions of GNU Emacs before 21.1 require `make-local-hook' to be called." + (declare (obsolete nil "29.1")) (when (and (fboundp 'make-local-hook) (not (get 'make-local-hook 'byte-obsolete-info))) `(make-local-hook ,hook))) diff --git a/lisp/mh-e/mh-alias.el b/lisp/mh-e/mh-alias.el index 37fdb16601..5761df5297 100644 --- a/lisp/mh-e/mh-alias.el +++ b/lisp/mh-e/mh-alias.el @@ -112,10 +112,10 @@ COMMA-SEPARATOR is non-nil." (setq res (match-string 1 res))) ;; Replace "&" with capitalized username (if (string-search "&" res) - (setq res (mh-replace-regexp-in-string "&" (capitalize username) res))) + (setq res (replace-regexp-in-string "&" (capitalize username) res))) ;; Remove " character (if (string-search "\"" res) - (setq res (mh-replace-regexp-in-string "\"" "" res))) + (setq res (replace-regexp-in-string "\"" "" res))) ;; If empty string, use username instead (if (string-equal "" res) (setq res username)) @@ -155,7 +155,7 @@ Exclude all aliases already in `mh-alias-alist' from \"ali\"" (if (string-equal username realname) (concat "<" username ">") (concat realname " <" username ">")))) - (when (not (mh-assoc-string alias-name mh-alias-alist t)) + (when (not (assoc-string alias-name mh-alias-alist t)) (setq passwd-alist (cons (list alias-name alias-translation) passwd-alist))))))) (forward-line 1))) @@ -184,12 +184,12 @@ been loaded." (cond ((looking-at "^[ \t]")) ;Continuation line ((looking-at "\\(.+\\): .+: .*$") ; A new -blind- MH alias - (when (not (mh-assoc-string (match-string 1) mh-alias-blind-alist t)) + (when (not (assoc-string (match-string 1) mh-alias-blind-alist t)) (setq mh-alias-blind-alist (cons (list (match-string 1)) mh-alias-blind-alist)) (setq mh-alias-alist (cons (list (match-string 1)) mh-alias-alist)))) ((looking-at "\\(.+\\): .*$") ; A new MH alias - (when (not (mh-assoc-string (match-string 1) mh-alias-alist t)) + (when (not (assoc-string (match-string 1) mh-alias-alist t)) (setq mh-alias-alist (cons (list (match-string 1)) mh-alias-alist))))) (forward-line 1))) @@ -200,7 +200,7 @@ been loaded." user) (while local-users (setq user (car local-users)) - (if (not (mh-assoc-string (car user) mh-alias-alist t)) + (if (not (assoc-string (car user) mh-alias-alist t)) (setq mh-alias-alist (append mh-alias-alist (list user)))) (setq local-users (cdr local-users))))) (run-hooks 'mh-alias-reloaded-hook) @@ -239,16 +239,16 @@ done here." "Return expansion for ALIAS. Blind aliases or users from /etc/passwd are not expanded." (cond - ((mh-assoc-string alias mh-alias-blind-alist t) + ((assoc-string alias mh-alias-blind-alist t) alias) ; Don't expand a blind alias - ((mh-assoc-string alias mh-alias-passwd-alist t) - (cadr (mh-assoc-string alias mh-alias-passwd-alist t))) + ((assoc-string alias mh-alias-passwd-alist t) + (cadr (assoc-string alias mh-alias-passwd-alist t))) (t (mh-alias-ali alias)))) (eval-and-compile - (mh-require 'crm nil t) ; completing-read-multiple - (mh-require 'multi-prompt nil t)) + (require 'crm nil t) ; completing-read-multiple + (require 'multi-prompt nil t)) ;;;###mh-autoload (defun mh-read-address (prompt) @@ -281,7 +281,7 @@ Blind aliases or users from /etc/passwd are not expanded." (let* ((case-fold-search t) (beg (mh-beginning-of-word)) (the-name (buffer-substring-no-properties beg (point)))) - (if (mh-assoc-string the-name mh-alias-alist t) + (if (assoc-string the-name mh-alias-alist t) (message "%s -> %s" the-name (mh-alias-expand the-name)) ;; Check if it was a single word likely to be an alias (if (and (equal mh-alias-flash-on-comma 1) @@ -313,7 +313,7 @@ Blind aliases or users from /etc/passwd are not expanded." res) res))) ((t) (all-completions string mh-alias-alist pred)) - ((lambda) (mh-test-completion string mh-alias-alist pred))))))))) + ((lambda) (test-completion string mh-alias-alist pred))))))))) ;;; Alias File Updating diff --git a/lisp/mh-e/mh-comp.el b/lisp/mh-e/mh-comp.el index 1eacc50589..8d5a472552 100644 --- a/lisp/mh-e/mh-comp.el +++ b/lisp/mh-e/mh-comp.el @@ -596,7 +596,7 @@ See also `mh-compose-forward-as-mime-flag', (set (make-local-variable 'mh-mail-header-separator) (save-excursion (goto-char (mh-mail-header-end)) - (buffer-substring-no-properties (point) (mh-line-end-position)))) + (buffer-substring-no-properties (point) (line-end-position)))) (set (make-local-variable 'mail-header-separator) mh-mail-header-separator) ;override sendmail.el ;; If using MML, translate MH-style directive (if (equal mh-compose-insertion 'mml) @@ -1095,7 +1095,6 @@ letter." (setq mh-previous-window-config config) (setq mode-line-buffer-identification (list " {%b}")) (mh-logo-display) - (mh-make-local-hook 'kill-buffer-hook) (add-hook 'kill-buffer-hook #'mh-tidy-draft-buffer nil t) (run-hook-with-args 'mh-compose-letter-function to subject cc)) @@ -1234,7 +1233,7 @@ discarded." (cond ((and overwrite-flag (mh-goto-header-field (concat field ":"))) (insert " " value) - (delete-region (point) (mh-line-end-position))) + (delete-region (point) (line-end-position))) ((and (not overwrite-flag) (mh-regexp-in-field-p (concat "\\b" (regexp-quote value) "\\b") field)) ;; Already there, do nothing. diff --git a/lisp/mh-e/mh-compat.el b/lisp/mh-e/mh-compat.el index 26e5576fe6..659c4354b1 100644 --- a/lisp/mh-e/mh-compat.el +++ b/lisp/mh-e/mh-compat.el @@ -34,29 +34,15 @@ ;; Please use mh-gnus.el when providing compatibility with different ;; versions of Gnus. -;; Items are listed alphabetically (except for mh-require which is -;; needed sooner it would normally appear). +;; Items are listed alphabetically. (eval-when-compile (require 'mh-acros)) (mh-do-in-gnu-emacs - (defalias 'mh-require #'require)) - -(defun-mh mh-assoc-string assoc-string (key list case-fold) - "Like `assoc' but specifically for strings. -Case is ignored if CASE-FOLD is non-nil. -This function is used by Emacs versions that lack `assoc-string', -introduced in Emacs 22." - ;; Test for fboundp is solely to silence compiler for Emacs >= 22.1. - (if (and case-fold (fboundp 'assoc-ignore-case)) - (assoc-ignore-case key list) - (assoc key list))) - -;; For XEmacs. -(defalias 'mh-cancel-timer - (if (fboundp 'cancel-timer) - 'cancel-timer - 'delete-itimer)) + (define-obsolete-function-alias 'mh-require #'require "29.1")) + +(define-obsolete-function-alias 'mh-assoc-string #'assoc-string "29.1") +(define-obsolete-function-alias 'mh-cancel-timer #'cancel-timer "29.1") ;; Emacs 24 made flet obsolete and suggested either cl-flet or ;; cl-letf. This macro is based upon gmm-flet from Gnus. @@ -75,17 +61,8 @@ the function cell of FUNCs rather than their value cell. ,@body) `(flet ,bindings ,@body))) -(defun mh-display-color-cells (&optional display) - "Return the number of color cells supported by DISPLAY. -This function is used by XEmacs to return 2 when `device-color-cells' -or `display-color-cells' returns nil. This happens when compiling or -running on a tty and causes errors since `display-color-cells' is -expected to return an integer." - (cond ((fboundp 'display-color-cells) ; GNU Emacs, XEmacs 21.5b28 - (or (display-color-cells display) 2)) - ((fboundp 'device-color-cells) ; XEmacs 21.4 - (or (device-color-cells display) 2)) - (t 2))) +(define-obsolete-function-alias 'mh-display-color-cells + #'display-color-cells "29.1") (defmacro mh-display-completion-list (completions &optional common-substring) "Display the list of COMPLETIONS. @@ -103,201 +80,46 @@ the completions." (t ; Emacs 22 `(display-completion-list ,completions ,common-substring)))) -(defmacro mh-face-foreground (face &optional frame inherit) - "Return the foreground color name of FACE, or nil if unspecified. -See documentation for `face-foreground' for a description of the -arguments FACE, FRAME, and perhaps INHERIT. -This macro is used by Emacs versions that lack an INHERIT argument, -introduced in Emacs 22." - (if (< emacs-major-version 22) - `(face-foreground ,face ,frame) - `(face-foreground ,face ,frame ,inherit))) - -(defmacro mh-face-background (face &optional frame inherit) - "Return the background color name of face, or nil if unspecified. -See documentation for `face-background' for a description of the -arguments FACE, FRAME, and INHERIT. -This macro is used by Emacs versions that lack an INHERIT argument, -introduced in Emacs 22." - (if (< emacs-major-version 22) - `(face-background ,face ,frame) - `(face-background ,face ,frame ,inherit))) - -(defun-mh mh-font-lock-add-keywords font-lock-add-keywords - (_mode _keywords &optional _how) - "XEmacs does not have `font-lock-add-keywords'. -This function returns nil on that system.") - -(defun-mh mh-image-load-path-for-library - image-load-path-for-library (library image &optional path no-error) - "Return a suitable search path for images used by LIBRARY. - -It searches for IMAGE in `image-load-path' (excluding -\"`data-directory'/images\") and `load-path', followed by a path -suitable for LIBRARY, which includes \"../../etc/images\" and -\"../etc/images\" relative to the library file itself, and then -in \"`data-directory'/images\". - -Then this function returns a list of directories which contains -first the directory in which IMAGE was found, followed by the -value of `load-path'. If PATH is given, it is used instead of -`load-path'. - -If NO-ERROR is non-nil and a suitable path can't be found, don't -signal an error. Instead, return a list of directories as before, -except that nil appears in place of the image directory. - -Here is an example that uses a common idiom to provide -compatibility with versions of Emacs that lack the variable -`image-load-path': - - ;; Shush compiler. - (defvar image-load-path) - - (let* ((load-path (image-load-path-for-library \"mh-e\" \"mh-logo.xpm\")) - (image-load-path (cons (car load-path) - (when (boundp \\='image-load-path) - image-load-path)))) - (mh-tool-bar-folder-buttons-init))" - (unless library (error "No library specified")) - (unless image (error "No image specified")) - (let (image-directory image-directory-load-path) - ;; Check for images in image-load-path or load-path. - (let ((img image) - (dir (or - ;; Images in image-load-path. - (mh-image-search-load-path image) - ;; Images in load-path. - (locate-library image))) - parent) - ;; Since the image might be in a nested directory (for - ;; example, mail/attach.pbm), adjust `image-directory' - ;; accordingly. - (when dir - (setq dir (file-name-directory dir)) - (while (setq parent (file-name-directory img)) - (setq img (directory-file-name parent) - dir (expand-file-name "../" dir)))) - (setq image-directory-load-path dir)) - - ;; If `image-directory-load-path' isn't Emacs's image directory, - ;; it's probably a user preference, so use it. Then use a - ;; relative setting if possible; otherwise, use - ;; `image-directory-load-path'. - (cond - ;; User-modified image-load-path? - ((and image-directory-load-path - (not (equal image-directory-load-path - (file-name-as-directory - (expand-file-name "images" data-directory))))) - (setq image-directory image-directory-load-path)) - ;; Try relative setting. - ((let (library-name d1ei d2ei) - ;; First, find library in the load-path. - (setq library-name (locate-library library)) - (if (not library-name) - (error "Cannot find library %s in load-path" library)) - ;; And then set image-directory relative to that. - (setq - ;; Go down 2 levels. - d2ei (file-name-as-directory - (expand-file-name - (concat (file-name-directory library-name) "../../etc/images"))) - ;; Go down 1 level. - d1ei (file-name-as-directory - (expand-file-name - (concat (file-name-directory library-name) "../etc/images")))) - (setq image-directory - ;; Set it to nil if image is not found. - (cond ((file-exists-p (expand-file-name image d2ei)) d2ei) - ((file-exists-p (expand-file-name image d1ei)) d1ei))))) - ;; Use Emacs's image directory. - (image-directory-load-path - (setq image-directory image-directory-load-path)) - (no-error - (message "Could not find image %s for library %s" image library)) - (t - (error "Could not find image %s for library %s" image library))) - - ;; Return an augmented `path' or `load-path'. - (nconc (list image-directory) - (delete image-directory (copy-sequence (or path load-path)))))) - -(defun-mh mh-image-search-load-path - image-search-load-path (_file &optional _path) - "Emacs 21 and XEmacs don't have `image-search-load-path'. -This function returns nil on those systems." - nil) - -;; For XEmacs. -(defalias 'mh-line-beginning-position - (if (fboundp 'line-beginning-position) - 'line-beginning-position - 'point-at-bol)) - -;; For XEmacs. -(defalias 'mh-line-end-position - (if (fboundp 'line-end-position) - 'line-end-position - 'point-at-eol)) - -(mh-require 'mailabbrev nil t) -(defun-mh mh-mail-abbrev-make-syntax-table - mail-abbrev-make-syntax-table () - "Emacs 21 and XEmacs don't have `mail-abbrev-make-syntax-table'. -This function returns nil on those systems." - nil) - -(defmacro mh-define-obsolete-variable-alias - (obsolete-name current-name &optional when docstring) - "Make OBSOLETE-NAME a variable alias for CURRENT-NAME and mark it obsolete. -See documentation for `define-obsolete-variable-alias' for a description -of the arguments OBSOLETE-NAME, CURRENT-NAME, and perhaps WHEN -and DOCSTRING. This macro is used by XEmacs that lacks WHEN and -DOCSTRING arguments." - (if (featurep 'xemacs) - `(define-obsolete-variable-alias ,obsolete-name ,current-name) - `(define-obsolete-variable-alias ,obsolete-name ,current-name ,when ,docstring))) - -(defmacro mh-make-obsolete-variable (obsolete-name current-name &optional when access-type) - "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. -See documentation for `make-obsolete-variable' for a description -of the arguments OBSOLETE-NAME, CURRENT-NAME, and perhaps WHEN -and ACCESS-TYPE. This macro is used by XEmacs that lacks WHEN and -ACCESS-TYPE arguments and by Emacs versions that lack ACCESS-TYPE, -introduced in Emacs 24." - (if (featurep 'xemacs) - `(make-obsolete-variable ,obsolete-name ,current-name) - (if (< emacs-major-version 24) - `(make-obsolete-variable ,obsolete-name ,current-name ,when) - `(make-obsolete-variable ,obsolete-name ,current-name ,when ,access-type)))) - -(defun-mh mh-match-string-no-properties - match-string-no-properties (num &optional _string) - "Return string of text matched by last search, without text properties. -This function is used by XEmacs that lacks `match-string-no-properties'. -The function `buffer-substring-no-properties' is used instead. -The argument STRING is ignored." - (buffer-substring-no-properties - (match-beginning num) (match-end num))) - -(defun-mh mh-replace-regexp-in-string replace-regexp-in-string - (regexp rep string &optional _fixedcase literal _subexp _start) - "Replace REGEXP with REP everywhere in STRING and return result. -This function is used by XEmacs that lacks `replace-regexp-in-string'. -The function `replace-in-string' is used instead. -The arguments FIXEDCASE, SUBEXP, and START, used by -`replace-in-string' are ignored." - (if (featurep 'xemacs) ; silence Emacs compiler - (replace-in-string string regexp rep literal))) - -(defun-mh mh-test-completion - test-completion (_string _collection &optional _predicate) - "Return non-nil if STRING is a valid completion. -XEmacs does not have `test-completion'. This function returns nil -on that system." nil) - -;; Copy of constant from url-util.el in Emacs 22; needed by Emacs 21. +(define-obsolete-function-alias 'mh-face-foreground + #'face-foreground "29.1") + +(define-obsolete-function-alias 'mh-face-background + #'face-background "29.1") + +(define-obsolete-function-alias 'mh-font-lock-add-keywords + #'font-lock-add-keywords "29.1") + +(define-obsolete-function-alias 'mh-image-load-path-for-library + #'image-load-path-for-library "29.1") + +(define-obsolete-function-alias 'mh-image-search-load-path + #'image-search-load-path "29.1") + +(define-obsolete-function-alias 'mh-line-beginning-position + #'line-beginning-position "29.1") + +(define-obsolete-function-alias 'mh-line-end-position + #'line-end-position "29.1") + +(require 'mailabbrev nil t) +(define-obsolete-function-alias 'mh-mail-abbrev-make-syntax-table + #'mail-abbrev-make-syntax-table "29.1") + +(define-obsolete-function-alias 'mh-define-obsolete-variable-alias + #'define-obsolete-variable-alias "29.1") + +(define-obsolete-function-alias 'mh-make-obsolete-variable + #'make-obsolete-variable "29.1") + +(define-obsolete-function-alias 'mh-match-string-no-properties + #'match-string-no-properties "29.1") + +(define-obsolete-function-alias 'mh-replace-regexp-in-string + #'replace-regexp-in-string "29.1") + +(define-obsolete-function-alias 'mh-test-completion + #'test-completion "29.1") + (defconst mh-url-unreserved-chars '( ?a ?b ?c ?d ?e ?f ?g ?h ?i ?j ?k ?l ?m ?n ?o ?p ?q ?r ?s ?t ?u ?v ?w ?x ?y ?z @@ -306,51 +128,21 @@ on that system." nil) ?- ?_ ?. ?! ?~ ?* ?' ?\( ?\)) "A list of characters that are _NOT_ reserved in the URL spec. This is taken from RFC 2396.") +(make-obsolete-variable 'mh-url-unreserved-chars 'url-unreserved-chars "29.1") + +(define-obsolete-function-alias 'mh-url-hexify-string + #'url-hexify-string "29.1") + +(define-obsolete-function-alias 'mh-view-mode-enter + #'view-mode-enter "29.1") -(defun-mh mh-url-hexify-string url-hexify-string (str) - "Escape characters in a string. -This is a copy of `url-hexify-string' from url-util.el in Emacs -22; needed by Emacs 21." - (mapconcat - (lambda (char) - ;; Fixme: use a char table instead. - (if (not (memq char mh-url-unreserved-chars)) - (if (> char 255) - (error "Hexifying multibyte character %s" str) - (format "%%%02X" char)) - (char-to-string char))) - str "")) - -(defun-mh mh-view-mode-enter - view-mode-enter (&optional return-to exit-action) - "Enter View mode. -This function is used by XEmacs that lacks `view-mode-enter'. -The function `view-mode' is used instead. -The arguments RETURN-TO and EXIT-ACTION are ignored." - ;; Shush compiler. - (if return-to nil) - (if exit-action nil) - (view-mode 1)) - -(defun-mh mh-window-full-height-p - window-full-height-p (&optional _window) - "Return non-nil if WINDOW is not the result of a vertical split. -This function is defined in XEmacs as it lacks -`window-full-height-p'. The values of the functions -`window-height' and `frame-height' are compared instead. The -argument WINDOW is ignored." - (= (1+ (window-height)) - (frame-height))) +(define-obsolete-function-alias 'mh-window-full-height-p + #'window-full-height-p "29.1") (defmacro mh-write-file-functions () - "Return `write-file-functions' if it exists. -Otherwise return `local-write-file-hooks'. -This macro exists purely for compatibility. The former symbol is used -in Emacs 22 onward while the latter is used in previous versions and -XEmacs." - (if (boundp 'write-file-functions) - ''write-file-functions ;Emacs 22 on - ''local-write-file-hooks)) ;XEmacs + "Return `write-file-functions'. " + (declare (obsolete nil "29.1")) + ''write-file-functions) (provide 'mh-compat) diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el index d929a329c9..09f62466b3 100644 --- a/lisp/mh-e/mh-e.el +++ b/lisp/mh-e/mh-e.el @@ -88,7 +88,7 @@ (require 'mh-buffers) (require 'mh-compat) -(mh-font-lock-add-keywords +(font-lock-add-keywords 'emacs-lisp-mode (eval-when-compile `((,(concat "(\\(" @@ -483,7 +483,7 @@ all the strings have been used." (count 0)) (while (and (not (eobp)) (< count mh-index-max-cmdline-args)) (push (buffer-substring-no-properties (point) - (mh-line-end-position)) + (line-end-position)) arg-list) (cl-incf count) (forward-line)) @@ -3239,7 +3239,7 @@ function used to insert the signature with :group 'mh-letter :package-version '(MH-E . "8.0")) -(mh-define-obsolete-variable-alias 'mh-kill-folder-suppress-prompt-hooks +(define-obsolete-variable-alias 'mh-kill-folder-suppress-prompt-hooks 'mh-kill-folder-suppress-prompt-functions "24.3") (defcustom-mh mh-kill-folder-suppress-prompt-functions '(mh-search-p) "Abnormal hook run at the beginning of \\\\[mh-kill-folder]. @@ -3555,7 +3555,7 @@ specified colors." (if mh-min-colors-defined-flag spec - (let ((cells (mh-display-color-cells)) + (let ((cells (display-color-cells)) new-spec) ;; Remove entries with min-colors, or delete them if we have ;; fewer colors than they specify. diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el index c8c6511bbc..289b430d66 100644 --- a/lisp/mh-e/mh-folder.el +++ b/lisp/mh-e/mh-folder.el @@ -512,7 +512,7 @@ font-lock is done highlighting.") nil) ;; Register mh-folder-mode as supporting which-function-mode... -(eval-and-compile (mh-require 'which-func nil t)) +(eval-and-compile (require 'which-func nil t)) (when (and (boundp 'which-func-modes) (listp which-func-modes)) (add-to-list 'which-func-modes 'mh-folder-mode)) @@ -635,8 +635,7 @@ perform the operation on all messages in that region. (setq truncate-lines t) (auto-save-mode -1) (setq buffer-offer-save t) - (mh-make-local-hook (mh-write-file-functions)) - (add-hook (mh-write-file-functions) #'mh-execute-commands nil t) + (add-hook 'write-file-functions #'mh-execute-commands nil t) (make-local-variable 'revert-buffer-function) (make-local-variable 'hl-line-mode) ; avoid pollution (mh-funcall-if-exists hl-line-mode 1) diff --git a/lisp/mh-e/mh-funcs.el b/lisp/mh-e/mh-funcs.el index 4a5e670c1e..0c73aae0d7 100644 --- a/lisp/mh-e/mh-funcs.el +++ b/lisp/mh-e/mh-funcs.el @@ -147,7 +147,7 @@ Display the results only if something went wrong." "-recurse" "-norecurse")) (goto-char (point-min)) - (mh-view-mode-enter) + (view-mode-enter) (setq view-exit-action 'kill-buffer) (message "Listing folders...done"))))) diff --git a/lisp/mh-e/mh-gnus.el b/lisp/mh-e/mh-gnus.el index a3ba859388..d7f88c6bf1 100644 --- a/lisp/mh-e/mh-gnus.el +++ b/lisp/mh-e/mh-gnus.el @@ -29,11 +29,11 @@ (require 'mh-e) (eval-and-compile - (mh-require 'gnus-util nil t) - (mh-require 'mm-bodies nil t) - (mh-require 'mm-decode nil t) - (mh-require 'mm-view nil t) - (mh-require 'mml nil t)) + (require 'gnus-util nil t) + (require 'mm-bodies nil t) + (require 'mm-decode nil t) + (require 'mm-view nil t) + (require 'mml nil t)) ;; Copy of function from gnus-util.el. ;; TODO This is not in Gnus 5.11. diff --git a/lisp/mh-e/mh-identity.el b/lisp/mh-e/mh-identity.el index cd7f089dc1..4e639f1f74 100644 --- a/lisp/mh-e/mh-identity.el +++ b/lisp/mh-e/mh-identity.el @@ -121,7 +121,7 @@ The field name is downcased. If the FIELD begins with the character \":\", then it must have a special handler defined in `mh-identity-handlers', else return an error since it is not a valid header field." - (or (cdr (mh-assoc-string field mh-identity-handlers t)) + (or (cdr (assoc-string field mh-identity-handlers t)) (and (eq (aref field 0) ?:) (error "Field %s not found in `mh-identity-handlers'" field)) (cdr (assoc ":default" mh-identity-handlers)) diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el index ce17df2189..f147b7ce0d 100644 --- a/lisp/mh-e/mh-letter.el +++ b/lisp/mh-e/mh-letter.el @@ -253,7 +253,7 @@ searching for `mh-mail-header-separator' in the buffer." (goto-char (point-min)) (cond ((equal mh-mail-header-separator "") (point-min)) ((search-forward (format "\n%s\n" mh-mail-header-separator) nil t) - (mh-line-beginning-position 0)) + (line-beginning-position 0)) (t (point-min))))) @@ -301,7 +301,7 @@ order). (set (make-local-variable 'mh-mail-header-separator) (save-excursion (goto-char (mh-mail-header-end)) - (buffer-substring-no-properties (point) (mh-line-end-position)))) + (buffer-substring-no-properties (point) (line-end-position)))) (make-local-variable 'mail-header-separator) (setq mail-header-separator mh-mail-header-separator) ;override sendmail.el (mh-set-help mh-letter-mode-help-messages) @@ -826,7 +826,7 @@ body." ((< (point) (progn (beginning-of-line) (re-search-forward mh-letter-header-field-regexp - (mh-line-end-position) t) + (line-end-position) t) (point))) (beginning-of-line)) (t (end-of-line))) diff --git a/lisp/mh-e/mh-limit.el b/lisp/mh-e/mh-limit.el index 39cf7c5d27..a00252284a 100644 --- a/lisp/mh-e/mh-limit.el +++ b/lisp/mh-e/mh-limit.el @@ -124,7 +124,7 @@ Use \\\\[mh-widen] to undo this command." (setq pick-expr (let ((case-fold-search t)) (cl-loop for s in pick-expr - collect (mh-replace-regexp-in-string "re: *" "" s)))) + collect (replace-regexp-in-string "re: *" "" s)))) (mh-narrow-to-header-field 'subject pick-expr)) ;;;###mh-autoload @@ -214,7 +214,7 @@ Return number of messages put in the sequence: (string-equal "" (match-string 3))) (progn (message "No subject line") nil) - (let ((subject (mh-match-string-no-properties 3)) + (let ((subject (match-string-no-properties 3)) (list)) (if (> (length subject) mh-limit-max-subject-size) (setq subject (substring subject 0 mh-limit-max-subject-size))) @@ -222,7 +222,7 @@ Return number of messages put in the sequence: (if all (goto-char (point-min))) (while (re-search-forward mh-scan-subject-regexp nil t) - (let ((this-subject (mh-match-string-no-properties 3))) + (let ((this-subject (match-string-no-properties 3))) (if (> (length this-subject) mh-limit-max-subject-size) (setq this-subject (substring this-subject 0 mh-limit-max-subject-size))) @@ -313,7 +313,7 @@ The MH command pick is used to do the match." (while (not (eobp)) (let ((num (ignore-errors (string-to-number - (buffer-substring (point) (mh-line-end-position)))))) + (buffer-substring (point) (line-end-position)))))) (when num (push num msg-list)) (forward-line)))) (if (null msg-list) diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el index dfd984118b..a34753731c 100644 --- a/lisp/mh-e/mh-mime.el +++ b/lisp/mh-e/mh-mime.el @@ -295,14 +295,14 @@ the attachment labeled with that number." start end) (cond ((and data (not inserted-flag) (not displayed-flag)) (let ((contents (mm-get-part data))) - (add-text-properties (mh-line-beginning-position) - (mh-line-end-position) '(mh-mime-inserted t)) + (add-text-properties (line-beginning-position) + (line-end-position) '(mh-mime-inserted t)) (setq start (point-marker)) (forward-line 1) (mm-insert-inline data contents) (setq end (point-marker)) (add-text-properties - start (progn (goto-char start) (mh-line-end-position)) + start (progn (goto-char start) (line-end-position)) `(mh-region (,start . ,end))))) ((and data (or inserted-flag displayed-flag)) (mh-press-button) @@ -748,8 +748,8 @@ buttons for alternative parts that are usually suppressed." (mh-insert-mime-button handle id (mm-handle-displayed-p handle)) (goto-char point) (when region - (add-text-properties (mh-line-beginning-position) - (mh-line-end-position) + (add-text-properties (line-beginning-position) + (line-end-position) `(mh-region ,region))))))) (defun mh-mime-part-index (handle) @@ -1489,9 +1489,9 @@ This function will quote all such characters." (goto-char (point-min)) (while (re-search-forward "^#" nil t) (beginning-of-line) - (unless (mh-mh-directive-present-p (point) (mh-line-end-position)) + (unless (mh-mh-directive-present-p (point) (line-end-position)) (insert "#")) - (goto-char (mh-line-end-position))))) + (goto-char (line-end-position))))) ;;;###mh-autoload (defun mh-mh-to-mime-undo (noconfirm) @@ -1677,7 +1677,7 @@ buffer, while END defaults to the end of the buffer." (goto-char begin) (while (re-search-forward "^#" end t) (let ((s (buffer-substring-no-properties - (point) (mh-line-end-position)))) + (point) (line-end-position)))) (cond ((equal s "")) ((string-match "^forw[ \t\n]+" s) (cl-return-from search-for-mh-directive t)) diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el index 49a2c00130..e3cd688c59 100644 --- a/lisp/mh-e/mh-search.el +++ b/lisp/mh-e/mh-search.el @@ -353,13 +353,13 @@ configuration and is used when the search folder is dismissed." (goto-char (point-min)) (dotimes (_ 5) (add-text-properties (point) (1+ (point)) '(front-sticky t)) - (add-text-properties (- (mh-line-end-position) 2) - (1- (mh-line-end-position)) + (add-text-properties (- (line-end-position) 2) + (1- (line-end-position)) '(rear-nonsticky t)) - (add-text-properties (point) (1- (mh-line-end-position)) '(read-only t)) + (add-text-properties (point) (1- (line-end-position)) '(read-only t)) (forward-line)) (add-text-properties (point) (1+ (point)) '(front-sticky t)) - (add-text-properties (point) (1- (mh-line-end-position)) '(read-only t)) + (add-text-properties (point) (1- (line-end-position)) '(read-only t)) (goto-char (point-max))) ;; Sequence Searches @@ -519,10 +519,10 @@ group of results." (cond ((and (bolp) (eolp)) (ignore-errors (forward-line -1)) (setq msg (mh-get-msg-num t))) - ((equal (char-after (mh-line-beginning-position)) ?+) + ((equal (char-after (line-beginning-position)) ?+) (setq folder (buffer-substring-no-properties - (mh-line-beginning-position) - (mh-line-end-position)))) + (line-beginning-position) + (line-end-position)))) (t (setq msg (mh-get-msg-num t))))) (when (not folder) (setq folder (car (gethash (gethash msg mh-index-msg-checksum-map) @@ -649,13 +649,13 @@ The cdr of the element is the pattern to search." start begin) (goto-char (point-min)) (while (not (eobp)) - (if (search-forward "--------" (mh-line-end-position) t) + (if (search-forward "--------" (line-end-position) t) (setq in-body-flag t) (beginning-of-line) (setq begin (point)) (setq start (if in-body-flag (point) - (search-forward ":" (mh-line-end-position) t) + (search-forward ":" (line-end-position) t) (point))) (push (cons (and (not in-body-flag) (intern (downcase @@ -663,7 +663,7 @@ The cdr of the element is the pattern to search." begin (1- start))))) (mh-index-parse-search-regexp (buffer-substring-no-properties - start (mh-line-end-position)))) + start (line-end-position)))) pattern-list)) (forward-line)) pattern-list))) @@ -973,8 +973,8 @@ is used to search." (cl-return nil)) (when (equal (char-after (point)) ?#) (cl-return 'error)) - (let* ((start (search-forward " " (mh-line-end-position) t)) - (end (search-forward " " (mh-line-end-position) t))) + (let* ((start (search-forward " " (line-end-position) t)) + (end (search-forward " " (line-end-position) t))) (unless (and start end) (cl-return 'error)) (setq end (1- end)) @@ -1052,7 +1052,7 @@ SEARCH-REGEXP-LIST is used to search." (cl-return 'error)) (let ((start (point)) end msg-start) - (setq end (mh-line-end-position)) + (setq end (line-end-position)) (unless (search-forward mh-mairix-folder end t) (cl-return 'error)) (goto-char (match-beginning 0)) @@ -1193,7 +1193,7 @@ is used to search." (cl-block nil (when (eobp) (cl-return nil)) (let ((file-name (buffer-substring-no-properties - (point) (mh-line-end-position)))) + (point) (line-end-position)))) (unless (equal (string-match mh-namazu-folder file-name) 0) (cl-return 'error)) (unless (file-exists-p file-name) @@ -1241,17 +1241,17 @@ is used to search." (prog1 (cl-block nil (when (eobp) (cl-return nil)) - (when (search-forward-regexp "^\\+" (mh-line-end-position) t) + (when (search-forward-regexp "^\\+" (line-end-position) t) (setq mh-index-pick-folder - (buffer-substring-no-properties (mh-line-beginning-position) - (mh-line-end-position))) + (buffer-substring-no-properties (line-beginning-position) + (line-end-position))) (cl-return 'error)) - (unless (search-forward-regexp "^[1-9][0-9]*$" (mh-line-end-position) t) + (unless (search-forward-regexp "^[1-9][0-9]*$" (line-end-position) t) (cl-return 'error)) (list mh-index-pick-folder (string-to-number - (buffer-substring-no-properties (mh-line-beginning-position) - (mh-line-end-position))) + (buffer-substring-no-properties (line-beginning-position) + (line-end-position))) nil)) (forward-line))) @@ -1328,8 +1328,8 @@ record is invalid return `error'." (cl-block nil (when (eobp) (cl-return nil)) - (let ((eol-pos (mh-line-end-position)) - (bol-pos (mh-line-beginning-position)) + (let ((eol-pos (line-end-position)) + (bol-pos (line-beginning-position)) folder-start msg-end) (goto-char bol-pos) (unless (search-forward mh-user-path eol-pos t) @@ -1411,7 +1411,7 @@ being the list of messages originally from that folder." (when cur-msg (mh-goto-msg cur-msg t t)) (set-buffer-modified-p old-buffer-modified-flag))) -(eval-and-compile (mh-require 'which-func nil t)) +(eval-and-compile (require 'which-func nil t)) ;; Shush compiler. (defvar which-func-mode) ; < Emacs 22, XEmacs @@ -1428,7 +1428,7 @@ being the list of messages originally from that folder." (save-excursion (beginning-of-line) (push (cons (buffer-substring-no-properties - (point) (mh-line-end-position)) + (point) (line-end-position)) (point-marker)) alist))) (setq imenu--index-alist (nreverse alist))))) @@ -1713,7 +1713,7 @@ folder, is removed from `mh-index-data'." "-format" "%{x-mhe-checksum}\n" folder msg) (goto-char (point-min)) (string-equal (buffer-substring-no-properties - (point) (mh-line-end-position)) + (point) (line-end-position)) checksum))) @@ -1822,8 +1822,8 @@ PROC is used to convert the value to actual data." (defun mh-md5sum-parser () "Parse md5sum output." - (let ((begin (mh-line-beginning-position)) - (end (mh-line-end-position)) + (let ((begin (line-beginning-position)) + (end (line-end-position)) first-space last-slash) (setq first-space (search-forward " " end t)) (goto-char end) @@ -1836,8 +1836,8 @@ PROC is used to convert the value to actual data." (defun mh-openssl-parser () "Parse openssl output." - (let ((begin (mh-line-beginning-position)) - (end (mh-line-end-position)) + (let ((begin (line-beginning-position)) + (end (line-end-position)) last-space last-slash) (goto-char end) (setq last-space (search-backward " " begin t)) @@ -1870,7 +1870,7 @@ origin-index) map is updated too." (let (msg checksum) (while (not (eobp)) (setq msg (buffer-substring-no-properties - (point) (mh-line-end-position))) + (point) (line-end-position))) (forward-line) (save-excursion (cond ((not (string-match "^[0-9]*$" msg))) @@ -1881,7 +1881,7 @@ origin-index) map is updated too." (t ;; update maps (setq checksum (buffer-substring-no-properties - (point) (mh-line-end-position))) + (point) (line-end-position))) (let ((msg (string-to-number msg))) (set-buffer folder) (mh-index-update-single-msg msg checksum origin-map))))) diff --git a/lisp/mh-e/mh-seq.el b/lisp/mh-e/mh-seq.el index 69f9224ebe..a7a395acbc 100644 --- a/lisp/mh-e/mh-seq.el +++ b/lisp/mh-e/mh-seq.el @@ -167,7 +167,7 @@ The list appears in a buffer named \"*MH-E Sequences*\"." (insert "\n")) (setq seq-list (cdr seq-list))) (goto-char (point-min)) - (mh-view-mode-enter) + (view-mode-enter) (setq view-exit-action 'kill-buffer) (message "Listing sequences...done"))))) @@ -734,7 +734,7 @@ completion is over." (cl-multiple-value-bind (folder unseen total) (cl-values-list (mh-parse-flist-output-line - (buffer-substring (point) (mh-line-end-position)))) + (buffer-substring (point) (line-end-position)))) (list total unseen folder)))) (defun mh-folder-size-folder (folder) @@ -762,7 +762,7 @@ folders whose names end with a `+' character." (when (search-backward " out of " (point-min) t) (setq total (string-to-number (buffer-substring-no-properties - (match-end 0) (mh-line-end-position)))) + (match-end 0) (line-end-position)))) (when (search-backward " in sequence " (point-min) t) (setq p (point)) (when (search-backward " has " (point-min) t) @@ -940,7 +940,7 @@ font-lock is turned on." ;; the case of user sequences. (mh-notate nil nil mh-cmd-note) (when font-lock-mode - (font-lock-fontify-region (point) (mh-line-end-position)))) + (font-lock-fontify-region (point) (line-end-position)))) (forward-char (+ mh-cmd-note mh-scan-field-destination-offset)) (let ((stack (gethash msg mh-sequence-notation-history))) (setf (gethash msg mh-sequence-notation-history) diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el index eb073ce15b..781f63e506 100644 --- a/lisp/mh-e/mh-show.el +++ b/lisp/mh-e/mh-show.el @@ -144,7 +144,7 @@ displayed." (if (not clean-message-header) (mh-start-of-uncleaned-message))) (mh-display-msg msg folder))) - (unless (mh-window-full-height-p) ; not vertically split + (unless (window-full-height-p) ; not vertically split (shrink-window (- (window-height) (or mh-summary-height (mh-summary-height))))) (mh-recenter nil) @@ -857,7 +857,6 @@ See also `mh-folder-mode'. (t (setq font-lock-defaults '(mh-show-font-lock-keywords t)))) (when mh-decode-mime-flag - (mh-make-local-hook 'kill-buffer-hook) (add-hook 'kill-buffer-hook #'mh-mime-cleanup nil t)) (make-local-variable 'mh-show-folder-buffer) (buffer-disable-undo) diff --git a/lisp/mh-e/mh-speed.el b/lisp/mh-e/mh-speed.el index 712d676984..a019c28b88 100644 --- a/lisp/mh-e/mh-speed.el +++ b/lisp/mh-e/mh-speed.el @@ -63,13 +63,13 @@ '("--" ["Visit Folder" mh-speed-view (with-current-buffer speedbar-buffer - (get-text-property (mh-line-beginning-position) 'mh-folder))] + (get-text-property (line-beginning-position) 'mh-folder))] ["Expand Nested Folders" mh-speed-expand-folder - (and (get-text-property (mh-line-beginning-position) 'mh-children-p) - (not (get-text-property (mh-line-beginning-position) 'mh-expanded)))] + (and (get-text-property (line-beginning-position) 'mh-children-p) + (not (get-text-property (line-beginning-position) 'mh-expanded)))] ["Contract Nested Folders" mh-speed-contract-folder - (and (get-text-property (mh-line-beginning-position) 'mh-children-p) - (get-text-property (mh-line-beginning-position) 'mh-expanded))] + (and (get-text-property (line-beginning-position) 'mh-children-p) + (get-text-property (line-beginning-position) 'mh-expanded))] ["Refresh Speedbar" mh-speed-refresh t]) "Extra menu items for speedbar.") @@ -150,7 +150,7 @@ The optional arguments from speedbar are IGNORED." (forward-line -1) (speedbar-change-expand-button-char ?+) (add-text-properties - (mh-line-beginning-position) (1+ (line-beginning-position)) + (line-beginning-position) (1+ (line-beginning-position)) '(mh-expanded nil))) (t (forward-line) @@ -158,14 +158,14 @@ The optional arguments from speedbar are IGNORED." (goto-char point) (speedbar-change-expand-button-char ?-) (add-text-properties - (mh-line-beginning-position) (1+ (line-beginning-position)) + (line-beginning-position) (1+ (line-beginning-position)) '(mh-expanded t))))))) (defun mh-speed-view (&rest _ignored) "Visits the selected folder just as if you had used \\\\[mh-visit-folder]. The optional arguments from speedbar are IGNORED." (interactive) - (let* ((folder (get-text-property (mh-line-beginning-position) 'mh-folder)) + (let* ((folder (get-text-property (line-beginning-position) 'mh-folder)) (range (and (stringp folder) (mh-read-range "Scan" folder t nil nil mh-interpret-number-as-range-flag)))) @@ -191,9 +191,9 @@ created." (forward-line -1) (setf (gethash nil mh-speed-folder-map) (set-marker (or (gethash nil mh-speed-folder-map) (make-marker)) - (1+ (mh-line-beginning-position)))) + (1+ (line-beginning-position)))) (add-text-properties - (mh-line-beginning-position) (1+ (line-beginning-position)) + (line-beginning-position) (1+ (line-beginning-position)) '(mh-folder nil mh-expanded nil mh-children-p t mh-level 0)) (mh-speed-stealth-update t) (when (> mh-speed-update-interval 0) @@ -260,12 +260,12 @@ The update is always carried out if FORCE is non-nil." (speedbar-with-writable (goto-char (gethash folder mh-speed-folder-map (point))) (beginning-of-line) - (if (re-search-forward "([1-9][0-9]*/[0-9]+)" (mh-line-end-position) t) + (if (re-search-forward "([1-9][0-9]*/[0-9]+)" (line-end-position) t) (setq face (mh-speed-bold-face face)) (setq face (mh-speed-normal-face face))) (beginning-of-line) - (when (re-search-forward "\\[.\\] " (mh-line-end-position) t) - (put-text-property (point) (mh-line-end-position) 'face face))))) + (when (re-search-forward "\\[.\\] " (line-end-position) t) + (put-text-property (point) (line-end-position) 'face face))))) (defun mh-speed-normal-face (face) "Return normal face for given FACE." @@ -305,7 +305,7 @@ The function will expand out parent folders of FOLDER if needed." (while suffix-list ;; We always need at least one toggle. We need two if the directory list ;; is stale since a folder was added. - (when (equal prefix (get-text-property (mh-line-beginning-position) + (when (equal prefix (get-text-property (line-beginning-position) 'mh-folder)) (mh-speed-toggle) (unless (get-text-property (point) 'mh-expanded) @@ -359,9 +359,9 @@ uses." (setf (gethash folder-name mh-speed-folder-map) (set-marker (or (gethash folder-name mh-speed-folder-map) (make-marker)) - (1+ (mh-line-beginning-position)))) + (1+ (line-beginning-position)))) (add-text-properties - (mh-line-beginning-position) (1+ (mh-line-beginning-position)) + (line-beginning-position) (1+ (line-beginning-position)) `(mh-folder ,folder-name mh-expanded nil mh-children-p ,(not (not (cdr f))) @@ -391,7 +391,7 @@ flists is run only for that one folder." (interactive (list t)) (when force (when mh-speed-flists-timer - (mh-cancel-timer mh-speed-flists-timer) + (cancel-timer mh-speed-flists-timer) (setq mh-speed-flists-timer nil)) (when (and (processp mh-speed-flists-process) (not (eq (process-status mh-speed-flists-process) 'exit))) @@ -462,25 +462,25 @@ be handled next." face) (when pos (goto-char pos) - (goto-char (mh-line-beginning-position)) + (goto-char (line-beginning-position)) (cond ((null (get-text-property (point) 'mh-count)) - (goto-char (mh-line-end-position)) + (goto-char (line-end-position)) (setq face (get-text-property (1- (point)) 'face)) (insert (format " (%s/%s)" unseen total)) (mh-speed-highlight 'unknown face) - (goto-char (mh-line-beginning-position)) + (goto-char (line-beginning-position)) (add-text-properties (point) (1+ (point)) `(mh-count (,unseen . ,total)))) ((not (equal (get-text-property (point) 'mh-count) (cons unseen total))) - (goto-char (mh-line-end-position)) + (goto-char (line-end-position)) (setq face (get-text-property (1- (point)) 'face)) - (re-search-backward " " (mh-line-beginning-position) t) - (delete-region (point) (mh-line-end-position)) + (re-search-backward " " (line-beginning-position) t) + (delete-region (point) (line-end-position)) (insert (format " (%s/%s)" unseen total)) (mh-speed-highlight 'unknown face) - (goto-char (mh-line-beginning-position)) + (goto-char (line-beginning-position)) (add-text-properties (point) (1+ (point)) `(mh-count (,unseen . ,total)))))))))))) @@ -509,15 +509,15 @@ be handled next." (caar parent-kids))) (setq parent-change ? )))) (goto-char parent-position) - (when (equal (get-text-property (mh-line-beginning-position) 'mh-folder) + (when (equal (get-text-property (line-beginning-position) 'mh-folder) parent) - (when (get-text-property (mh-line-beginning-position) 'mh-expanded) + (when (get-text-property (line-beginning-position) 'mh-expanded) (mh-speed-toggle)) (when parent-change (speedbar-with-writable (mh-speedbar-change-expand-button-char parent-change) (add-text-properties - (mh-line-beginning-position) (1+ (mh-line-beginning-position)) + (line-beginning-position) (1+ (line-beginning-position)) `(mh-children-p ,(equal parent-change ?+))))) (mh-speed-highlight mh-speed-last-selected-folder 'mh-speedbar-folder) (setq mh-speed-last-selected-folder nil) @@ -531,7 +531,7 @@ be handled next." "Change the expansion button character to CHAR for the current line." (save-excursion (beginning-of-line) - (if (re-search-forward "\\[.\\]" (mh-line-end-position) t) + (if (re-search-forward "\\[.\\]" (line-end-position) t) (speedbar-with-writable (backward-char 2) (delete-char 1) @@ -562,9 +562,9 @@ The function invalidates the latest ancestor that is present." (speedbar-with-writable (mh-speedbar-change-expand-button-char ?+) (add-text-properties - (mh-line-beginning-position) (1+ (mh-line-beginning-position)) + (line-beginning-position) (1+ (line-beginning-position)) '(mh-children-p t))) - (when (get-text-property (mh-line-beginning-position) 'mh-expanded) + (when (get-text-property (line-beginning-position) 'mh-expanded) (mh-speed-toggle)) (setq mh-speed-refresh-flag t)))) diff --git a/lisp/mh-e/mh-thread.el b/lisp/mh-e/mh-thread.el index 89b0dbd979..a4b4151bcf 100644 --- a/lisp/mh-e/mh-thread.el +++ b/lisp/mh-e/mh-thread.el @@ -294,7 +294,7 @@ at the end." (while (not (eobp)) (forward-char address-start-offset) (unless (equal (string-match spaces (buffer-substring-no-properties - (point) (mh-line-end-position))) + (point) (line-end-position))) 0) (beginning-of-line) (backward-char) @@ -455,8 +455,8 @@ If optional argument STRING is given then that is assumed to be the scan line. Otherwise uses the line at point as the scan line to parse." (let* ((string (or string (buffer-substring-no-properties - (mh-line-beginning-position) - (mh-line-end-position)))) + (line-beginning-position) + (line-end-position)))) (address-start (+ mh-cmd-note mh-scan-field-from-start-offset)) (body-start (+ mh-cmd-note mh-scan-field-from-end-offset)) (first-string (substring string 0 address-start))) @@ -597,20 +597,20 @@ Only information about messages in MSG-LIST are added to the tree." (while (not (eobp)) (cl-block process-message (let* ((index-line - (prog1 (buffer-substring (point) (mh-line-end-position)) + (prog1 (buffer-substring (point) (line-end-position)) (forward-line))) (index (string-to-number index-line)) - (id (prog1 (buffer-substring (point) (mh-line-end-position)) + (id (prog1 (buffer-substring (point) (line-end-position)) (forward-line))) (refs (prog1 - (buffer-substring (point) (mh-line-end-position)) + (buffer-substring (point) (line-end-position)) (forward-line))) (in-reply-to (prog1 (buffer-substring (point) - (mh-line-end-position)) + (line-end-position)) (forward-line))) (subject (prog1 (buffer-substring - (point) (mh-line-end-position)) + (point) (line-end-position)) (forward-line))) (subject-re-p nil)) (unless (gethash index mh-thread-scan-line-map) diff --git a/lisp/mh-e/mh-tool-bar.el b/lisp/mh-e/mh-tool-bar.el index 4e795d9600..e4cd01c222 100644 --- a/lisp/mh-e/mh-tool-bar.el +++ b/lisp/mh-e/mh-tool-bar.el @@ -216,8 +216,8 @@ where, ;; Tool bar initialization functions (defun mh-tool-bar-folder-buttons-init () (when (mh-buffer-exists-p 'mh-folder-mode) - (let* ((load-path (mh-image-load-path-for-library "mh-e" - "mh-logo.xpm")) + (let* ((load-path (image-load-path-for-library "mh-e" + "mh-logo.xpm")) (image-load-path (cons (car load-path) (when (boundp 'image-load-path) image-load-path)))) @@ -239,8 +239,8 @@ where, tool-bar-map))))) (defun mh-tool-bar-letter-buttons-init () (when (mh-buffer-exists-p 'mh-letter-mode) - (let* ((load-path (mh-image-load-path-for-library "mh-e" - "mh-logo.xpm")) + (let* ((load-path (image-load-path-for-library "mh-e" + "mh-logo.xpm")) (image-load-path (cons (car load-path) (when (boundp 'image-load-path) image-load-path)))) diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index 49302e1687..65286bdccc 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el @@ -52,7 +52,7 @@ used in lieu of `search' in the CL package." (let ((syntax-table (syntax-table))) (unwind-protect (save-excursion - (mh-mail-abbrev-make-syntax-table) + (mail-abbrev-make-syntax-table) (set-syntax-table mail-abbrev-syntax-table) (backward-word n) (point)) @@ -62,7 +62,7 @@ used in lieu of `search' in the CL package." (defun mh-colors-available-p () "Check if colors are available in the Emacs being used." ;; FIXME: Can this be replaced with `display-color-p'? - (let ((color-cells (mh-display-color-cells))) + (let ((color-cells (display-color-cells))) (and (numberp color-cells) (>= color-cells 8)))) ;;;###mh-autoload @@ -102,7 +102,7 @@ PICK-EXPR is a list of strings. Return nil if PICK-EXPR is nil." (not (string-equal string ""))) (cl-loop for i from 0 to (1- (length mh-pick-regexp-chars)) do (let ((s (string ?\\ (aref mh-pick-regexp-chars i)))) - (setq string (mh-replace-regexp-in-string s s string t t)))) + (setq string (replace-regexp-in-string s s string t t)))) (setq quoted-pick-expr (append quoted-pick-expr (list string))))) quoted-pick-expr)) @@ -128,7 +128,7 @@ Ignores case when searching for OLD." (defun mh-logo-display () "Modify mode line to display MH-E logo." (mh-do-in-gnu-emacs - (let* ((load-path (mh-image-load-path-for-library "mh-e" "mh-logo.xpm")) + (let* ((load-path (image-load-path-for-library "mh-e" "mh-logo.xpm")) (image-load-path (cons (car load-path) (when (boundp 'image-load-path) image-load-path)))) @@ -502,8 +502,8 @@ they will not be returned." ;; folder is specified, ensure it is nil to avoid adding the ;; folder to the folder-list and adding a slash to it. (when folder - (setq folder (mh-replace-regexp-in-string "^\\+" "" folder)) - (setq folder (mh-replace-regexp-in-string "/+$" "" folder)) + (setq folder (replace-regexp-in-string "^\\+" "" folder)) + (setq folder (replace-regexp-in-string "/+$" "" folder)) (if (equal folder "") (setq folder nil))) ;; Add provided folder to list, unless all folders are asked for. @@ -566,10 +566,10 @@ Expects FOLDER to have already been normalized with (apply #'call-process arg-list) (goto-char (point-min)) (while (not (and (eolp) (bolp))) - (goto-char (mh-line-end-position)) - (let ((start-pos (mh-line-beginning-position)) + (goto-char (line-end-position)) + (let ((start-pos (line-beginning-position)) (has-pos (search-backward " has " - (mh-line-beginning-position) t))) + (line-beginning-position) t))) (when (integerp has-pos) (while (equal (char-after has-pos) ? ) (cl-decf has-pos)) @@ -584,7 +584,7 @@ Expects FOLDER to have already been normalized with (setq name (substring name 0 (1- (length name))))) (push (cons name - (search-forward "(others)" (mh-line-end-position) t)) + (search-forward "(others)" (line-end-position) t)) results)))) (forward-line 1)))) (setq results (nreverse results)) @@ -948,9 +948,9 @@ is hidden, if positive then the field is displayed." (and (numberp arg) (>= arg 0)) (and (eq arg 'long) - (> (mh-line-beginning-position 5) end))) + (> (line-beginning-position 5) end))) (remove-text-properties begin end '(invisible nil)) - (search-forward ":" (mh-line-end-position) t) + (search-forward ":" (line-end-position) t) (mh-letter-skip-leading-whitespace-in-header-field)) ;; XXX Redesign to make usable by user. Perhaps use a positive ;; numeric prefix to make that many lines visible. diff --git a/lisp/mh-e/mh-xface.el b/lisp/mh-e/mh-xface.el index 9d3f0f4a62..d4c5481976 100644 --- a/lisp/mh-e/mh-xface.el +++ b/lisp/mh-e/mh-xface.el @@ -74,7 +74,6 @@ in this order is used." (when type (goto-char (point-min)) (when (re-search-forward "^from:" (point-max) t) - ;; GNU Emacs (mh-do-in-gnu-emacs (if (eq type 'url) (mh-x-image-url-display url) @@ -82,9 +81,9 @@ in this order is used." insert-image (create-image raw type t :foreground - (mh-face-foreground 'mh-show-xface nil t) + (face-foreground 'mh-show-xface nil t) :background - (mh-face-background 'mh-show-xface nil t)) + (face-background 'mh-show-xface nil t)) " ")))))))) (defun mh-face-to-png (data) @@ -324,14 +323,14 @@ This is only done if `mh-x-image-cache-directory' is nil." (defun mh-x-image-url-cache-canonicalize (url) "Canonicalize URL. Replace the ?/ character with a ?! character and append .png. -Also replaces special characters with `mh-url-hexify-string' +Also replaces special characters with `url-hexify-string' since not all characters, such as :, are valid within Windows filenames. In addition, replaces * with %2a. See URL `https://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/ifaces/iitemnamelimits/GetValidCharacters.asp'." (format "%s/%s.png" mh-x-image-cache-directory - (mh-replace-regexp-in-string + (replace-regexp-in-string "\\*" "%2a" - (mh-url-hexify-string + (url-hexify-string (with-temp-buffer (insert url) (mh-replace-string "/" "!") commit 89d64fca75557b3006532412d8c84885d5a6a873 Author: Paul Eggert Date: Thu Oct 7 13:09:19 2021 -0700 Pacify GCC 10.3 -Wmaybe-uninitialized Problem reported by Basil L. Contovounesios (Bug#51075). * src/term.c (encode_terminal_code): Add an UNINIT to pacify GCC 10 bug. diff --git a/src/term.c b/src/term.c index 0858f81685..6f0b827cfc 100644 --- a/src/term.c +++ b/src/term.c @@ -550,7 +550,7 @@ encode_terminal_code (struct glyph *src, int src_len, if (src->type == COMPOSITE_GLYPH) { struct composition *cmp; - Lisp_Object gstring; + Lisp_Object gstring UNINIT; int i; nbytes = buf - encode_terminal_src; commit 36d7c4af7c83c4f3ea9ab9fdd0822b986564d78e Author: Lars Ingebrigtsen Date: Thu Oct 7 21:10:34 2021 +0200 Update inhibit-changing-match-data obsoletion data * lisp/subr.el (inhibit-changing-match-data): Link to `save-match-data'. diff --git a/lisp/subr.el b/lisp/subr.el index 4173e9f449..33aa3ced44 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1752,7 +1752,7 @@ be a list of the form returned by `event-start' and `event-end'." (make-obsolete 'window-redisplay-end-trigger nil "23.1") (make-obsolete 'set-window-redisplay-end-trigger nil "23.1") (make-obsolete-variable 'operating-system-release nil "28.1") -(make-obsolete-variable 'inhibit-changing-match-data nil "29.1") +(make-obsolete-variable 'inhibit-changing-match-data 'save-match-data "29.1") (make-obsolete 'run-window-configuration-change-hook nil "27.1") commit 598cd9beebd4043f50a9542535623983afc8f3ad Author: Eli Zaretskii Date: Thu Oct 7 22:01:57 2021 +0300 ; * etc/NEWS: Fix a typo. diff --git a/etc/NEWS b/etc/NEWS index eb65187370..b91a5cbb72 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -119,7 +119,7 @@ Emacs buffers, like indentation and the like. The new ert function --- ** The 'inhibit-changing-match-data' variable is now obsolete. -Instead functions like 'string-match' and 'looking-at' now takes an +Instead, functions like 'string-match' and 'looking-at' now take an optional 'inhibit-modify' argument. --- commit 40c0864f4be4ba5d432e4f01ed365abc97a6b62a Author: Lars Ingebrigtsen Date: Thu Oct 7 20:55:05 2021 +0200 Update Fstring_match calls in comp.c * src/comp.c (Fcomp_el_to_eln_rel_filename, file_in_eln_sys_dir): Update Fstring_match calls. diff --git a/src/comp.c b/src/comp.c index bc1adcf4e2..5b947fc99b 100644 --- a/src/comp.c +++ b/src/comp.c @@ -4123,7 +4123,7 @@ one for the file name and another for its contents, followed by .eln. */) FOR_EACH_TAIL (lds_re_tail) { Lisp_Object match_idx = - Fstring_match (XCAR (lds_re_tail), filename, Qnil); + Fstring_match (XCAR (lds_re_tail), filename, Qnil, Qnil); if (EQ (match_idx, make_fixnum (0))) { filename = @@ -5260,7 +5260,8 @@ file_in_eln_sys_dir (Lisp_Object filename) eln_sys_dir = XCAR (tmp); return !NILP (Fstring_match (Fregexp_quote (Fexpand_file_name (eln_sys_dir, Qnil)), - Fexpand_file_name (filename, Qnil), Qnil)); + Fexpand_file_name (filename, Qnil), + Qnil, Qnil)); } /* Load related routines. */ commit a26824e5cbc454a3614b32d131bbdd74f3c03735 Author: Lars Ingebrigtsen Date: Thu Oct 7 20:46:50 2021 +0200 Make 'inhibit-changing-match-data' obsolete and adjust callers * doc/lispref/searching.texi (Regexp Search): (POSIX Regexps): Document this. * lisp/subr.el (inhibit-changing-match-data): Make obsolete. (looking-at-p): Adjust call. * lisp/vc/vc-hg.el (vc-hg--raw-dirstate-search): (vc-hg--ignore-patterns-ignored-p): (vc-hg--cached-dirstate-search): Don't use `inhibit-changing-match-data'. * src/minibuf.c (Ftry_completion): (Fall_completions): (Ftest_completion): Adjust Fstring_match calls. * src/search.c (looking_at_1): Pass in modify_data. (Flooking_at): Add optional inhibit-modify parameter. (string_match_1): Pass in modify_data. (Fstring_match): (Fposix_looking_at, Fposix_string_match): Add optional inhibit-modify parameter. diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index d27cfb8c0c..f5a42406ae 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -1986,7 +1986,7 @@ feature for matching regular expressions from end to beginning. It's not worth the trouble of implementing that. @end deffn -@defun string-match regexp string &optional start +@defun string-match regexp string &optional start inhibit-modify This function returns the index of the start of the first match for the regular expression @var{regexp} in @var{string}, or @code{nil} if there is no match. If @var{start} is non-@code{nil}, the search starts @@ -2011,8 +2011,10 @@ For example, The index of the first character of the string is 0, the index of the second character is 1, and so on. -If this function finds a match, the index of the first character beyond -the match is available as @code{(match-end 0)}. @xref{Match Data}. +By default, if this function finds a match, the index of the first +character beyond the match is available as @code{(match-end 0)}. +@xref{Match Data}. If @var{inhibit-modify} is non-@code{nil}, the +match data isn't modified. @example @group @@ -2033,16 +2035,18 @@ This predicate function does what @code{string-match} does, but it avoids modifying the match data. @end defun -@defun looking-at regexp +@defun looking-at regexp &optional inhibit-modify This function determines whether the text in the current buffer directly following point matches the regular expression @var{regexp}. ``Directly following'' means precisely that: the search is ``anchored'' and it can succeed only starting with the first character following point. The result is @code{t} if so, @code{nil} otherwise. -This function does not move point, but it does update the match data. -@xref{Match Data}. If you need to test for a match without modifying -the match data, use @code{looking-at-p}, described below. +This function does not move point, but it does update the match data +(if @var{inhibit-modify} is @code{nil} or missing, which is the +default). @xref{Match Data}. As a convenience, instead of using the +@var{inhibit-modify} argument, you can use @code{looking-at-p}, +described below. In this example, point is located directly before the @samp{T}. If it were anywhere else, the result would be @code{nil}. @@ -2149,13 +2153,13 @@ backtracking specified by the POSIX standard for regular expression matching. @end deffn -@defun posix-looking-at regexp +@defun posix-looking-at regexp &optional inhibit-modify This is like @code{looking-at} except that it performs the full backtracking specified by the POSIX standard for regular expression matching. @end defun -@defun posix-string-match regexp string &optional start +@defun posix-string-match regexp string &optional start inhibit-modify This is like @code{string-match} except that it performs the full backtracking specified by the POSIX standard for regular expression matching. diff --git a/etc/NEWS b/etc/NEWS index ab15b1efaf..eb65187370 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -117,6 +117,11 @@ Emacs buffers, like indentation and the like. The new ert function * Incompatible Lisp Changes in Emacs 29.1 +--- +** The 'inhibit-changing-match-data' variable is now obsolete. +Instead functions like 'string-match' and 'looking-at' now takes an +optional 'inhibit-modify' argument. + --- ** 'gnus-define-keys' is now obsolete. Use 'define-keymap' instead. diff --git a/lisp/subr.el b/lisp/subr.el index 9f0fe42f92..4173e9f449 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1752,6 +1752,7 @@ be a list of the form returned by `event-start' and `event-end'." (make-obsolete 'window-redisplay-end-trigger nil "23.1") (make-obsolete 'set-window-redisplay-end-trigger nil "23.1") (make-obsolete-variable 'operating-system-release nil "28.1") +(make-obsolete-variable 'inhibit-changing-match-data nil "29.1") (make-obsolete 'run-window-configuration-change-hook nil "27.1") @@ -4761,14 +4762,12 @@ wherever possible, since it is slow." (defsubst looking-at-p (regexp) "\ Same as `looking-at' except this function does not change the match data." - (let ((inhibit-changing-match-data t)) - (looking-at regexp))) + (looking-at regexp t)) (defsubst string-match-p (regexp string &optional start) "\ Same as `string-match' except this function does not change the match data." - (let ((inhibit-changing-match-data t)) - (string-match regexp string start))) + (string-match regexp string start t)) (defun subregexp-context-p (regexp pos &optional start) "Return non-nil if POS is in a normal subregexp context in REGEXP. diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 0ed9f7c31f..6bec9edbf3 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -672,7 +672,6 @@ Return the byte's value as an integer." (let* ((result nil) (flen (length fname)) (case-fold-search nil) - (inhibit-changing-match-data t) ;; Find a conservative bound for the loop below by using ;; Boyer-Moore on the raw dirstate without parsing it; we ;; know we can't possibly find fname _after_ the last place @@ -976,10 +975,9 @@ REPO must be the directory name of an hg repository." "Test whether the ignore pattern set HGIP says to ignore FILENAME. FILENAME must be the file's true absolute name." (let ((patterns (vc-hg--ignore-patterns-ignore-patterns hgip)) - (inhibit-changing-match-data t) (ignored nil)) (while (and patterns (not ignored)) - (setf ignored (string-match (pop patterns) filename))) + (setf ignored (string-match-p (pop patterns) filename))) ignored)) (defvar vc-hg--cached-ignore-patterns nil @@ -1043,7 +1041,8 @@ Avoids the need to repeatedly scan dirstate on repeated calls to (equal size (pop cache)) (equal ascii-fname (pop cache))) (pop cache) - (let ((result (vc-hg--raw-dirstate-search dirstate ascii-fname))) + (let ((result (save-match-data + (vc-hg--raw-dirstate-search dirstate ascii-fname)))) (setf vc-hg--dirstate-scan-cache (list dirstate mtime size ascii-fname result)) result)))) diff --git a/src/minibuf.c b/src/minibuf.c index 5455a93f69..0dc340e967 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1684,7 +1684,7 @@ is used to further constrain the set of candidates. */) specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil); } - tem = Fstring_match (XCAR (regexps), eltstring, zero); + tem = Fstring_match (XCAR (regexps), eltstring, zero, Qnil); if (NILP (tem)) break; } @@ -1948,7 +1948,7 @@ with a space are ignored unless STRING itself starts with a space. */) specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil); } - tem = Fstring_match (XCAR (regexps), eltstring, zero); + tem = Fstring_match (XCAR (regexps), eltstring, zero, Qnil); if (NILP (tem)) break; } @@ -2163,7 +2163,7 @@ the values STRING, PREDICATE and `lambda'. */) { /* We can test against STRING, because if we got here, then the element is equivalent to it. */ - if (NILP (Fstring_match (XCAR (regexps), string, Qnil))) + if (NILP (Fstring_match (XCAR (regexps), string, Qnil, Qnil))) return unbind_to (count, Qnil); } unbind_to (count, Qnil); diff --git a/src/search.c b/src/search.c index 08f1e9474f..66e77d42b4 100644 --- a/src/search.c +++ b/src/search.c @@ -260,7 +260,7 @@ compile_pattern (Lisp_Object pattern, struct re_registers *regp, static Lisp_Object -looking_at_1 (Lisp_Object string, bool posix) +looking_at_1 (Lisp_Object string, bool posix, bool modify_data) { Lisp_Object val; unsigned char *p1, *p2; @@ -278,11 +278,11 @@ looking_at_1 (Lisp_Object string, bool posix) CHECK_STRING (string); /* Snapshot in case Lisp changes the value. */ - bool preserve_match_data = NILP (Vinhibit_changing_match_data); + bool modify_match_data = NILP (Vinhibit_changing_match_data) && modify_data; struct regexp_cache *cache_entry = compile_pattern ( string, - preserve_match_data ? &search_regs : NULL, + modify_match_data ? &search_regs : NULL, (!NILP (BVAR (current_buffer, case_fold_search)) ? BVAR (current_buffer, case_canon_table) : Qnil), posix, @@ -316,7 +316,7 @@ looking_at_1 (Lisp_Object string, bool posix) re_match_object = Qnil; i = re_match_2 (&cache_entry->buf, (char *) p1, s1, (char *) p2, s2, PT_BYTE - BEGV_BYTE, - preserve_match_data ? &search_regs : NULL, + modify_match_data ? &search_regs : NULL, ZV_BYTE - BEGV_BYTE); if (i == -2) @@ -326,7 +326,7 @@ looking_at_1 (Lisp_Object string, bool posix) } val = (i >= 0 ? Qt : Qnil); - if (preserve_match_data && i >= 0) + if (modify_match_data && i >= 0) { for (i = 0; i < search_regs.num_regs; i++) if (search_regs.start[i] >= 0) @@ -343,35 +343,37 @@ looking_at_1 (Lisp_Object string, bool posix) return unbind_to (count, val); } -DEFUN ("looking-at", Flooking_at, Slooking_at, 1, 1, 0, +DEFUN ("looking-at", Flooking_at, Slooking_at, 1, 2, 0, doc: /* Return t if text after point matches regular expression REGEXP. -This function modifies the match data that `match-beginning', -`match-end' and `match-data' access; save and restore the match -data if you want to preserve them. */) - (Lisp_Object regexp) +By default, this function modifies the match data that +`match-beginning', `match-end' and `match-data' access. If +INHIBIT-MODIFY is non-nil, don't modify the match data. */) + (Lisp_Object regexp, Lisp_Object inhibit_modify) { - return looking_at_1 (regexp, 0); + return looking_at_1 (regexp, 0, NILP (inhibit_modify)); } -DEFUN ("posix-looking-at", Fposix_looking_at, Sposix_looking_at, 1, 1, 0, +DEFUN ("posix-looking-at", Fposix_looking_at, Sposix_looking_at, 1, 2, 0, doc: /* Return t if text after point matches REGEXP according to Posix rules. Find the longest match, in accordance with Posix regular expression rules. -This function modifies the match data that `match-beginning', -`match-end' and `match-data' access; save and restore the match -data if you want to preserve them. */) - (Lisp_Object regexp) + +By default, this function modifies the match data that +`match-beginning', `match-end' and `match-data' access. If +INHIBIT-MODIFY is non-nil, don't modify the match data. */) + (Lisp_Object regexp, Lisp_Object inhibit_modify) { - return looking_at_1 (regexp, 1); + return looking_at_1 (regexp, 1, NILP (inhibit_modify)); } static Lisp_Object string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, - bool posix) + bool posix, bool modify_data) { ptrdiff_t val; struct re_pattern_buffer *bufp; EMACS_INT pos; ptrdiff_t pos_byte, i; + bool modify_match_data = NILP (Vinhibit_changing_match_data) && modify_data; if (running_asynch_code) save_search_regs (); @@ -400,8 +402,7 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, BVAR (current_buffer, case_eqv_table)); bufp = &compile_pattern (regexp, - (NILP (Vinhibit_changing_match_data) - ? &search_regs : NULL), + (modify_match_data ? &search_regs : NULL), (!NILP (BVAR (current_buffer, case_fold_search)) ? BVAR (current_buffer, case_canon_table) : Qnil), posix, @@ -410,18 +411,17 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, val = re_search (bufp, SSDATA (string), SBYTES (string), pos_byte, SBYTES (string) - pos_byte, - (NILP (Vinhibit_changing_match_data) - ? &search_regs : NULL)); + (modify_match_data ? &search_regs : NULL)); /* Set last_thing_searched only when match data is changed. */ - if (NILP (Vinhibit_changing_match_data)) + if (modify_match_data) last_thing_searched = Qt; if (val == -2) matcher_overflow (); if (val < 0) return Qnil; - if (NILP (Vinhibit_changing_match_data)) + if (modify_match_data) for (i = 0; i < search_regs.num_regs; i++) if (search_regs.start[i] >= 0) { @@ -434,32 +434,42 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, return make_fixnum (string_byte_to_char (string, val)); } -DEFUN ("string-match", Fstring_match, Sstring_match, 2, 3, 0, +DEFUN ("string-match", Fstring_match, Sstring_match, 2, 4, 0, doc: /* Return index of start of first match for REGEXP in STRING, or nil. Matching ignores case if `case-fold-search' is non-nil. If third arg START is non-nil, start search at that index in STRING. -For index of first char beyond the match, do (match-end 0). -`match-end' and `match-beginning' also give indices of substrings -matched by parenthesis constructs in the pattern. -You can use the function `match-string' to extract the substrings -matched by the parenthesis constructions in REGEXP. */) - (Lisp_Object regexp, Lisp_Object string, Lisp_Object start) +If INHIBIT-MODIFY is non-nil, match data is not changed. + +If INHIBIT-MODIFY is nil or missing, match data is changed, and +`match-end' and `match-beginning' give indices of substrings matched +by parenthesis constructs in the pattern. You can use the function +`match-string' to extract the substrings matched by the parenthesis +constructions in REGEXP. For index of first char beyond the match, do +(match-end 0). */) + (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, + Lisp_Object inhibit_modify) { - return string_match_1 (regexp, string, start, 0); + return string_match_1 (regexp, string, start, 0, NILP (inhibit_modify)); } -DEFUN ("posix-string-match", Fposix_string_match, Sposix_string_match, 2, 3, 0, +DEFUN ("posix-string-match", Fposix_string_match, Sposix_string_match, 2, 4, 0, doc: /* Return index of start of first match for Posix REGEXP in STRING, or nil. Find the longest match, in accord with Posix regular expression rules. Case is ignored if `case-fold-search' is non-nil in the current buffer. -If third arg START is non-nil, start search at that index in STRING. -For index of first char beyond the match, do (match-end 0). -`match-end' and `match-beginning' also give indices of substrings -matched by parenthesis constructs in the pattern. */) - (Lisp_Object regexp, Lisp_Object string, Lisp_Object start) + +If INHIBIT-MODIFY is non-nil, match data is not changed. + +If INHIBIT-MODIFY is nil or missing, match data is changed, and +`match-end' and `match-beginning' give indices of substrings matched +by parenthesis constructs in the pattern. You can use the function +`match-string' to extract the substrings matched by the parenthesis +constructions in REGEXP. For index of first char beyond the match, do +(match-end 0). */) + (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, + Lisp_Object inhibit_modify) { - return string_match_1 (regexp, string, start, 1); + return string_match_1 (regexp, string, start, 1, NILP (inhibit_modify)); } /* Match REGEXP against STRING using translation table TABLE, commit bb8ef1aa300a54dba1b18215247258143c5a3693 Author: Juri Linkov Date: Thu Oct 7 21:01:04 2021 +0300 * lisp/tab-bar.el (tab-detach, tab-window-detach): New aliases. (tab-bar-mouse-context-menu, tab-bar-duplicate-tab): Use word "clone" in help/doc string. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index b08b744267..ccecdbc044 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -311,7 +311,7 @@ that closes only when clicked on the close button." `(menu-item "Duplicate" (lambda () (interactive) (tab-bar-duplicate-tab nil ,tab-number)) - :help "Duplicate the tab")) + :help "Clone the tab")) (define-key-after menu [detach-tab] `(menu-item "Detach" (lambda () (interactive) (tab-bar-detach-tab @@ -1350,7 +1350,7 @@ If FROM-NUMBER is a tab number, a new tab is created from that tab." (tab-bar-new-tab-to))) (defun tab-bar-duplicate-tab (&optional arg from-number) - "Duplicate the current tab to ARG positions to the right. + "Clone the current tab to ARG positions to the right. ARG and FROM-NUMBER have the same meaning as in `tab-bar-new-tab'." (interactive "P") (let ((tab-bar-new-tab-choice nil) @@ -2243,24 +2243,26 @@ When `switch-to-buffer-obey-display-actions' is non-nil, ;;; Short aliases and keybindings -(defalias 'tab-new 'tab-bar-new-tab) -(defalias 'tab-new-to 'tab-bar-new-tab-to) -(defalias 'tab-duplicate 'tab-bar-duplicate-tab) -(defalias 'tab-close 'tab-bar-close-tab) -(defalias 'tab-close-other 'tab-bar-close-other-tabs) -(defalias 'tab-close-group 'tab-bar-close-group-tabs) -(defalias 'tab-undo 'tab-bar-undo-close-tab) -(defalias 'tab-select 'tab-bar-select-tab) -(defalias 'tab-switch 'tab-bar-switch-to-tab) -(defalias 'tab-next 'tab-bar-switch-to-next-tab) -(defalias 'tab-previous 'tab-bar-switch-to-prev-tab) -(defalias 'tab-last 'tab-bar-switch-to-last-tab) -(defalias 'tab-recent 'tab-bar-switch-to-recent-tab) -(defalias 'tab-move 'tab-bar-move-tab) -(defalias 'tab-move-to 'tab-bar-move-tab-to) -(defalias 'tab-rename 'tab-bar-rename-tab) -(defalias 'tab-group 'tab-bar-change-tab-group) -(defalias 'tab-list 'tab-switcher) +(defalias 'tab-new 'tab-bar-new-tab) +(defalias 'tab-new-to 'tab-bar-new-tab-to) +(defalias 'tab-duplicate 'tab-bar-duplicate-tab) +(defalias 'tab-detach 'tab-bar-detach-tab) +(defalias 'tab-window-detach 'tab-bar-move-window-to-tab) +(defalias 'tab-close 'tab-bar-close-tab) +(defalias 'tab-close-other 'tab-bar-close-other-tabs) +(defalias 'tab-close-group 'tab-bar-close-group-tabs) +(defalias 'tab-undo 'tab-bar-undo-close-tab) +(defalias 'tab-select 'tab-bar-select-tab) +(defalias 'tab-switch 'tab-bar-switch-to-tab) +(defalias 'tab-next 'tab-bar-switch-to-next-tab) +(defalias 'tab-previous 'tab-bar-switch-to-prev-tab) +(defalias 'tab-last 'tab-bar-switch-to-last-tab) +(defalias 'tab-recent 'tab-bar-switch-to-recent-tab) +(defalias 'tab-move 'tab-bar-move-tab) +(defalias 'tab-move-to 'tab-bar-move-tab-to) +(defalias 'tab-rename 'tab-bar-rename-tab) +(defalias 'tab-group 'tab-bar-change-tab-group) +(defalias 'tab-list 'tab-switcher) (define-key tab-prefix-map "n" 'tab-duplicate) (define-key tab-prefix-map "N" 'tab-new-to) commit cb86d1d0def61950a149445cbbde829a30e210c4 Author: Lars Ingebrigtsen Date: Thu Oct 7 18:49:36 2021 +0200 Make gnus-define-keys obsolete * lisp/gnus/gnus-util.el (gnus-define-keys): (gnus-define-keys-1): Make obsolete. diff --git a/etc/NEWS b/etc/NEWS index 7b218aaf6d..ab15b1efaf 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -117,6 +117,10 @@ Emacs buffers, like indentation and the like. The new ert function * Incompatible Lisp Changes in Emacs 29.1 +--- +** 'gnus-define-keys' is now obsolete. +Use 'define-keymap' instead. + --- ** MozRepl has been removed from js.el. MozRepl was removed from Firefox in 2017, so this code doesn't work diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 0163abad4b..a777157f89 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -305,7 +305,7 @@ Symbols are also allowed; their print names are used instead." (defmacro gnus-define-keys (keymap &rest plist) "Define all keys in PLIST in KEYMAP." - (declare (indent 1)) + (declare (obsolete define-keymap "29.1") (indent 1)) `(gnus-define-keys-1 ,(if (symbolp keymap) keymap `',keymap) (quote ,plist))) (defmacro gnus-define-keys-safe (keymap &rest plist) @@ -319,6 +319,7 @@ Symbols are also allowed; their print names are used instead." `(gnus-define-keys-1 ,keymap (quote ,plist))) (defun gnus-define-keys-1 (keymap plist &optional safe) + (declare (obsolete define-keymap "29.1")) (when (null keymap) (error "Can't set keys in a null keymap")) (cond ((symbolp keymap) (error "First arg should be a keymap object")) commit d3a30b67dc798fa713ec5900b12517db321cc7d7 Author: Lars Ingebrigtsen Date: Thu Oct 7 18:45:36 2021 +0200 Convert mh-e to use define-keymap instead of gnus-define-keys * lisp/mh-e/mh-speed.el (mh-folder-speedbar-key-map): * lisp/mh-e/mh-show.el (mh-show-mode-map): * lisp/mh-e/mh-search.el (mh-letter): (mh-search-mode-map): * lisp/mh-e/mh-letter.el (mh-letter-mode-map): * lisp/mh-e/mh-folder.el (mh-folder-mode-map): Convert to use `define-keymap' instead of `gnus-define-keys'. diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el index 5fbaf12ef9..c8c6511bbc 100644 --- a/lisp/mh-e/mh-folder.el +++ b/lisp/mh-e/mh-folder.el @@ -213,137 +213,137 @@ annotation.") (defalias 'mh-alt-visit-folder #'mh-visit-folder) ;; Save the "b" binding for a future `back'. Maybe? -(gnus-define-keys mh-folder-mode-map - " " mh-page-msg - "!" mh-refile-or-write-again - "'" mh-toggle-tick - "," mh-header-display - "." mh-alt-show - ":" mh-show-preferred-alternative - ";" mh-toggle-mh-decode-mime-flag - ">" mh-write-msg-to-file - "?" mh-help - "E" mh-extract-rejected-mail - "M" mh-modify - "\177" mh-previous-page - "\C-d" mh-delete-msg-no-motion - "\t" mh-index-next-folder - [backtab] mh-index-previous-folder - "\M-\t" mh-index-previous-folder - "\e<" mh-first-msg - "\e>" mh-last-msg - "\ed" mh-redistribute - "\r" mh-show - "^" mh-alt-refile-msg - "c" mh-copy-msg - "d" mh-delete-msg - "e" mh-edit-again - "f" mh-forward - "g" mh-goto-msg - "i" mh-inc-folder - "k" mh-delete-subject-or-thread - "m" mh-alt-send - "n" mh-next-undeleted-msg - "\M-n" mh-next-unread-msg - "o" mh-refile-msg - "p" mh-previous-undeleted-msg - "\M-p" mh-previous-unread-msg - "q" mh-quit - "r" mh-reply - "s" mh-send - "t" mh-toggle-showing - "u" mh-undo - "v" mh-index-visit-folder - "x" mh-execute-commands - "|" mh-pipe-msg) - -(gnus-define-keys (mh-folder-map "F" mh-folder-mode-map) - "?" mh-prefix-help - "'" mh-index-ticked-messages - "S" mh-sort-folder - "c" mh-catchup - "f" mh-alt-visit-folder - "k" mh-kill-folder - "l" mh-list-folders - "n" mh-index-new-messages - "o" mh-alt-visit-folder - "p" mh-pack-folder - "q" mh-index-sequenced-messages - "r" mh-rescan-folder - "s" mh-search - "u" mh-undo-folder - "v" mh-visit-folder) - -(define-key mh-folder-mode-map "I" mh-inc-spool-map) - -(gnus-define-keys (mh-junk-map "J" mh-folder-mode-map) - "?" mh-prefix-help - "a" mh-junk-allowlist - "b" mh-junk-blocklist - "w" mh-junk-whitelist) - -(gnus-define-keys (mh-ps-print-map "P" mh-folder-mode-map) - "?" mh-prefix-help - "C" mh-ps-print-toggle-color - "F" mh-ps-print-toggle-faces - "f" mh-ps-print-msg-file - "l" mh-print-msg - "p" mh-ps-print-msg) - -(gnus-define-keys (mh-sequence-map "S" mh-folder-mode-map) - "'" mh-narrow-to-tick - "?" mh-prefix-help - "d" mh-delete-msg-from-seq - "k" mh-delete-seq - "l" mh-list-sequences - "n" mh-narrow-to-seq - "p" mh-put-msg-in-seq - "s" mh-msg-is-in-seq - "w" mh-widen) - -(gnus-define-keys (mh-thread-map "T" mh-folder-mode-map) - "?" mh-prefix-help - "u" mh-thread-ancestor - "p" mh-thread-previous-sibling - "n" mh-thread-next-sibling - "t" mh-toggle-threads - "d" mh-thread-delete - "o" mh-thread-refile) - -(gnus-define-keys (mh-limit-map "/" mh-folder-mode-map) - "'" mh-narrow-to-tick - "?" mh-prefix-help - "c" mh-narrow-to-cc - "g" mh-narrow-to-range - "m" mh-narrow-to-from - "s" mh-narrow-to-subject - "t" mh-narrow-to-to - "w" mh-widen) - -(gnus-define-keys (mh-extract-map "X" mh-folder-mode-map) - "?" mh-prefix-help - "s" mh-store-msg ;shar - "u" mh-store-msg) ;uuencode - -(gnus-define-keys (mh-digest-map "D" mh-folder-mode-map) - " " mh-page-digest - "?" mh-prefix-help - "\177" mh-page-digest-backwards - "b" mh-burst-digest) - -(gnus-define-keys (mh-mime-map "K" mh-folder-mode-map) - "?" mh-prefix-help - "a" mh-mime-save-parts - "e" mh-display-with-external-viewer - "i" mh-folder-inline-mime-part - "o" mh-folder-save-mime-part - "t" mh-toggle-mime-buttons - "v" mh-folder-toggle-mime-part - "\t" mh-next-button - [backtab] mh-prev-button - "\M-\t" mh-prev-button) - -(define-key mh-folder-mode-map [mouse-2] 'mh-show-mouse) +(define-keymap :keymap mh-folder-mode-map + " " #'mh-page-msg + "!" #'mh-refile-or-write-again + "'" #'mh-toggle-tick + "," #'mh-header-display + "." #'mh-alt-show + ":" #'mh-show-preferred-alternative + ";" #'mh-toggle-mh-decode-mime-flag + ">" #'mh-write-msg-to-file + "?" #'mh-help + "E" #'mh-extract-rejected-mail + "M" #'mh-modify + "\177" #'mh-previous-page + "\C-d" #'mh-delete-msg-no-motion + "\t" #'mh-index-next-folder + [backtab] #'mh-index-previous-folder + "\M-\t" #'mh-index-previous-folder + "\e<" #'mh-first-msg + "\e>" #'mh-last-msg + "\ed" #'mh-redistribute + "\r" #'mh-show + "^" #'mh-alt-refile-msg + "c" #'mh-copy-msg + "d" #'mh-delete-msg + "e" #'mh-edit-again + "f" #'mh-forward + "g" #'mh-goto-msg + "i" #'mh-inc-folder + "k" #'mh-delete-subject-or-thread + "m" #'mh-alt-send + "n" #'mh-next-undeleted-msg + "\M-n" #'mh-next-unread-msg + "o" #'mh-refile-msg + "p" #'mh-previous-undeleted-msg + "\M-p" #'mh-previous-unread-msg + "q" #'mh-quit + "r" #'mh-reply + "s" #'mh-send + "t" #'mh-toggle-showing + "u" #'mh-undo + "v" #'mh-index-visit-folder + "x" #'mh-execute-commands + "|" #'mh-pipe-msg + + "F" (define-keymap :prefix 'mh-folder-map + "?" #'mh-prefix-help + "'" #'mh-index-ticked-messages + "S" #'mh-sort-folder + "c" #'mh-catchup + "f" #'mh-alt-visit-folder + "k" #'mh-kill-folder + "l" #'mh-list-folders + "n" #'mh-index-new-messages + "o" #'mh-alt-visit-folder + "p" #'mh-pack-folder + "q" #'mh-index-sequenced-messages + "r" #'mh-rescan-folder + "s" #'mh-search + "u" #'mh-undo-folder + "v" #'mh-visit-folder) + + "I" mh-inc-spool-map + + "J" (define-keymap :prefix 'mh-junk-map + "?" #'mh-prefix-help + "a" #'mh-junk-allowlist + "b" #'mh-junk-blocklist + "w" #'mh-junk-allowlist) + + "P" (define-keymap :prefix 'mh-ps-print-map + "?" #'mh-prefix-help + "C" #'mh-ps-print-toggle-color + "F" #'mh-ps-print-toggle-faces + "f" #'mh-ps-print-msg-file + "l" #'mh-print-msg + "p" #'mh-ps-print-msg) + + "S" (define-keymap :prefix 'mh-sequence-map + "'" #'mh-narrow-to-tick + "?" #'mh-prefix-help + "d" #'mh-delete-msg-from-seq + "k" #'mh-delete-seq + "l" #'mh-list-sequences + "n" #'mh-narrow-to-seq + "p" #'mh-put-msg-in-seq + "s" #'mh-msg-is-in-seq + "w" #'mh-widen) + + "T" (define-keymap :prefix 'mh-thread-map + "?" #'mh-prefix-help + "u" #'mh-thread-ancestor + "p" #'mh-thread-previous-sibling + "n" #'mh-thread-next-sibling + "t" #'mh-toggle-threads + "d" #'mh-thread-delete + "o" #'mh-thread-refile) + + "/" (define-keymap :prefix 'mh-limit-map + "'" #'mh-narrow-to-tick + "?" #'mh-prefix-help + "c" #'mh-narrow-to-cc + "g" #'mh-narrow-to-range + "m" #'mh-narrow-to-from + "s" #'mh-narrow-to-subject + "t" #'mh-narrow-to-to + "w" #'mh-widen) + + "X" (define-keymap :prefix 'mh-extract-map + "?" #'mh-prefix-help + "s" #'mh-store-msg ;shar + "u" #'mh-store-msg) ;uuencode + + "D" (define-keymap :prefix 'mh-digest-map + " " #'mh-page-digest + "?" #'mh-prefix-help + "\177" #'mh-page-digest-backwards + "b" #'mh-burst-digest) + + "K" (define-keymap :prefix 'mh-mime-map + "?" #'mh-prefix-help + "a" #'mh-mime-save-parts + "e" #'mh-display-with-external-viewer + "i" #'mh-folder-inline-mime-part + "o" #'mh-folder-save-mime-part + "t" #'mh-toggle-mime-buttons + "v" #'mh-folder-toggle-mime-part + "\t" #'mh-next-button + [backtab] #'mh-prev-button + "\M-\t" #'mh-prev-button) + + [mouse-2] #'mh-show-mouse) ;; "C-c /" prefix is used in mh-folder-mode by pgp.el and mailcrypt diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el index 493749577b..ce17df2189 100644 --- a/lisp/mh-e/mh-letter.el +++ b/lisp/mh-e/mh-letter.el @@ -114,68 +114,68 @@ ;;; MH-Letter Keys ;; If this changes, modify mh-letter-mode-help-messages accordingly, above. -(gnus-define-keys mh-letter-mode-map - " " mh-letter-complete-or-space - "," mh-letter-confirm-address - "\C-c?" mh-help - "\C-c\C-\\" mh-fully-kill-draft ;if no C-q - "\C-c\C-^" mh-insert-signature ;if no C-s - "\C-c\C-c" mh-send-letter - "\C-c\C-d" mh-insert-identity - "\C-c\C-e" mh-mh-to-mime - "\C-c\C-f\C-a" mh-to-field - "\C-c\C-f\C-b" mh-to-field - "\C-c\C-f\C-c" mh-to-field - "\C-c\C-f\C-d" mh-to-field - "\C-c\C-f\C-f" mh-to-fcc - "\C-c\C-f\C-l" mh-to-field - "\C-c\C-f\C-m" mh-to-field - "\C-c\C-f\C-r" mh-to-field - "\C-c\C-f\C-s" mh-to-field - "\C-c\C-f\C-t" mh-to-field - "\C-c\C-fa" mh-to-field - "\C-c\C-fb" mh-to-field - "\C-c\C-fc" mh-to-field - "\C-c\C-fd" mh-to-field - "\C-c\C-ff" mh-to-fcc - "\C-c\C-fl" mh-to-field - "\C-c\C-fm" mh-to-field - "\C-c\C-fr" mh-to-field - "\C-c\C-fs" mh-to-field - "\C-c\C-ft" mh-to-field - "\C-c\C-i" mh-insert-letter - "\C-c\C-m\C-e" mh-mml-secure-message-encrypt - "\C-c\C-m\C-f" mh-compose-forward - "\C-c\C-m\C-g" mh-mh-compose-anon-ftp - "\C-c\C-m\C-i" mh-compose-insertion - "\C-c\C-m\C-m" mh-mml-to-mime - "\C-c\C-m\C-n" mh-mml-unsecure-message - "\C-c\C-m\C-s" mh-mml-secure-message-sign - "\C-c\C-m\C-t" mh-mh-compose-external-compressed-tar - "\C-c\C-m\C-u" mh-mh-to-mime-undo - "\C-c\C-m\C-x" mh-mh-compose-external-type - "\C-c\C-mee" mh-mml-secure-message-encrypt - "\C-c\C-mes" mh-mml-secure-message-signencrypt - "\C-c\C-mf" mh-compose-forward - "\C-c\C-mg" mh-mh-compose-anon-ftp - "\C-c\C-mi" mh-compose-insertion - "\C-c\C-mm" mh-mml-to-mime - "\C-c\C-mn" mh-mml-unsecure-message - "\C-c\C-mse" mh-mml-secure-message-signencrypt - "\C-c\C-mss" mh-mml-secure-message-sign - "\C-c\C-mt" mh-mh-compose-external-compressed-tar - "\C-c\C-mu" mh-mh-to-mime-undo - "\C-c\C-mx" mh-mh-compose-external-type - "\C-c\C-o" mh-open-line - "\C-c\C-q" mh-fully-kill-draft - "\C-c\C-s" mh-insert-signature - "\C-c\C-t" mh-letter-toggle-header-field-display - "\C-c\C-w" mh-check-whom - "\C-c\C-y" mh-yank-cur-msg - "\C-c\M-d" mh-insert-auto-fields - "\M-\t" mh-letter-complete - "\t" mh-letter-next-header-field-or-indent - [backtab] mh-letter-previous-header-field) +(define-keymap :keymap mh-letter-mode-map + " " #'mh-letter-complete-or-space + "," #'mh-letter-confirm-address + "\C-c?" #'mh-help + "\C-c\C-\\" #'mh-fully-kill-draft ;if no C-q + "\C-c\C-^" #'mh-insert-signature ;if no C-s + "\C-c\C-c" #'mh-send-letter + "\C-c\C-d" #'mh-insert-identity + "\C-c\C-e" #'mh-mh-to-mime + "\C-c\C-f\C-a" #'mh-to-field + "\C-c\C-f\C-b" #'mh-to-field + "\C-c\C-f\C-c" #'mh-to-field + "\C-c\C-f\C-d" #'mh-to-field + "\C-c\C-f\C-f" #'mh-to-fcc + "\C-c\C-f\C-l" #'mh-to-field + "\C-c\C-f\C-m" #'mh-to-field + "\C-c\C-f\C-r" #'mh-to-field + "\C-c\C-f\C-s" #'mh-to-field + "\C-c\C-f\C-t" #'mh-to-field + "\C-c\C-fa" #'mh-to-field + "\C-c\C-fb" #'mh-to-field + "\C-c\C-fc" #'mh-to-field + "\C-c\C-fd" #'mh-to-field + "\C-c\C-ff" #'mh-to-fcc + "\C-c\C-fl" #'mh-to-field + "\C-c\C-fm" #'mh-to-field + "\C-c\C-fr" #'mh-to-field + "\C-c\C-fs" #'mh-to-field + "\C-c\C-ft" #'mh-to-field + "\C-c\C-i" #'mh-insert-letter + "\C-c\C-m\C-e" #'mh-mml-secure-message-encrypt + "\C-c\C-m\C-f" #'mh-compose-forward + "\C-c\C-m\C-g" #'mh-mh-compose-anon-ftp + "\C-c\C-m\C-i" #'mh-compose-insertion + "\C-c\C-m\C-m" #'mh-mml-to-mime + "\C-c\C-m\C-n" #'mh-mml-unsecure-message + "\C-c\C-m\C-s" #'mh-mml-secure-message-sign + "\C-c\C-m\C-t" #'mh-mh-compose-external-compressed-tar + "\C-c\C-m\C-u" #'mh-mh-to-mime-undo + "\C-c\C-m\C-x" #'mh-mh-compose-external-type + "\C-c\C-mee" #'mh-mml-secure-message-encrypt + "\C-c\C-mes" #'mh-mml-secure-message-signencrypt + "\C-c\C-mf" #'mh-compose-forward + "\C-c\C-mg" #'mh-mh-compose-anon-ftp + "\C-c\C-mi" #'mh-compose-insertion + "\C-c\C-mm" #'mh-mml-to-mime + "\C-c\C-mn" #'mh-mml-unsecure-message + "\C-c\C-mse" #'mh-mml-secure-message-signencrypt + "\C-c\C-mss" #'mh-mml-secure-message-sign + "\C-c\C-mt" #'mh-mh-compose-external-compressed-tar + "\C-c\C-mu" #'mh-mh-to-mime-undo + "\C-c\C-mx" #'mh-mh-compose-external-type + "\C-c\C-o" #'mh-open-line + "\C-c\C-q" #'mh-fully-kill-draft + "\C-c\C-s" #'mh-insert-signature + "\C-c\C-t" #'mh-letter-toggle-header-field-display + "\C-c\C-w" #'mh-check-whom + "\C-c\C-y" #'mh-yank-cur-msg + "\C-c\M-d" #'mh-insert-auto-fields + "\M-\t" #'mh-letter-complete + "\t" #'mh-letter-next-header-field-or-indent + [backtab] #'mh-letter-previous-header-field) ;; "C-c /" prefix is used in mh-letter-mode by pgp.el and mailcrypt.el. diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el index d84af791f9..49a2c00130 100644 --- a/lisp/mh-e/mh-search.el +++ b/lisp/mh-e/mh-search.el @@ -42,6 +42,7 @@ ;;; Code: (require 'mh-e) +(require 'mh-letter) (require 'gnus-util) (require 'imenu) @@ -548,20 +549,20 @@ group of results." ;;; MH-Search Keys ;; If this changes, modify mh-search-mode-help-messages accordingly, below. -(gnus-define-keys mh-search-mode-map - "\C-c?" mh-help - "\C-c\C-c" mh-index-do-search - "\C-c\C-p" mh-pick-do-search - "\C-c\C-f\C-b" mh-to-field - "\C-c\C-f\C-c" mh-to-field - "\C-c\C-f\C-m" mh-to-field - "\C-c\C-f\C-s" mh-to-field - "\C-c\C-f\C-t" mh-to-field - "\C-c\C-fb" mh-to-field - "\C-c\C-fc" mh-to-field - "\C-c\C-fm" mh-to-field - "\C-c\C-fs" mh-to-field - "\C-c\C-ft" mh-to-field) +(define-keymap :keymap mh-search-mode-map + "\C-c?" #'mh-help + "\C-c\C-c" #'mh-index-do-search + "\C-c\C-p" #'mh-pick-do-search + "\C-c\C-f\C-b" #'mh-to-field + "\C-c\C-f\C-c" #'mh-to-field + "\C-c\C-f\C-m" #'mh-to-field + "\C-c\C-f\C-s" #'mh-to-field + "\C-c\C-f\C-t" #'mh-to-field + "\C-c\C-fb" #'mh-to-field + "\C-c\C-fc" #'mh-to-field + "\C-c\C-fm" #'mh-to-field + "\C-c\C-fs" #'mh-to-field + "\C-c\C-ft" #'mh-to-field) diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el index 9dfce215e4..eb073ce15b 100644 --- a/lisp/mh-e/mh-show.el +++ b/lisp/mh-e/mh-show.el @@ -562,132 +562,132 @@ still visible.\n") ;;; MH-Show Keys -(gnus-define-keys mh-show-mode-map - " " mh-show-page-msg - "!" mh-show-refile-or-write-again - "'" mh-show-toggle-tick - "," mh-show-header-display - "." mh-show-show - ":" mh-show-show-preferred-alternative - ">" mh-show-write-message-to-file - "?" mh-help - "E" mh-show-extract-rejected-mail - "M" mh-show-modify - "\177" mh-show-previous-page - "\C-d" mh-show-delete-msg-no-motion - "\t" mh-show-next-button - [backtab] mh-show-prev-button - "\M-\t" mh-show-prev-button - "\ed" mh-show-redistribute - "^" mh-show-refile-msg - "c" mh-show-copy-msg - "d" mh-show-delete-msg - "e" mh-show-edit-again - "f" mh-show-forward - "g" mh-show-goto-msg - "i" mh-show-inc-folder - "k" mh-show-delete-subject-or-thread - "m" mh-show-send - "n" mh-show-next-undeleted-msg - "\M-n" mh-show-next-unread-msg - "o" mh-show-refile-msg - "p" mh-show-previous-undeleted-msg - "\M-p" mh-show-previous-unread-msg - "q" mh-show-quit - "r" mh-show-reply - "s" mh-show-send - "t" mh-show-toggle-showing - "u" mh-show-undo - "x" mh-show-execute-commands - "v" mh-show-index-visit-folder - "|" mh-show-pipe-msg) - -(gnus-define-keys (mh-show-folder-map "F" mh-show-mode-map) - "?" mh-prefix-help - "'" mh-index-ticked-messages - "S" mh-show-sort-folder - "c" mh-show-catchup - "f" mh-show-visit-folder - "k" mh-show-kill-folder - "l" mh-show-list-folders - "n" mh-index-new-messages - "o" mh-show-visit-folder - "p" mh-show-pack-folder - "q" mh-show-index-sequenced-messages - "r" mh-show-rescan-folder - "s" mh-search - "t" mh-show-toggle-threads - "u" mh-show-undo-folder - "v" mh-show-visit-folder) - -(gnus-define-keys (mh-show-sequence-map "S" mh-show-mode-map) - "'" mh-show-narrow-to-tick - "?" mh-prefix-help - "d" mh-show-delete-msg-from-seq - "k" mh-show-delete-seq - "l" mh-show-list-sequences - "n" mh-show-narrow-to-seq - "p" mh-show-put-msg-in-seq - "s" mh-show-msg-is-in-seq - "w" mh-show-widen) - -(define-key mh-show-mode-map "I" mh-inc-spool-map) - -(gnus-define-keys (mh-show-junk-map "J" mh-show-mode-map) - "?" mh-prefix-help - "a" mh-show-junk-allowlist - "b" mh-show-junk-blocklist - "w" mh-show-junk-whitelist) - -(gnus-define-keys (mh-show-ps-print-map "P" mh-show-mode-map) - "?" mh-prefix-help - "C" mh-show-ps-print-toggle-color - "F" mh-show-ps-print-toggle-faces - "f" mh-show-ps-print-msg-file - "l" mh-show-print-msg - "p" mh-show-ps-print-msg) - -(gnus-define-keys (mh-show-thread-map "T" mh-show-mode-map) - "?" mh-prefix-help - "u" mh-show-thread-ancestor - "p" mh-show-thread-previous-sibling - "n" mh-show-thread-next-sibling - "t" mh-show-toggle-threads - "d" mh-show-thread-delete - "o" mh-show-thread-refile) - -(gnus-define-keys (mh-show-limit-map "/" mh-show-mode-map) - "'" mh-show-narrow-to-tick - "?" mh-prefix-help - "c" mh-show-narrow-to-cc - "g" mh-show-narrow-to-range - "m" mh-show-narrow-to-from - "s" mh-show-narrow-to-subject - "t" mh-show-narrow-to-to - "w" mh-show-widen) - -(gnus-define-keys (mh-show-extract-map "X" mh-show-mode-map) - "?" mh-prefix-help - "s" mh-show-store-msg - "u" mh-show-store-msg) - -(gnus-define-keys (mh-show-digest-map "D" mh-show-mode-map) - "?" mh-prefix-help - " " mh-show-page-digest - "\177" mh-show-page-digest-backwards - "b" mh-show-burst-digest) - -(gnus-define-keys (mh-show-mime-map "K" mh-show-mode-map) - "?" mh-prefix-help - "a" mh-mime-save-parts - "e" mh-show-display-with-external-viewer - "v" mh-show-toggle-mime-part - "o" mh-show-save-mime-part - "i" mh-show-inline-mime-part - "t" mh-show-toggle-mime-buttons - "\t" mh-show-next-button - [backtab] mh-show-prev-button - "\M-\t" mh-show-prev-button) +(define-keymap :keymap mh-show-mode-map + " " #'mh-show-page-msg + "!" #'mh-show-refile-or-write-again + "'" #'mh-show-toggle-tick + "," #'mh-show-header-display + "." #'mh-show-show + ":" #'mh-show-show-preferred-alternative + ">" #'mh-show-write-message-to-file + "?" #'mh-help + "E" #'mh-show-extract-rejected-mail + "M" #'mh-show-modify + "\177" #'mh-show-previous-page + "\C-d" #'mh-show-delete-msg-no-motion + "\t" #'mh-show-next-button + [backtab] #'mh-show-prev-button + "\M-\t" #'mh-show-prev-button + "\ed" #'mh-show-redistribute + "^" #'mh-show-refile-msg + "c" #'mh-show-copy-msg + "d" #'mh-show-delete-msg + "e" #'mh-show-edit-again + "f" #'mh-show-forward + "g" #'mh-show-goto-msg + "i" #'mh-show-inc-folder + "k" #'mh-show-delete-subject-or-thread + "m" #'mh-show-send + "n" #'mh-show-next-undeleted-msg + "\M-n" #'mh-show-next-unread-msg + "o" #'mh-show-refile-msg + "p" #'mh-show-previous-undeleted-msg + "\M-p" #'mh-show-previous-unread-msg + "q" #'mh-show-quit + "r" #'mh-show-reply + "s" #'mh-show-send + "t" #'mh-show-toggle-showing + "u" #'mh-show-undo + "x" #'mh-show-execute-commands + "v" #'mh-show-index-visit-folder + "|" #'mh-show-pipe-msg + + "F" (define-keymap :prefix 'mh-show-folder-map + "?" #'mh-prefix-help + "'" #'mh-index-ticked-messages + "S" #'mh-show-sort-folder + "c" #'mh-show-catchup + "f" #'mh-show-visit-folder + "k" #'mh-show-kill-folder + "l" #'mh-show-list-folders + "n" #'mh-index-new-messages + "o" #'mh-show-visit-folder + "p" #'mh-show-pack-folder + "q" #'mh-show-index-sequenced-messages + "r" #'mh-show-rescan-folder + "s" #'mh-search + "t" #'mh-show-toggle-threads + "u" #'mh-show-undo-folder + "v" #'mh-show-visit-folder) + + "S" (define-keymap :prefix 'mh-show-sequence-map + "'" #'mh-show-narrow-to-tick + "?" #'mh-prefix-help + "d" #'mh-show-delete-msg-from-seq + "k" #'mh-show-delete-seq + "l" #'mh-show-list-sequences + "n" #'mh-show-narrow-to-seq + "p" #'mh-show-put-msg-in-seq + "s" #'mh-show-msg-is-in-seq + "w" #'mh-show-widen) + + "I" mh-inc-spool-map + + "J" (define-keymap :prefix 'mh-show-junk-map + "?" #'mh-prefix-help + "a" #'mh-show-junk-allowlist + "b" #'mh-show-junk-blocklist + "w" #'mh-show-junk-allowlist) + + "P" (define-keymap :prefix 'mh-show-ps-print-map + "?" #'mh-prefix-help + "C" #'mh-show-ps-print-toggle-color + "F" #'mh-show-ps-print-toggle-faces + "f" #'mh-show-ps-print-msg-file + "l" #'mh-show-print-msg + "p" #'mh-show-ps-print-msg) + + "T" (define-keymap :prefix 'mh-show-thread-map + "?" #'mh-prefix-help + "u" #'mh-show-thread-ancestor + "p" #'mh-show-thread-previous-sibling + "n" #'mh-show-thread-next-sibling + "t" #'mh-show-toggle-threads + "d" #'mh-show-thread-delete + "o" #'mh-show-thread-refile) + + "/" (define-keymap :prefix 'mh-show-limit-map + "'" #'mh-show-narrow-to-tick + "?" #'mh-prefix-help + "c" #'mh-show-narrow-to-cc + "g" #'mh-show-narrow-to-range + "m" #'mh-show-narrow-to-from + "s" #'mh-show-narrow-to-subject + "t" #'mh-show-narrow-to-to + "w" #'mh-show-widen) + + "X" (define-keymap :prefix 'mh-show-extract-map + "?" #'mh-prefix-help + "s" #'mh-show-store-msg + "u" #'mh-show-store-msg) + + "D" (define-keymap :prefix 'mh-show-digest-map + "?" #'mh-prefix-help + " " #'mh-show-page-digest + "\177" #'mh-show-page-digest-backwards + "b" #'mh-show-burst-digest) + + "K" (define-keymap :prefix 'mh-show-mime-map + "?" #'mh-prefix-help + "a" #'mh-mime-save-parts + "e" #'mh-show-display-with-external-viewer + "v" #'mh-show-toggle-mime-part + "o" #'mh-show-save-mime-part + "i" #'mh-show-inline-mime-part + "t" #'mh-show-toggle-mime-buttons + "\t" #'mh-show-next-button + [backtab] #'mh-show-prev-button + "\M-\t" #'mh-show-prev-button)) diff --git a/lisp/mh-e/mh-speed.el b/lisp/mh-e/mh-speed.el index 76ef990d82..712d676984 100644 --- a/lisp/mh-e/mh-speed.el +++ b/lisp/mh-e/mh-speed.el @@ -83,11 +83,11 @@ (defvar mh-folder-speedbar-key-map (speedbar-make-specialized-keymap) "Specialized speedbar keymap for MH-E buffers.") -(gnus-define-keys mh-folder-speedbar-key-map - "+" mh-speed-expand-folder - "-" mh-speed-contract-folder - "\r" mh-speed-view - "r" mh-speed-refresh) +(define-keymap :keymap mh-folder-speedbar-key-map + "+" #'mh-speed-expand-folder + "-" #'mh-speed-contract-folder + "\r" #'mh-speed-view + "r" #'mh-speed-refresh) (defvar mh-show-speedbar-key-map mh-folder-speedbar-key-map) (defvar mh-letter-speedbar-key-map mh-folder-speedbar-key-map) commit 7ae70054aa208da5d281ad8f6887d818d98f02d6 Author: Eli Zaretskii Date: Thu Oct 7 19:27:49 2021 +0300 ; * src/composite.h (LGSTRING_FONT): Add comment about its role. diff --git a/src/composite.h b/src/composite.h index 67e87201bf..945f261291 100644 --- a/src/composite.h +++ b/src/composite.h @@ -254,6 +254,10 @@ composition_valid_p (ptrdiff_t start, ptrdiff_t end, Lisp_Object prop) #define LGSTRING_HEADER(lgs) AREF (lgs, 0) #define LGSTRING_SET_HEADER(lgs, header) ASET (lgs, 0, header) +/* LGSTRING_FONT retrieves the font used for LGSTRING, if we are going + to display it on a GUI frame. On text-mode frames, that slot + stores the coding-system that should be used to write output to the + frame's terminal. */ #define LGSTRING_FONT(lgs) AREF (LGSTRING_HEADER (lgs), 0) #define LGSTRING_CHAR(lgs, i) AREF (LGSTRING_HEADER (lgs), (i) + 1) #define LGSTRING_CHAR_LEN(lgs) (ASIZE (LGSTRING_HEADER (lgs)) - 1) commit 1af00e67d6af215c63cfb1b12a999f47a7228970 Author: Eli Zaretskii Date: Thu Oct 7 18:53:25 2021 +0300 Include the refcards in the release tarball * make-dist (possibly_non_vc_files): Include *.pdf files, to include the produced refcards in the tarball. This was lost when 'make-dist' was rewritten for Emacs 27. diff --git a/make-dist b/make-dist index 7074bb801b..eb040150d9 100755 --- a/make-dist +++ b/make-dist @@ -366,9 +366,9 @@ possibly_non_vc_files=" src/config.in "$( find admin doc etc lisp \ - \( -name '*.el' -o -name '*.elc' -o -name '*.map' -o -name '*.stamp' \ - -o -name '*.texi' -o -name '*.tex' -o -name '*.txt' \) \ - ! -name 'site-init*' ! -name 'site-load*' ! -name 'default*' + \( -name '*.el' -o -name '*.elc' -o -name '*.map' -o -name '*.stamp' \ + -o -name '*.texi' -o -name '*.tex' -o -name '*.txt' -o -name '*.pdf' \) \ + ! -name 'site-init*' ! -name 'site-load*' ! -name 'default*' ) || exit if [ $with_info = yes ]; then commit 3c29fb705cfa908afee4a3fc084f8f4b88e43c4c Author: Eli Zaretskii Date: Thu Oct 7 18:48:09 2021 +0300 ; * src/Makefile.in (../native-lisp): Make the long recipe silent. diff --git a/src/Makefile.in b/src/Makefile.in index b8d0e7b54c..0326b4a8f2 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -804,7 +804,7 @@ elnlisp := $(addprefix ${lispsource}/,${elnlisp}) $(lisp:.elc=.eln) THEFILE=$< $ Date: Thu Oct 7 08:37:46 2021 -0700 Merge from origin/emacs-28 7cb98ba057 (origin/emacs-28) ; * src/keyboard.c (make_lispy_position)... commit 20809e27cc213e46eb1f234cad605bc8b1ed659d Merge: aa26d3e2cc b7a10b44ac Author: Glenn Morris Date: Thu Oct 7 08:37:46 2021 -0700 ; Merge from origin/emacs-28 The following commit was skipped: b7a10b44ac Backport: * lisp/net/tramp-archive.el (tramp-archive-autol... commit aa26d3e2cc4ed1a49f41f1cb4f8cc6d9c2c27adb Merge: b1b2f490c5 160e62a23c Author: Glenn Morris Date: Thu Oct 7 08:37:46 2021 -0700 Merge from origin/emacs-28 160e62a23c Improve documentation and customization of 'blink-matching... 1100fffcd3 * lisp/erc/erc.el: Don't error if 'erc-loaddefs' does not ... 8865fc02ab Add 'erc-bug' command for reporting ERC bugs 5afa07919e Add 'erc-version' and use it to display ERC version consis... bc941846d9 Small tweaks and improvements to etc/ERC-NEWS 30b5e0a514 Add NEWS items for changes to ERC since 5.3 to etc/ERC-NEWS f7e6c199bf Clone the frame window configuration in 'clone-frame' 5f626488d8 * lisp/tool-bar.el (tool-bar-position): Doc fix. # Conflicts: # etc/NEWS commit b1b2f490c54703648737b2b54a7ee500667fe127 Author: Lars Ingebrigtsen Date: Thu Oct 7 17:36:12 2021 +0200 Fix mh-e compilation warning * lisp/mh-e/mh-comp.el (mh-compose-and-send-mail): Adjust doc string. * lisp/mh-e/mh-identity.el (mh-identity-make-menu): Don't call the obsolete `mh-identity-add-menu' function (that now does nothing). diff --git a/lisp/mh-e/mh-comp.el b/lisp/mh-e/mh-comp.el index cbbfd76247..1eacc50589 100644 --- a/lisp/mh-e/mh-comp.el +++ b/lisp/mh-e/mh-comp.el @@ -1077,7 +1077,6 @@ letter." ;; Insert identity. (mh-insert-identity mh-identity-default t) (mh-identity-make-menu) - (mh-identity-add-menu) ;; Cleanup possibly RFC2047 encoded subject header (mh-decode-message-subject) diff --git a/lisp/mh-e/mh-identity.el b/lisp/mh-e/mh-identity.el index 656dc658cc..cd7f089dc1 100644 --- a/lisp/mh-e/mh-identity.el +++ b/lisp/mh-e/mh-identity.el @@ -54,8 +54,7 @@ This is normally set as part of an Identity in (defun mh-identity-make-menu () "Build the Identity menu. This should be called any time `mh-identity-list' or -`mh-auto-fields-list' change. -See `mh-identity-add-menu'." +`mh-auto-fields-list' change." (easy-menu-define mh-identity-menu mh-letter-mode-map "MH-E identity menu" (append commit 25d4cb7e687cdb9d8fca36961d3bc6d0f3cd66f5 Author: Stefan Kangas Date: Thu Oct 7 17:02:05 2021 +0200 Revert "Declare compat macro mh-do-in-gnu-emacs obsolete" This reverts commit 148b136651413d8eca0f805c786fb04b9c5878b8. This commit led to some build failures that I don't yet understand, so I'm reverting it for now so as not to leave master in a broken state. diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el index f4815ecd6f..5ea7bca6f9 100644 --- a/lisp/mh-e/mh-acros.el +++ b/lisp/mh-e/mh-acros.el @@ -47,7 +47,7 @@ ;;;###mh-autoload (defmacro mh-do-in-gnu-emacs (&rest body) "Execute BODY if in GNU Emacs." - (declare (obsolete progn "29.1") (debug t) (indent defun)) + (declare (debug t) (indent defun)) (unless (featurep 'xemacs) `(progn ,@body))) ;;;###mh-autoload diff --git a/lisp/mh-e/mh-compat.el b/lisp/mh-e/mh-compat.el index 4d4c996570..26e5576fe6 100644 --- a/lisp/mh-e/mh-compat.el +++ b/lisp/mh-e/mh-compat.el @@ -39,7 +39,8 @@ (eval-when-compile (require 'mh-acros)) -(defalias 'mh-require #'require) +(mh-do-in-gnu-emacs + (defalias 'mh-require #'require)) (defun-mh mh-assoc-string assoc-string (key list case-fold) "Like `assoc' but specifically for strings. diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el index 494dee6f3b..5fbaf12ef9 100644 --- a/lisp/mh-e/mh-folder.el +++ b/lisp/mh-e/mh-folder.el @@ -580,10 +580,11 @@ region in the MH-Folder buffer, then the MH-E command will perform the operation on all messages in that region. \\{mh-folder-mode-map}" - (unless mh-folder-tool-bar-map - (mh-tool-bar-folder-buttons-init)) - (if (boundp 'tool-bar-map) - (set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map)) + (mh-do-in-gnu-emacs + (unless mh-folder-tool-bar-map + (mh-tool-bar-folder-buttons-init)) + (if (boundp 'tool-bar-map) + (set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map))) (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(mh-folder-font-lock-keywords t)) (make-local-variable 'desktop-save-buffer) diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el index 0c2936f65b..493749577b 100644 --- a/lisp/mh-e/mh-letter.el +++ b/lisp/mh-e/mh-letter.el @@ -291,10 +291,11 @@ order). (make-local-variable 'mh-previous-window-config) (make-local-variable 'mh-sent-from-folder) (make-local-variable 'mh-sent-from-msg) - (unless mh-letter-tool-bar-map - (mh-tool-bar-letter-buttons-init)) - (if (boundp 'tool-bar-map) - (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map)) + (mh-do-in-gnu-emacs + (unless mh-letter-tool-bar-map + (mh-tool-bar-letter-buttons-init)) + (if (boundp 'tool-bar-map) + (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map))) ;; Set the local value of mh-mail-header-separator according to what is ;; present in the buffer... (set (make-local-variable 'mh-mail-header-separator) diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el index 76f0d32370..dfd984118b 100644 --- a/lisp/mh-e/mh-mime.el +++ b/lisp/mh-e/mh-mime.el @@ -187,7 +187,8 @@ Set from last use.") (unless (>= (string-to-number emacs-version) 21) ;; XEmacs doesn't care. (set-keymap-parent map mh-show-mode-map)) - (define-key map [mouse-2] #'mh-push-button) + (mh-do-in-gnu-emacs + (define-key map [mouse-2] #'mh-push-button)) (dolist (c mh-mime-button-commands) (define-key map (cadr c) (car c))) map)) @@ -210,7 +211,8 @@ Set from last use.") (unless (>= (string-to-number emacs-version) 21) (set-keymap-parent map mh-show-mode-map)) (define-key map "\r" #'mh-press-button) - (define-key map [mouse-2] #'mh-push-button) + (mh-do-in-gnu-emacs + (define-key map [mouse-2] #'mh-push-button)) map)) @@ -771,12 +773,13 @@ This is only useful if a Content-Disposition header is not present." ; this only tells us if the image is ; something that emacs can display (let ((image (mm-get-image handle))) - (let ((size (and (fboundp 'image-size) (image-size image)))) - (and size - (< (cdr size) (or mh-max-inline-image-height - (1- (window-height)))) - (< (car size) (or mh-max-inline-image-width - (window-width))))))))) + (mh-do-in-gnu-emacs + (let ((size (and (fboundp 'image-size) (image-size image)))) + (and size + (< (cdr size) (or mh-max-inline-image-height + (1- (window-height)))) + (< (car size) (or mh-max-inline-image-width + (window-width)))))))))) (defun mh-inline-vcard-p (handle) "Decide if HANDLE is a vcard that must be displayed inline." @@ -804,9 +807,10 @@ being used to highlight the signature in a MIME part." (save-excursion (goto-char (point-max)) (when (re-search-backward regexp nil t) - (let ((ov (make-overlay (point) (point-max)))) - (overlay-put ov 'face 'mh-show-signature) - (overlay-put ov 'evaporate t)))))) + (mh-do-in-gnu-emacs + (let ((ov (make-overlay (point) (point-max)))) + (overlay-put ov 'face 'mh-show-signature) + (overlay-put ov 'evaporate t))))))) diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el index 614a825513..9dfce215e4 100644 --- a/lisp/mh-e/mh-show.el +++ b/lisp/mh-e/mh-show.el @@ -836,8 +836,9 @@ The hook `mh-show-mode-hook' is called upon entry to this mode. See also `mh-folder-mode'. \\{mh-show-mode-map}" - (if (boundp 'tool-bar-map) - (set (make-local-variable 'tool-bar-map) mh-show-tool-bar-map)) + (mh-do-in-gnu-emacs + (if (boundp 'tool-bar-map) + (set (make-local-variable 'tool-bar-map) mh-show-tool-bar-map))) (set (make-local-variable 'mail-header-separator) mh-mail-header-separator) (setq paragraph-start (default-value 'paragraph-start)) (setq buffer-invisibility-spec '((vanish . t) t)) diff --git a/lisp/mh-e/mh-tool-bar.el b/lisp/mh-e/mh-tool-bar.el index 1eca5a275d..4e795d9600 100644 --- a/lisp/mh-e/mh-tool-bar.el +++ b/lisp/mh-e/mh-tool-bar.el @@ -27,7 +27,8 @@ ;;; Code: (require 'mh-e) -(require 'tool-bar) +(mh-do-in-gnu-emacs + (require 'tool-bar)) ;;; Tool Bar Commands @@ -204,77 +205,79 @@ where, (unless (memq x letter-buttons) (error "Letter defaults contains unknown button %s" x))) `(eval-and-compile - (defun mh-buffer-exists-p (mode) - "Test whether a buffer with major mode MODE is present." - (cl-loop for buf in (buffer-list) - when (with-current-buffer buf - (eq major-mode mode)) - return t)) - ;; Tool bar initialization functions - (defun mh-tool-bar-folder-buttons-init () - (when (mh-buffer-exists-p 'mh-folder-mode) - (let* ((load-path (mh-image-load-path-for-library "mh-e" - "mh-logo.xpm")) - (image-load-path (cons (car load-path) - (when (boundp 'image-load-path) - image-load-path)))) - (setq mh-folder-tool-bar-map - (let ((tool-bar-map (make-sparse-keymap))) - ,@(nreverse folder-button-setter) - tool-bar-map)) - (setq mh-folder-seq-tool-bar-map - (let ((tool-bar-map (copy-keymap mh-folder-tool-bar-map))) - ,@(nreverse sequence-button-setter) - tool-bar-map)) - (setq mh-show-tool-bar-map - (let ((tool-bar-map (make-sparse-keymap))) - ,@(nreverse show-button-setter) - tool-bar-map)) - (setq mh-show-seq-tool-bar-map - (let ((tool-bar-map (copy-keymap mh-show-tool-bar-map))) - ,@(nreverse show-seq-button-setter) - tool-bar-map))))) - (defun mh-tool-bar-letter-buttons-init () - (when (mh-buffer-exists-p 'mh-letter-mode) - (let* ((load-path (mh-image-load-path-for-library "mh-e" - "mh-logo.xpm")) - (image-load-path (cons (car load-path) - (when (boundp 'image-load-path) - image-load-path)))) - (setq mh-letter-tool-bar-map - (let ((tool-bar-map (make-sparse-keymap))) - ,@(nreverse letter-button-setter) - tool-bar-map))))) - ;; Custom setter functions - (defun mh-tool-bar-update (mode default-map sequence-map) - "Update `tool-bar-map' in all buffers of MODE. + ;; GNU Emacs tool bar specific code + (mh-do-in-gnu-emacs + (defun mh-buffer-exists-p (mode) + "Test whether a buffer with major mode MODE is present." + (cl-loop for buf in (buffer-list) + when (with-current-buffer buf + (eq major-mode mode)) + return t)) + ;; Tool bar initialization functions + (defun mh-tool-bar-folder-buttons-init () + (when (mh-buffer-exists-p 'mh-folder-mode) + (let* ((load-path (mh-image-load-path-for-library "mh-e" + "mh-logo.xpm")) + (image-load-path (cons (car load-path) + (when (boundp 'image-load-path) + image-load-path)))) + (setq mh-folder-tool-bar-map + (let ((tool-bar-map (make-sparse-keymap))) + ,@(nreverse folder-button-setter) + tool-bar-map)) + (setq mh-folder-seq-tool-bar-map + (let ((tool-bar-map (copy-keymap mh-folder-tool-bar-map))) + ,@(nreverse sequence-button-setter) + tool-bar-map)) + (setq mh-show-tool-bar-map + (let ((tool-bar-map (make-sparse-keymap))) + ,@(nreverse show-button-setter) + tool-bar-map)) + (setq mh-show-seq-tool-bar-map + (let ((tool-bar-map (copy-keymap mh-show-tool-bar-map))) + ,@(nreverse show-seq-button-setter) + tool-bar-map))))) + (defun mh-tool-bar-letter-buttons-init () + (when (mh-buffer-exists-p 'mh-letter-mode) + (let* ((load-path (mh-image-load-path-for-library "mh-e" + "mh-logo.xpm")) + (image-load-path (cons (car load-path) + (when (boundp 'image-load-path) + image-load-path)))) + (setq mh-letter-tool-bar-map + (let ((tool-bar-map (make-sparse-keymap))) + ,@(nreverse letter-button-setter) + tool-bar-map))))) + ;; Custom setter functions + (defun mh-tool-bar-update (mode default-map sequence-map) + "Update `tool-bar-map' in all buffers of MODE. Use SEQUENCE-MAP if display is limited; DEFAULT-MAP otherwise." - (cl-loop for buf in (buffer-list) - do (with-current-buffer buf - (when (eq mode major-mode) ;FIXME: derived-mode-p? - (let ((map (if mh-folder-view-stack - sequence-map - default-map))) - ;; Yes, make-local-variable is necessary since we - ;; get here during initialization when loading - ;; mh-e.el, after the +inbox buffer has been - ;; created, but before mh-folder-mode has run and - ;; created the local map. - (set (make-local-variable 'tool-bar-map) map)))))) - (defun mh-tool-bar-folder-buttons-set (symbol value) - "Construct tool bar for `mh-folder-mode' and `mh-show-mode'." - (set-default symbol value) - (mh-tool-bar-folder-buttons-init) - (mh-tool-bar-update 'mh-folder-mode mh-folder-tool-bar-map - mh-folder-seq-tool-bar-map) - (mh-tool-bar-update 'mh-show-mode mh-show-tool-bar-map - mh-show-seq-tool-bar-map)) - (defun mh-tool-bar-letter-buttons-set (symbol value) - "Construct tool bar for `mh-letter-mode'." - (set-default symbol value) - (mh-tool-bar-letter-buttons-init) - (mh-tool-bar-update 'mh-letter-mode mh-letter-tool-bar-map - mh-letter-tool-bar-map)) + (cl-loop for buf in (buffer-list) + do (with-current-buffer buf + (when (eq mode major-mode) ;FIXME: derived-mode-p? + (let ((map (if mh-folder-view-stack + sequence-map + default-map))) + ;; Yes, make-local-variable is necessary since we + ;; get here during initialization when loading + ;; mh-e.el, after the +inbox buffer has been + ;; created, but before mh-folder-mode has run and + ;; created the local map. + (set (make-local-variable 'tool-bar-map) map)))))) + (defun mh-tool-bar-folder-buttons-set (symbol value) + "Construct tool bar for `mh-folder-mode' and `mh-show-mode'." + (set-default symbol value) + (mh-tool-bar-folder-buttons-init) + (mh-tool-bar-update 'mh-folder-mode mh-folder-tool-bar-map + mh-folder-seq-tool-bar-map) + (mh-tool-bar-update 'mh-show-mode mh-show-tool-bar-map + mh-show-seq-tool-bar-map)) + (defun mh-tool-bar-letter-buttons-set (symbol value) + "Construct tool bar for `mh-letter-mode'." + (set-default symbol value) + (mh-tool-bar-letter-buttons-init) + (mh-tool-bar-update 'mh-letter-mode mh-letter-tool-bar-map + mh-letter-tool-bar-map))) ;; Declare customizable tool bars (custom-declare-variable 'mh-tool-bar-folder-buttons diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index 6d9a3afe28..49302e1687 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el @@ -127,18 +127,19 @@ Ignores case when searching for OLD." ;;;###mh-autoload (defun mh-logo-display () "Modify mode line to display MH-E logo." - (let* ((load-path (mh-image-load-path-for-library "mh-e" "mh-logo.xpm")) - (image-load-path (cons (car load-path) - (when (boundp 'image-load-path) - image-load-path)))) - (add-text-properties - 0 2 - `(display ,(or mh-logo-cache - (setq mh-logo-cache - (mh-funcall-if-exists - find-image '((:type xpm :ascent center - :file "mh-logo.xpm")))))) - (car mode-line-buffer-identification)))) + (mh-do-in-gnu-emacs + (let* ((load-path (mh-image-load-path-for-library "mh-e" "mh-logo.xpm")) + (image-load-path (cons (car load-path) + (when (boundp 'image-load-path) + image-load-path)))) + (add-text-properties + 0 2 + `(display ,(or mh-logo-cache + (setq mh-logo-cache + (mh-funcall-if-exists + find-image '((:type xpm :ascent center + :file "mh-logo.xpm")))))) + (car mode-line-buffer-identification))))) @@ -912,7 +913,8 @@ Handle RFC 822 (or later) continuation lines." (defvar mh-hidden-header-keymap (let ((map (make-sparse-keymap))) - (define-key map [mouse-2] #'mh-letter-toggle-header-field-display-button) + (mh-do-in-gnu-emacs + (define-key map [mouse-2] #'mh-letter-toggle-header-field-display-button)) map)) ;;;###mh-autoload diff --git a/lisp/mh-e/mh-xface.el b/lisp/mh-e/mh-xface.el index 73406f0981..9d3f0f4a62 100644 --- a/lisp/mh-e/mh-xface.el +++ b/lisp/mh-e/mh-xface.el @@ -74,16 +74,18 @@ in this order is used." (when type (goto-char (point-min)) (when (re-search-forward "^from:" (point-max) t) - (if (eq type 'url) - (mh-x-image-url-display url) - (mh-funcall-if-exists - insert-image (create-image - raw type t - :foreground - (mh-face-foreground 'mh-show-xface nil t) - :background - (mh-face-background 'mh-show-xface nil t)) - " "))))))) + ;; GNU Emacs + (mh-do-in-gnu-emacs + (if (eq type 'url) + (mh-x-image-url-display url) + (mh-funcall-if-exists + insert-image (create-image + raw type t + :foreground + (mh-face-foreground 'mh-show-xface nil t) + :background + (mh-face-background 'mh-show-xface nil t)) + " ")))))))) (defun mh-face-to-png (data) "Convert base64 encoded DATA to png image." @@ -142,8 +144,9 @@ The directories are searched for in the order they appear in the list.") (defvar mh-picon-image-types (cl-loop for type in '(xpm xbm gif) - when (or (ignore-errors - (mh-funcall-if-exists image-type-available-p type))) + when (or (mh-do-in-gnu-emacs + (ignore-errors + (mh-funcall-if-exists image-type-available-p type)))) collect type)) (autoload 'message-tokenize-header "sendmail") @@ -368,7 +371,8 @@ filenames. In addition, replaces * with %2a. See URL (when (and (file-readable-p image) (not (file-symlink-p image)) (eq marker mh-x-image-marker)) (goto-char marker) - (mh-funcall-if-exists insert-image (create-image image 'png))) + (mh-do-in-gnu-emacs + (mh-funcall-if-exists insert-image (create-image image 'png)))) (set-buffer-modified-p buffer-modified-flag))))) (defun mh-x-image-url-fetch-image (url cache-file marker sentinel) commit 9d14e410dac11990cf0e95a1a77e83827323530d Author: Stefan Kangas Date: Thu Oct 7 16:05:43 2021 +0200 Delete some XEmacs compat code from mh-e/*.el * lisp/mh-e/mh-acros.el (mh-mark-active-p): * lisp/mh-e/mh-comp.el (mh-insert-x-mailer): * lisp/mh-e/mh-compat.el (mh-define-obsolete-variable-alias) (mh-make-obsolete-variable): * lisp/mh-e/mh-folder.el (mh-folder-mode-map) (mh-remove-xemacs-horizontal-scrollbar, mh-folder-mode): * lisp/mh-e/mh-gnus.el (mh-gnus-local-map-property): * lisp/mh-e/mh-show.el (mh-show-mode): * lisp/mh-e/mh-utils.el (mh-colors-available-p): * lisp/mh-e/mh-xface.el (mh-show-xface-function): Delete some XEmacs compat code. diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el index 956e42bc2c..f4815ecd6f 100644 --- a/lisp/mh-e/mh-acros.el +++ b/lisp/mh-e/mh-acros.el @@ -105,14 +105,11 @@ XEmacs and versions of GNU Emacs before 21.1 require ;;;###mh-autoload (defmacro mh-mark-active-p (check-transient-mark-mode-flag) - "A macro that expands into appropriate code in XEmacs and nil in GNU Emacs. -In GNU Emacs if CHECK-TRANSIENT-MARK-MODE-FLAG is non-nil then -check if variable `transient-mark-mode' is active." - (cond ((featurep 'xemacs) ;XEmacs - '(and (boundp 'zmacs-regions) zmacs-regions (region-active-p))) - ((not check-transient-mark-mode-flag) ;GNU Emacs + "If CHECK-TRANSIENT-MARK-MODE-FLAG is non-nil then check if +variable `transient-mark-mode' is active." + (cond ((not check-transient-mark-mode-flag) '(and (boundp 'mark-active) mark-active)) - (t ;GNU Emacs + (t '(and (boundp 'transient-mark-mode) transient-mark-mode (boundp 'mark-active) mark-active)))) diff --git a/lisp/mh-e/mh-comp.el b/lisp/mh-e/mh-comp.el index 404b6b3ce7..cbbfd76247 100644 --- a/lisp/mh-e/mh-comp.el +++ b/lisp/mh-e/mh-comp.el @@ -1107,18 +1107,8 @@ The versions of MH-E, Emacs, and MH are shown." ;; Lazily initialize mh-x-mailer-string. (when (and mh-insert-x-mailer-flag (null mh-x-mailer-string)) (setq mh-x-mailer-string - (format "MH-E %s; %s; %sEmacs %s" - mh-version mh-variant-in-use - (if (featurep 'xemacs) "X" "GNU ") - (cond ((not (featurep 'xemacs)) - (string-match "[0-9]+\\.[0-9]+\\(\\.[0-9]+\\)?" - emacs-version) - (match-string 0 emacs-version)) - ((string-match "[0-9.]*\\( +([ a-z]+[0-9]+)\\)?" - emacs-version) - (match-string 0 emacs-version)) - (t (format "%s.%s" emacs-major-version - emacs-minor-version)))))) + (format "MH-E %s; %s; Emacs %s" + mh-version mh-variant-in-use emacs-version))) ;; Insert X-Mailer, but only if it doesn't already exist. (save-excursion (when (and mh-insert-x-mailer-flag diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el index 05976986ec..494dee6f3b 100644 --- a/lisp/mh-e/mh-folder.el +++ b/lisp/mh-e/mh-folder.el @@ -343,11 +343,7 @@ annotation.") [backtab] mh-prev-button "\M-\t" mh-prev-button) -(cond - ((featurep 'xemacs) - (define-key mh-folder-mode-map [button2] 'mh-show-mouse)) - (t - (define-key mh-folder-mode-map [mouse-2] 'mh-show-mouse))) +(define-key mh-folder-mode-map [mouse-2] 'mh-show-mouse) ;; "C-c /" prefix is used in mh-folder-mode by pgp.el and mailcrypt @@ -512,12 +508,8 @@ font-lock is done highlighting.") ;;; MH-Folder Mode (defmacro mh-remove-xemacs-horizontal-scrollbar () - "Get rid of the horizontal scrollbar that XEmacs insists on putting in." - (when (featurep 'xemacs) - '(if (and (featurep 'scrollbar) - (fboundp 'set-specifier)) - (set-specifier horizontal-scrollbar-visible-p nil - (cons (current-buffer) nil))))) + (declare (obsolete nil "29.1")) + nil) ;; Register mh-folder-mode as supporting which-function-mode... (eval-and-compile (mh-require 'which-func nil t)) @@ -639,7 +631,6 @@ perform the operation on all messages in that region. 'imenu-create-index-function 'mh-index-create-imenu-index ; Setup imenu support 'mh-previous-window-config nil) ; Previous window configuration - (mh-remove-xemacs-horizontal-scrollbar) (setq truncate-lines t) (auto-save-mode -1) (setq buffer-offer-save t) @@ -651,10 +642,7 @@ perform the operation on all messages in that region. (setq revert-buffer-function #'mh-undo-folder) (add-to-list 'minor-mode-alist '(mh-showing-mode " Show")) (mh-inc-spool-make) - (mh-set-help mh-folder-mode-help-messages) - (if (and (featurep 'xemacs) - font-lock-auto-fontify) - (turn-on-font-lock))) ; Force font-lock in XEmacs. + (mh-set-help mh-folder-mode-help-messages)) diff --git a/lisp/mh-e/mh-gnus.el b/lisp/mh-e/mh-gnus.el index cc60f7b664..a3ba859388 100644 --- a/lisp/mh-e/mh-gnus.el +++ b/lisp/mh-e/mh-gnus.el @@ -39,8 +39,7 @@ ;; TODO This is not in Gnus 5.11. (defun-mh mh-gnus-local-map-property gnus-local-map-property (map) "Return a list suitable for a text property list specifying keymap MAP." - (cond ((featurep 'xemacs) (list 'keymap map)) - ((>= emacs-major-version 21) (list 'keymap map)) + (cond ((>= emacs-major-version 21) (list 'keymap map)) (t (list 'local-map map)))) ;; Copy of function from mm-decode.el. diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el index d52a859ae1..614a825513 100644 --- a/lisp/mh-e/mh-show.el +++ b/lisp/mh-e/mh-show.el @@ -855,9 +855,6 @@ See also `mh-folder-mode'. (mh-gnus-article-highlight-citation)) (t (setq font-lock-defaults '(mh-show-font-lock-keywords t)))) - (if (and (featurep 'xemacs) - font-lock-auto-fontify) - (turn-on-font-lock)) (when mh-decode-mime-flag (mh-make-local-hook 'kill-buffer-hook) (add-hook 'kill-buffer-hook #'mh-mime-cleanup nil t)) diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index 137e45ba7a..6d9a3afe28 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el @@ -61,9 +61,9 @@ used in lieu of `search' in the CL package." ;;;###mh-autoload (defun mh-colors-available-p () "Check if colors are available in the Emacs being used." - (or (featurep 'xemacs) - (let ((color-cells (mh-display-color-cells))) - (and (numberp color-cells) (>= color-cells 8))))) + ;; FIXME: Can this be replaced with `display-color-p'? + (let ((color-cells (mh-display-color-cells))) + (and (numberp color-cells) (>= color-cells 8)))) ;;;###mh-autoload (defun mh-colors-in-use-p () diff --git a/lisp/mh-e/mh-xface.el b/lisp/mh-e/mh-xface.el index 473fb409b5..73406f0981 100644 --- a/lisp/mh-e/mh-xface.el +++ b/lisp/mh-e/mh-xface.el @@ -31,10 +31,7 @@ (autoload 'message-fetch-field "message") (defvar mh-show-xface-function - (cond ((and (featurep 'xemacs) (locate-library "x-face") (not (featurep 'xface))) - (load "x-face" t t) - #'mh-face-display-function) - ((>= emacs-major-version 21) + (cond ((>= emacs-major-version 21) #'mh-face-display-function) (t #'ignore)) "Determine at run time what function should be called to display X-Face.") commit 148b136651413d8eca0f805c786fb04b9c5878b8 Author: Stefan Kangas Date: Thu Oct 7 15:39:43 2021 +0200 Declare compat macro mh-do-in-gnu-emacs obsolete * lisp/mh-e/mh-acros.el (mh-do-in-gnu-emacs): Declare compat macro obsolete. * lisp/mh-e/mh-compat.el (mh-require): * lisp/mh-e/mh-folder.el (mh-folder-mode): * lisp/mh-e/mh-letter.el (mh-letter-mode): * lisp/mh-e/mh-mime.el (mh-mime-button-map) (mh-mime-security-button-map, mh-small-image-p) (mh-signature-highlight): * lisp/mh-e/mh-show.el (mh-show-mode): * lisp/mh-e/mh-tool-bar.el (mh-tool-bar-define): * lisp/mh-e/mh-utils.el (mh-logo-display) (mh-hidden-header-keymap): * lisp/mh-e/mh-xface.el (mh-face-display-function) (mh-picon-image-types, mh-x-image-display): Don't wrap code in compat macro 'mh-do-in-gnu-emacs'. diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el index 93523a1115..956e42bc2c 100644 --- a/lisp/mh-e/mh-acros.el +++ b/lisp/mh-e/mh-acros.el @@ -47,7 +47,7 @@ ;;;###mh-autoload (defmacro mh-do-in-gnu-emacs (&rest body) "Execute BODY if in GNU Emacs." - (declare (debug t) (indent defun)) + (declare (obsolete progn "29.1") (debug t) (indent defun)) (unless (featurep 'xemacs) `(progn ,@body))) ;;;###mh-autoload diff --git a/lisp/mh-e/mh-compat.el b/lisp/mh-e/mh-compat.el index 26e5576fe6..4d4c996570 100644 --- a/lisp/mh-e/mh-compat.el +++ b/lisp/mh-e/mh-compat.el @@ -39,8 +39,7 @@ (eval-when-compile (require 'mh-acros)) -(mh-do-in-gnu-emacs - (defalias 'mh-require #'require)) +(defalias 'mh-require #'require) (defun-mh mh-assoc-string assoc-string (key list case-fold) "Like `assoc' but specifically for strings. diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el index c22f95a797..05976986ec 100644 --- a/lisp/mh-e/mh-folder.el +++ b/lisp/mh-e/mh-folder.el @@ -588,11 +588,10 @@ region in the MH-Folder buffer, then the MH-E command will perform the operation on all messages in that region. \\{mh-folder-mode-map}" - (mh-do-in-gnu-emacs - (unless mh-folder-tool-bar-map - (mh-tool-bar-folder-buttons-init)) - (if (boundp 'tool-bar-map) - (set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map))) + (unless mh-folder-tool-bar-map + (mh-tool-bar-folder-buttons-init)) + (if (boundp 'tool-bar-map) + (set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map)) (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(mh-folder-font-lock-keywords t)) (make-local-variable 'desktop-save-buffer) diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el index 493749577b..0c2936f65b 100644 --- a/lisp/mh-e/mh-letter.el +++ b/lisp/mh-e/mh-letter.el @@ -291,11 +291,10 @@ order). (make-local-variable 'mh-previous-window-config) (make-local-variable 'mh-sent-from-folder) (make-local-variable 'mh-sent-from-msg) - (mh-do-in-gnu-emacs - (unless mh-letter-tool-bar-map - (mh-tool-bar-letter-buttons-init)) - (if (boundp 'tool-bar-map) - (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map))) + (unless mh-letter-tool-bar-map + (mh-tool-bar-letter-buttons-init)) + (if (boundp 'tool-bar-map) + (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map)) ;; Set the local value of mh-mail-header-separator according to what is ;; present in the buffer... (set (make-local-variable 'mh-mail-header-separator) diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el index dfd984118b..76f0d32370 100644 --- a/lisp/mh-e/mh-mime.el +++ b/lisp/mh-e/mh-mime.el @@ -187,8 +187,7 @@ Set from last use.") (unless (>= (string-to-number emacs-version) 21) ;; XEmacs doesn't care. (set-keymap-parent map mh-show-mode-map)) - (mh-do-in-gnu-emacs - (define-key map [mouse-2] #'mh-push-button)) + (define-key map [mouse-2] #'mh-push-button) (dolist (c mh-mime-button-commands) (define-key map (cadr c) (car c))) map)) @@ -211,8 +210,7 @@ Set from last use.") (unless (>= (string-to-number emacs-version) 21) (set-keymap-parent map mh-show-mode-map)) (define-key map "\r" #'mh-press-button) - (mh-do-in-gnu-emacs - (define-key map [mouse-2] #'mh-push-button)) + (define-key map [mouse-2] #'mh-push-button) map)) @@ -773,13 +771,12 @@ This is only useful if a Content-Disposition header is not present." ; this only tells us if the image is ; something that emacs can display (let ((image (mm-get-image handle))) - (mh-do-in-gnu-emacs - (let ((size (and (fboundp 'image-size) (image-size image)))) - (and size - (< (cdr size) (or mh-max-inline-image-height - (1- (window-height)))) - (< (car size) (or mh-max-inline-image-width - (window-width)))))))))) + (let ((size (and (fboundp 'image-size) (image-size image)))) + (and size + (< (cdr size) (or mh-max-inline-image-height + (1- (window-height)))) + (< (car size) (or mh-max-inline-image-width + (window-width))))))))) (defun mh-inline-vcard-p (handle) "Decide if HANDLE is a vcard that must be displayed inline." @@ -807,10 +804,9 @@ being used to highlight the signature in a MIME part." (save-excursion (goto-char (point-max)) (when (re-search-backward regexp nil t) - (mh-do-in-gnu-emacs - (let ((ov (make-overlay (point) (point-max)))) - (overlay-put ov 'face 'mh-show-signature) - (overlay-put ov 'evaporate t))))))) + (let ((ov (make-overlay (point) (point-max)))) + (overlay-put ov 'face 'mh-show-signature) + (overlay-put ov 'evaporate t)))))) diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el index df7977c9cd..d52a859ae1 100644 --- a/lisp/mh-e/mh-show.el +++ b/lisp/mh-e/mh-show.el @@ -836,9 +836,8 @@ The hook `mh-show-mode-hook' is called upon entry to this mode. See also `mh-folder-mode'. \\{mh-show-mode-map}" - (mh-do-in-gnu-emacs - (if (boundp 'tool-bar-map) - (set (make-local-variable 'tool-bar-map) mh-show-tool-bar-map))) + (if (boundp 'tool-bar-map) + (set (make-local-variable 'tool-bar-map) mh-show-tool-bar-map)) (set (make-local-variable 'mail-header-separator) mh-mail-header-separator) (setq paragraph-start (default-value 'paragraph-start)) (setq buffer-invisibility-spec '((vanish . t) t)) diff --git a/lisp/mh-e/mh-tool-bar.el b/lisp/mh-e/mh-tool-bar.el index 4e795d9600..1eca5a275d 100644 --- a/lisp/mh-e/mh-tool-bar.el +++ b/lisp/mh-e/mh-tool-bar.el @@ -27,8 +27,7 @@ ;;; Code: (require 'mh-e) -(mh-do-in-gnu-emacs - (require 'tool-bar)) +(require 'tool-bar) ;;; Tool Bar Commands @@ -205,79 +204,77 @@ where, (unless (memq x letter-buttons) (error "Letter defaults contains unknown button %s" x))) `(eval-and-compile - ;; GNU Emacs tool bar specific code - (mh-do-in-gnu-emacs - (defun mh-buffer-exists-p (mode) - "Test whether a buffer with major mode MODE is present." - (cl-loop for buf in (buffer-list) - when (with-current-buffer buf - (eq major-mode mode)) - return t)) - ;; Tool bar initialization functions - (defun mh-tool-bar-folder-buttons-init () - (when (mh-buffer-exists-p 'mh-folder-mode) - (let* ((load-path (mh-image-load-path-for-library "mh-e" - "mh-logo.xpm")) - (image-load-path (cons (car load-path) - (when (boundp 'image-load-path) - image-load-path)))) - (setq mh-folder-tool-bar-map - (let ((tool-bar-map (make-sparse-keymap))) - ,@(nreverse folder-button-setter) - tool-bar-map)) - (setq mh-folder-seq-tool-bar-map - (let ((tool-bar-map (copy-keymap mh-folder-tool-bar-map))) - ,@(nreverse sequence-button-setter) - tool-bar-map)) - (setq mh-show-tool-bar-map - (let ((tool-bar-map (make-sparse-keymap))) - ,@(nreverse show-button-setter) - tool-bar-map)) - (setq mh-show-seq-tool-bar-map - (let ((tool-bar-map (copy-keymap mh-show-tool-bar-map))) - ,@(nreverse show-seq-button-setter) - tool-bar-map))))) - (defun mh-tool-bar-letter-buttons-init () - (when (mh-buffer-exists-p 'mh-letter-mode) - (let* ((load-path (mh-image-load-path-for-library "mh-e" - "mh-logo.xpm")) - (image-load-path (cons (car load-path) - (when (boundp 'image-load-path) - image-load-path)))) - (setq mh-letter-tool-bar-map - (let ((tool-bar-map (make-sparse-keymap))) - ,@(nreverse letter-button-setter) - tool-bar-map))))) - ;; Custom setter functions - (defun mh-tool-bar-update (mode default-map sequence-map) - "Update `tool-bar-map' in all buffers of MODE. + (defun mh-buffer-exists-p (mode) + "Test whether a buffer with major mode MODE is present." + (cl-loop for buf in (buffer-list) + when (with-current-buffer buf + (eq major-mode mode)) + return t)) + ;; Tool bar initialization functions + (defun mh-tool-bar-folder-buttons-init () + (when (mh-buffer-exists-p 'mh-folder-mode) + (let* ((load-path (mh-image-load-path-for-library "mh-e" + "mh-logo.xpm")) + (image-load-path (cons (car load-path) + (when (boundp 'image-load-path) + image-load-path)))) + (setq mh-folder-tool-bar-map + (let ((tool-bar-map (make-sparse-keymap))) + ,@(nreverse folder-button-setter) + tool-bar-map)) + (setq mh-folder-seq-tool-bar-map + (let ((tool-bar-map (copy-keymap mh-folder-tool-bar-map))) + ,@(nreverse sequence-button-setter) + tool-bar-map)) + (setq mh-show-tool-bar-map + (let ((tool-bar-map (make-sparse-keymap))) + ,@(nreverse show-button-setter) + tool-bar-map)) + (setq mh-show-seq-tool-bar-map + (let ((tool-bar-map (copy-keymap mh-show-tool-bar-map))) + ,@(nreverse show-seq-button-setter) + tool-bar-map))))) + (defun mh-tool-bar-letter-buttons-init () + (when (mh-buffer-exists-p 'mh-letter-mode) + (let* ((load-path (mh-image-load-path-for-library "mh-e" + "mh-logo.xpm")) + (image-load-path (cons (car load-path) + (when (boundp 'image-load-path) + image-load-path)))) + (setq mh-letter-tool-bar-map + (let ((tool-bar-map (make-sparse-keymap))) + ,@(nreverse letter-button-setter) + tool-bar-map))))) + ;; Custom setter functions + (defun mh-tool-bar-update (mode default-map sequence-map) + "Update `tool-bar-map' in all buffers of MODE. Use SEQUENCE-MAP if display is limited; DEFAULT-MAP otherwise." - (cl-loop for buf in (buffer-list) - do (with-current-buffer buf - (when (eq mode major-mode) ;FIXME: derived-mode-p? - (let ((map (if mh-folder-view-stack - sequence-map - default-map))) - ;; Yes, make-local-variable is necessary since we - ;; get here during initialization when loading - ;; mh-e.el, after the +inbox buffer has been - ;; created, but before mh-folder-mode has run and - ;; created the local map. - (set (make-local-variable 'tool-bar-map) map)))))) - (defun mh-tool-bar-folder-buttons-set (symbol value) - "Construct tool bar for `mh-folder-mode' and `mh-show-mode'." - (set-default symbol value) - (mh-tool-bar-folder-buttons-init) - (mh-tool-bar-update 'mh-folder-mode mh-folder-tool-bar-map - mh-folder-seq-tool-bar-map) - (mh-tool-bar-update 'mh-show-mode mh-show-tool-bar-map - mh-show-seq-tool-bar-map)) - (defun mh-tool-bar-letter-buttons-set (symbol value) - "Construct tool bar for `mh-letter-mode'." - (set-default symbol value) - (mh-tool-bar-letter-buttons-init) - (mh-tool-bar-update 'mh-letter-mode mh-letter-tool-bar-map - mh-letter-tool-bar-map))) + (cl-loop for buf in (buffer-list) + do (with-current-buffer buf + (when (eq mode major-mode) ;FIXME: derived-mode-p? + (let ((map (if mh-folder-view-stack + sequence-map + default-map))) + ;; Yes, make-local-variable is necessary since we + ;; get here during initialization when loading + ;; mh-e.el, after the +inbox buffer has been + ;; created, but before mh-folder-mode has run and + ;; created the local map. + (set (make-local-variable 'tool-bar-map) map)))))) + (defun mh-tool-bar-folder-buttons-set (symbol value) + "Construct tool bar for `mh-folder-mode' and `mh-show-mode'." + (set-default symbol value) + (mh-tool-bar-folder-buttons-init) + (mh-tool-bar-update 'mh-folder-mode mh-folder-tool-bar-map + mh-folder-seq-tool-bar-map) + (mh-tool-bar-update 'mh-show-mode mh-show-tool-bar-map + mh-show-seq-tool-bar-map)) + (defun mh-tool-bar-letter-buttons-set (symbol value) + "Construct tool bar for `mh-letter-mode'." + (set-default symbol value) + (mh-tool-bar-letter-buttons-init) + (mh-tool-bar-update 'mh-letter-mode mh-letter-tool-bar-map + mh-letter-tool-bar-map)) ;; Declare customizable tool bars (custom-declare-variable 'mh-tool-bar-folder-buttons diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index 1e244b5427..137e45ba7a 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el @@ -127,19 +127,18 @@ Ignores case when searching for OLD." ;;;###mh-autoload (defun mh-logo-display () "Modify mode line to display MH-E logo." - (mh-do-in-gnu-emacs - (let* ((load-path (mh-image-load-path-for-library "mh-e" "mh-logo.xpm")) - (image-load-path (cons (car load-path) - (when (boundp 'image-load-path) - image-load-path)))) - (add-text-properties - 0 2 - `(display ,(or mh-logo-cache - (setq mh-logo-cache - (mh-funcall-if-exists - find-image '((:type xpm :ascent center - :file "mh-logo.xpm")))))) - (car mode-line-buffer-identification))))) + (let* ((load-path (mh-image-load-path-for-library "mh-e" "mh-logo.xpm")) + (image-load-path (cons (car load-path) + (when (boundp 'image-load-path) + image-load-path)))) + (add-text-properties + 0 2 + `(display ,(or mh-logo-cache + (setq mh-logo-cache + (mh-funcall-if-exists + find-image '((:type xpm :ascent center + :file "mh-logo.xpm")))))) + (car mode-line-buffer-identification)))) @@ -913,8 +912,7 @@ Handle RFC 822 (or later) continuation lines." (defvar mh-hidden-header-keymap (let ((map (make-sparse-keymap))) - (mh-do-in-gnu-emacs - (define-key map [mouse-2] #'mh-letter-toggle-header-field-display-button)) + (define-key map [mouse-2] #'mh-letter-toggle-header-field-display-button) map)) ;;;###mh-autoload diff --git a/lisp/mh-e/mh-xface.el b/lisp/mh-e/mh-xface.el index b27ab2bcab..473fb409b5 100644 --- a/lisp/mh-e/mh-xface.el +++ b/lisp/mh-e/mh-xface.el @@ -77,18 +77,16 @@ in this order is used." (when type (goto-char (point-min)) (when (re-search-forward "^from:" (point-max) t) - ;; GNU Emacs - (mh-do-in-gnu-emacs - (if (eq type 'url) - (mh-x-image-url-display url) - (mh-funcall-if-exists - insert-image (create-image - raw type t - :foreground - (mh-face-foreground 'mh-show-xface nil t) - :background - (mh-face-background 'mh-show-xface nil t)) - " ")))))))) + (if (eq type 'url) + (mh-x-image-url-display url) + (mh-funcall-if-exists + insert-image (create-image + raw type t + :foreground + (mh-face-foreground 'mh-show-xface nil t) + :background + (mh-face-background 'mh-show-xface nil t)) + " "))))))) (defun mh-face-to-png (data) "Convert base64 encoded DATA to png image." @@ -147,9 +145,8 @@ The directories are searched for in the order they appear in the list.") (defvar mh-picon-image-types (cl-loop for type in '(xpm xbm gif) - when (or (mh-do-in-gnu-emacs - (ignore-errors - (mh-funcall-if-exists image-type-available-p type)))) + when (or (ignore-errors + (mh-funcall-if-exists image-type-available-p type))) collect type)) (autoload 'message-tokenize-header "sendmail") @@ -374,8 +371,7 @@ filenames. In addition, replaces * with %2a. See URL (when (and (file-readable-p image) (not (file-symlink-p image)) (eq marker mh-x-image-marker)) (goto-char marker) - (mh-do-in-gnu-emacs - (mh-funcall-if-exists insert-image (create-image image 'png)))) + (mh-funcall-if-exists insert-image (create-image image 'png))) (set-buffer-modified-p buffer-modified-flag))))) (defun mh-x-image-url-fetch-image (url cache-file marker sentinel) commit 7459a8d70f7e56da7f9dd27678f21eedd3f8f36a Author: Stefan Kangas Date: Thu Oct 7 15:33:52 2021 +0200 Declare compat macro mh-do-in-xemacs obsolete * lisp/mh-e/mh-identity.el (mh-identity-add-menu): * lisp/mh-e/mh-acros.el (mh-do-in-xemacs): Declare obsolete. * lisp/mh-e/mh-compat.el: * lisp/mh-e/mh-e.el (mh-xemacs-use-tool-bar-flag): * lisp/mh-e/mh-folder.el (mh-folder-mode): * lisp/mh-e/mh-letter.el (mh-letter-mode): * lisp/mh-e/mh-mime.el (mh-mime-button-map) (mh-mime-security-button-map, mh-small-image-p) (mh-signature-highlight): * lisp/mh-e/mh-search.el (mh-search-mode): * lisp/mh-e/mh-seq.el: * lisp/mh-e/mh-show.el (mh-show-mode): * lisp/mh-e/mh-tool-bar.el (mh-tool-bar-define): * lisp/mh-e/mh-utils.el (mh-logo-display) (mh-hidden-header-keymap): * lisp/mh-e/mh-xface.el (mh-face-display-function) (mh-picon-image-types, mh-x-image-display): Delete calls to 'mh-do-in-xemacs'. diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el index 8fdcf3c62b..93523a1115 100644 --- a/lisp/mh-e/mh-acros.el +++ b/lisp/mh-e/mh-acros.el @@ -53,7 +53,7 @@ ;;;###mh-autoload (defmacro mh-do-in-xemacs (&rest body) "Execute BODY if in XEmacs." - (declare (debug t) (indent defun)) + (declare (obsolete nil "29.1") (debug t) (indent defun)) (when (featurep 'xemacs) `(progn ,@body))) ;;;###mh-autoload diff --git a/lisp/mh-e/mh-compat.el b/lisp/mh-e/mh-compat.el index ade80e8b95..26e5576fe6 100644 --- a/lisp/mh-e/mh-compat.el +++ b/lisp/mh-e/mh-compat.el @@ -42,21 +42,6 @@ (mh-do-in-gnu-emacs (defalias 'mh-require #'require)) -(mh-do-in-xemacs - (defun mh-require (feature &optional filename noerror) - "If feature FEATURE is not loaded, load it from FILENAME. -If FEATURE is not a member of the list `features', then the feature -is not loaded; so load the file FILENAME. -If FILENAME is omitted, the printname of FEATURE is used as the file name. -If the optional third argument NOERROR is non-nil, -then return nil if the file is not found instead of signaling an error. - -Simulate NOERROR argument in XEmacs which lacks it." - (if (not (featurep feature)) - (if filename - (load filename noerror t) - (load (format "%s" feature) noerror t))))) - (defun-mh mh-assoc-string assoc-string (key list case-fold) "Like `assoc' but specifically for strings. Case is ignored if CASE-FOLD is non-nil. diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el index 9cbc8cfb73..d929a329c9 100644 --- a/lisp/mh-e/mh-e.el +++ b/lisp/mh-e/mh-e.el @@ -88,9 +88,6 @@ (require 'mh-buffers) (require 'mh-compat) -(mh-do-in-xemacs - (require 'mh-xemacs)) - (mh-font-lock-add-keywords 'emacs-lisp-mode (eval-when-compile @@ -619,10 +616,6 @@ Output is expected to be shown to user, not parsed by MH-E." ;; The bug wasn't seen in emacs21 but still occurred in XEmacs21.4. (mh-exchange-point-and-mark-preserving-active-mark)) -;; Shush compiler. -(mh-do-in-xemacs - (defvar mark-active)) - (defun mh-exchange-point-and-mark-preserving-active-mark () "Put the mark where point is now, and point where the mark is now. This command works even when the mark is not active, and @@ -3117,42 +3110,6 @@ of your own choosing." :group 'mh-tool-bar :package-version '(MH-E . "7.0")) -;; XEmacs has a couple of extra customizations... -(mh-do-in-xemacs - (defcustom-mh mh-xemacs-use-tool-bar-flag mh-xemacs-has-tool-bar-flag - "If non-nil, use tool bar. - -This option controls whether to show the MH-E icons at all. By -default, this option is turned on if the window system supports -tool bars. If your system doesn't support tool bars, then you -won't be able to turn on this option." - :type 'boolean - :group 'mh-tool-bar - :set (lambda (symbol value) - (if (and (eq value t) - (not mh-xemacs-has-tool-bar-flag)) - (error "Tool bar not supported")) - (set-default symbol value)) - :package-version '(MH-E . "7.3")) - - (defcustom-mh mh-xemacs-tool-bar-position nil - "Tool bar location. - -This option controls the placement of the tool bar along the four -edges of the frame. You can choose from one of \"Same As Default -Tool Bar\", \"Top\", \"Bottom\", \"Left\", or \"Right\". If this -variable is set to anything other than \"Same As Default Tool -Bar\" and the default tool bar is in a different location, then -two tool bars will be displayed: the MH-E tool bar and the -default tool bar." - :type '(radio (const :tag "Same As Default Tool Bar" :value nil) - (const :tag "Top" :value top) - (const :tag "Bottom" :value bottom) - (const :tag "Left" :value left) - (const :tag "Right" :value right)) - :group 'mh-tool-bar - :package-version '(MH-E . "7.3"))) - ;;; Hooks (:group 'mh-hooks + group where hook described) diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el index 35277ae46a..c22f95a797 100644 --- a/lisp/mh-e/mh-folder.el +++ b/lisp/mh-e/mh-folder.el @@ -527,8 +527,6 @@ font-lock is done highlighting.") ;; Shush compiler. (defvar desktop-save-buffer) (defvar font-lock-auto-fontify) -(mh-do-in-xemacs - (defvar font-lock-defaults)) ;; Ensure new buffers won't get this mode if default major-mode is nil. (put 'mh-folder-mode 'mode-class 'special) @@ -595,8 +593,6 @@ perform the operation on all messages in that region. (mh-tool-bar-folder-buttons-init)) (if (boundp 'tool-bar-map) (set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map))) - (mh-do-in-xemacs - (mh-tool-bar-init :folder)) (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(mh-folder-font-lock-keywords t)) (make-local-variable 'desktop-save-buffer) @@ -655,10 +651,6 @@ perform the operation on all messages in that region. (mh-funcall-if-exists hl-line-mode 1) (setq revert-buffer-function #'mh-undo-folder) (add-to-list 'minor-mode-alist '(mh-showing-mode " Show")) - (mh-do-in-xemacs - (easy-menu-add mh-folder-sequence-menu) - (easy-menu-add mh-folder-message-menu) - (easy-menu-add mh-folder-folder-menu)) (mh-inc-spool-make) (mh-set-help mh-folder-mode-help-messages) (if (and (featurep 'xemacs) diff --git a/lisp/mh-e/mh-identity.el b/lisp/mh-e/mh-identity.el index ceede0d07c..656dc658cc 100644 --- a/lisp/mh-e/mh-identity.el +++ b/lisp/mh-e/mh-identity.el @@ -88,8 +88,8 @@ See `mh-identity-add-menu'." (defun mh-identity-add-menu () "Add the current Identity menu. See `mh-identity-make-menu'." - (if mh-identity-menu - (mh-do-in-xemacs (easy-menu-add mh-identity-menu)))) + (declare (obsolete nil "29.1")) + nil) (defvar mh-identity-local nil "Buffer-local variable that holds the identity currently in use.") diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el index ae5b80d580..493749577b 100644 --- a/lisp/mh-e/mh-letter.el +++ b/lisp/mh-e/mh-letter.el @@ -260,10 +260,6 @@ searching for `mh-mail-header-separator' in the buffer." ;;; MH-Letter Mode -;; Shush compiler. -(mh-do-in-xemacs - (defvar font-lock-defaults)) - ;; Ensure new buffers won't get this mode if default major-mode is nil. (put 'mh-letter-mode 'mode-class 'special) @@ -300,8 +296,6 @@ order). (mh-tool-bar-letter-buttons-init)) (if (boundp 'tool-bar-map) (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map))) - (mh-do-in-xemacs - (mh-tool-bar-init :letter)) ;; Set the local value of mh-mail-header-separator according to what is ;; present in the buffer... (set (make-local-variable 'mh-mail-header-separator) @@ -328,12 +322,10 @@ order). (t ;; ...or the header only (setq font-lock-defaults '((mh-show-font-lock-keywords) t)))) - (mh-do-in-xemacs (easy-menu-add mh-letter-menu)) ;; Maybe we want to use the existing Mail menu from mail-mode in ;; 9.0; in the mean time, let's remove it since the redundancy will ;; only produce confusion. (define-key mh-letter-mode-map [menu-bar mail] #'undefined) - (mh-do-in-xemacs (easy-menu-remove mail-menubar-menu)) (setq fill-column mh-letter-fill-column) (add-hook 'completion-at-point-functions #'mh-letter-completion-at-point nil 'local) diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el index ad594aef90..dfd984118b 100644 --- a/lisp/mh-e/mh-mime.el +++ b/lisp/mh-e/mh-mime.el @@ -189,8 +189,6 @@ Set from last use.") (set-keymap-parent map mh-show-mode-map)) (mh-do-in-gnu-emacs (define-key map [mouse-2] #'mh-push-button)) - (mh-do-in-xemacs - (define-key map '(button2) #'mh-push-button)) (dolist (c mh-mime-button-commands) (define-key map (cadr c) (car c))) map)) @@ -215,8 +213,6 @@ Set from last use.") (define-key map "\r" #'mh-press-button) (mh-do-in-gnu-emacs (define-key map [mouse-2] #'mh-push-button)) - (mh-do-in-xemacs - (define-key map '(button2) #'mh-push-button)) map)) @@ -777,20 +773,13 @@ This is only useful if a Content-Disposition header is not present." ; this only tells us if the image is ; something that emacs can display (let ((image (mm-get-image handle))) - (or (mh-do-in-xemacs - (and (mh-funcall-if-exists glyphp image) - (< (glyph-width image) - (or mh-max-inline-image-width (window-pixel-width))) - (< (glyph-height image) - (or mh-max-inline-image-height - (window-pixel-height))))) - (mh-do-in-gnu-emacs - (let ((size (and (fboundp 'image-size) (image-size image)))) - (and size - (< (cdr size) (or mh-max-inline-image-height - (1- (window-height)))) - (< (car size) (or mh-max-inline-image-width - (window-width))))))))))) + (mh-do-in-gnu-emacs + (let ((size (and (fboundp 'image-size) (image-size image)))) + (and size + (< (cdr size) (or mh-max-inline-image-height + (1- (window-height)))) + (< (car size) (or mh-max-inline-image-width + (window-width)))))))))) (defun mh-inline-vcard-p (handle) "Decide if HANDLE is a vcard that must be displayed inline." @@ -821,19 +810,12 @@ being used to highlight the signature in a MIME part." (mh-do-in-gnu-emacs (let ((ov (make-overlay (point) (point-max)))) (overlay-put ov 'face 'mh-show-signature) - (overlay-put ov 'evaporate t))) - (mh-do-in-xemacs - (set-extent-property (make-extent (point) (point-max)) - 'face 'mh-show-signature)))))) + (overlay-put ov 'evaporate t))))))) ;;; Button Display -;; Shush compiler. -(mh-do-in-xemacs - (defvar ov)) - (defun mh-insert-mime-button (handle index displayed) "Insert MIME button for HANDLE. INDEX is the part number that will be DISPLAYED. It is also used diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el index e03c9dc83f..d84af791f9 100644 --- a/lisp/mh-e/mh-search.el +++ b/lisp/mh-e/mh-search.el @@ -318,10 +318,6 @@ folder containing the index search results." (cl-loop for msg-hash being the hash-values of mh-index-data count (> (hash-table-count msg-hash) 0))))))) -;; Shush compiler. -(mh-do-in-xemacs - (defvar pick-folder)) ;FIXME: Why? - (defun mh-search-folder (folder window-config) "Search FOLDER for messages matching a pattern. @@ -616,7 +612,6 @@ The hook `mh-search-mode-hook' is called upon entry to this mode. \\{mh-search-mode-map}" - (mh-do-in-xemacs (easy-menu-add mh-pick-menu)) (mh-set-help mh-search-mode-help-messages)) diff --git a/lisp/mh-e/mh-seq.el b/lisp/mh-e/mh-seq.el index a50319a455..69f9224ebe 100644 --- a/lisp/mh-e/mh-seq.el +++ b/lisp/mh-e/mh-seq.el @@ -194,8 +194,6 @@ MESSAGE appears." " ")))) ;; Shush compiler. -(mh-do-in-xemacs - (defvar tool-bar-mode)) (defvar tool-bar-map) ;;;###mh-autoload diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el index 803f07e02b..df7977c9cd 100644 --- a/lisp/mh-e/mh-show.el +++ b/lisp/mh-e/mh-show.el @@ -839,8 +839,6 @@ See also `mh-folder-mode'. (mh-do-in-gnu-emacs (if (boundp 'tool-bar-map) (set (make-local-variable 'tool-bar-map) mh-show-tool-bar-map))) - (mh-do-in-xemacs - (mh-tool-bar-init :show)) (set (make-local-variable 'mail-header-separator) mh-mail-header-separator) (setq paragraph-start (default-value 'paragraph-start)) (setq buffer-invisibility-spec '((vanish . t) t)) @@ -864,10 +862,6 @@ See also `mh-folder-mode'. (when mh-decode-mime-flag (mh-make-local-hook 'kill-buffer-hook) (add-hook 'kill-buffer-hook #'mh-mime-cleanup nil t)) - (mh-do-in-xemacs - (easy-menu-add mh-show-sequence-menu) - (easy-menu-add mh-show-message-menu) - (easy-menu-add mh-show-folder-menu)) (make-local-variable 'mh-show-folder-buffer) (buffer-disable-undo) (use-local-map mh-show-mode-map)) diff --git a/lisp/mh-e/mh-tool-bar.el b/lisp/mh-e/mh-tool-bar.el index 94aa8dd4a9..4e795d9600 100644 --- a/lisp/mh-e/mh-tool-bar.el +++ b/lisp/mh-e/mh-tool-bar.el @@ -29,8 +29,6 @@ (require 'mh-e) (mh-do-in-gnu-emacs (require 'tool-bar)) -(mh-do-in-xemacs - (require 'toolbar)) ;;; Tool Bar Commands @@ -145,8 +143,6 @@ where, (let* ((name (nth 0 button)) (name-str (symbol-name name)) (icon (nth 2 button)) - (xemacs-icon (mh-do-in-xemacs - `(cdr (assoc (quote ,(intern icon)) mh-xemacs-icon-map)))) (full-doc (nth 3 button)) (doc (if (string-match "\\(.*\\)\n" full-doc) (match-string 1 full-doc) @@ -186,7 +182,7 @@ where, (t 'folder-buttons))) (docs (cond ((eq mbuttons 'letter-buttons) 'letter-docs) ((eq mbuttons 'folder-buttons) 'folder-docs)))) - (add-to-list vector-list `(vector ,xemacs-icon ',function t ,full-doc)) + (add-to-list vector-list `(vector nil ',function t ,full-doc)) (add-to-list setter `(when (member ',name ,list) (mh-funcall-if-exists @@ -282,72 +278,6 @@ Use SEQUENCE-MAP if display is limited; DEFAULT-MAP otherwise." (mh-tool-bar-letter-buttons-init) (mh-tool-bar-update 'mh-letter-mode mh-letter-tool-bar-map mh-letter-tool-bar-map))) - ;; XEmacs specific code - (mh-do-in-xemacs - (defvar mh-tool-bar-folder-vector-map - (list ,@(cl-loop for button in folder-buttons - for vector in folder-vectors - collect `(cons ',button ,vector)))) - (defvar mh-tool-bar-show-vector-map - (list ,@(cl-loop for button in show-buttons - for vector in show-vectors - collect `(cons ',button ,vector)))) - (defvar mh-tool-bar-letter-vector-map - (list ,@(cl-loop for button in letter-buttons - for vector in letter-vectors - collect `(cons ',button ,vector)))) - (defvar mh-tool-bar-folder-buttons) - (defvar mh-tool-bar-show-buttons) - (defvar mh-tool-bar-letter-buttons) - ;; Custom setter functions - (defun mh-tool-bar-letter-buttons-set (symbol value) - (set-default symbol value) - (when mh-xemacs-has-tool-bar-flag - (setq mh-tool-bar-letter-buttons - (cl-loop - for b in value - collect (cdr (assoc b mh-tool-bar-letter-vector-map)))))) - (defun mh-tool-bar-folder-buttons-set (symbol value) - (set-default symbol value) - (when mh-xemacs-has-tool-bar-flag - (setq mh-tool-bar-folder-buttons - (cl-loop - for b in value - collect (cdr (assoc b mh-tool-bar-folder-vector-map)))) - (setq mh-tool-bar-show-buttons - (cl-loop - for b in value - collect (cdr (assoc b mh-tool-bar-show-vector-map)))))) - (defun mh-tool-bar-init (mode) - "Install tool bar in MODE." - (when mh-xemacs-use-tool-bar-flag - (let ((tool-bar (cond ((eq mode :folder) - mh-tool-bar-folder-buttons) - ((eq mode :letter) - mh-tool-bar-letter-buttons) - ((eq mode :show) - mh-tool-bar-show-buttons))) - (height 37) - (width 40) - (buffer (current-buffer))) - (cond - ((eq mh-xemacs-tool-bar-position 'top) - (set-specifier top-toolbar tool-bar buffer) - (set-specifier top-toolbar-visible-p t) - (set-specifier top-toolbar-height height)) - ((eq mh-xemacs-tool-bar-position 'bottom) - (set-specifier bottom-toolbar tool-bar buffer) - (set-specifier bottom-toolbar-visible-p t) - (set-specifier bottom-toolbar-height height)) - ((eq mh-xemacs-tool-bar-position 'left) - (set-specifier left-toolbar tool-bar buffer) - (set-specifier left-toolbar-visible-p t) - (set-specifier left-toolbar-width width)) - ((eq mh-xemacs-tool-bar-position 'right) - (set-specifier right-toolbar tool-bar buffer) - (set-specifier right-toolbar-visible-p t) - (set-specifier right-toolbar-width width)) - (t (set-specifier default-toolbar tool-bar buffer))))))) ;; Declare customizable tool bars (custom-declare-variable 'mh-tool-bar-folder-buttons @@ -372,7 +302,6 @@ Use SEQUENCE-MAP if display is limited; DEFAULT-MAP otherwise." ;;:package-version '(MH-E "7.1") )))) -;; The icon names are duplicated in the Makefile and mh-xemacs.el. (mh-tool-bar-define ((:folder mh-inc-folder mh-mime-save-parts mh-previous-undeleted-msg mh-page-msg diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index bbce17013b..1e244b5427 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el @@ -139,14 +139,7 @@ Ignores case when searching for OLD." (mh-funcall-if-exists find-image '((:type xpm :ascent center :file "mh-logo.xpm")))))) - (car mode-line-buffer-identification)))) - (mh-do-in-xemacs - (setq modeline-buffer-identification - (list - (if mh-modeline-glyph - (cons modeline-buffer-id-left-extent mh-modeline-glyph) - (cons modeline-buffer-id-left-extent "XEmacs%N:")) - (cons modeline-buffer-id-right-extent " %17b"))))) + (car mode-line-buffer-identification))))) @@ -922,9 +915,6 @@ Handle RFC 822 (or later) continuation lines." (let ((map (make-sparse-keymap))) (mh-do-in-gnu-emacs (define-key map [mouse-2] #'mh-letter-toggle-header-field-display-button)) - (mh-do-in-xemacs - (define-key map '(button2) - #'mh-letter-toggle-header-field-display-button)) map)) ;;;###mh-autoload diff --git a/lisp/mh-e/mh-xface.el b/lisp/mh-e/mh-xface.el index 58177c1794..b27ab2bcab 100644 --- a/lisp/mh-e/mh-xface.el +++ b/lisp/mh-e/mh-xface.el @@ -88,36 +88,7 @@ in this order is used." (mh-face-foreground 'mh-show-xface nil t) :background (mh-face-background 'mh-show-xface nil t)) - " "))) - ;; XEmacs - (mh-do-in-xemacs - (cond - ((eq type 'url) - (mh-x-image-url-display url)) - ((eq type 'png) - (when (featurep 'png) - (set-extent-begin-glyph - (make-extent (point) (point)) - (make-glyph (vector 'png ':data (mh-face-to-png face)))))) - ;; Try internal xface support if available... - ((and (eq type 'pbm) (featurep 'xface)) - (set-glyph-face - (set-extent-begin-glyph - (make-extent (point) (point)) - (make-glyph (vector 'xface ':data (concat "X-Face: " x-face)))) - 'mh-show-xface)) - ;; Otherwise try external support with x-face... - ((and (eq type 'pbm) - (fboundp 'x-face-xmas-wl-display-x-face) - (fboundp 'executable-find) (executable-find "uncompface")) - (mh-funcall-if-exists x-face-xmas-wl-display-x-face)) - ;; Picon display - ((and raw (member type '(xpm xbm gif))) - (when (featurep type) - (set-extent-begin-glyph - (make-extent (point) (point)) - (make-glyph (vector type ':data raw)))))) - (when raw (insert " ")))))))) + " ")))))))) (defun mh-face-to-png (data) "Convert base64 encoded DATA to png image." @@ -178,8 +149,7 @@ The directories are searched for in the order they appear in the list.") (cl-loop for type in '(xpm xbm gif) when (or (mh-do-in-gnu-emacs (ignore-errors - (mh-funcall-if-exists image-type-available-p type))) - (mh-do-in-xemacs (featurep type))) + (mh-funcall-if-exists image-type-available-p type)))) collect type)) (autoload 'message-tokenize-header "sendmail") @@ -405,15 +375,7 @@ filenames. In addition, replaces * with %2a. See URL (eq marker mh-x-image-marker)) (goto-char marker) (mh-do-in-gnu-emacs - (mh-funcall-if-exists insert-image (create-image image 'png))) - (mh-do-in-xemacs - (when (featurep 'png) - (set-extent-begin-glyph - (make-extent (point) (point)) - (make-glyph - (vector 'png ':data (with-temp-buffer - (insert-file-contents-literally image) - (buffer-string)))))))) + (mh-funcall-if-exists insert-image (create-image image 'png)))) (set-buffer-modified-p buffer-modified-flag))))) (defun mh-x-image-url-fetch-image (url cache-file marker sentinel) commit 7cb98ba057cbf5b5da8c86d96e15f46628e95590 Author: Eli Zaretskii Date: Thu Oct 7 16:09:37 2021 +0300 ; * src/keyboard.c (make_lispy_position): Avoid GCC warning. (Bug#51076) diff --git a/src/keyboard.c b/src/keyboard.c index bc6f97586d..4e47136e49 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5130,7 +5130,8 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, window_or_frame = Qnil; } #endif - if (!FRAME_WINDOW_P (f) + if (f + && !FRAME_WINDOW_P (f) && FRAME_TAB_BAR_LINES (f) > 0 && my >= FRAME_MENU_BAR_LINES (f) && my < FRAME_MENU_BAR_LINES (f) + FRAME_TAB_BAR_LINES (f)) commit a067fa72ad7b2936b775210e0de2fd8ce52adcda Author: Michael Albinus Date: Thu Oct 7 14:15:01 2021 +0200 ; Fix typo in test/Makefile.in diff --git a/test/Makefile.in b/test/Makefile.in index d82f53157b..a5720b2571 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -167,7 +167,7 @@ lisp/net/tramp-tests.log \ : WRITE_LOG = 2>&1 | tee $@ endif ifdef EMACS_EMBA_CI -lisp/filenotify-tests.log lisp/net/tramp-tests.log src/emacs-module-tests.el \ +lisp/filenotify-tests.log lisp/net/tramp-tests.log src/emacs-module-tests.log \ : WRITE_LOG = 2>&1 | tee $@ endif commit b7a10b44acf94458ed5f590be76749cec3e1b8dc Author: Stefan Monnier Date: Wed Oct 6 12:15:26 2021 -0400 Backport: * lisp/net/tramp-archive.el (tramp-archive-autoload-file-name-handler): Scope Fix the scoping of `tramp-archive-enabled`. (cherry picked from commit 8d53c23f90aab6e527c61137ae43274c7a36eca7) diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index b28235924d..8bf25151df 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el @@ -353,6 +353,7 @@ arguments to pass to the OPERATION." ;;;###autoload (progn (defun tramp-archive-autoload-file-name-handler (operation &rest args) "Load Tramp archive file name handler, and perform OPERATION." + (defvar tramp-archive-autoload) (when tramp-archive-enabled ;; We cannot use `tramp-compat-temporary-file-directory' here due ;; to autoload. When installing Tramp's GNU ELPA package, there @@ -360,7 +361,6 @@ arguments to pass to the OPERATION." ;; overload this. (let ((default-directory temporary-file-directory) (tramp-archive-autoload t)) - tramp-archive-autoload ; Silence byte compiler. (apply #'tramp-autoload-file-name-handler operation args))))) ;;;###autoload commit 160e62a23cd722744c74cec9e8d37cb678be0fb1 Author: Eli Zaretskii Date: Thu Oct 7 12:33:29 2021 +0300 Improve documentation and customization of 'blink-matching-paren' * lisp/simple.el (blink-matching-paren): Fix the wording of the doc string and the descriptions in the value menu. (Bug#51032) diff --git a/lisp/simple.el b/lisp/simple.el index 459fc67944..bec4aa4738 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -8419,21 +8419,29 @@ presented." (defcustom blink-matching-paren t "Non-nil means show matching open-paren when close-paren is inserted. -In addition, if the opening paren is not visible on screen, show -its position in the echo area. +If this is non-nil, then when you type a closing delimiter, such as a +closing parenthesis or brace, Emacs briefly indicates the location +of the matching opening delimiter. The valid values are: - nil Disable. - non-nil Highlight the opening paren. - `jump' Briefly move cursor to its position. - `jump-offscreen' Briefly move cursor to its position, - even if the opening paren is not on screen." + t Highlight the matching open-paren if it is visible + in the window, otherwise show the text with matching + open-paren in the echo area. This is the default. + `jump' If the matching open-paren is visible in the window, + briefly move cursor to its position; otherwise show + the text with matching open-paren in the echo area. + `jump-offscreen' Briefly move cursor to the matching open-paren + even if it is not visible in the window. + nil Don't show the matching open-paren. + +Any other non-nil value is handled the same as t." + :type '(choice (const :tag "Disable" nil) - (const :tag "Highlight" t) - (const :tag "Move cursor" jump) - (const :tag "Move cursor, even if off screen" jump-offscreen)) + (const :tag "Highlight open-paren if visible" t) + (const :tag "Move cursor to open-paren if visible" jump) + (const :tag "Move cursor even if it's off screen" jump-offscreen)) :group 'paren-blinking) (defcustom blink-matching-paren-on-screen t commit e338effc774f9a7cfe13d4a35dc1cf493a22c972 Author: Lars Ingebrigtsen Date: Thu Oct 7 09:33:29 2021 +0200 Fix syntax error in previous gnus-registry-install-shortcuts change * lisp/gnus/gnus-registry.el (gnus-registry-install-shortcuts): Fix syntax error in previous change. diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index 9e581d4247..8ce88dc81e 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el @@ -991,7 +991,8 @@ Uses `gnus-registry-marks' to find what shortcuts to install." (gnus-message 9 "Defined mark handling function %s" function-name)))))) (define-key gnus-summary-mark-map "M" - (apply #'define-keymap :prefix "M" 'gnus-summary-mark-map keys-plist)) + (apply #'define-keymap :prefix 'gnus-summary-mark-map + keys-plist)) (add-hook 'gnus-summary-menu-hook (lambda () (easy-menu-add-item commit 1100fffcd360867c0116cb5c4d17bab535577c03 Author: Amin Bandali Date: Sat Sep 18 12:53:59 2021 -0400 * lisp/erc/erc.el: Don't error if 'erc-loaddefs' does not exist. That autoload file is created as part of the Emacs compilation process, however we would like ERC to be usable if used outside emacs.git (e.g. if installed from GNU ELPA). diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index c347638465..3462aa4db0 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -58,7 +58,7 @@ ;;; Code: -(load "erc-loaddefs" nil t) +(load "erc-loaddefs" 'noerror 'nomessage) (require 'cl-lib) (require 'format-spec) commit 8865fc02abbf36aaa9801e74d82538336005eded Author: Amin Bandali Date: Wed Oct 6 22:49:59 2021 -0400 Add 'erc-bug' command for reporting ERC bugs * etc/ERC-NEWS: Announce the new command, and mention it at the top of the file along with 'report-emacs-bug'. * lisp/erc/erc.el (erc-bug): New command for reporting ERC bugs. It prompts for a subject, and passes it on to 'report-emacs-bug' along with the current ERC version, with the ERC mailing list in Cc. diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS index 49fc07726d..5a2f30ad8c 100644 --- a/etc/ERC-NEWS +++ b/etc/ERC-NEWS @@ -5,7 +5,7 @@ See the end of the file for license conditions. Please send ERC bug reports to 'bug-gnu-emacs@gnu.org', and Cc the 'emacs-erc@gnu.org' mailing list as well. -If possible, use 'M-x report-emacs-bug'. +If possible, use 'M-x erc-bug' or 'M-x report-emacs-bug'. This file is about changes in ERC, the powerful, modular, and extensible IRC (Internet Relay Chat) client distributed with @@ -157,6 +157,11 @@ a different server than the one the current user is connected to. Using the given nick itself instead of the server it is connected to is not standardized, but is widely supported across IRC networks. +*** Add 'erc-bug' command for reporting ERC bugs. +The new 'erc-bug' command prompts for a subject, and passes it on to +'report-emacs-bug' along with the current ERC version, and adds the +ERC mailing list in Cc. + * Changes in ERC 5.3 diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index c87238d0b7..c347638465 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -6620,6 +6620,15 @@ If BUFFER is nil, update the mode line in all ERC buffers." ;; Miscellaneous +(defun erc-bug (subject) + "Send a bug report to the Emacs bug tracker and ERC mailing list." + (interactive "sBug Subject: ") + (report-emacs-bug + (format "ERC %s: %s" erc-version subject)) + (save-excursion + (goto-char (point-min)) + (insert "X-Debbugs-CC: emacs-erc@gnu.org\n"))) + (defun erc-port-to-string (p) "Convert port P to a string. P may be an integer or a service name." commit 5afa07919ee6b2e90ad55048835049eb53faa843 Author: Amin Bandali Date: Wed Oct 6 21:50:56 2021 -0400 Add 'erc-version' and use it to display ERC version consistently * lisp/erc/erc.el (erc-version): New constant holding the current ERC version, now used in the function with the same name to produce a version string for use across ERC for consistency. Also, add another optional argument, 'bold-erc', which when non-nil, marks the "ERC" portion of the string with the control character for bold display. (erc-quit/part-reason-default): Use the 'erc-version' function for a consistent version string. (erc-cmd-SV): Mention the ERC version number from the 'erc-version' constant. (erc-ctcp-query-VERSION): Use the 'erc-version' function for a consistent version string. diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 308812f0eb..c87238d0b7 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -69,6 +69,9 @@ (require 'iso8601) (eval-when-compile (require 'subr-x)) +(defconst erc-version "5.3" + "This version of ERC.") + (defvar erc-official-location "https://www.gnu.org/software/emacs/erc.html (mailing list: emacs-erc@gnu.org)" "Location of the ERC client on the Internet.") @@ -3613,7 +3616,7 @@ If USER is omitted, close the current query buffer if one exists (defun erc-quit/part-reason-default () "Default quit/part message." - (format "\C-bERC\C-b (IRC client for Emacs %s)" emacs-version)) + (erc-version nil 'bold-erc)) (defun erc-quit-reason-normal (&optional s) @@ -3766,7 +3769,8 @@ the message given by REASON." (defun erc-cmd-SV () "Say the current ERC and Emacs version into channel." - (erc-send-message (format "I'm using ERC with GNU Emacs %s (%s%s)%s." + (erc-send-message (format "I'm using ERC %s with GNU Emacs %s (%s%s)%s." + erc-version emacs-version system-configuration (concat @@ -4845,8 +4849,8 @@ See also `erc-display-message'." (unless erc-disable-ctcp-replies (erc-send-ctcp-notice nick (format - "VERSION \C-bERC\C-b - an IRC client for Emacs %s (\C-b%s\C-b)" - emacs-version + "VERSION %s (\C-b%s\C-b)" + (erc-version nil 'bold-erc) erc-official-location))) nil) @@ -6632,12 +6636,18 @@ P may be an integer or a service name." s n)))) -(defun erc-version (&optional here) +(defun erc-version (&optional here bold-erc) "Show the version number of ERC in the minibuffer. -If optional argument HERE is non-nil, insert version number at point." +If optional argument HERE is non-nil, insert version number at point. +If optional argument BOLD-ERC is non-nil, display \"ERC\" as bold." (interactive "P") (let ((version-string - (format "ERC (IRC client for Emacs %s)" emacs-version))) + (format "%s %s (IRC client for GNU Emacs %s)" + (if bold-erc + "\C-bERC\C-b" + "ERC") + erc-version + emacs-version))) (if here (insert version-string) (if (called-interactively-p 'interactive) commit bc941846d9cc09341ef3c42c26cd3e04e29fe65f Author: Amin Bandali Date: Wed Oct 6 21:35:43 2021 -0400 Small tweaks and improvements to etc/ERC-NEWS * etc/ERC-NEWS: Small tweaks inspired by etc/NEWS, namely to add a descriptive blurb at the top of the file to explain what it is about and how to report ERC bugs, add a form feed before the section for every release, and set the same Local Variables that etc/NEWS does. diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS index 8d08d06975..49fc07726d 100644 --- a/etc/ERC-NEWS +++ b/etc/ERC-NEWS @@ -3,6 +3,15 @@ ERC NEWS -*- outline -*- Copyright (C) 2006-2021 Free Software Foundation, Inc. See the end of the file for license conditions. +Please send ERC bug reports to 'bug-gnu-emacs@gnu.org', +and Cc the 'emacs-erc@gnu.org' mailing list as well. +If possible, use 'M-x report-emacs-bug'. + +This file is about changes in ERC, the powerful, modular, and +extensible IRC (Internet Relay Chat) client distributed with +GNU Emacs since Emacs version 22.1. + + * Changes in ERC 5.4 ** Starting with Emacs 28.1 and ERC 5.4, ERC NEWS are added here again. @@ -148,6 +157,7 @@ a different server than the one the current user is connected to. Using the given nick itself instead of the server it is connected to is not standardized, but is widely supported across IRC networks. + * Changes in ERC 5.3 ** New function `erc-tls' is to be used for connecting to a server via TLS. @@ -392,6 +402,7 @@ message types are "333" and "353", respectively. **** Turn this into the "xdcc" module for ERC, so that it can be more easily enabled. + * Changes in ERC 5.2 ** M-x erc RET now starts ERC. @@ -671,6 +682,7 @@ not. **** New function: `erc-toggle-timestamps'. Toggles display of timestamps. + * Changes in ERC 5.1.4 ** Make find-function and find-variable work in Emacs 22 for @@ -694,6 +706,7 @@ is deactivated. **** Fix some errors that occur when exiting Emacs without first quitting open IRC servers. + * Changes in ERC 5.1.3 ** Fix use of /quote command with no initial whitespace. @@ -808,6 +821,7 @@ modules. **** Don't complete the user's current nickname. + * Changes in ERC 5.1.2 ** Fix compiler errors in erc-autojoin.el and erc-dcc.el. @@ -844,6 +858,7 @@ A side effect of using this new method is that there will only be one space before a right timestamp in any saved logs. If this is unacceptable, set `erc-timestamp-use-align-to' to nil. + * Changes in ERC 5.1.1 ** Fix a requirement on cl.el. @@ -877,6 +892,7 @@ new `erc-timestamp-right-align-by-pixel' option to non-nil. **** Since most of these changes are now merged into Emacs22, detect whether we need these changes and install them only if necessary. + * Changes in ERC 5.1 ** Improve XEmacs compatibility. @@ -1083,10 +1099,12 @@ the right margin. **** Helps ERC work correctly in viper-mode. + * Changes in ERC 5.0.4 ** Fix a problem with undo in channels. + * Changes in ERC 5.0.3 ** Fix typo in the `ctcp-request-to' entry of the English catalog. @@ -1128,6 +1146,7 @@ indicator. Previously, there was an additional unnecessary space. **** Fix an error that occurred when unchecked buffers existed when invoking /QUIT. + * Changes in ERC 5.0.2 ** If a channel key is required for a certain channel, ERC will prompt @@ -1161,6 +1180,7 @@ choice anymore. **** You can now save logs and truncate buffers from the menu-bar. + * Changes in ERC 5.0.1 ** Narrowing in ERC buffers no longer causes formatting errors. @@ -1175,6 +1195,7 @@ choice anymore. This means that `erc-track-priority-faces-only', `erc-track-exclude', and `erc-track-exclude-types' now work with server buffers. + * Changes in ERC 5.0 ** Channel members are now stored as a hash-table. @@ -1419,6 +1440,7 @@ in XEmacs. mode-line where modified channels are shown (only works in GNU Emacs versions above 21.3). + * Changes in ERC 4.0 ** The module system has again changed a lot. You can now customize @@ -1442,6 +1464,7 @@ in XEmacs. openprojects to freenode. You may need to update your configuration for a successful automatic nickserv identification. + * Changes in ERC 3.0.cvs.20030119 ** New module erc-dcc: @@ -1473,6 +1496,7 @@ Same applies to timestamps. You no longer need to (require the rest should be automatic. +---------------------------------------------------------------------- This file is part of GNU Emacs. GNU Emacs is free software: you can redistribute it and/or modify @@ -1487,3 +1511,10 @@ 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 . + + +Local variables: +coding: utf-8 +mode: outline +paragraph-separate: "[ ]*$" +end: commit 30b5e0a51417490e577407b7b0cc80983890e7be Author: Amin Bandali Date: Wed Oct 6 21:17:33 2021 -0400 Add NEWS items for changes to ERC since 5.3 to etc/ERC-NEWS * etc/ERC-NEWS: copy ERC NEWS items from etc/NEWS, etc/NEWS.27, etc/NEWS.26, etc/NEWS.25, and etc/NEWS.24 to here. Future ERC NEWS are also to be added here. This is in motivated by preparation for addition of ERC to GNU ELPA, along with the ERC manual and NEWS. * etc/NEWS: remove ERC-related entries, and refer the reader to ERC-NEWS instead. diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS index 8c9306b5ca..8d08d06975 100644 --- a/etc/ERC-NEWS +++ b/etc/ERC-NEWS @@ -3,7 +3,150 @@ ERC NEWS -*- outline -*- Copyright (C) 2006-2021 Free Software Foundation, Inc. See the end of the file for license conditions. -* For changes after ERC 5.3, see the main Emacs NEWS file +* Changes in ERC 5.4 + +** Starting with Emacs 28.1 and ERC 5.4, ERC NEWS are added here again. +After ERC 5.3, since November 2012, ERC's NEWS items were added in the +main Emacs NEWS file, and users were referred to there. Now, starting +with Emacs 28.1 and ERC 5.4, which mark ERC's release to GNU ELPA, ERC +NEWS have been moved to this file again, so that we can include a NEWS +file consisting only of ERC changes in ERC's package on GNU ELPA. + +The NEWS entries for ERC changes in Emacs 28.1 have been moved from +the main Emacs NEWS file to here. For ERC NEWS entries corresponding +to Emacs versions before 28, to avoid modifying the NEWS file for all +of those releases, the ERC NEWS entries have only been copied below, +and the NEWS.* files were left intact. + +*** New option 'erc-rename-buffers'. + +*** New faces 'erc-my-nick-prefix-face' and 'erc-nick-prefix-face'. + +*** 'erc-format-@nick' displays all user modes instead of only op and voice. + +*** The display of irc commands in the current buffer has been disabled. + +*** 'erc-version' now follows the Emacs version. + +*** ERC can now hide message types by network or channel. +'erc-hide-list' will hide all messages of the specified type, while +'erc-network-hide-list' and 'erc-channel-hide-list' will only hide the +specified message types for the respective specified targets. + +*** Reconnection is now asynchronous. + +*** Nick completion is now case-insensitive again after inadvertently +being made case-sensitive in Emacs 24.2. + +*** New variable 'erc-default-port-tls' used to connect to TLS IRC +servers. + +*** New hook 'erc-insert-done-hook'. +This hook is called after strings have been inserted into the buffer, +and is free to alter point and window configurations, as it's not +called from inside a 'save-excursion', as opposed to 'erc-insert-post-hook'. + +*** 'erc-button-google-url' has been renamed to 'erc-button-search-url' +and its value has been changed to Duck Duck Go. + +*** 'erc-send-pre-hook' and 'erc-send-this' have been obsoleted. +The user option to use instead to alter text to be sent is now +'erc-pre-send-functions'. + +*** Improve matching/highlighting of nicknames. +Open and close parenthesis and apostrophe are not considered valid +nick characters anymore, matching the given grammar in RFC 2812 +section 2.3.1. This enables correct matching and highlighting of +nicks when they are surrounded by parentheses, like "(nick)", and when +adjacent to an apostrophe, like "nick's". + +*** Set 'erc-button-url-regexp' to 'browse-url-button-regexp' +which better handles surrounding pair of parentheses. + +*** New function 'erc-switch-to-buffer-other-window' +which is like 'erc-switch-to-buffer', but opens the buffer in another +window. + +*** New function 'erc-track-switch-buffer-other-window' +which is like 'erc-track-switch-buffer', but opens the buffer in +another window. + +*** NickServ passwords can now be retrieved from auth-source. +The 'erc-use-auth-source-for-nickserv-password' user option enables +querying auth-source for NickServ passwords. To enable this, add the +following to your init file: + + (setq erc-use-auth-source-for-nickserv-password t) + +*** NickServ identification now prompts for password last. +When 'erc-prompt-for-nickserv-password' is non-nil, the user used to +be unconditionally prompted interactively for a password, regardless +of the value of 'erc-nickserv-passwords', which was effectively +ignored (same for the new +'erc-use-auth-source-for-nickserv-password'). This limitation is now +lifted, and the user is interactively prompted last, after the other +identification methods have run. + +*** The '/ignore' command will now ask for a timeout to stop ignoring the user. +Allowed inputs are seconds or ISO8601-like periods like "1h" or "4h30m". + +*** ERC now recognizes 'C-]' for italic text. +Italic text is displayed in the new 'erc-italic-face'. + +*** erc-match.el now supports 'message' highlight type (not including the nick). +The 'erc-current-nick-highlight-type', 'erc-pal-highlight-type', +'erc-fool-highlight-type', 'erc-keyword-highlight-type', and +'erc-dangerous-host-highlight-type' user options now support a +'message' type for highlighting the entire message but not the +sender's nick. + +*** erc-status-sidebar.el is now part of ERC. +The 'erc-status-sidebar' package which provides a HexChat-like +activity overview sidebar for joined IRC channels is now part of ERC. + +*** erc-tls now supports specifying a TLS client certificate. +The 'erc-tls' function has been updated to allow specifying a TLS +client certificate for authentication, as an alternative to NickServ +password-based authentication. This is referred to as "CertFP" (short +for Certificate Fingerprint) by several IRC networks. See the Info +node "(erc) Connecting" in the ERC manual for more details and +examples on how to specify and use TLS client certificates with +'erc-tls'. + +*** Update IRC-related references to point to Libera.Chat. +The Free Software Foundation and the GNU Project have moved their +official IRC channels from the Freenode network to Libera.Chat. +For the original announcement and the follow-up update, including +more details, see: + +https://lists.gnu.org/archive/html/info-gnu/2021-06/msg00005.html +https://lists.gnu.org/archive/html/info-gnu/2021-06/msg00007.html + +Given the relocation of GNU and FSF's official IRC channels, as well +as #emacs and various other Emacs-themed channels (see the link below) +to Libera.Chat, IRC-related references in the Emacs repository have +now been updated to point to Libera.Chat. + +https://lists.gnu.org/archive/html/info-gnu-emacs/2021-06/msg00000.html + +*** Add 'erc-track-select-mode-line-face' (obsoletes 'erc-track-find-face'). +The 'erc-track-find-face' function of the erc-track module has been +declared obsolete and rewritten as 'erc-track-select-mode-line-face', +with different expected arguments (the current and old faces are now +separated) and clearer documentation. + +*** Add '/opme' and '/deopme' convenience commands. +The new '/opme' convenience command asks ChanServ to set the operator +status for the current nick in the current channel, and '/deopme' +unsets it. + +*** Add '/wii' convenience command for whois with idle time. +The new '/wii' convenience command calls the '/whois' command with the +given nick as both arguments, which is useful for displaying the whois +information for the nick along with idle time, even if the nick is on +a different server than the one the current user is connected to. +Using the given nick itself instead of the server it is connected to +is not standardized, but is widely supported across IRC networks. * Changes in ERC 5.3 diff --git a/etc/NEWS b/etc/NEWS index 8b327fac0f..8f49d67ba9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2852,76 +2852,8 @@ non-nil. ** ERC ---- -*** NickServ passwords can now be retrieved from auth-source. -The 'erc-use-auth-source-for-nickserv-password' user option enables -querying auth-source for NickServ passwords. To enable this, add the -following to your init file: - - (setq erc-use-auth-source-for-nickserv-password t) - ---- -*** NickServ identification now prompts for password last. -When 'erc-prompt-for-nickserv-password' is non-nil, the user used to -be unconditionally prompted interactively for a password, regardless -of the value of 'erc-nickserv-passwords', which was effectively -ignored (same for the new -'erc-use-auth-source-for-nickserv-password'). This limitation is now -lifted, and the user is interactively prompted last, after the other -identification methods have run. - ---- -*** The '/ignore' command will now ask for a timeout to stop ignoring the user. -Allowed inputs are seconds or ISO8601-like periods like "1h" or "4h30m". - ---- -*** ERC now recognizes 'C-]' for italic text. -Italic text is displayed in the new 'erc-italic-face'. - ---- -*** erc-match.el now supports 'message' highlight type (not including the nick). -The 'erc-current-nick-highlight-type', 'erc-pal-highlight-type', -'erc-fool-highlight-type', 'erc-keyword-highlight-type', and -'erc-dangerous-host-highlight-type' user options now support a -'message' type for highlighting the entire message but not the -sender's nick. - ---- -*** erc-status-sidebar.el is now part of ERC. -The 'erc-status-sidebar' package which provides a HexChat-like -activity overview sidebar for joined IRC channels is now part of ERC. - -+++ -*** erc-tls now supports specifying a TLS client certificate. -The 'erc-tls' function has been updated to allow specifying a TLS -client certificate for authentication, as an alternative to NickServ -password-based authentication. This is referred to as "CertFP" (short -for Certificate Fingerprint) by several IRC networks. See the Info -node "(erc) Connecting" in the ERC manual for more details and -examples on how to specify and use TLS client certificates with -'erc-tls'. - ---- -*** Add 'erc-track-select-mode-line-face' (obsoletes 'erc-track-find-face'). -The 'erc-track-find-face' function of the erc-track module has been -declared obsolete and rewritten as 'erc-track-select-mode-line-face', -with different expected arguments (the current and old faces are now -separated) and clearer documentation. - ---- -*** Add '/opme' and '/deopme' convenience commands. -The new '/opme' convenience command asks ChanServ to set the operator -status for the current nick in the current channel, and '/deopme' -unsets it. - ---- -*** Add '/wii' convenience command for whois with idle time. -The new '/wii' convenience command calls the '/whois' command with the -given nick as both arguments, which is useful for displaying the whois -information for the nick along with idle time, even if the nick is on -a different server than the one the current user is connected to. -Using the given nick itself instead of the server it is connected to -is not standardized, but is widely supported across IRC networks. +*** Starting with Emacs 28.1 and ERC 5.4, see the ERC-NEWS file for +user-visible changes in ERC. ** xwidget-webkit mode commit f7e6c199bf5b915e000bad964f3be2323d07647e Author: Juri Linkov Date: Wed Oct 6 19:38:09 2021 +0300 Clone the frame window configuration in 'clone-frame' * doc/emacs/frames.texi (Creating Frames): Mention the cloned window configuration for clone-frame. * lisp/frame.el (clone-frame): Change second arg to 'no-windows' and clone window configuration when it's nil. * lisp/tab-bar.el (tab-bar-mouse-context-menu) (tab-bar-detach-tab): Replace "Detach" with "Move" in help/doc strings. https://lists.gnu.org/archive/html/emacs-devel/2021-10/msg00408.html diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 06e2642638..8cf7568fc8 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -458,8 +458,8 @@ Create a new frame using the default frame parameters @item C-x 5 c @kindex C-x 5 c @findex clone-frame -Create a new frame using the parameters of the current frame -(@code{clone-frame}). +Create a new frame using the window configuration and frame parameters +of the current frame (@code{clone-frame}). @item C-x 5 b @var{bufname} @key{RET} Select buffer @var{bufname} in another frame. This runs diff --git a/etc/NEWS b/etc/NEWS index 8808413a6a..8b327fac0f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -352,8 +352,8 @@ of the next command to be displayed in a new frame. +++ *** New command 'clone-frame' (bound to 'C-x 5 c'). -This is like 'C-x 5 2', but uses the frame parameters of the current -frame instead of 'default-frame-alist'. +This is like 'C-x 5 2', but uses the window configuration and frame +parameters of the current frame instead of 'default-frame-alist'. --- *** Default values of 'frame-title-format' and 'icon-title-format' have changed. diff --git a/lisp/frame.el b/lisp/frame.el index e97b9903df..2c73737a54 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -786,25 +786,26 @@ When called from Lisp, returns the new frame." (make-frame) (select-frame (make-frame)))) -(defun clone-frame (&optional frame use-default-parameters) - "Make a new frame with the same parameters as FRAME. -With a prefix arg (USE-DEFAULT-PARAMETERS), use -`default-frame-alist' instead. +(defun clone-frame (&optional frame no-windows) + "Make a new frame with the same parameters and windows as FRAME. +With a prefix arg NO-WINDOWS, don't clone the window configuration. FRAME defaults to the selected frame. The frame is created on the same terminal as FRAME. If the terminal is a text-only terminal then also select the new frame." - (interactive "i\nP") - (if use-default-parameters - (make-frame-command) - (let* ((default-frame-alist (seq-filter - (lambda (elem) - (not (eq (car elem) 'name))) - (frame-parameters frame))) - (new-frame (make-frame))) - (unless (display-graphic-p) - (select-frame new-frame)) - new-frame))) + (interactive (list (selected-frame) current-prefix-arg)) + (let* ((frame (or frame (selected-frame))) + (windows (unless no-windows + (window-state-get (frame-root-window frame)))) + (default-frame-alist + (seq-remove (lambda (elem) (eq (car elem) 'name)) + (frame-parameters frame))) + (new-frame (make-frame))) + (when windows + (window-state-put windows (frame-root-window new-frame) 'safe)) + (unless (display-graphic-p) + (select-frame new-frame)) + new-frame)) (defvar before-make-frame-hook nil "Functions to run before `make-frame' creates a new frame.") diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 68afb539fa..b08b744267 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -316,7 +316,7 @@ that closes only when clicked on the close button." `(menu-item "Detach" (lambda () (interactive) (tab-bar-detach-tab ,tab-number)) - :help "Detach the tab to new frame")) + :help "Move the tab to new frame")) (define-key-after menu [close] `(menu-item "Close" (lambda () (interactive) (tab-bar-close-tab ,tab-number)) @@ -1208,8 +1208,8 @@ Interactively, ARG selects the ARGth different frame to move to." (force-mode-line-update t)))) (defun tab-bar-detach-tab (&optional from-number) - "Detach tab number FROM-NUMBER to a new frame. -Interactively or without argument, detach current tab." + "Move tab number FROM-NUMBER to a new frame. +Interactively or without argument, move the current tab." (interactive (list (1+ (tab-bar--current-tab-index)))) (let* ((tabs (funcall tab-bar-tabs-function)) (tab-index (1- (or from-number (1+ (tab-bar--current-tab-index tabs))))) commit 5f626488d82476e8bd07121e9798304fc405bc4a Author: Eli Zaretskii Date: Wed Oct 6 19:18:51 2021 +0300 * lisp/tool-bar.el (tool-bar-position): Doc fix. diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el index 6da401187b..f5d64aeb36 100644 --- a/lisp/tool-bar.el +++ b/lisp/tool-bar.el @@ -290,6 +290,8 @@ holds a keymap." "Specify on which side the tool bar shall be. Possible values are `top' (tool bar on top), `bottom' (tool bar at bottom), `left' (tool bar on left) and `right' (tool bar on right). +This option has effect only on graphical frames and only +if Emacs was built with GTK. Customize `tool-bar-mode' if you want to show or hide the tool bar." :version "24.1" :type '(choice (const top) commit 8d53c23f90aab6e527c61137ae43274c7a36eca7 Author: Stefan Monnier Date: Wed Oct 6 12:15:26 2021 -0400 * lisp/net/tramp-archive.el (tramp-archive-autoload-file-name-handler): Scope Fix the scoping of `tramp-archive-enabled`. diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index b28235924d..8bf25151df 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el @@ -353,6 +353,7 @@ arguments to pass to the OPERATION." ;;;###autoload (progn (defun tramp-archive-autoload-file-name-handler (operation &rest args) "Load Tramp archive file name handler, and perform OPERATION." + (defvar tramp-archive-autoload) (when tramp-archive-enabled ;; We cannot use `tramp-compat-temporary-file-directory' here due ;; to autoload. When installing Tramp's GNU ELPA package, there @@ -360,7 +361,6 @@ arguments to pass to the OPERATION." ;; overload this. (let ((default-directory temporary-file-directory) (tramp-archive-autoload t)) - tramp-archive-autoload ; Silence byte compiler. (apply #'tramp-autoload-file-name-handler operation args))))) ;;;###autoload commit 1b11fcae92e583621e6ef90fe777b15a34ac2623 Merge: 444dfc044f 1ccd3eb721 Author: Glenn Morris Date: Wed Oct 6 07:50:33 2021 -0700 Merge from origin/emacs-28 1ccd3eb721 (origin/emacs-28) ; Fix typo in etc/NEWS 0f28ee94ac * NEWS: Mention rcirc connects to #emacs by default aacafbe267 Refactor mh-utils-tests macro 'with-mh-test-env' ead5c5cc51 Avoid using variable before it has been initialized b2c50d7cf3 Clarify docstring of blink-matching-paren d2a34cabcf ; Very minor touch-up to a recent change 36a7ce4393 ; * doc/emacs/trouble.texi (After a Crash): Fix typo. 1cd1b2835b * doc/misc/gnus.texi (Loose Threads): Use regexp-opt in ex... 9f041cdfac Bump project.el version ad2287e659 Retain compatibility with older project.el projects d86b2e59c7 native-comp-available-p is the definitive test 1b383ac424 Minor fix of a recently installed documentation change 4d76765b6c Fix md5 issue in recent Gnulib merge 18308b739a Tweak recent 'configure' fix # Conflicts: # etc/NEWS commit 444dfc044f4cd64557f6af6dc567845999af9ed8 Author: Lars Ingebrigtsen Date: Wed Oct 6 13:19:13 2021 +0200 Reparent `gnus-article-mode-map' again * lisp/gnus/gnus-art.el (:keymap): Make `button-buffer-map' the parent of `gnus-article-mode-map' again. diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 9b738b91d9..bb466b9400 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -4389,6 +4389,7 @@ If variable `gnus-use-long-file-name' is non-nil, it is (defvar gnus-article-send-map nil) (define-keymap :keymap gnus-article-mode-map :suppress t + :parent button-buffer-map " " #'gnus-article-goto-next-page [?\S-\ ] #'gnus-article-goto-prev-page "\177" #'gnus-article-goto-prev-page commit 597b6deb294ace9178c8927f83ec08b92597b347 Author: Lars Ingebrigtsen Date: Wed Oct 6 12:55:17 2021 +0200 Add new major mode 'clean-mode' * doc/lispref/modes.texi (Major Modes): Document it. * lisp/simple.el (clean-mode): New major mode. diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index ee55f982d0..d55df7db4b 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -266,6 +266,18 @@ This function restores the major mode recorded by function calls @code{normal-mode} (@pxref{Auto Major Mode, normal-mode}), but tries to force it not to choose any modes in @var{avoided-modes}, if that argument is non-@code{nil}. +@end defun + +@defun clean-mode +Changing the major mode clears out most local variables, but it +doesn't remove all artefacts in the buffer (like text properties and +overlays). It's rare to change a buffer from one major mode to +another (except from @code{fundamental-mode} to everything else), so +this is usually not a concern. It can sometimes be convenient (mostly +when debugging a problem in a buffer) to do a ``full reset'' of the +buffer, and that's what the @code{clean-mode} major mode offers. It +will kill all local variables (even the permanently local ones), and +also removes all overlays and text properties. @end defun The easiest way to write a major mode is to use the macro diff --git a/etc/NEWS b/etc/NEWS index 7360bb7985..7b218aaf6d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -125,6 +125,11 @@ with recent versions of Firefox. * Lisp Changes in Emacs 29.1 ++++ +** New major mode 'clean-mode'. +This is a new major mode meant for debugging. It kills absolutely all +local variables and removes overlays and text properties. + +++ ** 'kill-all-local-variables' can now kill all local variables. If given the new optional KILL-PERMANENT argument, also kill permanent diff --git a/lisp/simple.el b/lisp/simple.el index 5c6adcf490..042715449b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -527,6 +527,18 @@ Other major modes are defined by comparison with this one." (kill-all-local-variables) (run-mode-hooks)) +(define-derived-mode clean-mode fundamental-mode "Clean" + "A mode that removes all overlays and text properties." + (kill-all-local-variables t) + (let ((inhibit-read-only t)) + (dolist (overlay (overlays-in (point-min) (point-max))) + (delete-overlay overlay)) + (set-text-properties (point-min) (point-max) nil) + (setq-local after-change-functions + (list + (lambda (begin end _length) + (set-text-properties begin end nil)))))) + ;; Special major modes to view specially formatted data rather than files. (defvar-keymap special-mode-map commit c0f7396588080ac48b72b905880d3f488e5becb3 Author: Lars Ingebrigtsen Date: Wed Oct 6 12:53:07 2021 +0200 Add an optional parameter to kill-all-local-variables * doc/lispref/variables.texi (Creating Buffer-Local): Document it (bug#30204). * src/buffer.c (Fkill_all_local_variables): Allow killing permanent local variables, too. * src/print.c (temp_output_buffer_setup): * src/minibuf.c (set_minibuffer_mode): Adjust callers. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index a1d1919b4b..d2247004bc 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -1695,12 +1695,14 @@ buffer-local variables interactively. @end deffn @cindex local variables, killed by major mode -@defun kill-all-local-variables +@defun kill-all-local-variables &optional kill-permanent This function eliminates all the buffer-local variable bindings of the -current buffer except for variables marked as permanent and local -hook functions that have a non-@code{nil} @code{permanent-local-hook} -property (@pxref{Setting Hooks}). As a result, the buffer will see -the default values of most variables. +current buffer. As a result, the buffer will see the default values +of most variables. By default, for variables marked as permanent and +local hook functions that have a non-@code{nil} +@code{permanent-local-hook} property (@pxref{Setting Hooks}) won't be +killed, but if the optional @var{kill-permanent} argument is +non-@code{nil}, even these variables will be killed. This function also resets certain other information pertaining to the buffer: it sets the local keymap to @code{nil}, the syntax table to the diff --git a/etc/NEWS b/etc/NEWS index ae3bba4f78..7360bb7985 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -125,6 +125,11 @@ with recent versions of Firefox. * Lisp Changes in Emacs 29.1 ++++ +** 'kill-all-local-variables' can now kill all local variables. +If given the new optional KILL-PERMANENT argument, also kill permanent +local variables. + +++ ** Third 'mapconcat' argument 'separator' is now optional. An explicit nil always meant the empty string, now it can be left out. diff --git a/src/buffer.c b/src/buffer.c index 4eb7ab6d6b..c5b2736ae3 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2805,7 +2805,7 @@ current buffer is cleared. */) } DEFUN ("kill-all-local-variables", Fkill_all_local_variables, - Skill_all_local_variables, 0, 0, 0, + Skill_all_local_variables, 0, 1, 0, doc: /* Switch to Fundamental mode by killing current buffer's local variables. Most local variable bindings are eliminated so that the default values become effective once more. Also, the syntax table is set from @@ -2816,18 +2816,20 @@ This function also forces redisplay of the mode line. Every function to select a new major mode starts by calling this function. -As a special exception, local variables whose names have -a non-nil `permanent-local' property are not eliminated by this function. +As a special exception, local variables whose names have a non-nil +`permanent-local' property are not eliminated by this function. If +the optional KILL-PERMANENT argument is non-nil, clear out these local +variables, too. The first thing this function does is run the normal hook `change-major-mode-hook'. */) - (void) + (Lisp_Object kill_permanent) { run_hook (Qchange_major_mode_hook); /* Actually eliminate all local bindings of this buffer. */ - reset_buffer_local_variables (current_buffer, 0); + reset_buffer_local_variables (current_buffer, !NILP (kill_permanent)); /* Force mode-line redisplay. Useful here because all major mode commands call this function. */ diff --git a/src/minibuf.c b/src/minibuf.c index 4b72d3e896..5455a93f69 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1005,7 +1005,7 @@ set_minibuffer_mode (Lisp_Object buf, EMACS_INT depth) if (!NILP (Ffboundp (Qminibuffer_inactive_mode))) call0 (Qminibuffer_inactive_mode); else - Fkill_all_local_variables (); + Fkill_all_local_variables (Qnil); } buf = unbind_to (count, buf); } diff --git a/src/print.c b/src/print.c index 9f684bbeb5..c13294c8e6 100644 --- a/src/print.c +++ b/src/print.c @@ -564,7 +564,7 @@ temp_output_buffer_setup (const char *bufname) Fset_buffer (Fget_buffer_create (build_string (bufname), Qnil)); - Fkill_all_local_variables (); + Fkill_all_local_variables (Qnil); delete_all_overlays (current_buffer); bset_directory (current_buffer, BVAR (old, directory)); bset_read_only (current_buffer, Qnil); commit ff31741b85593635e96cf67fea8fbc015cbbb582 Author: Michael Albinus Date: Wed Oct 6 12:24:45 2021 +0200 * admin/notes/emba (Emacs jobset): Update. * test/infra/gitlab-ci.yml (.test-template): Uncomment 'allow_failure', it isn't needed anymore. diff --git a/admin/notes/emba b/admin/notes/emba index 36b126e773..4e500bc92c 100644 --- a/admin/notes/emba +++ b/admin/notes/emba @@ -31,20 +31,26 @@ The Emacs jobset is defined in the Emacs source tree, file '.gitlab-ci.yml'. It could be adapted for every Emacs branch, see . +A jobset on Gitlab is called pipeline. Emacs pipelines run through +the stages 'build-images', 'platform-images' and 'native-comp-images' +(create an Emacs instance by 'make bootstrap' with different +configuration parameters) as well as 'normal', 'slow', 'platforms' and +'native-comp' (run respective test jobs based on the produced images). + Every job runs in a Debian docker container. It uses the local clone of the Emacs git repository to perform a bootstrap and test of Emacs. This could happen for several jobs with changed configuration, compile and test parameters. -There are different types of jobs: 'prep-image-base' is responsible to -prepare the environment for the following jobs. 'build-image-*' jobs -are responsible to compile Emacs in different configuration. The -corresponding 'test-*' jobs run the ert tests. +The 'build-image-*' jobs of the different '*-images' stages run only +if there are severe changes in the Emacs sources, like in Makefiles +etc. Otherwise they are skipped, and the corresponding 'test-*' jobs +run just 'make -C test ...' in the respective Docker image from a +previous build run. -A special job is 'test-all-inotify', which runs 'make check-expensive'. -While most of the jobs run as soon as a respective file has been -committed into the Emacs git repository, this test job runs scheduled, -every 8 hours. +Jobs in the 'build-images' and 'normal' stages are triggered by +changes of respective files in the Emacs git repository. All other +jobs run scheduled in a pipeline every 8 hours. The log files for every test job are kept on the server for a week. They can be downloaded from the server, visiting the URL diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index 8c4cf3f2ca..532d333e34 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -147,7 +147,7 @@ default: .test-template: # Do not block later stages. - allow_failure: true + # allow_failure: true # Do not run fast and normal test jobs when scheduled. rules: - if: '$CI_JOB_STAGE =~ "fast|normal" && $CI_PIPELINE_SOURCE == "schedule"' commit 5fb306462919314f5977e2e71875c8de13362be2 Author: Lars Ingebrigtsen Date: Wed Oct 6 12:07:33 2021 +0200 Make unused macro gnus-local-set-keys obsolete * lisp/gnus/gnus-util.el (gnus-local-set-keys): Make obsolete. diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 07ffdaff49..0163abad4b 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -300,7 +300,7 @@ Symbols are also allowed; their print names are used instead." (defmacro gnus-local-set-keys (&rest plist) "Set the keys in PLIST in the current keymap." - (declare (indent 1)) + (declare (obsolete define-keymap "29.1") (indent 1)) `(gnus-define-keys-1 (current-local-map) ',plist)) (defmacro gnus-define-keys (keymap &rest plist) commit 5eec541d6b16ab029c41623270b7f28c57e14382 Author: Lars Ingebrigtsen Date: Wed Oct 6 12:05:38 2021 +0200 Make unused gnus-define-keys-safe macro obsolete * lisp/gnus/gnus-util.el (gnus-define-keys-safe): Make obsolete. diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index ab4c423d58..07ffdaff49 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -310,7 +310,7 @@ Symbols are also allowed; their print names are used instead." (defmacro gnus-define-keys-safe (keymap &rest plist) "Define all keys in PLIST in KEYMAP without overwriting previous definitions." - (declare (indent 1)) + (declare (obsolete define-keymap "29.1") (indent 1)) `(gnus-define-keys-1 (quote ,keymap) (quote ,plist) t)) (defmacro gnus-define-keymap (keymap &rest plist) commit 453db254132f2621b5a2a37e313a64d3e30a4994 Author: Lars Ingebrigtsen Date: Wed Oct 6 12:04:37 2021 +0200 Use `define-keymap' in gnus-registry-install-shortcuts * lisp/gnus/gnus-registry.el (gnus-registry-install-shortcuts): Use `define-keymap'. diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index 11913a213b..9e581d4247 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el @@ -990,9 +990,8 @@ Uses `gnus-registry-marks' to find what shortcuts to install." gnus-registry-misc-menus) (gnus-message 9 "Defined mark handling function %s" function-name)))))) - (gnus-define-keys-1 - '(gnus-registry-mark-map "M" gnus-summary-mark-map) - keys-plist) + (define-key gnus-summary-mark-map "M" + (apply #'define-keymap :prefix "M" 'gnus-summary-mark-map keys-plist)) (add-hook 'gnus-summary-menu-hook (lambda () (easy-menu-add-item commit 2dd5fc85d134a35877beac6dd9750f58071e82cf Author: Lars Ingebrigtsen Date: Wed Oct 6 12:01:43 2021 +0200 Make `gnus-define-keymap' obsolete and adjust caller * lisp/gnus/gnus-kill.el (gnus-kill-file-mode-map): Use `define-keymap'. * lisp/gnus/gnus-util.el (gnus-define-keymap): Make obsolete. diff --git a/lisp/gnus/gnus-kill.el b/lisp/gnus/gnus-kill.el index 525823e72c..7e589c54e9 100644 --- a/lisp/gnus/gnus-kill.el +++ b/lisp/gnus/gnus-kill.el @@ -66,18 +66,15 @@ of time." ;;; Gnus Kill File Mode ;;; -(defvar gnus-kill-file-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map emacs-lisp-mode-map) - (gnus-define-keymap map - "\C-c\C-k\C-s" gnus-kill-file-kill-by-subject - "\C-c\C-k\C-a" gnus-kill-file-kill-by-author - "\C-c\C-k\C-t" gnus-kill-file-kill-by-thread - "\C-c\C-k\C-x" gnus-kill-file-kill-by-xref - "\C-c\C-a" gnus-kill-file-apply-buffer - "\C-c\C-e" gnus-kill-file-apply-last-sexp - "\C-c\C-c" gnus-kill-file-exit) - map)) +(defvar-keymap gnus-kill-file-mode-map + :parent emacs-lisp-mode-map + "\C-c\C-k\C-s" #'gnus-kill-file-kill-by-subject + "\C-c\C-k\C-a" #'gnus-kill-file-kill-by-author + "\C-c\C-k\C-t" #'gnus-kill-file-kill-by-thread + "\C-c\C-k\C-x" #'gnus-kill-file-kill-by-xref + "\C-c\C-a" #'gnus-kill-file-apply-buffer + "\C-c\C-e" #'gnus-kill-file-apply-last-sexp + "\C-c\C-c" #'gnus-kill-file-exit) (define-derived-mode gnus-kill-file-mode emacs-lisp-mode "Kill" "Major mode for editing kill files. diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 5bf2869983..ab4c423d58 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -315,7 +315,7 @@ Symbols are also allowed; their print names are used instead." (defmacro gnus-define-keymap (keymap &rest plist) "Define all keys in PLIST in KEYMAP." - (declare (indent 1)) + (declare (obsolete define-keymap "29.1") (indent 1)) `(gnus-define-keys-1 ,keymap (quote ,plist))) (defun gnus-define-keys-1 (keymap plist &optional safe) commit e006d4a2516c770be476e61e639ea461cd686d96 Author: Lars Ingebrigtsen Date: Wed Oct 6 11:58:16 2021 +0200 Fix gnus-start.el compilation warning * lisp/gnus/gnus-start.el (gnus-save-newsrc-file-last-timestamp): Move to avoid a compilation warning. diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index 8262a18b40..606bd3a39a 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -663,6 +663,7 @@ the first newsgroup." (defvar mail-sources) (defvar nnmail-scan-directory-mail-source-once) (defvar nnmail-split-history) +(defvar gnus-save-newsrc-file-last-timestamp nil) (defun gnus-close-all-servers () "Close all servers." @@ -2732,7 +2733,6 @@ The form should return either t or nil." 'msdos-long-file-names (lambda () t)))) -(defvar gnus-save-newsrc-file-last-timestamp nil) (defun gnus-save-newsrc-file (&optional force) "Save .newsrc file. Use the group string names in `gnus-group-list' to pull info commit 550745b98b83d94af29c9561d051bb1658efa6af Author: Lars Ingebrigtsen Date: Wed Oct 6 11:57:22 2021 +0200 Finish conversion of Gnus from `gnus-define-keys' * lisp/gnus/gnus-undo.el (gnus-undo-mode-map): * lisp/gnus/gnus-salt.el (gnus-pick-mode-map): (gnus-binary-mode-map): (gnus-tree-mode-map): * lisp/gnus/gnus-msg.el (gnus-summary-send-map): * lisp/gnus/gnus-ml.el (gnus-mailing-list-mode-map): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-setup): * lisp/gnus/gnus-art.el (gnus-article-mode-map): (gnus-article-edit-mode-map): Use `define-keymap' instead of * `gnus-define-keys'. diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index c2ec3f1f97..9b738b91d9 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -4386,44 +4386,43 @@ If variable `gnus-use-long-file-name' is non-nil, it is ;;; Gnus article mode ;;; -(set-keymap-parent gnus-article-mode-map button-buffer-map) - -(gnus-define-keys gnus-article-mode-map - " " gnus-article-goto-next-page - [?\S-\ ] gnus-article-goto-prev-page - "\177" gnus-article-goto-prev-page - [delete] gnus-article-goto-prev-page - "\C-c^" gnus-article-refer-article - "h" gnus-article-show-summary - "s" gnus-article-show-summary - "\C-c\C-m" gnus-article-mail - "?" gnus-article-describe-briefly - "<" beginning-of-buffer - ">" end-of-buffer - "\C-c\C-i" gnus-info-find-node - "\C-c\C-b" gnus-bug - "R" gnus-article-reply-with-original - "F" gnus-article-followup-with-original - "\C-hk" gnus-article-describe-key - "\C-hc" gnus-article-describe-key-briefly - "\C-hb" gnus-article-describe-bindings - - "e" gnus-article-read-summary-keys - "\C-d" gnus-article-read-summary-keys - "\C-c\C-f" gnus-summary-mail-forward - "\M-*" gnus-article-read-summary-keys - "\M-#" gnus-article-read-summary-keys - "\M-^" gnus-article-read-summary-keys - "\M-g" gnus-article-read-summary-keys) +(defvar gnus-article-send-map nil) + +(define-keymap :keymap gnus-article-mode-map :suppress t + " " #'gnus-article-goto-next-page + [?\S-\ ] #'gnus-article-goto-prev-page + "\177" #'gnus-article-goto-prev-page + [delete] #'gnus-article-goto-prev-page + "\C-c^" #'gnus-article-refer-article + "h" #'gnus-article-show-summary + "s" #'gnus-article-show-summary + "\C-c\C-m" #'gnus-article-mail + "?" #'gnus-article-describe-briefly + "<" #'beginning-of-buffer + ">" #'end-of-buffer + "\C-c\C-i" #'gnus-info-find-node + "\C-c\C-b" #'gnus-bug + "R" #'gnus-article-reply-with-original + "F" #'gnus-article-followup-with-original + "\C-hk" #'gnus-article-describe-key + "\C-hc" #'gnus-article-describe-key-briefly + "\C-hb" #'gnus-article-describe-bindings + + "e" #'gnus-article-read-summary-keys + "\C-d" #'gnus-article-read-summary-keys + "\C-c\C-f" #'gnus-summary-mail-forward + "\M-*" #'gnus-article-read-summary-keys + "\M-#" #'gnus-article-read-summary-keys + "\M-^" #'gnus-article-read-summary-keys + "\M-g" #'gnus-article-read-summary-keys + + "S" (define-keymap :prefix 'gnus-article-send-map + "W" #'gnus-article-wide-reply-with-original + [t] #'gnus-article-read-summary-send-keys)) (substitute-key-definition #'undefined #'gnus-article-read-summary-keys gnus-article-mode-map) -(defvar gnus-article-send-map) -(gnus-define-keys (gnus-article-send-map "S" gnus-article-mode-map) - "W" gnus-article-wide-reply-with-original - [t] gnus-article-read-summary-send-keys) - (defun gnus-article-make-menu-bar () (unless (boundp 'gnus-article-commands-menu) (gnus-summary-make-menu-bar)) @@ -7216,50 +7215,43 @@ other groups." (defvar gnus-article-edit-done-function nil) -(defvar gnus-article-edit-mode-map nil) - -;; Should we be using derived.el for this? -(unless gnus-article-edit-mode-map - (setq gnus-article-edit-mode-map (make-keymap)) - (set-keymap-parent gnus-article-edit-mode-map text-mode-map) - - (gnus-define-keys gnus-article-edit-mode-map - "\C-c?" describe-mode - "\C-c\C-c" gnus-article-edit-done - "\C-c\C-k" gnus-article-edit-exit - "\C-c\C-f\C-t" message-goto-to - "\C-c\C-f\C-o" message-goto-from - "\C-c\C-f\C-b" message-goto-bcc - ;;"\C-c\C-f\C-w" message-goto-fcc - "\C-c\C-f\C-c" message-goto-cc - "\C-c\C-f\C-s" message-goto-subject - "\C-c\C-f\C-r" message-goto-reply-to - "\C-c\C-f\C-n" message-goto-newsgroups - "\C-c\C-f\C-d" message-goto-distribution - "\C-c\C-f\C-f" message-goto-followup-to - "\C-c\C-f\C-m" message-goto-mail-followup-to - "\C-c\C-f\C-k" message-goto-keywords - "\C-c\C-f\C-u" message-goto-summary - "\C-c\C-f\C-i" message-insert-or-toggle-importance - "\C-c\C-f\C-a" message-generate-unsubscribed-mail-followup-to - "\C-c\C-b" message-goto-body - "\C-c\C-i" message-goto-signature - - "\C-c\C-t" message-insert-to - "\C-c\C-n" message-insert-newsgroups - "\C-c\C-o" message-sort-headers - "\C-c\C-e" message-elide-region - "\C-c\C-v" message-delete-not-region - "\C-c\C-z" message-kill-to-signature - "\M-\r" message-newline-and-reformat - "\C-c\C-a" mml-attach-file - "\C-a" message-beginning-of-line - "\t" message-tab - "\M-;" comment-region) - - (gnus-define-keys (gnus-article-edit-wash-map - "\C-c\C-w" gnus-article-edit-mode-map) - "f" gnus-article-edit-full-stops)) +(defvar-keymap gnus-article-edit-mode-map + :full t :parent text-mode-map + "\C-c?" #'describe-mode + "\C-c\C-c" #'gnus-article-edit-done + "\C-c\C-k" #'gnus-article-edit-exit + "\C-c\C-f\C-t" #'message-goto-to + "\C-c\C-f\C-o" #'message-goto-from + "\C-c\C-f\C-b" #'message-goto-bcc + ;;"\C-c\C-f\C-w" message-goto-fcc + "\C-c\C-f\C-c" #'message-goto-cc + "\C-c\C-f\C-s" #'message-goto-subject + "\C-c\C-f\C-r" #'message-goto-reply-to + "\C-c\C-f\C-n" #'message-goto-newsgroups + "\C-c\C-f\C-d" #'message-goto-distribution + "\C-c\C-f\C-f" #'message-goto-followup-to + "\C-c\C-f\C-m" #'message-goto-mail-followup-to + "\C-c\C-f\C-k" #'message-goto-keywords + "\C-c\C-f\C-u" #'message-goto-summary + "\C-c\C-f\C-i" #'message-insert-or-toggle-importance + "\C-c\C-f\C-a" #'message-generate-unsubscribed-mail-followup-to + "\C-c\C-b" #'message-goto-body + "\C-c\C-i" #'message-goto-signature + + "\C-c\C-t" #'message-insert-to + "\C-c\C-n" #'message-insert-newsgroups + "\C-c\C-o" #'message-sort-headers + "\C-c\C-e" #'message-elide-region + "\C-c\C-v" #'message-delete-not-region + "\C-c\C-z" #'message-kill-to-signature + "\M-\r" #'message-newline-and-reformat + "\C-c\C-a" #'mml-attach-file + "\C-a" #'message-beginning-of-line + "\t" #'message-tab + "\M-;" #'comment-region + + "\C-c\C-w" (define-keymap :prefix 'gnus-article-edit-wash-map + "f" #'gnus-article-edit-full-stops)) (easy-menu-define gnus-article-edit-mode-field-menu gnus-article-edit-mode-map "" diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el index 15da356e87..81e46d7a51 100644 --- a/lisp/gnus/gnus-icalendar.el +++ b/lisp/gnus/gnus-icalendar.el @@ -1062,13 +1062,14 @@ These will be used to retrieve the RSVP information from ical events." (add-to-list 'mm-automatic-display "text/calendar") (add-to-list 'mm-inline-media-tests '("text/calendar" gnus-icalendar-mm-inline identity)) - (gnus-define-keys (gnus-summary-calendar-map "i" gnus-summary-mode-map) - "a" gnus-icalendar-reply-accept - "t" gnus-icalendar-reply-tentative - "d" gnus-icalendar-reply-decline - "c" gnus-icalendar-event-check-agenda - "e" gnus-icalendar-event-export - "s" gnus-icalendar-event-show) + (define-key gnus-summary-mode-map "i" + (define-keymap :prefix 'gnus-summary-calendar-map + "a" #'gnus-icalendar-reply-accept + "t" #'gnus-icalendar-reply-tentative + "d" #'gnus-icalendar-reply-decline + "c" #'gnus-icalendar-event-check-agenda + "e" #'gnus-icalendar-event-export + "s" #'gnus-icalendar-event-show)) (require 'gnus-art) (add-to-list 'gnus-mime-action-alist diff --git a/lisp/gnus/gnus-ml.el b/lisp/gnus/gnus-ml.el index ee3abf2f7b..bf33194cf7 100644 --- a/lisp/gnus/gnus-ml.el +++ b/lisp/gnus/gnus-ml.el @@ -31,16 +31,13 @@ ;;; Mailing list minor mode -(defvar gnus-mailing-list-mode-map - (let ((map (make-sparse-keymap))) - (gnus-define-keys map - "\C-c\C-nh" gnus-mailing-list-help - "\C-c\C-ns" gnus-mailing-list-subscribe - "\C-c\C-nu" gnus-mailing-list-unsubscribe - "\C-c\C-np" gnus-mailing-list-post - "\C-c\C-no" gnus-mailing-list-owner - "\C-c\C-na" gnus-mailing-list-archive) - map)) +(defvar-keymap gnus-mailing-list-mode-map + "\C-c\C-nh" #'gnus-mailing-list-help + "\C-c\C-ns" #'gnus-mailing-list-subscribe + "\C-c\C-nu" #'gnus-mailing-list-unsubscribe + "\C-c\C-np" #'gnus-mailing-list-post + "\C-c\C-no" #'gnus-mailing-list-owner + "\C-c\C-na" #'gnus-mailing-list-archive) (defvar gnus-mailing-list-menu) diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index 8a3272042f..e88aa8f7d0 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el @@ -349,39 +349,39 @@ only affect the Gcc copy, but not the original message." ;;; Gnus Posting Functions ;;; -(gnus-define-keys (gnus-summary-send-map "S" gnus-summary-mode-map) - "p" gnus-summary-post-news - "i" gnus-summary-news-other-window - "f" gnus-summary-followup - "F" gnus-summary-followup-with-original - "c" gnus-summary-cancel-article - "s" gnus-summary-supersede-article - "r" gnus-summary-reply - "y" gnus-summary-yank-message - "R" gnus-summary-reply-with-original - "L" gnus-summary-reply-to-list-with-original - "w" gnus-summary-wide-reply - "W" gnus-summary-wide-reply-with-original - "v" gnus-summary-very-wide-reply - "V" gnus-summary-very-wide-reply-with-original - "n" gnus-summary-followup-to-mail - "N" gnus-summary-followup-to-mail-with-original - "m" gnus-summary-mail-other-window - "u" gnus-uu-post-news - "A" gnus-summary-attach-article - "\M-c" gnus-summary-mail-crosspost-complaint - "Br" gnus-summary-reply-broken-reply-to - "BR" gnus-summary-reply-broken-reply-to-with-original - "om" gnus-summary-mail-forward - "op" gnus-summary-post-forward - "Om" gnus-uu-digest-mail-forward - "Op" gnus-uu-digest-post-forward) - -(gnus-define-keys (gnus-send-bounce-map "D" gnus-summary-send-map) - "b" gnus-summary-resend-bounced-mail - ;; "c" gnus-summary-send-draft - "r" gnus-summary-resend-message - "e" gnus-summary-resend-message-edit) +(define-keymap :prefix 'gnus-summary-send-map + "p" #'gnus-summary-post-news + "i" #'gnus-summary-news-other-window + "f" #'gnus-summary-followup + "F" #'gnus-summary-followup-with-original + "c" #'gnus-summary-cancel-article + "s" #'gnus-summary-supersede-article + "r" #'gnus-summary-reply + "y" #'gnus-summary-yank-message + "R" #'gnus-summary-reply-with-original + "L" #'gnus-summary-reply-to-list-with-original + "w" #'gnus-summary-wide-reply + "W" #'gnus-summary-wide-reply-with-original + "v" #'gnus-summary-very-wide-reply + "V" #'gnus-summary-very-wide-reply-with-original + "n" #'gnus-summary-followup-to-mail + "N" #'gnus-summary-followup-to-mail-with-original + "m" #'gnus-summary-mail-other-window + "u" #'gnus-uu-post-news + "A" #'gnus-summary-attach-article + "\M-c" #'gnus-summary-mail-crosspost-complaint + "Br" #'gnus-summary-reply-broken-reply-to + "BR" #'gnus-summary-reply-broken-reply-to-with-original + "om" #'gnus-summary-mail-forward + "op" #'gnus-summary-post-forward + "Om" #'gnus-uu-digest-mail-forward + "Op" #'gnus-uu-digest-post-forward + + "D" (define-keymap :prefix 'gnus-send-bounce-map + "b" #'gnus-summary-resend-bounced-mail + ;; "c" gnus-summary-send-draft + "r" #'gnus-summary-resend-message + "e" #'gnus-summary-resend-message-edit)) ;;; Internal functions. diff --git a/lisp/gnus/gnus-salt.el b/lisp/gnus/gnus-salt.el index dc81dfc5f6..8ffe4a4c57 100644 --- a/lisp/gnus/gnus-salt.el +++ b/lisp/gnus/gnus-salt.el @@ -64,15 +64,12 @@ It accepts the same format specs that `gnus-summary-line-format' does." ;;; Internal variables. -(defvar gnus-pick-mode-map - (let ((map (make-sparse-keymap))) - (gnus-define-keys map - " " gnus-pick-next-page - "u" gnus-pick-unmark-article-or-thread - "." gnus-pick-article-or-thread - [down-mouse-2] gnus-pick-mouse-pick-region - "\r" gnus-pick-start-reading) - map)) +(defvar-keymap gnus-pick-mode-map + " " #'gnus-pick-next-page + "u" #'gnus-pick-unmark-article-or-thread + "." #'gnus-pick-article-or-thread + [down-mouse-2] #'gnus-pick-mouse-pick-region + "\r" #'gnus-pick-start-reading) (defun gnus-pick-make-menu-bar () (unless (boundp 'gnus-pick-menu) @@ -315,11 +312,8 @@ This must be bound to a button-down mouse event." (defvar gnus-binary-mode-hook nil "Hook run in summary binary mode buffers.") -(defvar gnus-binary-mode-map - (let ((map (make-sparse-keymap))) - (gnus-define-keys map - "g" gnus-binary-show-article) - map)) +(defvar-keymap gnus-binary-mode-map + "g" #'gnus-binary-show-article) (defun gnus-binary-make-menu-bar () (unless (boundp 'gnus-binary-menu) @@ -424,21 +418,17 @@ Two predefined functions are available: (defvar gnus-tree-displayed-thread nil) (defvar gnus-tree-inhibit nil) -(defvar gnus-tree-mode-map - (let ((map (make-keymap))) - (suppress-keymap map) - (gnus-define-keys - map - "\r" gnus-tree-select-article - [mouse-2] gnus-tree-pick-article - "\C-?" gnus-tree-read-summary-keys - "h" gnus-tree-show-summary - - "\C-c\C-i" gnus-info-find-node) - - (substitute-key-definition - 'undefined 'gnus-tree-read-summary-keys map) - map)) +(defvar-keymap gnus-tree-mode-map + :full t :suppress t + "\r" #'gnus-tree-select-article + [mouse-2] #'gnus-tree-pick-article + "\C-?" #'gnus-tree-read-summary-keys + "h" #'gnus-tree-show-summary + + "\C-c\C-i" #'gnus-info-find-node) + +(substitute-key-definition 'undefined #'gnus-tree-read-summary-keys + gnus-tree-mode-map) (defun gnus-tree-make-menu-bar () (unless (boundp 'gnus-tree-menu) diff --git a/lisp/gnus/gnus-undo.el b/lisp/gnus/gnus-undo.el index 64ed2bbad6..182c8743e0 100644 --- a/lisp/gnus/gnus-undo.el +++ b/lisp/gnus/gnus-undo.el @@ -75,15 +75,12 @@ ;;; Minor mode definition. -(defvar gnus-undo-mode-map - (let ((map (make-sparse-keymap))) - (gnus-define-keys map - "\M-\C-_" gnus-undo - "\C-_" gnus-undo - "\C-xu" gnus-undo - ;; many people are used to type `C-/' on X terminals and get `C-_'. - [(control /)] gnus-undo) - map)) +(defvar-keymap gnus-undo-mode-map + "\M-\C-_" #'gnus-undo + "\C-_" #'gnus-undo + "\C-xu" #'gnus-undo + ;; many people are used to type `C-/' on X terminals and get `C-_'. + [(control /)] #'gnus-undo) (defun gnus-undo-make-menu-bar () ;; This is disabled for the time being. commit 8e37466efc36dab153a9c784ce1ff41c5a663318 Author: Lars Ingebrigtsen Date: Wed Oct 6 11:18:16 2021 +0200 Clear gnus-save-newsrc-file-last-timestamp on start and exit * lisp/gnus/gnus-start.el (gnus-clear-system): Clear `gnus-save-newsrc-file-last-timestamp' on start and exit (bug#51053). diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index c7be958edd..8262a18b40 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -707,6 +707,7 @@ the first newsgroup." gnus-current-select-method nil nnmail-split-history nil gnus-extended-servers nil + gnus-save-newsrc-file-last-timestamp nil gnus-ephemeral-servers nil) (gnus-shutdown 'gnus) ;; Kill the startup file. commit 74aaf8b72762ea65eb755321f0cb8561aca54479 Author: Arash Esbati Date: Wed Oct 6 11:14:45 2021 +0200 Improve finding external documents in reftext * lisp/textmodes/reftex-parse.el (reftex-parse-from-file): Extend regexp in order to support \externalcitedocument macro and a second optional argument provided by LaTeX package xr-hyper (bug#51054). diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el index c521a07f19..b8c75cb21b 100644 --- a/lisp/textmodes/reftex-parse.el +++ b/lisp/textmodes/reftex-parse.el @@ -345,7 +345,17 @@ of master file." ;; Find external document specifications (goto-char 1) - (while (re-search-forward "[\n\r][ \t]*\\\\externaldocument\\(\\[\\([^]]*\\)\\]\\)?{\\([^}]+\\)}" nil t) + (while (re-search-forward + (concat "[\n\r][ \t]*" + ;; Support \externalcitedocument macro + "\\\\external\\(?:cite\\)?document" + ;; The optional prefix + "\\(\\[\\([^]]*\\)\\]\\)?" + ;; The 2nd opt. arg can only be nocite + "\\(?:\\[nocite\\]\\)?" + ;; Mandatory file argument + "{\\([^}]+\\)}") + nil t) (push (list 'xr-doc (reftex-match-string 2) (reftex-match-string 3)) docstruct)) commit 1ccd3eb7214aee3d741bec164134b3b7510a2143 Author: Michael Albinus Date: Wed Oct 6 10:57:02 2021 +0200 ; Fix typo in etc/NEWS diff --git a/etc/NEWS b/etc/NEWS index 6ad288b376..8808413a6a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3032,7 +3032,7 @@ Face 'mh-folder-whitelisted' is renamed 'mh-folder-allowlisted'. *** rcirc now supports SASL authentication. --- -*** #emacs on Libera.chat has been added to rcirc-server-alist +*** #emacs on Libera.chat has been added to 'rcirc-server-alist'. --- *** rcirc connects asynchronously. commit c5c545e45eba866ca7c5931a6f4a86891035222b Author: Miha Rihtaršič Date: Tue Oct 5 12:20:45 2021 +0200 Add tests for incomplete escape sequences in ansi-color-tests * test/lisp/ansi-color-tests.el (ansi-color-tests-equal-props): New function. (ansi-color-incomplete-sequences-test): New ert test (bug#50806). diff --git a/test/lisp/ansi-color-tests.el b/test/lisp/ansi-color-tests.el index 16a1ba4a89..14a14ca4f0 100644 --- a/test/lisp/ansi-color-tests.el +++ b/test/lisp/ansi-color-tests.el @@ -24,6 +24,7 @@ ;;; Code: (require 'ansi-color) +(eval-when-compile (require 'cl-lib)) (defvar ansi-color-tests--strings (let ((bright-yellow (face-foreground 'ansi-color-bright-yellow nil 'default)) @@ -61,6 +62,17 @@ ("\e[48;2;135;255;255;1mHello World\e[0m" "Hello World" (ansi-color-bold (:background ,custom-color)))))) +(defun ansi-color-tests-equal-props (o1 o2) + "Return t if two Lisp objects have similar structure and contents. +While `equal-including-properties' compares text properties of +strings with `eq', this function compares them with `equal'." + (or (equal-including-properties o1 o2) + (and (stringp o1) + (equal o1 o2) + (cl-loop for i below (length o1) + always (equal (text-properties-at i o1) + (text-properties-at i o2)))))) + (ert-deftest ansi-color-apply-on-region-test () (pcase-dolist (`(,input ,text ,face) ansi-color-tests--strings) (with-temp-buffer @@ -91,6 +103,76 @@ (ansi-color-apply-on-region (point-min) (point-max) t) (should (equal (buffer-string) (car pair)))))) +(ert-deftest ansi-color-incomplete-sequences-test () + (let* ((strs (list "\e[" "2;31m Hello World " + "\e" "[108;5;12" "3m" "Greetings" + "\e[0m\e[35;6m" "Hello")) + (complete-str (apply #'concat strs)) + (filtered-str) + (propertized-str) + (ansi-color-apply-face-function + #'ansi-color-apply-text-property-face) + (ansi-filt (lambda (str) (ansi-color-filter-apply + (copy-sequence str)))) + (ansi-app (lambda (str) (ansi-color-apply + (copy-sequence str))))) + + (with-temp-buffer + (setq filtered-str + (replace-regexp-in-string "\e\\[.*?m" "" complete-str)) + (setq propertized-str (funcall ansi-app complete-str)) + + (should-not (ansi-color-tests-equal-props + filtered-str propertized-str)) + (should (equal filtered-str propertized-str))) + + ;; Tests for `ansi-color-filter-apply' + (with-temp-buffer + (should (equal-including-properties + filtered-str + (funcall ansi-filt complete-str)))) + + (with-temp-buffer + (should (equal-including-properties + filtered-str + (mapconcat ansi-filt strs "")))) + + ;; Tests for `ansi-color-filter-region' + (with-temp-buffer + (insert complete-str) + (ansi-color-filter-region (point-min) (point-max)) + (should (equal-including-properties + filtered-str (buffer-string)))) + + (with-temp-buffer + (dolist (str strs) + (let ((opoint (point))) + (insert str) + (ansi-color-filter-region opoint (point)))) + (should (equal-including-properties + filtered-str (buffer-string)))) + + ;; Test for `ansi-color-apply' + (with-temp-buffer + (should (ansi-color-tests-equal-props + propertized-str + (mapconcat ansi-app strs "")))) + + ;; Tests for `ansi-color-apply-on-region' + (with-temp-buffer + (insert complete-str) + (ansi-color-apply-on-region (point-min) (point-max)) + (should (ansi-color-tests-equal-props + propertized-str (buffer-string)))) + + (with-temp-buffer + (dolist (str strs) + (let ((opoint (point))) + (insert str) + (ansi-color-apply-on-region opoint (point)))) + (should (ansi-color-tests-equal-props + propertized-str (buffer-string)))))) + (provide 'ansi-color-tests) ;;; ansi-color-tests.el ends here commit a8b2d858995398b184b57af85eb08565537650bc Author: Miha Rihtaršič Date: Tue Oct 5 11:14:22 2021 +0200 Documentation fixes for recent ansi-color additions * lisp/ansi-color.el (ansi-color-context-region): Improve formatting. * lisp/term.el (term-ansi-face-already-done): (term-handle-colors-array): Fix obsoleting version (bug#50806). diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index aaaf60cd00..2e51264ec3 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -656,9 +656,9 @@ COLOR is less than 16." "Context saved between two calls to `ansi-color-apply-on-region'. This is a list of the form (FACE-VEC MARKER) or nil. FACE-VEC represents the state the last call to `ansi-color-apply-on-region' -ended with, currently a list of the form +ended with, currently a list of the form: -(BASIC-FACES FG BG). + (BASIC-FACES FG BG). BASIC-FACES is a bool-vector that specifies which basic faces from `ansi-color-basic-faces-vector' to apply. FG and BG are diff --git a/lisp/term.el b/lisp/term.el index ce086c379b..0e36e877e6 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -723,7 +723,7 @@ Buffer local variable.") (defvar term-ansi-current-invisible nil) (make-obsolete-variable 'term-ansi-face-already-done - "it doesn't have any effect." "28.1") + "it doesn't have any effect." "29.1") ;;; Faces (defvar ansi-term-color-vector @@ -3346,7 +3346,7 @@ otherwise use the current foreground color." ;; have any bold/underline/fg/bg/reverse combination. -mm (defun term-handle-colors-array (parameter) - (declare (obsolete term--handle-colors-list "28.1")) + (declare (obsolete term--handle-colors-list "29.1")) (term--handle-colors-list (list parameter))) (defun term--handle-colors-list (parameters) commit 8b67eef5a1ce761230feb804d0ec17bf5f214730 Author: Yuri D'Elia Date: Wed Oct 6 10:43:47 2021 +0200 Document the improved scroll-margin behavior * etc/NEWS: document the improved `scroll-margin' behavior. diff --git a/etc/NEWS b/etc/NEWS index e9fcfba425..ae3bba4f78 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -61,6 +61,13 @@ case keys. This command increases (or decreases) the number of empty lines before point. +--- +*** Improved mouse behavior with auto-scrolling modes. +When clicking inside the `scroll-margin' or `hscroll-margin' region +the point is now moved only when releasing the mouse button. This no +longer results in a bogus selection, unless the mouse has been +effectively dragged. + * Changes in Specialized Modes and Packages in Emacs 29.1 commit dc5bb729589ce10734a1a03536026ded8745eba0 Author: Yuri D'Elia Date: Wed Oct 6 10:43:22 2021 +0200 Perform cleanup on errors in mouse-drag-track * lisp/mouse.el (mouse-drag-track): Disable both scroll-margin and auto-hscroll-mode in mouse-drag-region and do not re-enable them until dragging is over, making selections work as expected when inside the margins. * lisp/mouse.el (mouse-drag-track): Correctly reset original values changed during execution if errors occur. diff --git a/lisp/mouse.el b/lisp/mouse.el index 3c457a36c5..1cbdaaf812 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -1593,75 +1593,81 @@ The region will be defined with mark and point." ;; Save original automatic scrolling behavior (see below). (auto-hscroll-mode-saved auto-hscroll-mode) (scroll-margin-saved scroll-margin) - (old-track-mouse track-mouse)) - - (setq mouse-selection-click-count click-count) - - ;; Suppress automatic scrolling near the edges while tracking - ;; movement, as it interferes with the natural dragging behavior - ;; (point will unexpectedly be moved beneath the pointer, making - ;; selections in auto-scrolling margins impossible). - (setq auto-hscroll-mode nil) - (setq scroll-margin 0) + (old-track-mouse track-mouse) + (cleanup (lambda () + (setq track-mouse old-track-mouse) + (setq auto-hscroll-mode auto-hscroll-mode-saved) + (setq scroll-margin scroll-margin-saved)))) + (condition-case err + (progn + (setq mouse-selection-click-count click-count) + + ;; Suppress automatic scrolling near the edges while tracking + ;; movement, as it interferes with the natural dragging behavior + ;; (point will unexpectedly be moved beneath the pointer, making + ;; selections in auto-scrolling margins impossible). + (setq auto-hscroll-mode nil) + (setq scroll-margin 0) + + ;; In case the down click is in the middle of some intangible text, + ;; use the end of that text, and put it in START-POINT. + (if (< (point) start-point) + (goto-char start-point)) + (setq start-point (point)) + + ;; Activate the region, using `mouse-start-end' to determine where + ;; to put point and mark (e.g., double-click will select a word). + (setq-local transient-mark-mode + (if (eq transient-mark-mode 'lambda) + '(only) + (cons 'only transient-mark-mode))) + (let ((range (mouse-start-end start-point start-point click-count))) + (push-mark (nth 0 range) t t) + (goto-char (nth 1 range))) - ;; In case the down click is in the middle of some intangible text, - ;; use the end of that text, and put it in START-POINT. - (if (< (point) start-point) - (goto-char start-point)) - (setq start-point (point)) + (setf (terminal-parameter nil 'mouse-drag-start) start-event) + (setq track-mouse t) - ;; Activate the region, using `mouse-start-end' to determine where - ;; to put point and mark (e.g., double-click will select a word). - (setq-local transient-mark-mode - (if (eq transient-mark-mode 'lambda) - '(only) - (cons 'only transient-mark-mode))) - (let ((range (mouse-start-end start-point start-point click-count))) - (push-mark (nth 0 range) t t) - (goto-char (nth 1 range))) - - (setf (terminal-parameter nil 'mouse-drag-start) start-event) - (setq track-mouse t) - - (set-transient-map - (let ((map (make-sparse-keymap))) - (define-key map [switch-frame] #'ignore) - (define-key map [select-window] #'ignore) - (define-key map [mouse-movement] - (lambda (event) (interactive "e") - (let* ((end (event-end event)) - (end-point (posn-point end))) - (unless (eq end-point start-point) - ;; And remember that we have moved, so mouse-set-region can know - ;; its event is really a drag event. - (setcar start-event 'mouse-movement)) - (if (and (eq (posn-window end) start-window) - (integer-or-marker-p end-point)) - (mouse--drag-set-mark-and-point start-point - end-point click-count) - (let ((mouse-row (cdr (cdr (mouse-position))))) - (cond - ((null mouse-row)) - ((< mouse-row top) - (mouse-scroll-subr start-window (- mouse-row top) - nil start-point)) - ((>= mouse-row bottom) - (mouse-scroll-subr start-window (1+ (- mouse-row bottom)) - nil start-point)))))))) - map) - t (lambda () - (setq track-mouse old-track-mouse) - (setq auto-hscroll-mode auto-hscroll-mode-saved) - (setq scroll-margin scroll-margin-saved) - ;; Don't deactivate the mark when the context menu was invoked - ;; by down-mouse-3 immediately after down-mouse-1 and without - ;; releasing the mouse button with mouse-1. This allows to use - ;; region-related context menu to operate on the selected region. - (unless (and context-menu-mode - (eq (car-safe (aref (this-command-keys-vector) 0)) - 'down-mouse-3)) - (deactivate-mark) - (pop-mark)))))) + (set-transient-map + (let ((map (make-sparse-keymap))) + (define-key map [switch-frame] #'ignore) + (define-key map [select-window] #'ignore) + (define-key map [mouse-movement] + (lambda (event) (interactive "e") + (let* ((end (event-end event)) + (end-point (posn-point end))) + (unless (eq end-point start-point) + ;; And remember that we have moved, so mouse-set-region can know + ;; its event is really a drag event. + (setcar start-event 'mouse-movement)) + (if (and (eq (posn-window end) start-window) + (integer-or-marker-p end-point)) + (mouse--drag-set-mark-and-point start-point + end-point click-count) + (let ((mouse-row (cdr (cdr (mouse-position))))) + (cond + ((null mouse-row)) + ((< mouse-row top) + (mouse-scroll-subr start-window (- mouse-row top) + nil start-point)) + ((>= mouse-row bottom) + (mouse-scroll-subr start-window (1+ (- mouse-row bottom)) + nil start-point)))))))) + map) + t (lambda () + (funcall cleanup) + ;; Don't deactivate the mark when the context menu was invoked + ;; by down-mouse-3 immediately after down-mouse-1 and without + ;; releasing the mouse button with mouse-1. This allows to use + ;; region-related context menu to operate on the selected region. + (unless (and context-menu-mode + (eq (car-safe (aref (this-command-keys-vector) 0)) + 'down-mouse-3)) + (deactivate-mark) + (pop-mark))))) + ;; Cleanup on errors + (error (funcall cleanup) + (signal (car err) (cdr err)))))) (defun mouse--drag-set-mark-and-point (start click click-count) (let* ((range (mouse-start-end start click click-count)) commit e62d1fa9831cc4f046b330f438f8bd49a27a2458 Author: Yuri D'Elia Date: Wed Oct 6 10:42:56 2021 +0200 Improve interaction between mouse-drag-region and scroll-margin * lisp/mouse.el (mouse-drag-track): Disable both scroll-margin and auto-hscroll-mode in mouse-drag-region and do not re-enable them until dragging is over, making selections work as expected when inside the margins. diff --git a/lisp/mouse.el b/lisp/mouse.el index bb47d04a3a..3c457a36c5 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -1568,8 +1568,7 @@ The region will be defined with mark and point." (mouse-minibuffer-check start-event) (setq mouse-selection-click-count-buffer (current-buffer)) (deactivate-mark) - (let* ((scroll-margin 0) ; Avoid margin scrolling (Bug#9541). - (start-posn (event-start start-event)) + (let* ((start-posn (event-start start-event)) (start-point (posn-point start-posn)) (start-window (posn-window start-posn)) (_ (with-current-buffer (window-buffer start-window) @@ -1591,12 +1590,20 @@ The region will be defined with mark and point." ;; Don't count the mode line. (1- (nth 3 bounds)))) (click-count (1- (event-click-count start-event))) - ;; Suppress automatic hscrolling, because that is a nuisance - ;; when setting point near the right fringe (but see below). + ;; Save original automatic scrolling behavior (see below). (auto-hscroll-mode-saved auto-hscroll-mode) + (scroll-margin-saved scroll-margin) (old-track-mouse track-mouse)) (setq mouse-selection-click-count click-count) + + ;; Suppress automatic scrolling near the edges while tracking + ;; movement, as it interferes with the natural dragging behavior + ;; (point will unexpectedly be moved beneath the pointer, making + ;; selections in auto-scrolling margins impossible). + (setq auto-hscroll-mode nil) + (setq scroll-margin 0) + ;; In case the down click is in the middle of some intangible text, ;; use the end of that text, and put it in START-POINT. (if (< (point) start-point) @@ -1615,7 +1622,6 @@ The region will be defined with mark and point." (setf (terminal-parameter nil 'mouse-drag-start) start-event) (setq track-mouse t) - (setq auto-hscroll-mode nil) (set-transient-map (let ((map (make-sparse-keymap))) @@ -1626,8 +1632,6 @@ The region will be defined with mark and point." (let* ((end (event-end event)) (end-point (posn-point end))) (unless (eq end-point start-point) - ;; As soon as the user moves, we can re-enable auto-hscroll. - (setq auto-hscroll-mode auto-hscroll-mode-saved) ;; And remember that we have moved, so mouse-set-region can know ;; its event is really a drag event. (setcar start-event 'mouse-movement)) @@ -1648,6 +1652,7 @@ The region will be defined with mark and point." t (lambda () (setq track-mouse old-track-mouse) (setq auto-hscroll-mode auto-hscroll-mode-saved) + (setq scroll-margin scroll-margin-saved) ;; Don't deactivate the mark when the context menu was invoked ;; by down-mouse-3 immediately after down-mouse-1 and without ;; releasing the mouse button with mouse-1. This allows to use commit 0f28ee94ac953d7e1572ce06f5269008dac9b043 Author: Philip Kaludercic Date: Wed Oct 6 09:16:14 2021 +0200 * NEWS: Mention rcirc connects to #emacs by default diff --git a/etc/NEWS b/etc/NEWS index c3bfc9c947..6ad288b376 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3031,6 +3031,9 @@ Face 'mh-folder-whitelisted' is renamed 'mh-folder-allowlisted'. +++ *** rcirc now supports SASL authentication. +--- +*** #emacs on Libera.chat has been added to rcirc-server-alist + --- *** rcirc connects asynchronously. commit 405660e785228bbfe375f8997174f0a33fd5838b Author: Lars Ingebrigtsen Date: Wed Oct 6 09:05:22 2021 +0200 Fix up gnus-summary-mode-map after previous change * lisp/gnus/gnus-sum.el (:keymap): Fix two sub-maps that were moved to the wrong place. diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 6d09576684..ab8c578c9c 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -2032,8 +2032,6 @@ increase the score of each group you read." "b" #'gnus-article-view-part "\M-t" #'gnus-summary-toggle-display-buttonized - "V" #'gnus-summary-score-map - "X" #'gnus-uu-extract-map "S" #'gnus-summary-send-map ;; Sort of orthogonal keymaps. @@ -2058,13 +2056,32 @@ increase the score of each group you read." "\C-c" #'gnus-summary-catchup-all "k" #'gnus-summary-kill-same-subject-and-select "K" #'gnus-summary-kill-same-subject - "P" #'gnus-uu-mark-map) - "V" (define-keymap :prefix 'gnus-summary-mscore-map - "c" #'gnus-summary-clear-above - "u" #'gnus-summary-tick-above - "m" #'gnus-summary-mark-above - "k" #'gnus-summary-kill-below) + "P" (define-keymap :prefix 'gnus-uu-mark-map + "p" #'gnus-summary-mark-as-processable + "u" #'gnus-summary-unmark-as-processable + "U" #'gnus-summary-unmark-all-processable + "v" #'gnus-uu-mark-over + "s" #'gnus-uu-mark-series + "r" #'gnus-uu-mark-region + "g" #'gnus-uu-unmark-region + "R" #'gnus-uu-mark-by-regexp + "G" #'gnus-uu-unmark-by-regexp + "t" #'gnus-uu-mark-thread + "T" #'gnus-uu-unmark-thread + "a" #'gnus-uu-mark-all + "b" #'gnus-uu-mark-buffer + "S" #'gnus-uu-mark-sparse + "k" #'gnus-summary-kill-process-mark + "y" #'gnus-summary-yank-process-mark + "w" #'gnus-summary-save-process-mark + "i" #'gnus-uu-invert-processable) + + "V" (define-keymap :prefix 'gnus-summary-mscore-map + "c" #'gnus-summary-clear-above + "u" #'gnus-summary-tick-above + "m" #'gnus-summary-mark-above + "k" #'gnus-summary-kill-below)) "/" (define-keymap :prefix 'gnus-summary-limit-map "/" #'gnus-summary-limit-to-subject @@ -2340,26 +2357,6 @@ increase the score of each group you read." "i" #'gnus-article-inline-part "|" #'gnus-article-pipe-part) - "P" (define-keymap :prefix 'gnus-uu-mark-map - "p" #'gnus-summary-mark-as-processable - "u" #'gnus-summary-unmark-as-processable - "U" #'gnus-summary-unmark-all-processable - "v" #'gnus-uu-mark-over - "s" #'gnus-uu-mark-series - "r" #'gnus-uu-mark-region - "g" #'gnus-uu-unmark-region - "R" #'gnus-uu-mark-by-regexp - "G" #'gnus-uu-unmark-by-regexp - "t" #'gnus-uu-mark-thread - "T" #'gnus-uu-unmark-thread - "a" #'gnus-uu-mark-all - "b" #'gnus-uu-mark-buffer - "S" #'gnus-uu-mark-sparse - "k" #'gnus-summary-kill-process-mark - "y" #'gnus-summary-yank-process-mark - "w" #'gnus-summary-save-process-mark - "i" #'gnus-uu-invert-processable) - "X" (define-keymap :prefix 'gnus-uu-extract-map ;;"x" gnus-uu-extract-any "m" #'gnus-summary-save-parts commit aacafbe267306a2bb5d504ae408008d1ff7e9c8f Author: Stephen Gildea Date: Tue Oct 5 20:32:59 2021 -0700 Refactor mh-utils-tests macro 'with-mh-test-env' * test/lisp/mh-e/mh-utils-tests.el (with-mh-test-env): Refactor to reduce the size of the expanded macro. (mh-test-utils-setup): New helper function. (mh-ensure-native-trampolines): Absorbed by mh-test-utils-setup. diff --git a/test/lisp/mh-e/mh-utils-tests.el b/test/lisp/mh-e/mh-utils-tests.el index f1282ab44a..bf684dbbea 100644 --- a/test/lisp/mh-e/mh-utils-tests.el +++ b/test/lisp/mh-e/mh-utils-tests.el @@ -95,26 +95,28 @@ install an MH variant and test it interactively." (mh-sub-folders-cache (make-hash-table :test #'equal)) ;; remember the original value (original-mh-envvar (getenv "MH"))) - (unless mh-test-variant-logged-already - (mh-variant-set mh-variant) - (setq mh-test-variant-logged-already t)) (unwind-protect (progn - (if mh-variant-in-use - (setq temp-home-dir (mh-test-utils-setup-with-variant)) - (mh-test-utils-setup-with-mocks)) + (setq temp-home-dir (mh-test-utils-setup)) ,@body) (if temp-home-dir (delete-directory temp-home-dir t)) (setenv "MH" original-mh-envvar)))) -(defun mh-ensure-native-trampolines () - "Build head of time the trampolines we'll need. -As `call-process'' and `file-directory-p' will be redefined, the -native compiler will invoke `call-process' to compile the -respective trampolines. To avoid interferences with the -`call-process' mocking we build these AOT." +(defun mh-test-utils-setup () + "Set dynamically bound variables needed by mock and/or variants. +Return the name of the root of the created directory tree, if any." + (unless mh-test-variant-logged-already + (mh-variant-set mh-variant) + (setq mh-test-variant-logged-already t)) + ;; As `call-process'' and `file-directory-p' will be redefined, the + ;; native compiler will invoke `call-process' to compile the + ;; respective trampolines. To avoid interference with the + ;; `call-process' mocking, we build these ahead of time. (when (native-comp-available-p) - (mapc #'comp-subr-trampoline-install '(call-process file-directory-p)))) + (mapc #'comp-subr-trampoline-install '(call-process file-directory-p))) + (if mh-variant-in-use + (mh-test-utils-setup-with-variant) + (mh-test-utils-setup-with-mocks))) (defun mh-test-utils-setup-with-mocks () "Set dynamically bound variables so that MH programs are mocked out. @@ -125,9 +127,10 @@ The tests use this method if no configured MH variant is found." (mh-populate-sub-folders-cache "+rela-folder/bar") (mh-populate-sub-folders-cache "+rela-folder/foo") (mh-populate-sub-folders-cache "+rela-folder/food") - (mh-ensure-native-trampolines) (fset 'call-process #'mh-test-utils-mock-call-process) - (fset 'file-directory-p #'mh-test-utils-mock-file-directory-p)) + (fset 'file-directory-p #'mh-test-utils-mock-file-directory-p) + ;; no temp directory created + nil) (defun mh-test-utils-mock-call-process (program &optional _infile _destination _display @@ -196,7 +199,7 @@ Return the name of the root of the created directory tree. Set dynamically bound variables so that MH programs may log. The tests use this method if a configured MH variant is found." (let* ((temp-home-dir - (make-temp-file "emacs-mh-e-unit-test" t)) + (make-temp-file "emacs-mh-e-unit-test-" t)) (profile (expand-file-name ".mh_profile" temp-home-dir)) (mail-dir (expand-file-name "Mail" temp-home-dir)) @@ -215,7 +218,6 @@ The tests use this method if a configured MH variant is found." (make-directory (expand-file-name "foo" abso-folder) t) (make-directory (expand-file-name "food" abso-folder) t) (setq mh-test-abs-folder abso-folder) - (mh-ensure-native-trampolines) (fset 'call-process #'mh-test-utils-log-call-process) (fset 'file-directory-p #'mh-test-utils-log-file-directory-p) temp-home-dir)) commit ead5c5cc5196c373421eaf8ebd996e652a37de81 Author: Stefan Kangas Date: Tue Oct 5 23:22:16 2021 +0200 Avoid using variable before it has been initialized * lisp/ibuffer.el (ibuffer-shrink-to-fit): Don't try to use ibuffer-auto-mode variable before ibuf-ext.el has been loaded. (Bug#51029) diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 6c0180590b..046595a4d9 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -1079,7 +1079,8 @@ a new window in the current frame, splitting vertically." ;; Make sure that redisplay is performed, otherwise there can be a ;; bad interaction with code in the window-scroll-functions hook (redisplay t) - (when (buffer-local-value 'ibuffer-auto-mode (window-buffer)) + (when (and (boundp 'ibuffer-auto-mode) ; ibuf-ext.el might not be loaded yet + (buffer-local-value 'ibuffer-auto-mode (window-buffer))) (fit-window-to-buffer nil (and owin (/ (frame-height) commit b2c50d7cf36b8df931be0864f586cdf272886b11 Author: Stefan Kangas Date: Tue Oct 5 23:11:31 2021 +0200 Clarify docstring of blink-matching-paren * lisp/simple.el (blink-matching-paren): Clarify docstring. (Bug#51032) diff --git a/lisp/simple.el b/lisp/simple.el index 3695415163..459fc67944 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -8419,11 +8419,16 @@ presented." (defcustom blink-matching-paren t "Non-nil means show matching open-paren when close-paren is inserted. -If t, highlight the paren. If `jump', briefly move cursor to its -position. If `jump-offscreen', move cursor there even if the -position is off screen. With any other non-nil value, the -off-screen position of the opening paren will be shown in the -echo area." +In addition, if the opening paren is not visible on screen, show +its position in the echo area. + +The valid values are: + + nil Disable. + non-nil Highlight the opening paren. + `jump' Briefly move cursor to its position. + `jump-offscreen' Briefly move cursor to its position, + even if the opening paren is not on screen." :type '(choice (const :tag "Disable" nil) (const :tag "Highlight" t) commit 3ff29babbfa2f8b46848944629c1e047291e916b Author: Lars Ingebrigtsen Date: Tue Oct 5 21:49:26 2021 +0200 Convert more parts of Gnus from `gnus-define-keys' to `define-keymap' * lisp/gnus/spam.el (gnus-summary-mode-map): * lisp/gnus/gnus-topic.el (gnus-topic-mode-map): * lisp/gnus/gnus-sum.el (gnus-summary-mode-map): * lisp/gnus/gnus-srvr.el (gnus-server-mode-map): (gnus-server-mode-map): (gnus-browse-mode-map): * lisp/gnus/gnus-score.el (gnus-summary-score-map): * lisp/gnus/gnus-draft.el (gnus-draft-mode-map): * lisp/gnus/gnus-agent.el (gnus-agent-group-mode-map): (gnus-agent-summary-mode-map): (gnus-agent-server-mode-map): (gnus-category-mode-map): Convert from `gnus-define-keys' to `define-keymap'. * lisp/gnus/gnus.el: Define more commands. diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index 6426d82546..20da295aca 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el @@ -475,17 +475,16 @@ manipulated as follows: (gnus-run-hooks 'gnus-agent-mode-hook (intern (format "gnus-agent-%s-mode-hook" buffer))))) -(defvar gnus-agent-group-mode-map (make-sparse-keymap)) -(gnus-define-keys gnus-agent-group-mode-map - "Ju" gnus-agent-fetch-groups - "Jc" gnus-enter-category-buffer - "Jj" gnus-agent-toggle-plugged - "Js" gnus-agent-fetch-session - "JY" gnus-agent-synchronize-flags - "JS" gnus-group-send-queue - "Ja" gnus-agent-add-group - "Jr" gnus-agent-remove-group - "Jo" gnus-agent-toggle-group-plugged) +(defvar-keymap gnus-agent-group-mode-map + "Ju" #'gnus-agent-fetch-groups + "Jc" #'gnus-enter-category-buffer + "Jj" #'gnus-agent-toggle-plugged + "Js" #'gnus-agent-fetch-session + "JY" #'gnus-agent-synchronize-flags + "JS" #'gnus-group-send-queue + "Ja" #'gnus-agent-add-group + "Jr" #'gnus-agent-remove-group + "Jo" #'gnus-agent-toggle-group-plugged) (defun gnus-agent-group-make-menu-bar () (unless (boundp 'gnus-agent-group-menu) @@ -504,16 +503,15 @@ manipulated as follows: ["Synchronize flags" gnus-agent-synchronize-flags t] )))) -(defvar gnus-agent-summary-mode-map (make-sparse-keymap)) -(gnus-define-keys gnus-agent-summary-mode-map - "Jj" gnus-agent-toggle-plugged - "Ju" gnus-agent-summary-fetch-group - "JS" gnus-agent-fetch-group - "Js" gnus-agent-summary-fetch-series - "J#" gnus-agent-mark-article - "J\M-#" gnus-agent-unmark-article - "@" gnus-agent-toggle-mark - "Jc" gnus-agent-catchup) +(defvar-keymap gnus-agent-summary-mode-map + "Jj" #'gnus-agent-toggle-plugged + "Ju" #'gnus-agent-summary-fetch-group + "JS" #'gnus-agent-fetch-group + "Js" #'gnus-agent-summary-fetch-series + "J#" #'gnus-agent-mark-article + "J\M-#" #'gnus-agent-unmark-article + "@" #'gnus-agent-toggle-mark + "Jc" #'gnus-agent-catchup) (defun gnus-agent-summary-make-menu-bar () (unless (boundp 'gnus-agent-summary-menu) @@ -527,11 +525,10 @@ manipulated as follows: ["Fetch downloadable" gnus-agent-summary-fetch-group t] ["Catchup undownloaded" gnus-agent-catchup t])))) -(defvar gnus-agent-server-mode-map (make-sparse-keymap)) -(gnus-define-keys gnus-agent-server-mode-map - "Jj" gnus-agent-toggle-plugged - "Ja" gnus-agent-add-server - "Jr" gnus-agent-remove-server) +(defvar-keymap gnus-agent-server-mode-map + "Jj" #'gnus-agent-toggle-plugged + "Ja" #'gnus-agent-add-server + "Jr" #'gnus-agent-remove-server) (defun gnus-agent-server-make-menu-bar () (unless (boundp 'gnus-agent-server-menu) @@ -2597,25 +2594,20 @@ General format specifiers can also be used. See Info node (defvar gnus-category-line-format-spec nil) (defvar gnus-category-mode-line-format-spec nil) -(defvar gnus-category-mode-map nil) - -(unless gnus-category-mode-map - (setq gnus-category-mode-map (make-sparse-keymap)) - (suppress-keymap gnus-category-mode-map) - - (gnus-define-keys gnus-category-mode-map - "q" gnus-category-exit - "k" gnus-category-kill - "c" gnus-category-copy - "a" gnus-category-add - "e" gnus-agent-customize-category - "p" gnus-category-edit-predicate - "g" gnus-category-edit-groups - "s" gnus-category-edit-score - "l" gnus-category-list - - "\C-c\C-i" gnus-info-find-node - "\C-c\C-b" gnus-bug)) +(defvar-keymap gnus-category-mode-map + :suppress t + "q" #'gnus-category-exit + "k" #'gnus-category-kill + "c" #'gnus-category-copy + "a" #'gnus-category-add + "e" #'gnus-agent-customize-category + "p" #'gnus-category-edit-predicate + "g" #'gnus-category-edit-groups + "s" #'gnus-category-edit-score + "l" #'gnus-category-list + + "\C-c\C-i" #'gnus-info-find-node + "\C-c\C-b" #'gnus-bug) (defcustom gnus-category-menu-hook nil "Hook run after the creation of the menu." diff --git a/lisp/gnus/gnus-draft.el b/lisp/gnus/gnus-draft.el index 9a0f21359f..756e6d2d36 100644 --- a/lisp/gnus/gnus-draft.el +++ b/lisp/gnus/gnus-draft.el @@ -33,15 +33,12 @@ ;;; Draft minor mode -(defvar gnus-draft-mode-map - (let ((map (make-sparse-keymap))) - (gnus-define-keys map - "Dt" gnus-draft-toggle-sending - "e" gnus-draft-edit-message ;; Use `B w' for `gnus-summary-edit-article' - "De" gnus-draft-edit-message - "Ds" gnus-draft-send-message - "DS" gnus-draft-send-all-messages) - map)) +(defvar-keymap gnus-draft-mode-map + "Dt" #'gnus-draft-toggle-sending + "e" #' gnus-draft-edit-message ;; Use `B w' for `gnus-summary-edit-article' + "De" #'gnus-draft-edit-message + "Ds" #'gnus-draft-send-message + "DS" #'gnus-draft-send-all-messages) (defun gnus-draft-make-menu-bar () (unless (boundp 'gnus-draft-menu) diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el index e0ad9f698d..2ca2580295 100644 --- a/lisp/gnus/gnus-score.el +++ b/lisp/gnus/gnus-score.el @@ -502,19 +502,20 @@ of the last successful match.") ;;; Summary mode score maps. -(gnus-define-keys (gnus-summary-score-map "V" gnus-summary-mode-map) - "s" gnus-summary-set-score - "S" gnus-summary-current-score - "c" gnus-score-change-score-file - "C" gnus-score-customize - "m" gnus-score-set-mark-below - "x" gnus-score-set-expunge-below - "R" gnus-summary-rescore - "e" gnus-score-edit-current-scores - "f" gnus-score-edit-file - "F" gnus-score-flush-cache - "t" gnus-score-find-trace - "w" gnus-score-find-favorite-words) +(define-key gnus-summary-mode-map "V" + (define-keymap :prefix 'gnus-summary-score-map + "s" #'gnus-summary-set-score + "S" #'gnus-summary-current-score + "c" #'gnus-score-change-score-file + "C" #'gnus-score-customize + "m" #'gnus-score-set-mark-below + "x" #'gnus-score-set-expunge-below + "R" #'gnus-summary-rescore + "e" #'gnus-score-edit-current-scores + "f" #'gnus-score-edit-file + "F" #'gnus-score-flush-cache + "t" #'gnus-score-find-trace + "w" #'gnus-score-find-favorite-words)) ;; Summary score file commands diff --git a/lisp/gnus/gnus-srvr.el b/lisp/gnus/gnus-srvr.el index 5f2fc46333..f2ffb067b8 100644 --- a/lisp/gnus/gnus-srvr.el +++ b/lisp/gnus/gnus-srvr.el @@ -103,7 +103,43 @@ If nil, a faster, but more primitive, buffer is used instead." (defvar gnus-server-mode-line-format-spec nil) (defvar gnus-server-killed-servers nil) -(defvar gnus-server-mode-map nil) +(defvar-keymap gnus-server-mode-map + :full t :suppress t + " " #'gnus-server-read-server-in-server-buffer + "\r" #'gnus-server-read-server + [mouse-2] #'gnus-server-pick-server + "q" #'gnus-server-exit + "l" #'gnus-server-list-servers + "k" #'gnus-server-kill-server + "y" #'gnus-server-yank-server + "c" #'gnus-server-copy-server + "a" #'gnus-server-add-server + "e" #'gnus-server-edit-server + "S" #'gnus-server-show-server + "s" #'gnus-server-scan-server + + "O" #'gnus-server-open-server + "\M-o" #'gnus-server-open-all-servers + "C" #'gnus-server-close-server + "\M-c" #'gnus-server-close-all-servers + "D" #'gnus-server-deny-server + "L" #'gnus-server-offline-server + "R" #'gnus-server-remove-denials + + "n" #'next-line + "p" #'previous-line + + "g" #'gnus-server-regenerate-server + + "G" #'gnus-group-read-ephemeral-search-group + + "z" #'gnus-server-compact-server + + "i" #'gnus-server-toggle-cloud-server + "I" #'gnus-server-set-cloud-method-server + + "\C-c\C-i" #'gnus-info-find-node + "\C-c\C-b" #'gnus-bug) (defcustom gnus-server-menu-hook nil "Hook run after the creation of the server mode menu." @@ -145,47 +181,6 @@ If nil, a faster, but more primitive, buffer is used instead." (gnus-run-hooks 'gnus-server-menu-hook))) -(unless gnus-server-mode-map - (setq gnus-server-mode-map (make-keymap)) - (suppress-keymap gnus-server-mode-map) - - (gnus-define-keys gnus-server-mode-map - " " gnus-server-read-server-in-server-buffer - "\r" gnus-server-read-server - [mouse-2] gnus-server-pick-server - "q" gnus-server-exit - "l" gnus-server-list-servers - "k" gnus-server-kill-server - "y" gnus-server-yank-server - "c" gnus-server-copy-server - "a" gnus-server-add-server - "e" gnus-server-edit-server - "S" gnus-server-show-server - "s" gnus-server-scan-server - - "O" gnus-server-open-server - "\M-o" gnus-server-open-all-servers - "C" gnus-server-close-server - "\M-c" gnus-server-close-all-servers - "D" gnus-server-deny-server - "L" gnus-server-offline-server - "R" gnus-server-remove-denials - - "n" next-line - "p" previous-line - - "g" gnus-server-regenerate-server - - "G" gnus-group-read-ephemeral-search-group - - "z" gnus-server-compact-server - - "i" gnus-server-toggle-cloud-server - "I" gnus-server-set-cloud-method-server - - "\C-c\C-i" gnus-info-find-node - "\C-c\C-b" gnus-bug)) - (defface gnus-server-agent '((((class color) (background light)) (:foreground "PaleTurquoise" :bold t)) (((class color) (background dark)) (:foreground "PaleTurquoise" :bold t)) @@ -697,37 +692,31 @@ claim them." function (repeat function))) -(defvar gnus-browse-mode-map nil) - -(unless gnus-browse-mode-map - (setq gnus-browse-mode-map (make-keymap)) - (suppress-keymap gnus-browse-mode-map) - - (gnus-define-keys - gnus-browse-mode-map - " " gnus-browse-read-group - "=" gnus-browse-select-group - "n" gnus-browse-next-group - "p" gnus-browse-prev-group - "\177" gnus-browse-prev-group - [delete] gnus-browse-prev-group - "N" gnus-browse-next-group - "P" gnus-browse-prev-group - "\M-n" gnus-browse-next-group - "\M-p" gnus-browse-prev-group - "\r" gnus-browse-select-group - "u" gnus-browse-toggle-subscription-at-point - "l" gnus-browse-exit - "L" gnus-browse-exit - "q" gnus-browse-exit - "Q" gnus-browse-exit - "d" gnus-browse-describe-group - [delete] gnus-browse-delete-group - "\C-c\C-c" gnus-browse-exit - "?" gnus-browse-describe-briefly - - "\C-c\C-i" gnus-info-find-node - "\C-c\C-b" gnus-bug)) +(defvar-keymap gnus-browse-mode-map + :full t :suppress t + " " #'gnus-browse-read-group + "=" #'gnus-browse-select-group + "n" #'gnus-browse-next-group + "p" #'gnus-browse-prev-group + "\177" #'gnus-browse-prev-group + [delete] #'gnus-browse-prev-group + "N" #'gnus-browse-next-group + "P" #'gnus-browse-prev-group + "\M-n" #'gnus-browse-next-group + "\M-p" #'gnus-browse-prev-group + "\r" #'gnus-browse-select-group + "u" #'gnus-browse-toggle-subscription-at-point + "l" #'gnus-browse-exit + "L" #'gnus-browse-exit + "q" #'gnus-browse-exit + "Q" #'gnus-browse-exit + "d" #'gnus-browse-describe-group + [delete] #'gnus-browse-delete-group + "\C-c\C-c" #'gnus-browse-exit + "?" #'gnus-browse-describe-briefly + + "\C-c\C-i" #'gnus-info-find-node + "\C-c\C-b" #'gnus-bug) (defun gnus-browse-make-menu-bar () (gnus-turn-off-edit-menu 'browse) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index d790655aa9..6d09576684 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -1907,485 +1907,485 @@ increase the score of each group you read." ;; Non-orthogonal keys -(gnus-define-keys gnus-summary-mode-map - " " gnus-summary-next-page - [?\S-\ ] gnus-summary-prev-page - "\177" gnus-summary-prev-page - [delete] gnus-summary-prev-page - "\r" gnus-summary-scroll-up - "\M-\r" gnus-summary-scroll-down - "n" gnus-summary-next-unread-article - "p" gnus-summary-prev-unread-article - "N" gnus-summary-next-article - "P" gnus-summary-prev-article - "\M-\C-n" gnus-summary-next-same-subject - "\M-\C-p" gnus-summary-prev-same-subject - "\M-n" gnus-summary-next-unread-subject - "\M-p" gnus-summary-prev-unread-subject - "." gnus-summary-first-unread-article - "," gnus-summary-best-unread-article - "[" gnus-summary-prev-unseen-article - "]" gnus-summary-next-unseen-article - "\M-s\M-s" gnus-summary-search-article-forward - "\M-s\M-r" gnus-summary-search-article-backward - "\M-r" gnus-summary-search-article-backward - "\M-S" gnus-summary-repeat-search-article-forward - "\M-R" gnus-summary-repeat-search-article-backward - "<" gnus-summary-beginning-of-article - ">" gnus-summary-end-of-article - "j" gnus-summary-goto-article - "^" gnus-summary-refer-parent-article - "\M-^" gnus-summary-refer-article - "u" gnus-summary-tick-article-forward - "!" gnus-summary-tick-article-forward - "U" gnus-summary-tick-article-backward - "d" gnus-summary-mark-as-read-forward - "D" gnus-summary-mark-as-read-backward - "E" gnus-summary-mark-as-expirable - "\M-u" gnus-summary-clear-mark-forward - "\M-U" gnus-summary-clear-mark-backward - "k" gnus-summary-kill-same-subject-and-select - "\C-k" gnus-summary-kill-same-subject - "\M-\C-k" gnus-summary-kill-thread - "\M-\C-l" gnus-summary-lower-thread - "e" gnus-summary-edit-article - "#" gnus-summary-mark-as-processable - "\M-#" gnus-summary-unmark-as-processable - "\M-\C-t" gnus-summary-toggle-threads - "\M-\C-s" gnus-summary-show-thread - "\M-\C-h" gnus-summary-hide-thread - "\M-\C-f" gnus-summary-next-thread - "\M-\C-b" gnus-summary-prev-thread - [(meta down)] gnus-summary-next-thread - [(meta up)] gnus-summary-prev-thread - "\M-\C-u" gnus-summary-up-thread - "\M-\C-d" gnus-summary-down-thread - "&" gnus-summary-execute-command - "c" gnus-summary-catchup-and-exit - "\C-w" gnus-summary-mark-region-as-read - "\C-t" toggle-truncate-lines - "?" gnus-summary-mark-as-dormant - "\C-c\M-\C-s" gnus-summary-limit-include-expunged - "\C-c\C-s\C-n" gnus-summary-sort-by-number - "\C-c\C-s\C-m\C-n" gnus-summary-sort-by-most-recent-number - "\C-c\C-s\C-l" gnus-summary-sort-by-lines - "\C-c\C-s\C-c" gnus-summary-sort-by-chars - "\C-c\C-s\C-m\C-m" gnus-summary-sort-by-marks - "\C-c\C-s\C-a" gnus-summary-sort-by-author - "\C-c\C-s\C-t" gnus-summary-sort-by-recipient - "\C-c\C-s\C-s" gnus-summary-sort-by-subject - "\C-c\C-s\C-d" gnus-summary-sort-by-date - "\C-c\C-s\C-m\C-d" gnus-summary-sort-by-most-recent-date - "\C-c\C-s\C-i" gnus-summary-sort-by-score - "\C-c\C-s\C-o" gnus-summary-sort-by-original - "\C-c\C-s\C-r" gnus-summary-sort-by-random - "\C-c\C-s\C-u" gnus-summary-sort-by-newsgroups - "\C-c\C-s\C-x" gnus-summary-sort-by-extra - "=" gnus-summary-expand-window - "\C-x\C-s" gnus-summary-reselect-current-group - "\M-g" gnus-summary-rescan-group - "\C-c\C-r" gnus-summary-caesar-message - "f" gnus-summary-followup - "F" gnus-summary-followup-with-original - "C" gnus-summary-cancel-article - "r" gnus-summary-reply - "R" gnus-summary-reply-with-original - "\C-c\C-f" gnus-summary-mail-forward - "o" gnus-summary-save-article - "\C-o" gnus-summary-save-article-mail - "|" gnus-summary-pipe-output - "\M-k" gnus-summary-edit-local-kill - "\M-K" gnus-summary-edit-global-kill +(define-keymap :keymap gnus-summary-mode-map + " " #'gnus-summary-next-page + [?\S-\ ] #'gnus-summary-prev-page + "\177" #'gnus-summary-prev-page + [delete] #'gnus-summary-prev-page + "\r" #'gnus-summary-scroll-up + "\M-\r" #'gnus-summary-scroll-down + "n" #'gnus-summary-next-unread-article + "p" #'gnus-summary-prev-unread-article + "N" #'gnus-summary-next-article + "P" #'gnus-summary-prev-article + "\M-\C-n" #'gnus-summary-next-same-subject + "\M-\C-p" #'gnus-summary-prev-same-subject + "\M-n" #'gnus-summary-next-unread-subject + "\M-p" #'gnus-summary-prev-unread-subject + "." #'gnus-summary-first-unread-article + "," #'gnus-summary-best-unread-article + "[" #'gnus-summary-prev-unseen-article + "]" #'gnus-summary-next-unseen-article + "\M-s\M-s" #'gnus-summary-search-article-forward + "\M-s\M-r" #'gnus-summary-search-article-backward + "\M-r" #'gnus-summary-search-article-backward + "\M-S" #'gnus-summary-repeat-search-article-forward + "\M-R" #'gnus-summary-repeat-search-article-backward + "<" #'gnus-summary-beginning-of-article + ">" #'gnus-summary-end-of-article + "j" #'gnus-summary-goto-article + "^" #'gnus-summary-refer-parent-article + "\M-^" #'gnus-summary-refer-article + "u" #'gnus-summary-tick-article-forward + "!" #'gnus-summary-tick-article-forward + "U" #'gnus-summary-tick-article-backward + "d" #'gnus-summary-mark-as-read-forward + "D" #'gnus-summary-mark-as-read-backward + "E" #'gnus-summary-mark-as-expirable + "\M-u" #'gnus-summary-clear-mark-forward + "\M-U" #'gnus-summary-clear-mark-backward + "k" #'gnus-summary-kill-same-subject-and-select + "\C-k" #'gnus-summary-kill-same-subject + "\M-\C-k" #'gnus-summary-kill-thread + "\M-\C-l" #'gnus-summary-lower-thread + "e" #'gnus-summary-edit-article + "#" #'gnus-summary-mark-as-processable + "\M-#" #'gnus-summary-unmark-as-processable + "\M-\C-t" #'gnus-summary-toggle-threads + "\M-\C-s" #'gnus-summary-show-thread + "\M-\C-h" #'gnus-summary-hide-thread + "\M-\C-f" #'gnus-summary-next-thread + "\M-\C-b" #'gnus-summary-prev-thread + [(meta down)] #'gnus-summary-next-thread + [(meta up)] #'gnus-summary-prev-thread + "\M-\C-u" #'gnus-summary-up-thread + "\M-\C-d" #'gnus-summary-down-thread + "&" #'gnus-summary-execute-command + "c" #'gnus-summary-catchup-and-exit + "\C-w" #'gnus-summary-mark-region-as-read + "\C-t" #'toggle-truncate-lines + "?" #'gnus-summary-mark-as-dormant + "\C-c\M-\C-s" #'gnus-summary-limit-include-expunged + "\C-c\C-s\C-n" #'gnus-summary-sort-by-number + "\C-c\C-s\C-m\C-n" #'gnus-summary-sort-by-most-recent-number + "\C-c\C-s\C-l" #'gnus-summary-sort-by-lines + "\C-c\C-s\C-c" #'gnus-summary-sort-by-chars + "\C-c\C-s\C-m\C-m" #'gnus-summary-sort-by-marks + "\C-c\C-s\C-a" #'gnus-summary-sort-by-author + "\C-c\C-s\C-t" #'gnus-summary-sort-by-recipient + "\C-c\C-s\C-s" #'gnus-summary-sort-by-subject + "\C-c\C-s\C-d" #'gnus-summary-sort-by-date + "\C-c\C-s\C-m\C-d" #'gnus-summary-sort-by-most-recent-date + "\C-c\C-s\C-i" #'gnus-summary-sort-by-score + "\C-c\C-s\C-o" #'gnus-summary-sort-by-original + "\C-c\C-s\C-r" #'gnus-summary-sort-by-random + "\C-c\C-s\C-u" #'gnus-summary-sort-by-newsgroups + "\C-c\C-s\C-x" #'gnus-summary-sort-by-extra + "=" #'gnus-summary-expand-window + "\C-x\C-s" #'gnus-summary-reselect-current-group + "\M-g" #'gnus-summary-rescan-group + "\C-c\C-r" #'gnus-summary-caesar-message + "f" #'gnus-summary-followup + "F" #'gnus-summary-followup-with-original + "C" #'gnus-summary-cancel-article + "r" #'gnus-summary-reply + "R" #'gnus-summary-reply-with-original + "\C-c\C-f" #'gnus-summary-mail-forward + "o" #'gnus-summary-save-article + "\C-o" #'gnus-summary-save-article-mail + "|" #'gnus-summary-pipe-output + "\M-k" #'gnus-summary-edit-local-kill + "\M-K" #'gnus-summary-edit-global-kill ;; "V" gnus-version - "\C-c\C-d" gnus-summary-describe-group - "\C-c\C-p" gnus-summary-make-group-from-search - "q" gnus-summary-exit - "Q" gnus-summary-exit-no-update - "\C-c\C-i" gnus-info-find-node - [mouse-2] gnus-mouse-pick-article - [follow-link] mouse-face - "m" gnus-summary-mail-other-window - "a" gnus-summary-post-news - "x" gnus-summary-limit-to-unread - "s" gnus-summary-isearch-article - "\t" gnus-summary-button-forward - [backtab] gnus-summary-button-backward - "w" gnus-summary-browse-url - "t" gnus-summary-toggle-header - "g" gnus-summary-show-article - "l" gnus-summary-goto-last-article - "\C-c\C-v\C-v" gnus-uu-decode-uu-view - "\C-d" gnus-summary-enter-digest-group - "\M-\C-d" gnus-summary-read-document - "\M-\C-e" gnus-summary-edit-parameters - "\M-\C-a" gnus-summary-customize-parameters - "\C-c\C-b" gnus-bug - "*" gnus-cache-enter-article - "\M-*" gnus-cache-remove-article - "\M-&" gnus-summary-universal-argument - "\C-l" gnus-recenter - "I" gnus-summary-increase-score - "L" gnus-summary-lower-score - "\M-i" gnus-symbolic-argument - "h" gnus-summary-select-article-buffer - - "b" gnus-article-view-part - "\M-t" gnus-summary-toggle-display-buttonized - - "V" gnus-summary-score-map - "X" gnus-uu-extract-map - "S" gnus-summary-send-map) - -;; Sort of orthogonal keymap -(gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map) - "t" gnus-summary-tick-article-forward - "!" gnus-summary-tick-article-forward - "d" gnus-summary-mark-as-read-forward - "r" gnus-summary-mark-as-read-forward - "c" gnus-summary-clear-mark-forward - " " gnus-summary-clear-mark-forward - "e" gnus-summary-mark-as-expirable - "x" gnus-summary-mark-as-expirable - "?" gnus-summary-mark-as-dormant - "b" gnus-summary-set-bookmark - "B" gnus-summary-remove-bookmark - "#" gnus-summary-mark-as-processable - "\M-#" gnus-summary-unmark-as-processable - "S" gnus-summary-limit-include-expunged - "C" gnus-summary-catchup - "H" gnus-summary-catchup-to-here - "h" gnus-summary-catchup-from-here - "\C-c" gnus-summary-catchup-all - "k" gnus-summary-kill-same-subject-and-select - "K" gnus-summary-kill-same-subject - "P" gnus-uu-mark-map) - -(gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map) - "c" gnus-summary-clear-above - "u" gnus-summary-tick-above - "m" gnus-summary-mark-above - "k" gnus-summary-kill-below) - -(gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map) - "/" gnus-summary-limit-to-subject - "n" gnus-summary-limit-to-articles - "b" gnus-summary-limit-to-bodies - "h" gnus-summary-limit-to-headers - "w" gnus-summary-pop-limit - "s" gnus-summary-limit-to-subject - "a" gnus-summary-limit-to-author - "u" gnus-summary-limit-to-unread - "m" gnus-summary-limit-to-marks - "M" gnus-summary-limit-exclude-marks - "v" gnus-summary-limit-to-score - "*" gnus-summary-limit-include-cached - "D" gnus-summary-limit-include-dormant - "T" gnus-summary-limit-include-thread - "d" gnus-summary-limit-exclude-dormant - "t" gnus-summary-limit-to-age - "." gnus-summary-limit-to-unseen - "x" gnus-summary-limit-to-extra - "p" gnus-summary-limit-to-display-predicate - "E" gnus-summary-limit-include-expunged - "c" gnus-summary-limit-exclude-childless-dormant - "C" gnus-summary-limit-mark-excluded-as-read - "o" gnus-summary-insert-old-articles - "N" gnus-summary-insert-new-articles - "S" gnus-summary-limit-to-singletons - "r" gnus-summary-limit-to-replied - "R" gnus-summary-limit-to-recipient - "A" gnus-summary-limit-to-address) - -(gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map) - "n" gnus-summary-next-unread-article - "p" gnus-summary-prev-unread-article - "N" gnus-summary-next-article - "P" gnus-summary-prev-article - "\C-n" gnus-summary-next-same-subject - "\C-p" gnus-summary-prev-same-subject - "\M-n" gnus-summary-next-unread-subject - "\M-p" gnus-summary-prev-unread-subject - "f" gnus-summary-first-unread-article - "b" gnus-summary-best-unread-article - "u" gnus-summary-next-unseen-article - "U" gnus-summary-prev-unseen-article - "j" gnus-summary-goto-article - "g" gnus-summary-goto-subject - "l" gnus-summary-goto-last-article - "o" gnus-summary-pop-article) - -(gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map) - "k" gnus-summary-kill-thread - "E" gnus-summary-expire-thread - "l" gnus-summary-lower-thread - "i" gnus-summary-raise-thread - "T" gnus-summary-toggle-threads - "t" gnus-summary-rethread-current - "^" gnus-summary-reparent-thread - "\M-^" gnus-summary-reparent-children - "s" gnus-summary-show-thread - "S" gnus-summary-show-all-threads - "h" gnus-summary-hide-thread - "H" gnus-summary-hide-all-threads - "n" gnus-summary-next-thread - "p" gnus-summary-prev-thread - "u" gnus-summary-up-thread - "o" gnus-summary-top-thread - "d" gnus-summary-down-thread - "#" gnus-uu-mark-thread - "\M-#" gnus-uu-unmark-thread) - -(gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map) - "g" gnus-summary-prepare - "c" gnus-summary-insert-cached-articles - "d" gnus-summary-insert-dormant-articles - "t" gnus-summary-insert-ticked-articles) - -(gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map) - "c" gnus-summary-catchup-and-exit - "C" gnus-summary-catchup-all-and-exit - "E" gnus-summary-exit-no-update - "Q" gnus-summary-exit - "Z" gnus-summary-exit - "n" gnus-summary-catchup-and-goto-next-group - "p" gnus-summary-catchup-and-goto-prev-group - "R" gnus-summary-reselect-current-group - "G" gnus-summary-rescan-group - "N" gnus-summary-next-group - "s" gnus-summary-save-newsrc - "P" gnus-summary-prev-group) - -(gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map) - " " gnus-summary-next-page - "n" gnus-summary-next-page - [?\S-\ ] gnus-summary-prev-page - "\177" gnus-summary-prev-page - [delete] gnus-summary-prev-page - "p" gnus-summary-prev-page - "\r" gnus-summary-scroll-up - "\M-\r" gnus-summary-scroll-down - "<" gnus-summary-beginning-of-article - ">" gnus-summary-end-of-article - "b" gnus-summary-beginning-of-article - "e" gnus-summary-end-of-article - "^" gnus-summary-refer-parent-article - "r" gnus-summary-refer-parent-article - "C" gnus-summary-show-complete-article - "D" gnus-summary-enter-digest-group - "R" gnus-summary-refer-references - "T" gnus-summary-refer-thread - "W" gnus-warp-to-article - "g" gnus-summary-show-article - "s" gnus-summary-isearch-article - "\t" gnus-summary-button-forward - [backtab] gnus-summary-button-backward - "w" gnus-summary-browse-url - "P" gnus-summary-print-article - "S" gnus-sticky-article - "M" gnus-mailing-list-insinuate - "t" gnus-article-babel) - -(gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map) - "b" gnus-article-add-buttons - "B" gnus-article-add-buttons-to-head - "o" gnus-article-treat-overstrike - "e" gnus-article-emphasize - "w" gnus-article-fill-cited-article - "Q" gnus-article-fill-long-lines - "L" gnus-article-toggle-truncate-lines - "C" gnus-article-capitalize-sentences - "c" gnus-article-remove-cr - "q" gnus-article-de-quoted-unreadable - "6" gnus-article-de-base64-unreadable - "Z" gnus-article-decode-HZ - "A" gnus-article-treat-ansi-sequences - "h" gnus-article-wash-html - "u" gnus-article-unsplit-urls - "s" gnus-summary-force-verify-and-decrypt - "f" gnus-article-display-x-face - "l" gnus-summary-stop-page-breaking - "r" gnus-summary-caesar-message - "m" gnus-summary-morse-message - "t" gnus-summary-toggle-header - "g" gnus-treat-smiley - "v" gnus-summary-verbose-headers - "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive - "p" gnus-article-verify-x-pgp-sig - "d" gnus-article-treat-smartquotes - "U" gnus-article-treat-non-ascii - "i" gnus-summary-idna-message) - -(gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map) - ;; mnemonic: deuglif*Y* - "u" gnus-article-outlook-unwrap-lines - "a" gnus-article-outlook-repair-attribution - "c" gnus-article-outlook-rearrange-citation - "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify - -(gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map) - "a" gnus-article-hide - "h" gnus-article-hide-headers - "b" gnus-article-hide-boring-headers - "s" gnus-article-hide-signature - "c" gnus-article-hide-citation - "C" gnus-article-hide-citation-in-followups - "l" gnus-article-hide-list-identifiers - "B" gnus-article-strip-banner - "P" gnus-article-hide-pem - "\C-c" gnus-article-hide-citation-maybe) - -(gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map) - "a" gnus-article-highlight - "h" gnus-article-highlight-headers - "c" gnus-article-highlight-citation - "s" gnus-article-highlight-signature) - -(gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map) - "f" gnus-article-treat-fold-headers - "u" gnus-article-treat-unfold-headers - "n" gnus-article-treat-fold-newsgroups) - -(gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map) - "x" gnus-article-display-x-face - "d" gnus-article-display-face - "s" gnus-treat-smiley - "D" gnus-article-remove-images - "W" gnus-article-show-images - "F" gnus-article-toggle-fonts - "f" gnus-treat-from-picon - "m" gnus-treat-mail-picon - "n" gnus-treat-newsgroups-picon - "g" gnus-treat-from-gravatar - "h" gnus-treat-mail-gravatar) - -(gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map) - "w" gnus-article-decode-mime-words - "c" gnus-article-decode-charset - "h" gnus-mime-buttonize-attachments-in-header - "v" gnus-mime-view-all-parts - "b" gnus-article-view-part) - -(gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map) - "z" gnus-article-date-ut - "u" gnus-article-date-ut - "l" gnus-article-date-local - "p" gnus-article-date-english - "e" gnus-article-date-lapsed - "o" gnus-article-date-original - "i" gnus-article-date-iso8601 - "s" gnus-article-date-user) - -(gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map) - "t" gnus-article-remove-trailing-blank-lines - "l" gnus-article-strip-leading-blank-lines - "m" gnus-article-strip-multiple-blank-lines - "a" gnus-article-strip-blank-lines - "A" gnus-article-strip-all-blank-lines - "s" gnus-article-strip-leading-space - "e" gnus-article-strip-trailing-space - "w" gnus-article-remove-leading-whitespace) - -(gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map) - "v" gnus-version - "d" gnus-summary-describe-group - "h" gnus-summary-describe-briefly - "i" gnus-info-find-node) - -(gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map) - "e" gnus-summary-expire-articles - "\M-\C-e" gnus-summary-expire-articles-now - "\177" gnus-summary-delete-article - [delete] gnus-summary-delete-article - [backspace] gnus-summary-delete-article - "m" gnus-summary-move-article - "r" gnus-summary-respool-article - "w" gnus-summary-edit-article - "c" gnus-summary-copy-article - "B" gnus-summary-crosspost-article - "q" gnus-summary-respool-query - "t" gnus-summary-respool-trace - "i" gnus-summary-import-article - "I" gnus-summary-create-article - "p" gnus-summary-article-posted-p) - -(gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map) - "o" gnus-summary-save-article - "m" gnus-summary-save-article-mail - "F" gnus-summary-write-article-file - "r" gnus-summary-save-article-rmail - "f" gnus-summary-save-article-file - "b" gnus-summary-save-article-body-file - "B" gnus-summary-write-article-body-file - "h" gnus-summary-save-article-folder - "v" gnus-summary-save-article-vm - "p" gnus-summary-pipe-output - "P" gnus-summary-muttprint) - -(gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map) - "b" gnus-summary-display-buttonized - "m" gnus-summary-repair-multipart - "v" gnus-article-view-part - "o" gnus-article-save-part - "O" gnus-article-save-part-and-strip - "r" gnus-article-replace-part - "d" gnus-article-delete-part - "t" gnus-article-view-part-as-type - "j" gnus-article-jump-to-part - "c" gnus-article-copy-part - "C" gnus-article-view-part-as-charset - "e" gnus-article-view-part-externally - "H" gnus-article-browse-html-article - "E" gnus-article-encrypt-body - "i" gnus-article-inline-part - "|" gnus-article-pipe-part) - -(gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map) - "p" gnus-summary-mark-as-processable - "u" gnus-summary-unmark-as-processable - "U" gnus-summary-unmark-all-processable - "v" gnus-uu-mark-over - "s" gnus-uu-mark-series - "r" gnus-uu-mark-region - "g" gnus-uu-unmark-region - "R" gnus-uu-mark-by-regexp - "G" gnus-uu-unmark-by-regexp - "t" gnus-uu-mark-thread - "T" gnus-uu-unmark-thread - "a" gnus-uu-mark-all - "b" gnus-uu-mark-buffer - "S" gnus-uu-mark-sparse - "k" gnus-summary-kill-process-mark - "y" gnus-summary-yank-process-mark - "w" gnus-summary-save-process-mark - "i" gnus-uu-invert-processable) - -(gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map) - ;;"x" gnus-uu-extract-any - "m" gnus-summary-save-parts - "u" gnus-uu-decode-uu - "U" gnus-uu-decode-uu-and-save - "s" gnus-uu-decode-unshar - "S" gnus-uu-decode-unshar-and-save - "o" gnus-uu-decode-save - "O" gnus-uu-decode-save - "b" gnus-uu-decode-binhex - "B" gnus-uu-decode-binhex - "Y" gnus-uu-decode-yenc - "p" gnus-uu-decode-postscript - "P" gnus-uu-decode-postscript-and-save) - -(gnus-define-keys - (gnus-uu-extract-view-map "v" gnus-uu-extract-map) - "u" gnus-uu-decode-uu-view - "U" gnus-uu-decode-uu-and-save-view - "s" gnus-uu-decode-unshar-view - "S" gnus-uu-decode-unshar-and-save-view - "o" gnus-uu-decode-save-view - "O" gnus-uu-decode-save-view - "b" gnus-uu-decode-binhex-view - "B" gnus-uu-decode-binhex-view - "p" gnus-uu-decode-postscript-view - "P" gnus-uu-decode-postscript-and-save-view) + "\C-c\C-d" #'gnus-summary-describe-group + "\C-c\C-p" #'gnus-summary-make-group-from-search + "q" #'gnus-summary-exit + "Q" #'gnus-summary-exit-no-update + "\C-c\C-i" #'gnus-info-find-node + [mouse-2] #'gnus-mouse-pick-article + [follow-link] 'mouse-face + "m" #'gnus-summary-mail-other-window + "a" #'gnus-summary-post-news + "x" #'gnus-summary-limit-to-unread + "s" #'gnus-summary-isearch-article + "\t" #'gnus-summary-button-forward + [backtab] #'gnus-summary-button-backward + "w" #'gnus-summary-browse-url + "t" #'gnus-summary-toggle-header + "g" #'gnus-summary-show-article + "l" #'gnus-summary-goto-last-article + "\C-c\C-v\C-v" #'gnus-uu-decode-uu-view + "\C-d" #'gnus-summary-enter-digest-group + "\M-\C-d" #'gnus-summary-read-document + "\M-\C-e" #'gnus-summary-edit-parameters + "\M-\C-a" #'gnus-summary-customize-parameters + "\C-c\C-b" #'gnus-bug + "*" #'gnus-cache-enter-article + "\M-*" #'gnus-cache-remove-article + "\M-&" #'gnus-summary-universal-argument + "\C-l" #'gnus-recenter + "I" #'gnus-summary-increase-score + "L" #'gnus-summary-lower-score + "\M-i" #'gnus-symbolic-argument + "h" #'gnus-summary-select-article-buffer + + "b" #'gnus-article-view-part + "\M-t" #'gnus-summary-toggle-display-buttonized + + "V" #'gnus-summary-score-map + "X" #'gnus-uu-extract-map + "S" #'gnus-summary-send-map + + ;; Sort of orthogonal keymaps. + "M" (define-keymap :prefix 'gnus-summary-mark-map + "t" #'gnus-summary-tick-article-forward + "!" #'gnus-summary-tick-article-forward + "d" #'gnus-summary-mark-as-read-forward + "r" #'gnus-summary-mark-as-read-forward + "c" #'gnus-summary-clear-mark-forward + " " #'gnus-summary-clear-mark-forward + "e" #'gnus-summary-mark-as-expirable + "x" #'gnus-summary-mark-as-expirable + "?" #'gnus-summary-mark-as-dormant + "b" #'gnus-summary-set-bookmark + "B" #'gnus-summary-remove-bookmark + "#" #'gnus-summary-mark-as-processable + "\M-#" #'gnus-summary-unmark-as-processable + "S" #'gnus-summary-limit-include-expunged + "C" #'gnus-summary-catchup + "H" #'gnus-summary-catchup-to-here + "h" #'gnus-summary-catchup-from-here + "\C-c" #'gnus-summary-catchup-all + "k" #'gnus-summary-kill-same-subject-and-select + "K" #'gnus-summary-kill-same-subject + "P" #'gnus-uu-mark-map) + + "V" (define-keymap :prefix 'gnus-summary-mscore-map + "c" #'gnus-summary-clear-above + "u" #'gnus-summary-tick-above + "m" #'gnus-summary-mark-above + "k" #'gnus-summary-kill-below) + + "/" (define-keymap :prefix 'gnus-summary-limit-map + "/" #'gnus-summary-limit-to-subject + "n" #'gnus-summary-limit-to-articles + "b" #'gnus-summary-limit-to-bodies + "h" #'gnus-summary-limit-to-headers + "w" #'gnus-summary-pop-limit + "s" #'gnus-summary-limit-to-subject + "a" #'gnus-summary-limit-to-author + "u" #'gnus-summary-limit-to-unread + "m" #'gnus-summary-limit-to-marks + "M" #'gnus-summary-limit-exclude-marks + "v" #'gnus-summary-limit-to-score + "*" #'gnus-summary-limit-include-cached + "D" #'gnus-summary-limit-include-dormant + "T" #'gnus-summary-limit-include-thread + "d" #'gnus-summary-limit-exclude-dormant + "t" #'gnus-summary-limit-to-age + "." #'gnus-summary-limit-to-unseen + "x" #'gnus-summary-limit-to-extra + "p" #'gnus-summary-limit-to-display-predicate + "E" #'gnus-summary-limit-include-expunged + "c" #'gnus-summary-limit-exclude-childless-dormant + "C" #'gnus-summary-limit-mark-excluded-as-read + "o" #'gnus-summary-insert-old-articles + "N" #'gnus-summary-insert-new-articles + "S" #'gnus-summary-limit-to-singletons + "r" #'gnus-summary-limit-to-replied + "R" #'gnus-summary-limit-to-recipient + "A" #'gnus-summary-limit-to-address) + + "G" (define-keymap :prefix 'gnus-summary-goto-map + "n" #'gnus-summary-next-unread-article + "p" #'gnus-summary-prev-unread-article + "N" #'gnus-summary-next-article + "P" #'gnus-summary-prev-article + "\C-n" #'gnus-summary-next-same-subject + "\C-p" #'gnus-summary-prev-same-subject + "\M-n" #'gnus-summary-next-unread-subject + "\M-p" #'gnus-summary-prev-unread-subject + "f" #'gnus-summary-first-unread-article + "b" #'gnus-summary-best-unread-article + "u" #'gnus-summary-next-unseen-article + "U" #'gnus-summary-prev-unseen-article + "j" #'gnus-summary-goto-article + "g" #'gnus-summary-goto-subject + "l" #'gnus-summary-goto-last-article + "o" #'gnus-summary-pop-article) + + "T" (define-keymap :prefix 'gnus-summary-thread-map + "k" #'gnus-summary-kill-thread + "E" #'gnus-summary-expire-thread + "l" #'gnus-summary-lower-thread + "i" #'gnus-summary-raise-thread + "T" #'gnus-summary-toggle-threads + "t" #'gnus-summary-rethread-current + "^" #'gnus-summary-reparent-thread + "\M-^" #'gnus-summary-reparent-children + "s" #'gnus-summary-show-thread + "S" #'gnus-summary-show-all-threads + "h" #'gnus-summary-hide-thread + "H" #'gnus-summary-hide-all-threads + "n" #'gnus-summary-next-thread + "p" #'gnus-summary-prev-thread + "u" #'gnus-summary-up-thread + "o" #'gnus-summary-top-thread + "d" #'gnus-summary-down-thread + "#" #'gnus-uu-mark-thread + "\M-#" #'gnus-uu-unmark-thread) + + "Y" (define-keymap :prefix 'gnus-summary-buffer-map + "g" #'gnus-summary-prepare + "c" #'gnus-summary-insert-cached-articles + "d" #'gnus-summary-insert-dormant-articles + "t" #'gnus-summary-insert-ticked-articles) + + "Z" (define-keymap :prefix 'gnus-summary-exit-map + "c" #'gnus-summary-catchup-and-exit + "C" #'gnus-summary-catchup-all-and-exit + "E" #'gnus-summary-exit-no-update + "Q" #'gnus-summary-exit + "Z" #'gnus-summary-exit + "n" #'gnus-summary-catchup-and-goto-next-group + "p" #'gnus-summary-catchup-and-goto-prev-group + "R" #'gnus-summary-reselect-current-group + "G" #'gnus-summary-rescan-group + "N" #'gnus-summary-next-group + "s" #'gnus-summary-save-newsrc + "P" #'gnus-summary-prev-group) + + "A" (define-keymap :prefix 'gnus-summary-article-map + " " #'gnus-summary-next-page + "n" #'gnus-summary-next-page + [?\S-\ ] #'gnus-summary-prev-page + "\177" #'gnus-summary-prev-page + [delete] #'gnus-summary-prev-page + "p" #'gnus-summary-prev-page + "\r" #'gnus-summary-scroll-up + "\M-\r" #'gnus-summary-scroll-down + "<" #'gnus-summary-beginning-of-article + ">" #'gnus-summary-end-of-article + "b" #'gnus-summary-beginning-of-article + "e" #'gnus-summary-end-of-article + "^" #'gnus-summary-refer-parent-article + "r" #'gnus-summary-refer-parent-article + "C" #'gnus-summary-show-complete-article + "D" #'gnus-summary-enter-digest-group + "R" #'gnus-summary-refer-references + "T" #'gnus-summary-refer-thread + "W" #'gnus-warp-to-article + "g" #'gnus-summary-show-article + "s" #'gnus-summary-isearch-article + "\t" #'gnus-summary-button-forward + [backtab] #'gnus-summary-button-backward + "w" #'gnus-summary-browse-url + "P" #'gnus-summary-print-article + "S" #'gnus-sticky-article + "M" #'gnus-mailing-list-insinuate + "t" #'gnus-article-babel) + + "W" (define-keymap :prefix 'gnus-summary-wash-map + "b" #'gnus-article-add-buttons + "B" #'gnus-article-add-buttons-to-head + "o" #'gnus-article-treat-overstrike + "e" #'gnus-article-emphasize + "w" #'gnus-article-fill-cited-article + "Q" #'gnus-article-fill-long-lines + "L" #'gnus-article-toggle-truncate-lines + "C" #'gnus-article-capitalize-sentences + "c" #'gnus-article-remove-cr + "q" #'gnus-article-de-quoted-unreadable + "6" #'gnus-article-de-base64-unreadable + "Z" #'gnus-article-decode-HZ + "A" #'gnus-article-treat-ansi-sequences + "h" #'gnus-article-wash-html + "u" #'gnus-article-unsplit-urls + "s" #'gnus-summary-force-verify-and-decrypt + "f" #'gnus-article-display-x-face + "l" #'gnus-summary-stop-page-breaking + "r" #'gnus-summary-caesar-message + "m" #'gnus-summary-morse-message + "t" #'gnus-summary-toggle-header + "g" #'gnus-treat-smiley + "v" #'gnus-summary-verbose-headers + "a" #'gnus-article-strip-headers-in-body ;; mnemonic: wash archive + "p" #'gnus-article-verify-x-pgp-sig + "d" #'gnus-article-treat-smartquotes + "U" #'gnus-article-treat-non-ascii + "i" #'gnus-summary-idna-message + + "Y" (define-keymap :prefix 'gnus-summary-wash-deuglify-map + ;; mnemonic: deuglif*Y* + "u" #'gnus-article-outlook-unwrap-lines + "a" #'gnus-article-outlook-repair-attribution + "c" #'gnus-article-outlook-rearrange-citation + ;; mnemonic: full deuglify + "f" #'gnus-article-outlook-deuglify-article) + + "W" (define-keymap :prefix 'gnus-summary-wash-hide-map + "a" #'gnus-article-hide + "h" #'gnus-article-hide-headers + "b" #'gnus-article-hide-boring-headers + "s" #'gnus-article-hide-signature + "c" #'gnus-article-hide-citation + "C" #'gnus-article-hide-citation-in-followups + "l" #'gnus-article-hide-list-identifiers + "B" #'gnus-article-strip-banner + "P" #'gnus-article-hide-pem + "\C-c" #'gnus-article-hide-citation-maybe) + + "H" (define-keymap :prefix 'gnus-summary-wash-highlight-map + "a" #'gnus-article-highlight + "h" #'gnus-article-highlight-headers + "c" #'gnus-article-highlight-citation + "s" #'gnus-article-highlight-signature) + + "G" (define-keymap :prefix 'gnus-summary-wash-header-map + "f" #'gnus-article-treat-fold-headers + "u" #'gnus-article-treat-unfold-headers + "n" #'gnus-article-treat-fold-newsgroups) + + "D" (define-keymap :prefix 'gnus-summary-wash-display-map + "x" #'gnus-article-display-x-face + "d" #'gnus-article-display-face + "s" #'gnus-treat-smiley + "D" #'gnus-article-remove-images + "W" #'gnus-article-show-images + "F" #'gnus-article-toggle-fonts + "f" #'gnus-treat-from-picon + "m" #'gnus-treat-mail-picon + "n" #'gnus-treat-newsgroups-picon + "g" #'gnus-treat-from-gravatar + "h" #'gnus-treat-mail-gravatar) + + "M" (define-keymap :prefix 'gnus-summary-wash-mime-map + "w" #'gnus-article-decode-mime-words + "c" #'gnus-article-decode-charset + "h" #'gnus-mime-buttonize-attachments-in-header + "v" #'gnus-mime-view-all-parts + "b" #'gnus-article-view-part) + + "T" (define-keymap :prefix 'gnus-summary-wash-time-map + "z" #'gnus-article-date-ut + "u" #'gnus-article-date-ut + "l" #'gnus-article-date-local + "p" #'gnus-article-date-english + "e" #'gnus-article-date-lapsed + "o" #'gnus-article-date-original + "i" #'gnus-article-date-iso8601 + "s" #'gnus-article-date-user) + + "E" (define-keymap :prefix 'gnus-summary-wash-empty-map + "t" #'gnus-article-remove-trailing-blank-lines + "l" #'gnus-article-strip-leading-blank-lines + "m" #'gnus-article-strip-multiple-blank-lines + "a" #'gnus-article-strip-blank-lines + "A" #'gnus-article-strip-all-blank-lines + "s" #'gnus-article-strip-leading-space + "e" #'gnus-article-strip-trailing-space + "w" #'gnus-article-remove-leading-whitespace)) + + "H" (define-keymap :prefix 'gnus-summary-help-map + "v" #'gnus-version + "d" #'gnus-summary-describe-group + "h" #'gnus-summary-describe-briefly + "i" #'gnus-info-find-node) + + "B" (define-keymap :prefix 'gnus-summary-backend-map + "e" #'gnus-summary-expire-articles + "\M-\C-e" #'gnus-summary-expire-articles-now + "\177" #'gnus-summary-delete-article + [delete] #'gnus-summary-delete-article + [backspace] #'gnus-summary-delete-article + "m" #'gnus-summary-move-article + "r" #'gnus-summary-respool-article + "w" #'gnus-summary-edit-article + "c" #'gnus-summary-copy-article + "B" #'gnus-summary-crosspost-article + "q" #'gnus-summary-respool-query + "t" #'gnus-summary-respool-trace + "i" #'gnus-summary-import-article + "I" #'gnus-summary-create-article + "p" #'gnus-summary-article-posted-p) + + "O" (define-keymap :prefix 'gnus-summary-save-map + "o" #'gnus-summary-save-article + "m" #'gnus-summary-save-article-mail + "F" #'gnus-summary-write-article-file + "r" #'gnus-summary-save-article-rmail + "f" #'gnus-summary-save-article-file + "b" #'gnus-summary-save-article-body-file + "B" #'gnus-summary-write-article-body-file + "h" #'gnus-summary-save-article-folder + "v" #'gnus-summary-save-article-vm + "p" #'gnus-summary-pipe-output + "P" #'gnus-summary-muttprint) + + "K" (define-keymap :prefix 'gnus-summary-mime-map + "b" #'gnus-summary-display-buttonized + "m" #'gnus-summary-repair-multipart + "v" #'gnus-article-view-part + "o" #'gnus-article-save-part + "O" #'gnus-article-save-part-and-strip + "r" #'gnus-article-replace-part + "d" #'gnus-article-delete-part + "t" #'gnus-article-view-part-as-type + "j" #'gnus-article-jump-to-part + "c" #'gnus-article-copy-part + "C" #'gnus-article-view-part-as-charset + "e" #'gnus-article-view-part-externally + "H" #'gnus-article-browse-html-article + "E" #'gnus-article-encrypt-body + "i" #'gnus-article-inline-part + "|" #'gnus-article-pipe-part) + + "P" (define-keymap :prefix 'gnus-uu-mark-map + "p" #'gnus-summary-mark-as-processable + "u" #'gnus-summary-unmark-as-processable + "U" #'gnus-summary-unmark-all-processable + "v" #'gnus-uu-mark-over + "s" #'gnus-uu-mark-series + "r" #'gnus-uu-mark-region + "g" #'gnus-uu-unmark-region + "R" #'gnus-uu-mark-by-regexp + "G" #'gnus-uu-unmark-by-regexp + "t" #'gnus-uu-mark-thread + "T" #'gnus-uu-unmark-thread + "a" #'gnus-uu-mark-all + "b" #'gnus-uu-mark-buffer + "S" #'gnus-uu-mark-sparse + "k" #'gnus-summary-kill-process-mark + "y" #'gnus-summary-yank-process-mark + "w" #'gnus-summary-save-process-mark + "i" #'gnus-uu-invert-processable) + + "X" (define-keymap :prefix 'gnus-uu-extract-map + ;;"x" gnus-uu-extract-any + "m" #'gnus-summary-save-parts + "u" #'gnus-uu-decode-uu + "U" #'gnus-uu-decode-uu-and-save + "s" #'gnus-uu-decode-unshar + "S" #'gnus-uu-decode-unshar-and-save + "o" #'gnus-uu-decode-save + "O" #'gnus-uu-decode-save + "b" #'gnus-uu-decode-binhex + "B" #'gnus-uu-decode-binhex + "Y" #'gnus-uu-decode-yenc + "p" #'gnus-uu-decode-postscript + "P" #'gnus-uu-decode-postscript-and-save + + "v" (define-keymap :prefix 'gnus-uu-extract-view-map + "u" #'gnus-uu-decode-uu-view + "U" #'gnus-uu-decode-uu-and-save-view + "s" #'gnus-uu-decode-unshar-view + "S" #'gnus-uu-decode-unshar-and-save-view + "o" #'gnus-uu-decode-save-view + "O" #'gnus-uu-decode-save-view + "b" #'gnus-uu-decode-binhex-view + "B" #'gnus-uu-decode-binhex-view + "p" #'gnus-uu-decode-postscript-view + "P" #'gnus-uu-decode-postscript-and-save-view))) (defvar gnus-article-post-menu nil) diff --git a/lisp/gnus/gnus-topic.el b/lisp/gnus/gnus-topic.el index c8bcccdfdd..e78dd1542c 100644 --- a/lisp/gnus/gnus-topic.el +++ b/lisp/gnus/gnus-topic.el @@ -1056,63 +1056,56 @@ articles in the topic and its subtopics." ;;; Topic mode, commands and keymap. -(defvar gnus-topic-mode-map nil) -(defvar gnus-group-topic-map nil) - -(unless gnus-topic-mode-map - (setq gnus-topic-mode-map (make-sparse-keymap)) - +(defvar-keymap gnus-topic-mode-map ;; Override certain group mode keys. - (gnus-define-keys gnus-topic-mode-map - "=" gnus-topic-select-group - "\r" gnus-topic-select-group - " " gnus-topic-read-group - "\C-c\C-x" gnus-topic-expire-articles - "c" gnus-topic-catchup-articles - "\C-k" gnus-topic-kill-group - "\C-y" gnus-topic-yank-group - "\M-g" gnus-topic-get-new-news-this-topic - "AT" gnus-topic-list-active - "Gp" gnus-topic-edit-parameters - "#" gnus-topic-mark-topic - "\M-#" gnus-topic-unmark-topic - [tab] gnus-topic-indent - [(meta tab)] gnus-topic-unindent - "\C-i" gnus-topic-indent - "\M-\C-i" gnus-topic-unindent - [mouse-2] gnus-mouse-pick-topic) - - ;; Define a new submap. - (gnus-define-keys (gnus-group-topic-map "T" gnus-group-mode-map) - "#" gnus-topic-mark-topic - "\M-#" gnus-topic-unmark-topic - "n" gnus-topic-create-topic - "m" gnus-topic-move-group - "D" gnus-topic-remove-group - "c" gnus-topic-copy-group - "h" gnus-topic-hide-topic - "s" gnus-topic-show-topic - "j" gnus-topic-jump-to-topic - "M" gnus-topic-move-matching - "C" gnus-topic-copy-matching - "\M-p" gnus-topic-goto-previous-topic - "\M-n" gnus-topic-goto-next-topic - "\C-i" gnus-topic-indent - [tab] gnus-topic-indent - "r" gnus-topic-rename - "\177" gnus-topic-delete - [delete] gnus-topic-delete - "H" gnus-topic-toggle-display-empty-topics) - - (gnus-define-keys (gnus-topic-sort-map "S" gnus-group-topic-map) - "s" gnus-topic-sort-groups - "a" gnus-topic-sort-groups-by-alphabet - "u" gnus-topic-sort-groups-by-unread - "l" gnus-topic-sort-groups-by-level - "e" gnus-topic-sort-groups-by-server - "v" gnus-topic-sort-groups-by-score - "r" gnus-topic-sort-groups-by-rank - "m" gnus-topic-sort-groups-by-method)) + "=" #'gnus-topic-select-group + "\r" #'gnus-topic-select-group + " " #'gnus-topic-read-group + "\C-c\C-x" #'gnus-topic-expire-articles + "c" #'gnus-topic-catchup-articles + "\C-k" #'gnus-topic-kill-group + "\C-y" #'gnus-topic-yank-group + "\M-g" #'gnus-topic-get-new-news-this-topic + "AT" #'gnus-topic-list-active + "Gp" #'gnus-topic-edit-parameters + "#" #'gnus-topic-mark-topic + "\M-#" #'gnus-topic-unmark-topic + [tab] #'gnus-topic-indent + [(meta tab)] #'gnus-topic-unindent + "\C-i" #'gnus-topic-indent + "\M-\C-i" #'gnus-topic-unindent + [mouse-2] #'gnus-mouse-pick-topic + + "T" (define-keymap :prefix 'gnus-group-topic-map + "#" #'gnus-topic-mark-topic + "\M-#" #'gnus-topic-unmark-topic + "n" #'gnus-topic-create-topic + "m" #'gnus-topic-move-group + "D" #'gnus-topic-remove-group + "c" #'gnus-topic-copy-group + "h" #'gnus-topic-hide-topic + "s" #'gnus-topic-show-topic + "j" #'gnus-topic-jump-to-topic + "M" #'gnus-topic-move-matching + "C" #'gnus-topic-copy-matching + "\M-p" #'gnus-topic-goto-previous-topic + "\M-n" #'gnus-topic-goto-next-topic + "\C-i" #'gnus-topic-indent + [tab] #'gnus-topic-indent + "r" #'gnus-topic-rename + "\177" #'gnus-topic-delete + [delete] #'gnus-topic-delete + "H" #'gnus-topic-toggle-display-empty-topics + + "S" (define-keymap :prefix 'gnus-topic-sort-map + "s" #'gnus-topic-sort-groups + "a" #'gnus-topic-sort-groups-by-alphabet + "u" #'gnus-topic-sort-groups-by-unread + "l" #'gnus-topic-sort-groups-by-level + "e" #'gnus-topic-sort-groups-by-server + "v" #'gnus-topic-sort-groups-by-score + "r" #'gnus-topic-sort-groups-by-rank + "m" #'gnus-topic-sort-groups-by-method))) (defun gnus-topic-make-menu-bar () (unless (boundp 'gnus-topic-menu) diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index 3c2e4ad972..6644cc4d81 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -2609,7 +2609,11 @@ are always t.") gnus-uu-decode-uu-and-save-view gnus-uu-decode-unshar-view gnus-uu-decode-unshar-and-save-view gnus-uu-decode-save-view gnus-uu-decode-binhex-view gnus-uu-unmark-thread - gnus-uu-mark-over gnus-uu-post-news gnus-uu-invert-processable) + gnus-uu-mark-over gnus-uu-post-news gnus-uu-invert-processable + gnus-uu-decode-postscript-and-save-view + gnus-uu-decode-postscript-view gnus-uu-decode-postscript-and-save + gnus-uu-decode-yenc gnus-uu-unmark-by-regexp gnus-uu-unmark-region + gnus-uu-decode-postscript) ("gnus-uu" gnus-uu-delete-work-dir gnus-uu-unmark-thread) ("gnus-msg" (gnus-summary-send-map keymap) gnus-article-mail gnus-copy-article-buffer gnus-extended-version) @@ -2667,7 +2671,34 @@ are always t.") gnus-article-edit-mode gnus-article-edit-article gnus-article-edit-done gnus-article-decode-encoded-words gnus-start-date-timer gnus-stop-date-timer - gnus-mime-view-all-parts) + gnus-mime-view-all-parts gnus-article-pipe-part + gnus-article-inline-part gnus-article-encrypt-body + gnus-article-browse-html-article gnus-article-view-part-externally + gnus-article-view-part-as-charset gnus-article-copy-part + gnus-article-jump-to-part gnus-article-view-part-as-type + gnus-article-delete-part gnus-article-replace-part + gnus-article-save-part-and-strip gnus-article-save-part + gnus-article-remove-leading-whitespace gnus-article-strip-trailing-space + gnus-article-strip-leading-space gnus-article-strip-all-blank-lines + gnus-article-strip-blank-lines gnus-article-strip-multiple-blank-lines + gnus-article-date-user gnus-article-date-iso8601 + gnus-article-date-english gnus-article-date-ut + gnus-article-decode-charset gnus-article-decode-mime-words + gnus-article-toggle-fonts gnus-article-show-images + gnus-article-remove-images gnus-article-display-face + gnus-article-treat-fold-newsgroups gnus-article-treat-unfold-headers + gnus-article-treat-fold-headers gnus-article-highlight-signature + gnus-article-highlight-headers gnus-article-highlight + gnus-article-strip-banner gnus-article-hide-list-identifiers + gnus-article-hide gnus-article-outlook-rearrange-citation + gnus-article-treat-non-ascii gnus-article-treat-smartquotes + gnus-article-verify-x-pgp-sig gnus-article-strip-headers-in-body + gnus-treat-smiley gnus-article-treat-ansi-sequences + gnus-article-capitalize-sentences gnus-article-toggle-truncate-lines + gnus-article-fill-long-lines gnus-article-emphasize + gnus-article-add-buttons-to-head gnus-article-add-button + gnus-article-babel gnus-sticky-article gnus-article-view-part + gnus-article-add-buttons) ("gnus-int" gnus-request-type) ("gnus-start" gnus-newsrc-parse-options gnus-1 gnus-no-server-1 gnus-dribble-enter gnus-read-init-file gnus-dribble-touch diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el index d00f0a60b6..cfef69f103 100644 --- a/lisp/gnus/spam.el +++ b/lisp/gnus/spam.el @@ -663,13 +663,13 @@ order for SpamAssassin to recognize the new registered spam." ;;; Key bindings for spam control. -(gnus-define-keys gnus-summary-mode-map - "St" spam-generic-score - "Sx" gnus-summary-mark-as-spam - "Mst" spam-generic-score - "Msx" gnus-summary-mark-as-spam - "\M-d" gnus-summary-mark-as-spam - "$" gnus-summary-mark-as-spam) +(define-keymap :keymap gnus-summary-mode-map + "St" #'spam-generic-score + "Sx" #'gnus-summary-mark-as-spam + "Mst" #'spam-generic-score + "Msx" #'gnus-summary-mark-as-spam + "\M-d" #'gnus-summary-mark-as-spam + "$" #'gnus-summary-mark-as-spam) (defvar spam-cache-lookups t "Whether spam.el will try to cache lookups using `spam-caches'.") commit d2a34cabcf13eb406f06324361c1c647f6e5d31b Author: Stefan Kangas Date: Tue Oct 5 21:35:09 2021 +0200 ; Very minor touch-up to a recent change * doc/lispintro/emacs-lisp-intro.texi (Design @value{COUNT-WORDS}): Remove an unnecessary and potentially confusing "now". diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 9dbf854171..32c39c7261 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -13475,7 +13475,7 @@ What we need to do is fill in the slots. The name of the function should be self-explanatory and easy to remember. @code{count-words-region} is the obvious choice. Since -that name is now used for the standard Emacs command to count words, we +that name is used for the standard Emacs command to count words, we will name our implementation @code{@value{COUNT-WORDS}}. The function counts words within a region. This means that the commit 36a7ce43936cadff77f50391217ff04265fec6d7 Author: Stefan Kangas Date: Tue Oct 5 21:11:19 2021 +0200 ; * doc/emacs/trouble.texi (After a Crash): Fix typo. diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index 60b5cc7602..027086cab5 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -393,7 +393,7 @@ this---saving them---updates the files themselves. associated with any files, or if the autosave was not recent enough to have recorded important changes, you can use the @file{etc/emacs-buffer.gdb} script with GDB (the GNU Debugger) to -retrieve them from a core dump--provided that a core dump was saved, +retrieve them from a core dump---provided that a core dump was saved, and that the Emacs executable was not stripped of its debugging symbols. commit 1cd1b2835b5e35562c677c48dcf185bb73af4275 Author: Stefan Kangas Date: Tue Oct 5 19:31:52 2021 +0200 * doc/misc/gnus.texi (Loose Threads): Use regexp-opt in example. diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 0c065584c4..6c892bc80a 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -7130,20 +7130,15 @@ as 10, you might consider setting this variable to something sensible: (setq gnus-simplify-ignored-prefixes (concat "\\`\\[?\\(" - (mapconcat - 'identity - '("looking" - "wanted" "followup" "summary\\( of\\)?" - "help" "query" "problem" "question" - "answer" "reference" "announce" - "How can I" "How to" "Comparison of" - ;; ... - ) - "\\|") + (regexp-opt '("looking" + "wanted" "followup" "summary" "summary of" + "help" "query" "problem" "question" + "answer" "reference" "announce" + "How can I" "How to" "Comparison of" + ;; ... + )) "\\)\\s *\\(" - (mapconcat 'identity - '("for" "for reference" "with" "about") - "\\|") + (regexp-opt '("for" "for reference" "with" "about")) "\\)?\\]?:?[ \t]*")) @end lisp commit 9f041cdfaca0f3def74eb7d3348bbf35c12bcc5b Author: Dmitry Gutov Date: Tue Oct 5 19:58:26 2021 +0300 Bump project.el version * lisp/progmodes/project.el: Bump the version. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 57a961c260..3eaa789b3e 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1,7 +1,7 @@ ;;; project.el --- Operations on the current project -*- lexical-binding: t; -*- ;; Copyright (C) 2015-2021 Free Software Foundation, Inc. -;; Version: 0.7.1 +;; Version: 0.8.0 ;; Package-Requires: ((emacs "26.1") (xref "1.0.2")) ;; This is a GNU ELPA :core package. Avoid using functionality that commit ad2287e659cf3edaeb3d6fc9687ee6d87cc7ace1 Author: Dmitry Gutov Date: Tue Oct 5 05:45:09 2021 +0300 Retain compatibility with older project.el projects * lisp/progmodes/xref.el (xref--analyze): Retain compatibility with older project.el and its compatible project definitions (for standalone Xref from ELPA). diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 267ee16400..1feb6ef915 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1025,7 +1025,7 @@ Return an alist of the form ((GROUP . (XREF ...)) ...)." (eq xref-file-name-display 'project-relative) (project-current))) (project-root (and project - (expand-file-name (project-root project))))) + (expand-file-name (xref--project-root project))))) (mapcar (lambda (pair) (cons (xref--group-name-for-display (car pair) project-root) commit d86b2e59c746966e1ae023937b2a6b3b8c16d18b Author: Stephen Gildea Date: Tue Oct 5 09:15:57 2021 -0700 native-comp-available-p is the definitive test * doc/lispref/compile.texi (Native Compilation): Document native-comp-available-p as the way to test for native compilation. * lisp/emacs-lisp/package.el (package--native-compile-async): * test/lisp/mh-e/mh-utils-tests.el (mh-ensure-native-trampolines): Test for native compilation with native-comp-available-p. Thank you to Andrea Corallo for reviewing this patch. diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi index 15d1f4ce53..523758c10f 100644 --- a/doc/lispref/compile.texi +++ b/doc/lispref/compile.texi @@ -811,8 +811,7 @@ for you to be able to native-compile Lisp code. @vindex native-compile@r{, a Lisp feature} To determine whether the current Emacs process can produce and load -natively-compiled Lisp code, test whether the @code{native-compile} -feature is available (@pxref{Named Features}). Alternatively, call +natively-compiled Lisp code, call @code{native-comp-available-p} (@pxref{Native-Compilation Functions}). Unlike byte-compiled code, natively-compiled Lisp code is executed diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 62f5fc7341..5445fa970f 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1081,8 +1081,7 @@ This assumes that `pkg-desc' has already been activated with "Native compile installed package PKG-DESC asynchronously. This assumes that `pkg-desc' has already been activated with `package-activate-1'." - (when (and (featurep 'native-compile) - (native-comp-available-p)) + (when (native-comp-available-p) (let ((warning-minimum-level :error)) (native-compile-async (package-desc-dir pkg-desc) t)))) diff --git a/test/lisp/mh-e/mh-utils-tests.el b/test/lisp/mh-e/mh-utils-tests.el index 82afbab647..f1282ab44a 100644 --- a/test/lisp/mh-e/mh-utils-tests.el +++ b/test/lisp/mh-e/mh-utils-tests.el @@ -113,7 +113,7 @@ As `call-process'' and `file-directory-p' will be redefined, the native compiler will invoke `call-process' to compile the respective trampolines. To avoid interferences with the `call-process' mocking we build these AOT." - (when (featurep 'native-compile) + (when (native-comp-available-p) (mapc #'comp-subr-trampoline-install '(call-process file-directory-p)))) (defun mh-test-utils-setup-with-mocks () commit 1b383ac424b847e5e50cc5e5e1761ebb9d7d658a Author: Eli Zaretskii Date: Tue Oct 5 19:20:51 2021 +0300 Minor fix of a recently installed documentation change * doc/emacs/search.texi (Lax Search): Don't use ".." inside @samp, it looks confusing, especially in print. (Bug#51020) diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 761161be1c..f6d9cb3be1 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -1331,8 +1331,8 @@ matches @w{@samp{foo bar}}, @w{@samp{foo@ @ bar}}, precisely, Emacs matches each sequence of space characters in the search string to a regular expression specified by the variable @code{search-whitespace-regexp}. For example, to make spaces match -sequences of newlines as well as spaces, set it to -@samp{"[[:space:]\n]+"}. The default value of this variable considers +sequences of newlines as well as spaces, set it to the regular expression +@samp{[[:space:]\n]+}. The default value of this variable considers any sequence of spaces and tab characters as whitespace. If you want whitespace characters to match exactly, you can turn lax diff --git a/etc/NEWS b/etc/NEWS index 2274588913..c3bfc9c947 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1168,7 +1168,7 @@ search string is at least this long. 'lazy-highlight-initial-delay' still applies for shorter search strings, which avoids flicker in the search buffer due to too many matches being highlighted. ---- ++++ *** The default 'search-whitespace-regexp' value has changed. This used to be "\\s-+", which meant that it was mode-dependent whether newlines were included in the whitespace set. This has now been commit d30cbc1e3791ae9e713104ada3541b22ab63cefa Author: Stefan Kangas Date: Tue Oct 5 18:16:48 2021 +0200 Do interactive mode tagging for proced.el diff --git a/lisp/proced.el b/lisp/proced.el index 9a8eaf54e7..e959e91c6e 100644 --- a/lisp/proced.el +++ b/lisp/proced.el @@ -658,6 +658,7 @@ After displaying or updating a Proced buffer, Proced runs the normal hook `proced-post-display-hook'. \\{proced-mode-map}" + :interactive nil (abbrev-mode 0) (auto-fill-mode 0) (setq buffer-read-only t @@ -721,7 +722,7 @@ Proced buffers." With prefix ARG, update this buffer automatically if ARG is positive, otherwise do not update. Sets the variable `proced-auto-update-flag'. The time interval for updates is specified via `proced-auto-update-interval'." - (interactive (list (or current-prefix-arg 'toggle))) + (interactive (list (or current-prefix-arg 'toggle)) proced-mode) (setq proced-auto-update-flag (cond ((eq arg 'toggle) (not proced-auto-update-flag)) (arg (> (prefix-numeric-value arg) 0)) @@ -733,19 +734,19 @@ The time interval for updates is specified via `proced-auto-update-interval'." (defun proced-mark (&optional count) "Mark the current (or next COUNT) processes." - (interactive "p") + (interactive "p" proced-mode) (proced-do-mark t count)) (defun proced-unmark (&optional count) "Unmark the current (or next COUNT) processes." - (interactive "p") + (interactive "p" proced-mode) (proced-do-mark nil count)) (defun proced-unmark-backward (&optional count) "Unmark the previous (or COUNT previous) processes." ;; Analogous to `dired-unmark-backward', ;; but `ibuffer-unmark-backward' behaves different. - (interactive "p") + (interactive "p" proced-mode) (proced-do-mark nil (- (or count 1)))) (defun proced-do-mark (mark &optional count) @@ -762,7 +763,7 @@ The time interval for updates is specified via `proced-auto-update-interval'." (defun proced-toggle-marks () "Toggle marks: marked processes become unmarked, and vice versa." - (interactive) + (interactive nil proced-mode) (let ((mark-re (proced-marker-regexp)) buffer-read-only) (save-excursion @@ -788,14 +789,14 @@ Otherwise move one line forward after inserting the mark." "Mark all processes. If `transient-mark-mode' is turned on and the region is active, mark the region." - (interactive) + (interactive nil proced-mode) (proced-do-mark-all t)) (defun proced-unmark-all () "Unmark all processes. If `transient-mark-mode' is turned on and the region is active, unmark the region." - (interactive) + (interactive nil proced-mode) (proced-do-mark-all nil)) (defun proced-do-mark-all (mark) @@ -830,14 +831,14 @@ mark the region." (defun proced-mark-children (ppid &optional omit-ppid) "Mark child processes of process PPID. Also mark process PPID unless prefix OMIT-PPID is non-nil." - (interactive (list (proced-pid-at-point) current-prefix-arg)) + (interactive (list (proced-pid-at-point) current-prefix-arg) proced-mode) (proced-mark-process-alist (proced-filter-children proced-process-alist ppid omit-ppid))) (defun proced-mark-parents (cpid &optional omit-cpid) "Mark parent processes of process CPID. Also mark CPID unless prefix OMIT-CPID is non-nil." - (interactive (list (proced-pid-at-point) current-prefix-arg)) + (interactive (list (proced-pid-at-point) current-prefix-arg) proced-mode) (proced-mark-process-alist (proced-filter-parents proced-process-alist cpid omit-cpid))) @@ -870,7 +871,7 @@ If `transient-mark-mode' is turned on and the region is active, omit the processes in region. If QUIET is non-nil suppress status message. Returns count of omitted lines." - (interactive "P") + (interactive "P" proced-mode) (let ((mark-re (proced-marker-regexp)) (count 0) buffer-read-only) @@ -947,7 +948,8 @@ Set variable `proced-filter' to SCHEME. Revert listing." (interactive (let ((scheme (completing-read "Filter: " proced-filter-alist nil t))) - (list (if (string= "" scheme) nil (intern scheme))))) + (list (if (string= "" scheme) nil (intern scheme)))) + proced-mode) ;; only update if necessary (unless (eq proced-filter scheme) (setq proced-filter scheme) @@ -1057,7 +1059,7 @@ Each parent process is followed by its child processes. The process tree inherits the chosen sorting order of the process listing, that is, child processes of the same parent process are sorted using the selected sorting order." - (interactive (list (or current-prefix-arg 'toggle))) + (interactive (list (or current-prefix-arg 'toggle)) proced-mode) (setq proced-tree-flag (cond ((eq arg 'toggle) (not proced-tree-flag)) (arg (> (prefix-numeric-value arg) 0)) @@ -1140,7 +1142,7 @@ This command refines an already existing process listing generated initially based on the value of the variable `proced-filter'. It does not change this variable. It does not revert the listing. If you frequently need a certain refinement, consider defining a new filter in `proced-filter-alist'." - (interactive (list last-input-event)) + (interactive (list last-input-event) proced-mode) (if event (posn-set-point (event-end event))) (let ((key (get-text-property (point) 'proced-key)) (pid (get-text-property (point) 'proced-pid))) @@ -1269,7 +1271,8 @@ in the mode line, using \"+\" or \"-\" for ascending or descending order." nil t))) (list (if (string= "" scheme) nil (intern scheme)) ;; like 'toggle in `define-derived-mode' - (or current-prefix-arg 'no-arg)))) + (or current-prefix-arg 'no-arg))) + proced-mode) (setq proced-descend ;; If `proced-sort-interactive' is called repeatedly for the same @@ -1290,37 +1293,37 @@ in the mode line, using \"+\" or \"-\" for ascending or descending order." (defun proced-sort-pcpu (&optional arg) "Sort Proced buffer by percentage CPU time (%CPU). Prefix ARG controls sort order, see `proced-sort-interactive'." - (interactive (list (or current-prefix-arg 'no-arg))) + (interactive (list (or current-prefix-arg 'no-arg)) proced-mode) (proced-sort-interactive 'pcpu arg)) (defun proced-sort-pmem (&optional arg) "Sort Proced buffer by percentage memory usage (%MEM). Prefix ARG controls sort order, see `proced-sort-interactive'." - (interactive (list (or current-prefix-arg 'no-arg))) + (interactive (list (or current-prefix-arg 'no-arg)) proced-mode) (proced-sort-interactive 'pmem arg)) (defun proced-sort-pid (&optional arg) "Sort Proced buffer by PID. Prefix ARG controls sort order, see `proced-sort-interactive'." - (interactive (list (or current-prefix-arg 'no-arg))) + (interactive (list (or current-prefix-arg 'no-arg)) proced-mode) (proced-sort-interactive 'pid arg)) (defun proced-sort-start (&optional arg) "Sort Proced buffer by time the command started (START). Prefix ARG controls sort order, see `proced-sort-interactive'." - (interactive (list (or current-prefix-arg 'no-arg))) + (interactive (list (or current-prefix-arg 'no-arg)) proced-mode) (proced-sort-interactive 'start arg)) (defun proced-sort-time (&optional arg) "Sort Proced buffer by CPU time (TIME). Prefix ARG controls sort order, see `proced-sort-interactive'." - (interactive (list (or current-prefix-arg 'no-arg))) + (interactive (list (or current-prefix-arg 'no-arg)) proced-mode) (proced-sort-interactive 'time arg)) (defun proced-sort-user (&optional arg) "Sort Proced buffer by USER. Prefix ARG controls sort order, see `proced-sort-interactive'." - (interactive (list (or current-prefix-arg 'no-arg))) + (interactive (list (or current-prefix-arg 'no-arg)) proced-mode) (proced-sort-interactive 'user arg)) (defun proced-sort-header (event &optional arg) @@ -1329,7 +1332,7 @@ EVENT is a mouse event with starting position in the header line. It is converted to the corresponding attribute key. This command updates the variable `proced-sort'. Prefix ARG controls sort order, see `proced-sort-interactive'." - (interactive (list last-input-event (or last-prefix-arg 'no-arg))) + (interactive (list last-input-event (or last-prefix-arg 'no-arg)) proced-mode) (let ((start (event-start event)) col key) (save-selected-window @@ -1534,7 +1537,8 @@ With prefix REVERT non-nil revert listing." (let ((scheme (completing-read "Format: " proced-format-alist nil t))) (list (if (string= "" scheme) nil (intern scheme)) - current-prefix-arg))) + current-prefix-arg)) + proced-mode) ;; only update if necessary (when (or (not (eq proced-format scheme)) revert) (setq proced-format scheme) @@ -1566,7 +1570,7 @@ Suppress status information if QUIET is nil. After updating a displayed Proced buffer run the normal hook `proced-post-display-hook'." ;; This is the main function that generates and updates the process listing. - (interactive "P") + (interactive "P" proced-mode) (setq revert (or revert (not proced-process-alist))) (or quiet (message (if revert "Updating process information..." "Updating process display..."))) @@ -1776,7 +1780,8 @@ supported but discouraged. It will be removed in a future version of Emacs." "TERM" pnum) proced-signal-list nil nil nil nil "TERM") - process-alist)))) + process-alist))) + proced-mode) (unless (and signal process-alist) ;; Discouraged usage (supported for backward compatibility): @@ -1861,7 +1866,8 @@ the normal hook `proced-after-send-signal-hook'." (let ((process-alist (proced-marked-processes))) (proced-with-processes-buffer process-alist (list (read-number "New priority: ") - process-alist)))) + process-alist))) + proced-mode) (if (numberp priority) (setq priority (number-to-string priority))) (let (failures) @@ -1893,7 +1899,7 @@ the normal hook `proced-after-send-signal-hook'." "Pop up a buffer with error log output from Proced. A group of errors from a single command ends with a formfeed. Thus, use \\[backward-page] to find the beginning of a group of errors." - (interactive) + (interactive nil proced-mode) (if (get-buffer proced-log-buffer) (save-selected-window ;; move `proced-log-buffer' to the front of the buffer list @@ -1945,7 +1951,7 @@ STRING is an overall summary of the failures." (defun proced-help () "Provide help for the Proced user." - (interactive) + (interactive nil proced-mode) (proced-why) (if (eq last-command 'proced-help) (describe-mode) @@ -1955,7 +1961,7 @@ STRING is an overall summary of the failures." "Undo in a Proced buffer. This doesn't recover killed processes, it just undoes changes in the Proced buffer. You can use it to recover marks." - (interactive) + (interactive nil proced-mode) (let (buffer-read-only) (undo)) (message "Change in Proced buffer undone. commit 4d76765b6c8a3117c436ccc93572cddfd8d17d7c Author: Paul Eggert Date: Tue Oct 5 09:08:02 2021 -0700 Fix md5 issue in recent Gnulib merge When configured --with-native-compilation, Emacs needs md5_stream. Problem reported by Andy Moreton (Bug#50985#23). * admin/merge-gnulib (GNULIB_MODULES): Add crypto/md5, needed for --with-native-compilation. (AVOIDED_MODULES): Avoid crypto/af_alg, since Emacs doesn’t need to bother with kernel-supported cryptography algorithms. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate by running admin/merge-gnulib. * lib/md5-stream.c: New file, copied from Gnulib. diff --git a/admin/merge-gnulib b/admin/merge-gnulib index 10cc73aa73..886f37e28c 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib @@ -30,7 +30,8 @@ GNULIB_MODULES=' canonicalize-lgpl careadlinkat close-stream copy-file-range count-leading-zeros count-one-bits count-trailing-zeros - crypto/md5-buffer crypto/sha1-buffer crypto/sha256-buffer crypto/sha512-buffer + crypto/md5 crypto/md5-buffer + crypto/sha1-buffer crypto/sha256-buffer crypto/sha512-buffer d-type diffseq double-slash-root dtoastr dtotimespec dup2 environ execinfo explicit_bzero faccessat fchmodat fcntl fcntl-h fdopendir file-has-acl @@ -49,7 +50,7 @@ GNULIB_MODULES=' ' AVOIDED_MODULES=' - btowc close dup fchdir fstat langinfo lock + btowc close crypto/af_alg dup fchdir fstat langinfo lock mbrtowc mbsinit memchr mkdir msvc-inval msvc-nothrow nl_langinfo openat-die opendir pthread-h raise save-cwd select setenv sigprocmask stat stdarg stdbool diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index bac27f3a68..e9a1a5dc02 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -36,6 +36,7 @@ # --no-vc-files \ # --avoid=btowc \ # --avoid=close \ +# --avoid=crypto/af_alg \ # --avoid=dup \ # --avoid=fchdir \ # --avoid=fstat \ @@ -79,6 +80,7 @@ # count-leading-zeros \ # count-one-bits \ # count-trailing-zeros \ +# crypto/md5 \ # crypto/md5-buffer \ # crypto/sha1-buffer \ # crypto/sha256-buffer \ @@ -544,8 +546,8 @@ GL_GNULIB_WRITE = @GL_GNULIB_WRITE@ GL_GNULIB__EXIT = @GL_GNULIB__EXIT@ GMALLOC_OBJ = @GMALLOC_OBJ@ GMP_H = @GMP_H@ -GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@ +GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ GNULIB_WARN_CFLAGS = @GNULIB_WARN_CFLAGS@ GNUSTEP_CFLAGS = @GNUSTEP_CFLAGS@ GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@ @@ -1473,6 +1475,14 @@ EXTRA_DIST += count-trailing-zeros.h endif ## end gnulib module count-trailing-zeros +## begin gnulib module crypto/md5 +ifeq (,$(OMIT_GNULIB_MODULE_crypto/md5)) + +libgnu_a_SOURCES += md5-stream.c + +endif +## end gnulib module crypto/md5 + ## begin gnulib module crypto/md5-buffer ifeq (,$(OMIT_GNULIB_MODULE_crypto/md5-buffer)) diff --git a/lib/md5-stream.c b/lib/md5-stream.c new file mode 100644 index 0000000000..fb483b7334 --- /dev/null +++ b/lib/md5-stream.c @@ -0,0 +1,141 @@ +/* Functions to compute MD5 message digest of files or memory blocks. + according to the definition of MD5 in RFC 1321 from April 1992. + Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2021 Free Software + Foundation, Inc. + This file is part of the GNU C Library. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Ulrich Drepper , 1995. */ + +#include + +/* Specification. */ +#if HAVE_OPENSSL_MD5 +# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE +#endif +#include "md5.h" + +#include + +#if USE_UNLOCKED_IO +# include "unlocked-io.h" +#endif + +#include "af_alg.h" + +#ifdef _LIBC +# include +# if __BYTE_ORDER == __BIG_ENDIAN +# define WORDS_BIGENDIAN 1 +# endif +/* We need to keep the namespace clean so define the MD5 function + protected using leading __ . */ +# define md5_init_ctx __md5_init_ctx +# define md5_process_block __md5_process_block +# define md5_process_bytes __md5_process_bytes +# define md5_finish_ctx __md5_finish_ctx +# define md5_stream __md5_stream +#endif + +#define BLOCKSIZE 32768 +#if BLOCKSIZE % 64 != 0 +# error "invalid BLOCKSIZE" +#endif + +/* Compute MD5 message digest for bytes read from STREAM. The + resulting message digest number will be written into the 16 bytes + beginning at RESBLOCK. */ +int +md5_stream (FILE *stream, void *resblock) +{ + switch (afalg_stream (stream, "md5", resblock, MD5_DIGEST_SIZE)) + { + case 0: return 0; + case -EIO: return 1; + } + + char *buffer = malloc (BLOCKSIZE + 72); + if (!buffer) + return 1; + + struct md5_ctx ctx; + md5_init_ctx (&ctx); + size_t sum; + + /* Iterate over full file contents. */ + while (1) + { + /* We read the file in blocks of BLOCKSIZE bytes. One call of the + computation function processes the whole buffer so that with the + next round of the loop another block can be read. */ + size_t n; + sum = 0; + + /* Read block. Take care for partial reads. */ + while (1) + { + /* Either process a partial fread() from this loop, + or the fread() in afalg_stream may have gotten EOF. + We need to avoid a subsequent fread() as EOF may + not be sticky. For details of such systems, see: + https://sourceware.org/bugzilla/show_bug.cgi?id=1190 */ + if (feof (stream)) + goto process_partial_block; + + n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); + + sum += n; + + if (sum == BLOCKSIZE) + break; + + if (n == 0) + { + /* Check for the error flag IFF N == 0, so that we don't + exit the loop after a partial read due to e.g., EAGAIN + or EWOULDBLOCK. */ + if (ferror (stream)) + { + free (buffer); + return 1; + } + goto process_partial_block; + } + } + + /* Process buffer with BLOCKSIZE bytes. Note that + BLOCKSIZE % 64 == 0 + */ + md5_process_block (buffer, BLOCKSIZE, &ctx); + } + +process_partial_block: + + /* Process any remaining bytes. */ + if (sum > 0) + md5_process_bytes (buffer, sum, &ctx); + + /* Construct result in desired memory. */ + md5_finish_ctx (&ctx, resblock); + free (buffer); + return 0; +} + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index dd5bde8d79..a795fe7651 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -63,6 +63,7 @@ AC_DEFUN([gl_EARLY], # Code from module count-leading-zeros: # Code from module count-one-bits: # Code from module count-trailing-zeros: + # Code from module crypto/md5: # Code from module crypto/md5-buffer: # Code from module crypto/sha1-buffer: # Code from module crypto/sha256-buffer: @@ -1207,6 +1208,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/malloc/scratch_buffer_grow.c lib/malloc/scratch_buffer_grow_preserve.c lib/malloc/scratch_buffer_set_array_size.c + lib/md5-stream.c lib/md5.c lib/md5.h lib/memmem.c commit 18308b739a561bff677929da2a1412e91c0d05cd Author: Paul Eggert Date: Tue Oct 5 09:03:47 2021 -0700 Tweak recent 'configure' fix * configure.ac (gt_TYPE_WINT_T): Omit obsolete and now-overridden definition. diff --git a/configure.ac b/configure.ac index 62bf25ebbf..e6ffea0637 100644 --- a/configure.ac +++ b/configure.ac @@ -874,9 +874,6 @@ for func in $ac_func_list; do done ac_func_list=$funcs # Emacs does not use the wchar or wctype-h modules. -AC_DEFUN([gt_TYPE_WINT_T], - [GNULIB_OVERRIDES_WINT_T=0 - AC_SUBST([GNULIB_OVERRIDES_WINT_T])]) AC_DEFUN([gt_TYPE_WINT_T], [GNULIBHEADERS_OVERRIDE_WINT_T=0 AC_SUBST([GNULIBHEADERS_OVERRIDE_WINT_T])]) commit 2dc88a27a46ab1798383483454e45a7d69caa3d0 Merge: 6090e0f23e 63abe976ce Author: Glenn Morris Date: Tue Oct 5 07:50:22 2021 -0700 Merge from origin/emacs-28 63abe976ce (origin/emacs-28) Document minibuffer-default-prompt-forma... b5afbedc90 Backward compatibility option for 'nobreak-char-display' ea1b728a06 ; * lisp/dired.el: Fix typo. 984eafeb98 Unbreak the build after Gnulib update 5946370cd1 Check, whether an FUSE mount has been broken in Tramp 90575a6c0c Disable 'nobreak-char-display' in Eldoc buffers 570e2c9a17 Fix small error in comint-send-input fd7bb31412 Update documentation of search-whitespace-regexp 1f4ced47a1 Fix cc-compat.el syntax error b431f54c1b Mention `seq-uniq' in `delete-dups' documentation 0a7bab689c ; Minor stylistic fixes found by checkdoc e2861e2d08 ; * etc/NEWS: Fix typo. 1a65d49931 Port recent Gnulib changes to MS-Windows 68a256c892 Update from Gnulib 63cb65dcce * Fix mh tests for native comp builds (bug#50975) e606cc6f40 * Fix `batch-native-compile' not to spawn a subprocess 894dfe70da Fix native-compilation build from tarball on Cygwin 2ce5e08058 Remove U+FE0F from script-representative-chars # Conflicts: # etc/NEWS commit 6090e0f23e80945641970a6caa3681870b80e7fa Merge: 7fd9c3acc7 9750e78202 Author: Glenn Morris Date: Tue Oct 5 07:50:20 2021 -0700 ; Merge from origin/emacs-28 The following commit was skipped: 9750e78202 Fix problem with 'vertical-motion' and emoji commit 7fd9c3acc748738de6e8a9eab82a8d6450c82b7d Merge: e8cedbfcd1 13f459b3ac Author: Glenn Morris Date: Tue Oct 5 07:50:20 2021 -0700 Merge from origin/emacs-28 13f459b3ac ; Describe PROBLEMS with Unicode display on some TTYs 7a98a62079 * test/README: Mention :nativecomp tag. commit 63abe976ce65e42d67730d0577854867bc83e69c Author: Stefan Kangas Date: Tue Oct 5 16:34:07 2021 +0200 Document minibuffer-default-prompt-format in manual * doc/emacs/mini.texi (Basic Minibuffer): Mention minibuffer-default-prompt-format. (Bug#50935) diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi index 6dcee3fa82..b0f6e424a7 100644 --- a/doc/emacs/mini.texi +++ b/doc/emacs/mini.texi @@ -41,11 +41,14 @@ Alternatively, you can type @kbd{C-g} to exit the minibuffer by canceling the command asking for the argument (@pxref{Quitting}). @cindex default argument +@vindex minibuffer-default-prompt-format Sometimes, the prompt shows a @dfn{default argument}, inside parentheses before the colon. This default will be used as the argument if you just type @key{RET}. For example, commands that read buffer names usually show a buffer name as the default; you can type -@key{RET} to operate on that default buffer. +@key{RET} to operate on that default buffer. You can customize how +the default argument is shown with the user option +@code{minibuffer-default-prompt-format}. @cindex Minibuffer Electric Default mode @cindex mode, Minibuffer Electric Default commit e8cedbfcd1a10f8b03d59f109e2ac86f0411be04 Author: Basil L. Contovounesios Date: Tue Oct 5 15:31:17 2021 +0100 Fix recent "erts files" additions in ERT manual * doc/misc/ert.texi (erts files): Indent examples with spaces rather than tabs, since Texinfo treats tab characters as a single space; see (info "(texinfo) @example"). Fix typos/thinkos. diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index 0eb9cdf09f..770a5b7749 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -800,7 +800,7 @@ Name: flet (bla 42)) =-= (cl-flet ((bla (x) - (* x x))) + (* x x))) (bla 42)) =-=-= @@ -809,12 +809,12 @@ Name: defun =-= (defun x () (print (quote ( thingy great - stuff)))) + stuff)))) =-=-= @end example A test starts with a line containing just @samp{=-=} and ends with a -line containing just just @samp{=-=-=}. The test may be preceded by +line containing just @samp{=-=-=}. The test may be preceded by freeform text (for instance, comments), and also name/value pairs (see below for a list of them). @@ -838,7 +838,7 @@ Here's an example usage: A list of the name/value specifications that can appear before a test follows. The general syntax is @samp{Name: Value}, but continuation -lines can be used (along the same lines as in mail -- subsequent lines +lines can be used (along the same lines as in mail---subsequent lines that start with a space are part of the value). @example @@ -849,8 +849,8 @@ Code: (indent-region @table @samp @item Name -All tests should have a name. This name will appear in the output -from ert if the test fails, and helps identifying the failing test. +All tests should have a name. This name will appear in ERT output if +the test fails, and helps to identify the failing test. @item Code This is the code that will be run to do the transform. This can also @@ -867,7 +867,7 @@ specify.) @item Point-Char Sometimes it's useful to be able to put point at a specific place -before executing the transform character. @samp{Point-Char: |} will +before executing the transform function. @samp{Point-Char: |} will make @code{ert-test-erts-file} place point where @samp{|} is in the ``before'' form (and remove that character), and will check that it's where the @samp{|} character is in the ``after'' form (and issue a commit b5afbedc908e97cc5094a336cc275390d618e82e Author: Eli Zaretskii Date: Tue Oct 5 17:12:49 2021 +0300 Backward compatibility option for 'nobreak-char-display' * src/xdisp.c (syms_of_xdisp) : New variable. (get_next_display_element): If 'nobreak-char-ascii-display' is non-nil, display non-ASCII space and hyphen characters as their ASCII equivalents. (Bug#50983) * etc/NEWS: * etc/PROBLEMS: Mention 'nobreak-char-ascii-display'. diff --git a/etc/NEWS b/etc/NEWS index 0d44092f8d..2274588913 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -828,7 +828,24 @@ buffers. This can be controlled by customizing the user option *** 'nobreak-char-display' now also affects all non-ASCII space characters. Previously, this was limited only to 'NO-BREAK SPACE' and hyphen characters. Now it also covers the rest of the non-ASCII Unicode -space characters. +space characters. Also, unlike in previous versions of Emacs, the +non-ASCII characters are displayed as themselves when +'nobreak-char-display' is t, i.e. they are not replaced on display +with the ASCII space and hyphen characters. + +--- +*** New backward compatibility variable 'nobreak-char-ascii-display'. +This variable is nil by default, and non-ASCII space and hyphen +characters are displayed as themselves, even if 'nobreak-char-display' +is non-nil. If 'nobreak-char-ascii-display' is set to a non-nil +value, the non-ASCII space and hyphen characters are instead displayed +as their ASCII counterparts: spaces and ASCII hyphen (a.k.a. "dash") +characters. This provides backward compatibility feature for the +change described above, where the non-ASCII characters are no longer +replaced with their ASCII counterparts when 'nobreak-char-display' is +t. You may need this on text-mode terminals that produce messed up +display when non-ASCII spaces and hyphens are written to the display. +(This variable is only effective when 'nobreak-char-display' is t.) +++ *** Improved support for terminal emulators that encode the Meta flag. diff --git a/etc/PROBLEMS b/etc/PROBLEMS index f3c0c4b34c..f396dc3a00 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -1995,6 +1995,10 @@ a regular ASCII dash character '-': (aset standard-display-table #xAD (vector (make-glyph-code ?- 'escape-glyph))) +Another workaround is to set 'nobreak-char-ascii-display' to a non-nil +value, which will cause any non-ASCII space and hyphen characters to +be displayed as their ASCII counterparts, with a special face. + Kitty also differs from many other character terminals in how it handles character compositions. As one example, Emoji sequences that begin with a non-Emoji character and end in U+FE0F VARIATION SELECTOR diff --git a/src/xdisp.c b/src/xdisp.c index b777d1b282..9ddf0dd54b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -7668,7 +7668,8 @@ get_next_display_element (struct it *it) /* Merge `nobreak-space' into the current face. */ face_id = merge_faces (it->w, Qnobreak_space, 0, it->face_id); - XSETINT (it->ctl_chars[0], it->c); + XSETINT (it->ctl_chars[0], + nobreak_char_ascii_display ? ' ' : it->c); ctl_len = 1; goto display_control; } @@ -7681,7 +7682,8 @@ get_next_display_element (struct it *it) /* Merge `nobreak-space' into the current face. */ face_id = merge_faces (it->w, Qnobreak_hyphen, 0, it->face_id); - XSETINT (it->ctl_chars[0], it->c); + XSETINT (it->ctl_chars[0], + nobreak_char_ascii_display ? '-' : it->c); ctl_len = 1; goto display_control; } @@ -35034,6 +35036,26 @@ glyph followed by an ordinary space or hyphen. A value of nil means no special handling of these characters. */); Vnobreak_char_display = Qt; + DEFVAR_BOOL ("nobreak-char-ascii-display", nobreak_char_ascii_display, + doc: /* Control display of non-ASCII space and hyphen chars. +If the value of this variable is nil, the default, Emacs displays +non-ASCII chars which have the same appearance as an ASCII space +or hyphen as themselves, with the `nobreak-space' or `nobreak-hyphen' +face, respectively. + +If the value is t, these characters are displayed as their ASCII +counterparts: whitespace characters as ASCII space, hyphen characters +as ASCII hyphen (a.k.a. \"dash\"), using the `nobreak-space' or +the `nobreak-hyphen' face. + +This variable has effect only if `nobreak-char-display' is t; +otherwise it is ignored. + +All of the non-ASCII characters in the Unicode horizontal whitespace +character class, as well as U+00AD (soft hyphen), U+2010 (hyphen), and +U+2011 (non-breaking hyphen) are affected. */); + nobreak_char_ascii_display = false; + DEFVAR_LISP ("void-text-area-pointer", Vvoid_text_area_pointer, doc: /* The pointer shape to show in void text areas. A value of nil means to show the text pointer. Other options are commit d652efcd087099c71cd76c4bbf2bbf04314844b4 Author: Stefan Kangas Date: Tue Oct 5 15:36:31 2021 +0200 Make 'mapconcat' argument 'separator' optional * src/fns.c (Fmapconcat): Make third 'separator' argument optional. (Bug#50965) * doc/lispref/functions.texi (Mapping Functions): Update documentation for above change. * test/src/fns-tests.el (fns-tests-mapconcat): New test. * doc/misc/cl.texi (Obsolete Setf Customization): Don't use third mapconcat argument in example. * lisp/emacs-lisp/subr-x.el (string-join): Doc fix. diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index c856557c3c..3163300184 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -961,14 +961,14 @@ side-effects only---the values it returns are ignored, not collected into a list. @code{mapc} always returns @var{sequence}. @end defun -@defun mapconcat function sequence separator +@defun mapconcat function sequence &optional separator @code{mapconcat} applies @var{function} to each element of @var{sequence}; the results, which must be sequences of characters (strings, vectors, or lists), are concatenated into a single string return value. Between each pair of result sequences, @code{mapconcat} inserts the characters from @var{separator}, which also must be a -string, or a vector or list of characters. @xref{Sequences Arrays -Vectors}. +string, or a vector or list of characters; a @code{nil} value is +treated as the empty string. @xref{Sequences Arrays Vectors}. The argument @var{function} must be a function that can take one argument and returns a sequence of characters: a string, a vector, or @@ -986,8 +986,7 @@ string. @group (mapconcat (lambda (x) (format "%c" (1+ x))) - "HAL-8000" - "") + "HAL-8000") @result{} "IBM.9111" @end group @end example diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index 1e5d40b037..04e2c71a2b 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -5030,7 +5030,7 @@ The above @code{incf} example could be written using @ignore (defmacro concatf (place &rest args) (gv-letplace (getter setter) place - (macroexp-let2 nil v (mapconcat 'identity args "") + (macroexp-let2 nil v (mapconcat 'identity args) (funcall setter `(concat ,getter ,v))))) @end ignore @end defmac diff --git a/etc/NEWS b/etc/NEWS index 2dcd12f22f..e9fcfba425 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -118,6 +118,10 @@ with recent versions of Firefox. * Lisp Changes in Emacs 29.1 ++++ +** Third 'mapconcat' argument 'separator' is now optional. +An explicit nil always meant the empty string, now it can be left out. + --- ** Themes can now be made obsolete. Using 'make-obsolete' on a theme is now supported. This will make diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index ecd3ca831e..8d6bb19fd4 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -208,7 +208,9 @@ The variable list SPEC is the same as in `if-let'." (string= string "")) (defsubst string-join (strings &optional separator) - "Join all STRINGS using SEPARATOR." + "Join all STRINGS using SEPARATOR. +Optional argument SEPARATOR must be a string, a vector, or a list of +characters; nil stands for the empty string." (mapconcat #'identity strings separator)) (define-obsolete-function-alias 'string-reverse 'reverse "25.1") diff --git a/src/fns.c b/src/fns.c index a72e41aee5..61182852ba 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2852,12 +2852,16 @@ mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq) return leni; } -DEFUN ("mapconcat", Fmapconcat, Smapconcat, 3, 3, 0, +DEFUN ("mapconcat", Fmapconcat, Smapconcat, 2, 3, 0, doc: /* Apply FUNCTION to each element of SEQUENCE, and concat the results as strings. In between each pair of results, stick in SEPARATOR. Thus, " " as SEPARATOR results in spaces between the values returned by FUNCTION. + SEQUENCE may be a list, a vector, a bool-vector, or a string. -SEPARATOR must be a string, a vector, or a list of characters. + +Optional argument SEPARATOR must be a string, a vector, or a list of +characters; nil stands for the empty string. + FUNCTION must be a function of one argument, and must return a value that is a sequence of characters: either a string, or a vector or list of numbers that are valid character codepoints. */) diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 5759457209..2d641cc311 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -430,6 +430,23 @@ (buffer-hash)) (sha1 "foo")))) +(ert-deftest fns-tests-mapconcat () + (should (string= (mapconcat #'identity '()) "")) + (should (string= (mapconcat #'identity '("a" "b")) "ab")) + (should (string= (mapconcat #'identity '() "_") "")) + (should (string= (mapconcat #'identity '("A") "_") "A")) + (should (string= (mapconcat #'identity '("A" "B") "_") "A_B")) + (should (string= (mapconcat #'identity '("A" "B" "C") "_") "A_B_C")) + ;; non-ASCII strings + (should (string= (mapconcat #'identity '("Ä" "ø" "☭" "தமிழ்") "_漢字_") + "Ä_漢字_ø_漢字_☭_漢字_தமிழ்")) + ;; vector + (should (string= (mapconcat #'identity ["a" "b"] "") "ab")) + ;; bool-vector + (should (string= (mapconcat #'identity [nil nil] "") "")) + (should-error (mapconcat #'identity [nil nil t]) + :type 'wrong-type-argument)) + (ert-deftest fns-tests-mapcan () (should-error (mapcan)) (should-error (mapcan #'identity)) commit ea1b728a06ebbe61910c9f8f5de2fdf2c07f9178 Author: Stefan Kangas Date: Tue Oct 5 15:20:28 2021 +0200 ; * lisp/dired.el: Fix typo. diff --git a/lisp/dired.el b/lisp/dired.el index fff4f16ee9..4652589122 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -247,7 +247,7 @@ This is similar to the \"-L\" option for the \"cp\" shell command." :type 'boolean :group 'dired) -;; These variables were deleted and the replacements are on files.el. +;; These variables were deleted and the replacements are in files.el. ;; We leave aliases behind for back-compatibility. (define-obsolete-variable-alias 'dired-free-space-program 'directory-free-space-program "27.1") commit 4bf532ee82473740cfd43c66ecbfe6cfddf99df9 Author: Stefan Kangas Date: Tue Oct 5 15:17:41 2021 +0200 Make two old function aliases obsolete * lisp/textmodes/bibtex.el (bibtex-find-crossref) (bibtex-find-entry): Make function aliases obsolete. These were left behind when renaming functions, but never declared obsolete. diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index 9b76f98322..11913a213b 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el @@ -1142,7 +1142,7 @@ non-nil." entry) (while (car-safe old) (cl-incf count) - ;; don't use progress reporters for backwards compatibility + ;; todo: use progress reporters. (when (and (< 0 expected) (= 0 (mod count 100))) (message "importing: %d of %d (%.2f%%)" diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 237a1d9935..c06e8bfa1b 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -4317,8 +4317,6 @@ for a crossref key, t otherwise." (eqb (goto-char pos)) (t (set-buffer buffer) (goto-char pos))) pos)) -;; backward compatibility -(defalias 'bibtex-find-crossref 'bibtex-search-crossref) (defun bibtex-dist (pos beg end) "Return distance between POS and region delimited by BEG and END." @@ -4381,8 +4379,6 @@ A prefix arg negates the value of `bibtex-search-entry-globally'." (if display (bibtex-reposition-window))) (display (message "Key `%s' not found" key))) pnt))) -;; backward compatibility -(defalias 'bibtex-find-entry 'bibtex-search-entry) (defun bibtex-prepare-new-entry (index) "Prepare a new BibTeX entry with index INDEX. @@ -5608,5 +5604,8 @@ If APPEND is non-nil, append ENTRIES to those already displayed." (setq buffer-read-only t) (goto-char (point-min))) +(define-obsolete-function-alias 'bibtex-find-crossref #'bibtex-search-crossref "29.1") +(define-obsolete-function-alias 'bibtex-find-entry #'bibtex-search-entry "29.1") + (provide 'bibtex) ;;; bibtex.el ends here commit 984eafeb9890d8a6e4fa401d38f5e6de9d720f2b Author: Eli Zaretskii Date: Tue Oct 5 15:55:18 2021 +0300 Unbreak the build after Gnulib update * lib/gnulib.mk.in (GNULIBHEADERS_OVERRIDE_WINT_T): Rename from GNULIB_OVERRIDES_WINT_T. * configure.ac (GNULIBHEADERS_OVERRIDE_WINT_T): Define. (Bug#50985) diff --git a/configure.ac b/configure.ac index 92b222545d..62bf25ebbf 100644 --- a/configure.ac +++ b/configure.ac @@ -877,6 +877,9 @@ ac_func_list=$funcs AC_DEFUN([gt_TYPE_WINT_T], [GNULIB_OVERRIDES_WINT_T=0 AC_SUBST([GNULIB_OVERRIDES_WINT_T])]) +AC_DEFUN([gt_TYPE_WINT_T], + [GNULIBHEADERS_OVERRIDE_WINT_T=0 + AC_SUBST([GNULIBHEADERS_OVERRIDE_WINT_T])]) # Initialize gnulib right after choosing the compiler. dnl Amongst other things, this sets AR and ARFLAGS. diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 584c7141d8..bac27f3a68 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -545,7 +545,7 @@ GL_GNULIB__EXIT = @GL_GNULIB__EXIT@ GMALLOC_OBJ = @GMALLOC_OBJ@ GMP_H = @GMP_H@ GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ -GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ +GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@ GNULIB_WARN_CFLAGS = @GNULIB_WARN_CFLAGS@ GNUSTEP_CFLAGS = @GNUSTEP_CFLAGS@ GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@ commit f6901aebad31bce473cf2d438ffec2473d2df05b Author: Stefan Kangas Date: Tue Oct 5 14:43:11 2021 +0200 Set advertised calling convention on make-face-* functions * lisp/faces.el (make-face-bold, make-face-unbold) (make-face-italic, make-face-unitalic, make-face-bold-italic): Use `advertised-calling-convention` to avoid promoting the third _noerror argument; it has been ignored since 1999. diff --git a/lisp/faces.el b/lisp/faces.el index 302bfa245e..089cb88909 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -861,8 +861,8 @@ is specified, `:italic' is ignored." (defun make-face-bold (face &optional frame _noerror) "Make the font of FACE be bold, if possible. FRAME nil or not specified means change face on all frames. -Argument NOERROR is ignored and retained for compatibility. Use `set-face-attribute' for finer control of the font weight." + (declare (advertised-calling-convention (face &optional frame) "29.1")) (interactive (list (read-face-name "Make which face bold" (face-at-point t)))) (set-face-attribute face frame :weight 'bold)) @@ -870,8 +870,8 @@ Use `set-face-attribute' for finer control of the font weight." (defun make-face-unbold (face &optional frame _noerror) "Make the font of FACE be non-bold, if possible. -FRAME nil or not specified means change face on all frames. -Argument NOERROR is ignored and retained for compatibility." +FRAME nil or not specified means change face on all frames." + (declare (advertised-calling-convention (face &optional frame) "29.1")) (interactive (list (read-face-name "Make which face non-bold" (face-at-point t)))) (set-face-attribute face frame :weight 'normal)) @@ -880,8 +880,8 @@ Argument NOERROR is ignored and retained for compatibility." (defun make-face-italic (face &optional frame _noerror) "Make the font of FACE be italic, if possible. FRAME nil or not specified means change face on all frames. -Argument NOERROR is ignored and retained for compatibility. Use `set-face-attribute' for finer control of the font slant." + (declare (advertised-calling-convention (face &optional frame) "29.1")) (interactive (list (read-face-name "Make which face italic" (face-at-point t)))) (set-face-attribute face frame :slant 'italic)) @@ -889,8 +889,8 @@ Use `set-face-attribute' for finer control of the font slant." (defun make-face-unitalic (face &optional frame _noerror) "Make the font of FACE be non-italic, if possible. -FRAME nil or not specified means change face on all frames. -Argument NOERROR is ignored and retained for compatibility." +FRAME nil or not specified means change face on all frames." + (declare (advertised-calling-convention (face &optional frame) "29.1")) (interactive (list (read-face-name "Make which face non-italic" (face-at-point t)))) (set-face-attribute face frame :slant 'normal)) @@ -899,8 +899,8 @@ Argument NOERROR is ignored and retained for compatibility." (defun make-face-bold-italic (face &optional frame _noerror) "Make the font of FACE be bold and italic, if possible. FRAME nil or not specified means change face on all frames. -Argument NOERROR is ignored and retained for compatibility. Use `set-face-attribute' for finer control of font weight and slant." + (declare (advertised-calling-convention (face &optional frame) "29.1")) (interactive (list (read-face-name "Make which face bold-italic" (face-at-point t)))) (set-face-attribute face frame :weight 'bold :slant 'italic)) commit 5946370cd1d6728f2edd071fa8befc88fd0bd7a7 Author: Michael Albinus Date: Tue Oct 5 11:27:48 2021 +0200 Check, whether an FUSE mount has been broken in Tramp * lisp/net/tramp-fuse.el (tramp-fuse-mount-timeout): New defconst. (tramp-fuse-mounted-p): Use it. Check for a file property instead of a connection property. (tramp-fuse-unmount): Dito. * lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection): Do not trust existence of a process, whether the volume is mounted. diff --git a/lisp/net/tramp-fuse.el b/lisp/net/tramp-fuse.el index d2bac2d0ee..c359082dc1 100644 --- a/lisp/net/tramp-fuse.el +++ b/lisp/net/tramp-fuse.el @@ -156,19 +156,27 @@ (tramp-file-name-host-port vec)) tramp-compat-temporary-file-directory))) +(defconst tramp-fuse-mount-timeout + (eval (car (get 'remote-file-name-inhibit-cache 'standard-value)) t) + "Time period to check whether the mount point still exists. +It has the same meaning as `remote-file-name-inhibit-cache'.") + (defun tramp-fuse-mounted-p (vec) "Check, whether fuse volume determined by VEC is mounted." - (when (tramp-get-connection-process vec) - ;; We cannot use `with-connection-property', because we don't want - ;; to cache a nil result. - (or (tramp-get-connection-property - (tramp-get-connection-process vec) "mounted" nil) + ;; Remember the mount status by using a file property on "/", + ;; instead of using a connection property, because a file property + ;; has a timeout. Having a timeout lets us regularly recheck the + ;; mount status, as requested by `tramp-fuse-mount-timeout'. We + ;; cannot use `with-tramp-file-property', because we don't want to + ;; cache a nil result. + (let ((remote-file-name-inhibit-cache tramp-fuse-mount-timeout)) + (or (tramp-get-file-property vec "/" "mounted" nil) (let* ((default-directory tramp-compat-temporary-file-directory) (command (format "mount -t fuse.%s" (tramp-file-name-method vec))) (mount (shell-command-to-string command))) (tramp-message vec 6 "%s\n%s" command mount) - (tramp-set-connection-property - (tramp-get-connection-process vec) "mounted" + (tramp-set-file-property + vec "/" "mounted" (when (string-match (format "^\\(%s\\)\\s-" (regexp-quote (tramp-fuse-mount-spec vec))) @@ -191,8 +199,7 @@ (mount-point (tramp-fuse-mount-point vec)) (command (format "%s -u %s" (tramp-fuse-get-fusermount) mount-point))) (tramp-message vec 6 "%s\n%s" command (shell-command-to-string command)) - (tramp-flush-connection-property - (tramp-get-connection-process vec) "mounted") + (tramp-flush-file-property vec "/" "mounted") (setq tramp-fuse-mount-points (delete (tramp-file-name-unify vec) tramp-fuse-mount-points)) ;; Give the caches a chance to expire. diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el index 2be0485fbf..1bd4c5dc1c 100644 --- a/lisp/net/tramp-sshfs.el +++ b/lisp/net/tramp-sshfs.el @@ -349,31 +349,31 @@ connection if a previous connection has died for some reason." (tramp-set-connection-property p "lock-pid" (truncate (time-to-seconds))) ;; Set connection-local variables. - (tramp-set-connection-local-variables vec) - - ;; Create directory. - (unless (file-directory-p (tramp-fuse-mount-point vec)) - (make-directory (tramp-fuse-mount-point vec) 'parents)) - - (unless - (or (tramp-fuse-mounted-p vec) - (with-temp-buffer - (zerop - (apply - #'tramp-call-process - vec tramp-sshfs-program nil t nil - (tramp-fuse-mount-spec vec) - (tramp-fuse-mount-point vec) - (tramp-expand-args - vec 'tramp-mount-args - ?p (or (tramp-file-name-port vec) ""))))) - (tramp-error - vec 'file-error "Error mounting %s" (tramp-fuse-mount-spec vec)))) - - ;; Mark it as connected. - (add-to-list 'tramp-fuse-mount-points (tramp-file-name-unify vec)) - (tramp-set-connection-property - (tramp-get-connection-process vec) "connected" t))) + (tramp-set-connection-local-variables vec))) + + ;; Create directory. + (unless (file-directory-p (tramp-fuse-mount-point vec)) + (make-directory (tramp-fuse-mount-point vec) 'parents)) + + (unless + (or (tramp-fuse-mounted-p vec) + (with-temp-buffer + (zerop + (apply + #'tramp-call-process + vec tramp-sshfs-program nil t nil + (tramp-fuse-mount-spec vec) + (tramp-fuse-mount-point vec) + (tramp-expand-args + vec 'tramp-mount-args + ?p (or (tramp-file-name-port vec) "")))))) + (tramp-error + vec 'file-error "Error mounting %s" (tramp-fuse-mount-spec vec))) + + ;; Mark it as connected. + (add-to-list 'tramp-fuse-mount-points (tramp-file-name-unify vec)) + (tramp-set-connection-property + (tramp-get-connection-process vec) "connected" t) ;; In `tramp-check-cached-permissions', the connection properties ;; "{uid,gid}-{integer,string}" are used. We set them to proper values. commit 90575a6c0c17e88671999867f0773fef5ea516a8 Author: Augusto Stoffel Date: Tue Oct 5 11:12:05 2021 +0200 Disable 'nobreak-char-display' in Eldoc buffers * lisp/emacs-lisp/eldoc.el (eldoc--format-doc-buffer): Set 'nobreak-char-display' to nil in Eldoc buffers (bug#50989). diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 21f262adc6..a1c3c3268f 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -477,6 +477,7 @@ This holds the results of the last documentation request." (let ((inhibit-read-only t) (things-reported-on)) (erase-buffer) (setq buffer-read-only t) + (setq-local nobreak-char-display nil) (local-set-key "q" 'quit-window) (cl-loop for (docs . rest) on docs for (this-doc . plist) = docs commit 4103123806311aa42f8ee22082015c0a7c3e30dd Author: Lars Ingebrigtsen Date: Tue Oct 5 10:34:37 2021 +0200 Change the call convention for `defvar-keymap' * doc/lispref/keymaps.texi (Changing Key Bindings): Adjust documentation. * lisp/simple.el (special-mode-map): * lisp/net/shr.el (shr-map): * lisp/net/eww.el (eww-link-keymap): (eww-mode-map): (eww-submit-map): (eww-textarea-map): (eww-bookmark-mode-map): (eww-history-mode-map): (eww-buffers-mode-map): * lisp/gnus/message.el (message-mode-map): * lisp/gnus/gnus-html.el (gnus-html-image-map): * lisp/gnus/gnus-eform.el (gnus-edit-form-mode-map): * lisp/gnus/gnus-dired.el (gnus-dired-mode-map): * lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-mode-map): Adjust usage of `defvar-keymap'. * lisp/subr.el (define-keymap, define-keymap--define): Change how these functions call each other. (defvar-keymap): Change interface to be more like `define-keymap'. * lisp/emacs-lisp/lisp-mode.el (lisp-indent--defvar-keymap): Remove. (lisp-indent-function): Don't use it. diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index adee7ce58e..407bdca5ed 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi @@ -1455,13 +1455,13 @@ returned by @code{define-keymap} instead of the map itself. @end defun -@defmac defvar-keymap name options &rest defs +@defmac defvar-keymap name &key options... &rest pairs... By far, the most common thing to do with a keymap is to bind it to a variable. This is what virtually all modes do---a mode called @code{foo} almost always has a variable called @code{foo-mode-map}. This macro defines @var{name} as a variable, and passes @var{options} -and @var{defs} to @code{define-keymap}, and uses the result as the +and @var{pars} to @code{define-keymap}, and uses the result as the default value for the variable. @var{options} is like the keywords in @code{define-keymap}, but adds a @@ -1471,7 +1471,8 @@ variable should be. Here's an example: @lisp -(defvar-keymap eww-textarea-map (:parent text-mode-map) +(defvar-keymap eww-textarea-map + :parent text-mode-map "\r" #'forward-line [?\t] #'shr-next-link) @end lisp diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index a465d189b7..57196dfec4 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1162,18 +1162,6 @@ STATE is the `parse-partial-sexp' state for current position." (goto-char (scan-lists (point) -1 0)) (point))))))))))) -(defun lisp-indent--defvar-keymap (state) - "Return the indent position in the options part of a `defvar-keymap' form." - (save-excursion - (let ((parens (ppss-open-parens state))) - (and (equal (nth 1 parens) (ppss-innermost-start state)) - (progn - (goto-char (nth 0 parens)) - (looking-at-p "(defvar-keymap")) - (progn - (goto-char (ppss-innermost-start state)) - (1+ (current-column))))))) - (defun lisp-indent-function (indent-point state) "This function is the normal value of the variable `lisp-indent-function'. The function `calculate-lisp-indent' calls this to determine @@ -1207,12 +1195,10 @@ Lisp function does not specify a special indentation." (if (and (elt state 2) (not (looking-at "\\sw\\|\\s_"))) ;; car of form doesn't seem to be a symbol - (cond - ((lisp--local-defform-body-p state) - ;; We nevertheless check whether we are in flet-like form - ;; as we presume local function names could be non-symbols. - (lisp-indent-defform state indent-point)) - (t + (if (lisp--local-defform-body-p state) + ;; We nevertheless check whether we are in flet-like form + ;; as we presume local function names could be non-symbols. + (lisp-indent-defform state indent-point) (if (not (> (save-excursion (forward-line 1) (point)) calculate-lisp-indent-last-sexp)) (progn (goto-char calculate-lisp-indent-last-sexp) @@ -1224,28 +1210,25 @@ Lisp function does not specify a special indentation." ;; thing on that line has to be complete sexp since we are ;; inside the innermost containing sexp. (backward-prefix-chars) - (current-column))) - ;; Indent `defvar-keymap' arguments. - (or (lisp-indent--defvar-keymap state) - ;; Other forms. - (let ((function (buffer-substring (point) - (progn (forward-sexp 1) (point)))) - method) - (setq method (or (function-get (intern-soft function) - 'lisp-indent-function) - (get (intern-soft function) 'lisp-indent-hook))) - (cond ((or (eq method 'defun) - (and (null method) - (> (length function) 3) - (string-match "\\`def" function)) - ;; Check whether we are in flet-like form. - (lisp--local-defform-body-p state)) - (lisp-indent-defform state indent-point)) - ((integerp method) - (lisp-indent-specform method state - indent-point normal-indent)) - (method - (funcall method indent-point state)))))))) + (current-column)) + (let ((function (buffer-substring (point) + (progn (forward-sexp 1) (point)))) + method) + (setq method (or (function-get (intern-soft function) + 'lisp-indent-function) + (get (intern-soft function) 'lisp-indent-hook))) + (cond ((or (eq method 'defun) + (and (null method) + (> (length function) 3) + (string-match "\\`def" function)) + ;; Check whether we are in flet-like form. + (lisp--local-defform-body-p state)) + (lisp-indent-defform state indent-point)) + ((integerp method) + (lisp-indent-specform method state + indent-point normal-indent)) + (method + (funcall method indent-point state))))))) (defcustom lisp-body-indent 2 "Number of columns to indent the second line of a `(def...)' form." diff --git a/lisp/gnus/gnus-bookmark.el b/lisp/gnus/gnus-bookmark.el index a6b1a0762b..171da9d17a 100644 --- a/lisp/gnus/gnus-bookmark.el +++ b/lisp/gnus/gnus-bookmark.el @@ -419,8 +419,9 @@ That is, all information but the name." (defvar gnus-bookmark-bmenu-bookmark-column nil) (defvar gnus-bookmark-bmenu-hidden-bookmarks ()) -(defvar-keymap gnus-bookmark-bmenu-mode-map (:full t - :suppress 'nodigits) +(defvar-keymap gnus-bookmark-bmenu-mode-map + :full t + :suppress 'nodigits "q" #'quit-window "\C-m" #'gnus-bookmark-bmenu-select "v" #'gnus-bookmark-bmenu-select diff --git a/lisp/gnus/gnus-dired.el b/lisp/gnus/gnus-dired.el index 08a4289714..be46d3a341 100644 --- a/lisp/gnus/gnus-dired.el +++ b/lisp/gnus/gnus-dired.el @@ -53,7 +53,7 @@ (autoload 'message-buffers "message") (autoload 'gnus-print-buffer "gnus-sum") -(defvar-keymap gnus-dired-mode-map () +(defvar-keymap gnus-dired-mode-map "\C-c\C-m\C-a" #'gnus-dired-attach "\C-c\C-m\C-l" #'gnus-dired-find-file-mailcap "\C-c\C-m\C-p" #'gnus-dired-print) diff --git a/lisp/gnus/gnus-eform.el b/lisp/gnus/gnus-eform.el index 922e25e277..b0aa58f0f2 100644 --- a/lisp/gnus/gnus-eform.el +++ b/lisp/gnus/gnus-eform.el @@ -48,7 +48,8 @@ (defvar gnus-edit-form-buffer "*Gnus edit form*") (defvar gnus-edit-form-done-function nil) -(defvar-keymap gnus-edit-form-mode-map (:parent emacs-lisp-mode-map) +(defvar-keymap gnus-edit-form-mode-map + :parent emacs-lisp-mode-map "\C-c\C-c" #'gnus-edit-form-done "\C-c\C-k" #'gnus-edit-form-exit) diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el index e9fa819d0b..c1815d3486 100644 --- a/lisp/gnus/gnus-html.el +++ b/lisp/gnus/gnus-html.el @@ -71,12 +71,12 @@ fit these criteria." :group 'gnus-art :type 'float) -(defvar-keymap gnus-html-image-map () +(defvar-keymap gnus-html-image-map "u" #'gnus-article-copy-string "i" #'gnus-html-insert-image "v" #'gnus-html-browse-url) -(defvar-keymap gnus-html-displayed-image-map () +(defvar-keymap gnus-html-displayed-image-map "a" #'gnus-html-show-alt-text "i" #'gnus-html-browse-image "\r" #'gnus-html-browse-url diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 7ca43d603f..e165a0429f 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -2868,8 +2868,9 @@ Consider adding this function to `message-header-setup-hook'" ;;; Set up keymap. -(defvar-keymap message-mode-map (:full t :parent text-mode-map - :doc "Message Mode keymap.") +(defvar-keymap message-mode-map + :full t :parent text-mode-map + :doc "Message Mode keymap." "\C-c?" #'describe-mode "\C-c\C-f\C-t" #'message-goto-to diff --git a/lisp/net/eww.el b/lisp/net/eww.el index afcf2ce8b4..24c6335210 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -271,10 +271,12 @@ See also `eww-form-checkbox-selected-symbol'." "text/html, text/plain, text/sgml, text/css, application/xhtml+xml, */*;q=0.01" "Value used for the HTTP 'Accept' header.") -(defvar-keymap eww-link-keymap (:parent shr-map) +(defvar-keymap eww-link-keymap + :parent shr-map "\r" #'eww-follow-link) -(defvar-keymap eww-image-link-keymap (:parent shr-map) +(defvar-keymap eww-image-link-keymap + :parent shr-map "\r" #'eww-follow-link) (defun eww-suggested-uris nil @@ -969,7 +971,7 @@ the like." (setq result highest)))) result)) -(defvar-keymap eww-mode-map () +(defvar-keymap eww-mode-map "g" #'eww-reload ;FIXME: revert-buffer-function instead! "G" #'eww [?\M-\r] #'eww-open-in-new-buffer @@ -1223,20 +1225,21 @@ just re-display the HTML already fetched." (defvar eww-form nil) -(defvar-keymap eww-submit-map () +(defvar-keymap eww-submit-map "\r" #'eww-submit [(control c) (control c)] #'eww-submit) -(defvar-keymap eww-submit-file () +(defvar-keymap eww-submit-file "\r" #'eww-select-file [(control c) (control c)] #'eww-submit) -(defvar-keymap eww-checkbox-map () +(defvar-keymap eww-checkbox-map " " #'eww-toggle-checkbox "\r" #'eww-toggle-checkbox [(control c) (control c)] #'eww-submit) -(defvar-keymap eww-text-map (:full t :parent text-mode-map) +(defvar-keymap eww-text-map + :full t :parent text-mode-map "\r" #'eww-submit [(control a)] #'eww-beginning-of-text [(control c) (control c)] #'eww-submit @@ -1245,14 +1248,16 @@ just re-display the HTML already fetched." [?\M-\t] #'shr-previous-link [backtab] #'shr-previous-link) -(defvar-keymap eww-textarea-map (:full t :parent text-mode-map) +(defvar-keymap eww-textarea-map + :full t :parent text-mode-map "\r" #'forward-line [(control c) (control c)] #'eww-submit [?\t] #'shr-next-link [?\M-\t] #'shr-previous-link [backtab] #'shr-previous-link) -(defvar-keymap eww-select-map (:doc "Map for select buttons") +(defvar-keymap eww-select-map + :doc "Map for select buttons" "\r" #'eww-change-select [follow-link] 'mouse-face [mouse-2] #'eww-change-select @@ -2079,7 +2084,7 @@ If ERROR-OUT, signal user-error if there are no bookmarks." 'eww-bookmark))) (eww-browse-url (plist-get bookmark :url)))) -(defvar-keymap eww-bookmark-mode-map () +(defvar-keymap eww-bookmark-mode-map [(control k)] #'eww-bookmark-kill [(control y)] #'eww-bookmark-yank "\r" #'eww-bookmark-browse @@ -2155,7 +2160,7 @@ If ERROR-OUT, signal user-error if there are no bookmarks." (pop-to-buffer-same-window buffer))) (eww-restore-history history))) -(defvar-keymap eww-history-mode-map () +(defvar-keymap eww-history-mode-map "\r" #'eww-history-browse "n" #'next-line "p" #'previous-line @@ -2274,7 +2279,7 @@ If ERROR-OUT, signal user-error if there are no bookmarks." (forward-line -1)) (eww-buffer-show)) -(defvar-keymap eww-buffers-mode-map () +(defvar-keymap eww-buffers-mode-map [(control k)] #'eww-buffer-kill "\r" #'eww-buffer-select "n" #'eww-buffer-show-next diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 8f11b140fb..72d2ab7867 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -247,7 +247,7 @@ and other things: (defvar shr-target-id nil "Target fragment identifier anchor.") -(defvar-keymap shr-map () +(defvar-keymap shr-map "a" #'shr-show-alt-text "i" #'shr-browse-image "z" #'shr-zoom-image diff --git a/lisp/simple.el b/lisp/simple.el index 114c841c2c..5c6adcf490 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -529,7 +529,8 @@ Other major modes are defined by comparison with this one." ;; Special major modes to view specially formatted data rather than files. -(defvar-keymap special-mode-map (:suppress t) +(defvar-keymap special-mode-map + :suppress t "q" #'quit-window " " #'scroll-up-command [?\S-\ ] #'scroll-down-command diff --git a/lisp/subr.el b/lisp/subr.el index e4819c4b2b..f751c297ed 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6491,30 +6491,26 @@ KEY/DEFINITION pairs are as KEY and DEF in `define-key'. KEY can also be the special symbol `:menu', in which case DEFINITION should be a MENU form as accepted by `easy-menu-define'. -\(fn (&key FULL PARENT SUPPRESS NAME PREFIX KEYMAP) &rest [KEY DEFINITION]...)" - ;; Handle keywords. - (let ((options nil)) +\(fn &key FULL PARENT SUPPRESS NAME PREFIX KEYMAP &rest [KEY DEFINITION]...)" + (define-keymap--define definitions)) + +(defun define-keymap--define (definitions) + (let (full suppress parent name prefix keymap) + ;; Handle keywords. (while (and definitions - (keywordp (car definitions))) + (keywordp (car definitions)) + (not (eq (car definitions) :menu))) (let ((keyword (pop definitions))) (unless definitions (error "Missing keyword value for %s" keyword)) - (push keyword options) - (push (pop definitions) options))) - (define-keymap--define (nreverse options) definitions))) - -(defun define-keymap--define (options definitions) - (let (full suppress parent name prefix keymap) - (while options - (let ((keyword (pop options)) - (value (pop options))) - (pcase keyword - (:full (setq full value)) - (:keymap (setq keymap value)) - (:parent (setq parent value)) - (:suppress (setq suppress value)) - (:name (setq name value)) - (:prefix (setq prefix value))))) + (let ((value (pop definitions))) + (pcase keyword + (:full (setq full value)) + (:keymap (setq keymap value)) + (:parent (setq parent value)) + (:suppress (setq suppress value)) + (:name (setq name value)) + (:prefix (setq prefix value)))))) (when (and prefix (or full parent suppress keymap)) @@ -6544,27 +6540,31 @@ should be a MENU form as accepted by `easy-menu-define'. (define-key keymap key def))))) keymap))) -(defmacro defvar-keymap (name options &rest defs) - "Define NAME as a variable with a keymap definition. -See `define-keymap' for an explanation of OPTIONS. In addition, -the :doc keyword can be used in OPTIONS to add a doc string to NAME. +(defmacro defvar-keymap (variable-name &rest defs) + "Define VARIABLE-NAME as a variable with a keymap definition. +See `define-keymap' for an explanation of the keywords and KEY/DEFINITION. + +In addition to the keywords accepted by `define-keymap', this +macro also accepts a `:doc' keyword, which (if present) is used +as the variable documentation string. -DEFS is passed to `define-keymap' and should be a plist of -key/definition pairs." +\(fn VARIABLE-NAME &key DOC FULL PARENT SUPPRESS NAME PREFIX KEYMAP &rest [KEY DEFINITION]...)" (let ((opts nil) doc) - (while options - (let ((keyword (pop options))) - (unless options - (error "Uneven number of options")) + (while (and defs + (keywordp (car defs)) + (not (eq (car defs) :menu))) + (let ((keyword (pop defs))) + (unless defs + (error "Uneven number of keywords")) (if (eq keyword :doc) - (setq doc (pop options)) + (setq doc (pop defs)) (push keyword opts) - (push (pop options) opts)))) + (push (pop defs) opts)))) (unless (zerop (% (length defs) 2)) - (error "Uneven number of key definitions: %s" defs)) - `(defvar ,name - (define-keymap--define (list ,@(nreverse opts)) (list ,@defs)) + (error "Uneven number of key/definition pairs: %s" defs)) + `(defvar ,variable-name + (define-keymap--define (list ,@(nreverse opts) ,@defs)) ,@(and doc (list doc))))) ;;; subr.el ends here diff --git a/test/lisp/progmodes/elisp-mode-resources/elisp-indents.erts b/test/lisp/progmodes/elisp-mode-resources/elisp-indents.erts index 70642e230c..d3eaac9ba5 100644 --- a/test/lisp/progmodes/elisp-mode-resources/elisp-indents.erts +++ b/test/lisp/progmodes/elisp-mode-resources/elisp-indents.erts @@ -52,7 +52,8 @@ Name: defun-space Name: defvar-keymap =-= -(defvar-keymap eww-link-keymap (:copy shr-map - :foo bar) +(defvar-keymap eww-link-keymap + :copy shr-map + :foo bar "\r" #'eww-follow-link) =-=-= commit 570e2c9a17ca0b2964bb79e18b8cb5dda5fe9a98 Author: Miha Rihtaršič Date: Tue Oct 5 09:42:28 2021 +0200 Fix small error in comint-send-input * lisp/comint.el (comint-send-input): Run comint-output-filter-functions with comint-last-output-start set correctly (bug#51009). diff --git a/lisp/comint.el b/lisp/comint.el index 1e5b990c77..a0873c0b6a 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -1990,6 +1990,7 @@ Similarly for Soar, Scheme, etc." ;; This used to call comint-output-filter-functions, ;; but that scrolled the buffer in undesirable ways. + (set-marker comint-last-output-start pmark) (run-hook-with-args 'comint-output-filter-functions ""))))) (defvar comint-preoutput-filter-functions nil commit 947aee281c1f6d891a5770e70735697fe3c3e1a7 Author: Daniel Martín Date: Tue Oct 5 09:39:03 2021 +0200 Update documentation about how M-x completes obsolete commands * doc/emacs/m-x.texi (M-x): Mention that Emacs offers completion for commands marked obsolete in the current version of Emacs (bug#51017). diff --git a/doc/emacs/m-x.texi b/doc/emacs/m-x.texi index d35a835154..7b9b40388c 100644 --- a/doc/emacs/m-x.texi +++ b/doc/emacs/m-x.texi @@ -45,10 +45,11 @@ from running the command by name. @cindex obsolete command When @kbd{M-x} completes on commands, it ignores the commands that -are declared @dfn{obsolete}; for these, you will have to type their -full name. (Obsolete commands are those for which newer, better -alternatives exist, and which are slated for removal in some future -Emacs release.) +were declared @dfn{obsolete} in any previous major version of Emacs; +for these, you will have to type their full name. Commands that were +marked obsolete in the current version of Emacs are listed. (Obsolete +commands are those for which newer, better alternatives exist, and +which are slated for removal in some future Emacs release.) @vindex read-extended-command-predicate In addition, @kbd{M-x} completion can exclude commands that are not commit fd7bb314128baa270d63c79fac97792be5a271e2 Author: Daniel Martín Date: Tue Oct 5 09:37:56 2021 +0200 Update documentation of search-whitespace-regexp * doc/emacs/search.texi (Lax Search): Update the documentation about the default value of search-whitespace-regexp, as it is now independent of the major mode's syntax table (bug#51020). diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 8a101f1150..761161be1c 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -1332,9 +1332,8 @@ precisely, Emacs matches each sequence of space characters in the search string to a regular expression specified by the variable @code{search-whitespace-regexp}. For example, to make spaces match sequences of newlines as well as spaces, set it to -@samp{"[[:space:]\n]+"}. The default value of this variable depends -on the buffer's major mode; most major modes classify spaces, tabs, -and formfeed characters as whitespace. +@samp{"[[:space:]\n]+"}. The default value of this variable considers +any sequence of spaces and tab characters as whitespace. If you want whitespace characters to match exactly, you can turn lax space matching off by typing @kbd{M-s @key{SPC}} commit 1f4ced47a1d2387be3c439f6858cf5fa1903cac8 Author: Po Lu via Date: Tue Oct 5 09:22:57 2021 +0200 Fix cc-compat.el syntax error * lisp/obsolete/cc-compat.el (offsets): Fix syntax error in BOCM style setup. diff --git a/lisp/obsolete/cc-compat.el b/lisp/obsolete/cc-compat.el index 037a8e9e87..2c383d31c8 100644 --- a/lisp/obsolete/cc-compat.el +++ b/lisp/obsolete/cc-compat.el @@ -80,7 +80,7 @@ This is in addition to c-continued-statement-offset.") ;; these offsets are taken by brute force testing c-mode.el, since ;; there's no logic to what it does. -(let* ((offsets '(c-offsets-alist . +(let* ((offsets '((c-offsets-alist . ((defun-block-intro . cc-block-intro-offset) (statement-block-intro . cc-block-intro-offset) (defun-open . 0) @@ -95,7 +95,7 @@ This is in addition to c-continued-statement-offset.") (case-label . c-label-offset) (access-label . c-label-offset) (label . c-label-offset) - )))) + ))))) (c-add-style "BOCM" offsets)) commit b431f54c1b01675ba36513474e14b206e26fd6fa Author: Tak Kunihiro Date: Tue Oct 5 09:11:33 2021 +0200 Mention `seq-uniq' in `delete-dups' documentation * doc/lispref/lists.texi (Sets And Lists): Mention `seq-uniq' (bug#50928). * lisp/subr.el (delete-dups): Link to `seq-uniq' in doc string. diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index 75641256b6..f98ae76da9 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -1227,13 +1227,13 @@ this is not guaranteed to happen): @cindex lists as sets @cindex sets - A list can represent an unordered mathematical set---simply consider a -value an element of a set if it appears in the list, and ignore the -order of the list. To form the union of two sets, use @code{append} (as -long as you don't mind having duplicate elements). You can remove -@code{equal} duplicates using @code{delete-dups}. Other useful -functions for sets include @code{memq} and @code{delq}, and their -@code{equal} versions, @code{member} and @code{delete}. + A list can represent an unordered mathematical set---simply consider +a value an element of a set if it appears in the list, and ignore the +order of the list. To form the union of two sets, use @code{append} +(as long as you don't mind having duplicate elements). You can remove +@code{equal} duplicates using @code{delete-dups} or @code{seq-uniq}. +Other useful functions for sets include @code{memq} and @code{delq}, +and their @code{equal} versions, @code{member} and @code{delete}. @cindex CL note---lack @code{union}, @code{intersection} @quotation @@ -1489,7 +1489,8 @@ comparison. This function destructively removes all @code{equal} duplicates from @var{list}, stores the result in @var{list} and returns it. Of several @code{equal} occurrences of an element in @var{list}, -@code{delete-dups} keeps the first one. +@code{delete-dups} keeps the first one. See @code{seq-uniq} for +non-destructive operation (@pxref{Sequence Functions}). @end defun See also the function @code{add-to-list}, in @ref{List Variables}, diff --git a/lisp/subr.el b/lisp/subr.el index a8fb52c909..f8f446c6a9 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -696,7 +696,7 @@ If N is omitted or nil, remove the last element." "Destructively remove `equal' duplicates from LIST. Store the result in LIST and return it. LIST must be a proper list. Of several `equal' occurrences of an element in LIST, the first -one is kept." +one is kept. See `seq-uniq' for non-destructive operation." (let ((l (length list))) (if (> l 100) (let ((hash (make-hash-table :test #'equal :size l)) commit 0707fdd36cffe2211614b921cbc8dcd44e9cd880 Author: Miha Rihtaršič Date: Mon Sep 27 15:15:57 2021 +0200 In term-mode, handle ANSI codes, specifying italic and other modes * etc/e/eterm-color.ti: Add new capabilities * lisp/term.el: New faces and variables to support new ANSI modes. (term-termcap-format): Add new capabilities (term-emulate-terminal): When saving cursor, additionally save the new variables. (term--handle-colors-list): Handle ANSI codes, specifying italic other modes. * test/lisp/term-tests.el (ansi-test-strings): Adjust tests. diff --git a/etc/NEWS b/etc/NEWS index 3c16e2fd4d..2dcd12f22f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -92,9 +92,11 @@ filters and displayed with the specified color. ** term-mode --- -*** Support for ANSI 256-color and 24-bit colors. -256-color and 24-bit color codes are now displayed with the specified -color. +*** Support for ANSI 256-color and 24-bit colors, italic and other fonts. +Term-mode can now display 256-color and 24-bit color codes. It can +also handle ANSI codes for faint, italic and blinking text, displaying +it with new 'ansi-term-faint/italic/slow-blinking/fast-blinking' +faces. * New Modes and Packages in Emacs 29.1 diff --git a/etc/e/eterm-color b/etc/e/eterm-color index 99603ba561..bf44fa0f36 100644 Binary files a/etc/e/eterm-color and b/etc/e/eterm-color differ diff --git a/etc/e/eterm-color.ti b/etc/e/eterm-color.ti index 61c29e6dcc..eeb9b0b6e6 100644 --- a/etc/e/eterm-color.ti +++ b/etc/e/eterm-color.ti @@ -18,6 +18,7 @@ eterm-color|Emacs term.el terminal emulator term-protocol-version 0.96, msgr, xenl, bel=^G, + blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=\r, @@ -31,6 +32,7 @@ eterm-color|Emacs term.el terminal emulator term-protocol-version 0.96, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, cuu=\E[%p1%dA, + dim=\E[2m, dch1=\E[P, dch=\E[%p1%dP, dl1=\E[M, @@ -60,6 +62,7 @@ eterm-color|Emacs term.el terminal emulator term-protocol-version 0.96, rc=\E8, rev=\E[7m, ri=\EM, + ritm=\E[23m, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, @@ -68,6 +71,7 @@ eterm-color|Emacs term.el terminal emulator term-protocol-version 0.96, setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m, setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m, sgr0=\E[m, + sitm=\E[3m, smir=\E[4h, smul=\E[4m, smso=\E[7m, diff --git a/etc/e/eterm-direct b/etc/e/eterm-direct index 35983ec8ad..c113c37136 100644 Binary files a/etc/e/eterm-direct and b/etc/e/eterm-direct differ diff --git a/lisp/term.el b/lisp/term.el index 771b73238f..ce086c379b 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -711,10 +711,14 @@ Buffer local variable.") (defvar term-ansi-at-save-pwd nil) (defvar term-ansi-at-save-anon nil) (defvar term-ansi-current-bold nil) +(defvar term-ansi-current-faint nil) +(defvar term-ansi-current-italic nil) +(defvar term-ansi-current-underline nil) +(defvar term-ansi-current-slow-blink nil) +(defvar term-ansi-current-fast-blink nil) (defvar term-ansi-current-color 0) (defvar term-ansi-face-already-done nil) (defvar term-ansi-current-bg-color 0) -(defvar term-ansi-current-underline nil) (defvar term-ansi-current-reverse nil) (defvar term-ansi-current-invisible nil) @@ -769,12 +773,36 @@ Buffer local variable.") :group 'term :version "28.1") +(defface term-faint + '((t :inherit ansi-color-faint)) + "Default face to use for faint text." + :group 'term + :version "28.1") + +(defface term-italic + '((t :inherit ansi-color-italic)) + "Default face to use for italic text." + :group 'term + :version "28.1") + (defface term-underline '((t :inherit ansi-color-underline)) "Default face to use for underlined text." :group 'term :version "28.1") +(defface term-slow-blink + '((t :inherit ansi-color-slow-blink)) + "Default face to use for slowly blinking text." + :group 'term + :version "28.1") + +(defface term-fast-blink + '((t :inherit ansi-color-fast-blink)) + "Default face to use for rapidly blinking text." + :group 'term + :version "28.1") + (defface term-color-black '((t :inherit ansi-color-black)) "Face used to render black color code." @@ -1038,8 +1066,12 @@ is buffer-local." (defun term-ansi-reset () (setq term-current-face 'term) - (setq term-ansi-current-underline nil) (setq term-ansi-current-bold nil) + (setq term-ansi-current-faint nil) + (setq term-ansi-current-italic nil) + (setq term-ansi-current-underline nil) + (setq term-ansi-current-slow-blink nil) + (setq term-ansi-current-fast-blink nil) (setq term-ansi-current-reverse nil) (setq term-ansi-current-color 0) (setq term-ansi-current-invisible nil) @@ -1581,6 +1613,7 @@ Using \"emacs\" loses, because bash disables editing if $TERM == emacs.") :nd=\\E[C:up=\\E[A:ce=\\E[K:ho=\\E[H:pt\ :al=\\E[L:dl=\\E[M:DL=\\E[%%dM:AL=\\E[%%dL:cs=\\E[%%i%%d;%%dr:sf=^J\ :dc=\\E[P:DC=\\E[%%dP:IC=\\E[%%d@:im=\\E[4h:ei=\\E[4l:mi:\ +:mb=\\E[5m:mh=\\E[2m:ZR=\\E[23m:ZH=\\E[3m\ :so=\\E[7m:se=\\E[m:us=\\E[4m:ue=\\E[m:md=\\E[1m:mr=\\E[7m:me=\\E[m\ :UP=\\E[%%dA:DO=\\E[%%dB:LE=\\E[%%dD:RI=\\E[%%dC\ :kl=\\EOD:kd=\\EOB:kr=\\EOC:ku=\\EOA:kN=\\E[6~:kP=\\E[5~:@7=\\E[4~:kh=\\E[1~\ @@ -3105,30 +3138,34 @@ See `term-prompt-regexp'." (term-horizontal-column) term-ansi-current-bg-color term-ansi-current-bold + term-ansi-current-faint + term-ansi-current-italic + term-ansi-current-underline + term-ansi-current-slow-blink + term-ansi-current-fast-blink term-ansi-current-color term-ansi-current-invisible term-ansi-current-reverse - term-ansi-current-underline term-current-face))) (?8 ;; Restore cursor (terminfo: rc, [ctlseqs] ;; "DECRC"). (when term-saved-cursor (term-goto (nth 0 term-saved-cursor) (nth 1 term-saved-cursor)) - (setq term-ansi-current-bg-color - (nth 2 term-saved-cursor) - term-ansi-current-bold - (nth 3 term-saved-cursor) - term-ansi-current-color - (nth 4 term-saved-cursor) - term-ansi-current-invisible - (nth 5 term-saved-cursor) - term-ansi-current-reverse - (nth 6 term-saved-cursor) - term-ansi-current-underline - (nth 7 term-saved-cursor) - term-current-face - (nth 8 term-saved-cursor)))) + (pcase-setq + `( ,_ ,_ + ,term-ansi-current-bg-color + ,term-ansi-current-bold + ,term-ansi-current-faint + ,term-ansi-current-italic + ,term-ansi-current-underline + ,term-ansi-current-slow-blink + ,term-ansi-current-fast-blink + ,term-ansi-current-color + ,term-ansi-current-invisible + ,term-ansi-current-reverse + ,term-current-face) + term-saved-cursor))) (?c ;; \Ec - Reset (terminfo: rs1, [ctlseqs] "RIS"). ;; This is used by the "clear" program. (term-reset-terminal)) @@ -3316,11 +3353,20 @@ otherwise use the current foreground color." (while parameters (pcase (pop parameters) (1 (setq term-ansi-current-bold t)) ; (terminfo: bold) + (2 (setq term-ansi-current-faint t)) ; (terminfo: dim) + (3 (setq term-ansi-current-italic t)) ; (terminfo: sitm) (4 (setq term-ansi-current-underline t)) ; (terminfo: smul) - (5 (setq term-ansi-current-bold t)) ; (terminfo: bold) + (5 (setq term-ansi-current-slow-blink t)) ; (terminfo: blink) + (6 (setq term-ansi-current-fast-blink t)) (7 (setq term-ansi-current-reverse t)) ; (terminfo: smso, rev) (8 (setq term-ansi-current-invisible t)) ; (terminfo: invis) + (21 (setq term-ansi-current-bold nil)) + (22 (setq term-ansi-current-bold nil) + (setq term-ansi-current-faint nil)) + (23 (setq term-ansi-current-italic nil)) ; (terminfo: ritm) (24 (setq term-ansi-current-underline nil)) ; (terminfo: rmul) + (25 (setq term-ansi-current-slow-blink nil) + (setq term-ansi-current-fast-blink nil)) (27 (setq term-ansi-current-reverse nil)) ; (terminfo: rmso) ;; Foreground (terminfo: setaf) @@ -3398,13 +3444,20 @@ otherwise use the current foreground color." ,@(unless term-ansi-current-invisible (list :inverse-video term-ansi-current-reverse))))) - (when term-ansi-current-bold - (setq term-current-face - `(,term-current-face :inherit term-bold))) - - (when term-ansi-current-underline - (setq term-current-face - `(,term-current-face :inherit term-underline)))) + (setq term-current-face + `(,term-current-face + ,@(when term-ansi-current-bold + '(term-bold)) + ,@(when term-ansi-current-faint + '(term-faint)) + ,@(when term-ansi-current-italic + '(term-italic)) + ,@(when term-ansi-current-underline + '(term-underline)) + ,@(when term-ansi-current-slow-blink + '(term-slow-blink)) + ,@(when term-ansi-current-fast-blink + '(term-fast-blink))))) ;; Handle a character assuming (eq terminal-state 2) - @@ -3490,7 +3543,7 @@ otherwise use the current foreground color." ;; Modified to allow ansi coloring -mm ;; \E[m - Set/reset modes, set bg/fg - ;;(terminfo: smso,rmso,smul,rmul,rev,bold,sgr0,invis,op,setab,setaf) + ;;(terminfo: smso,rmso,smul,rmul,rev,bold,dim,sitm,ritm,blink,sgr0,invis,op,setab,setaf) ((eq char ?m) (term--handle-colors-list params)) diff --git a/test/lisp/term-tests.el b/test/lisp/term-tests.el index b8adc62c9d..73d39cf3b6 100644 --- a/test/lisp/term-tests.el +++ b/test/lisp/term-tests.el @@ -48,44 +48,44 @@ (defvar ansi-test-strings `(("\e[33mHello World\e[0m" - ,(propertize "Hello World" 'font-lock-face yellow-fg-props)) + ,(propertize "Hello World" 'font-lock-face `(,yellow-fg-props))) ("\e[43mHello World\e[0m" - ,(propertize "Hello World" 'font-lock-face yellow-bg-props)) + ,(propertize "Hello World" 'font-lock-face `(,yellow-bg-props))) ("\e[93mHello World\e[0m" - ,(propertize "Hello World" 'font-lock-face bright-yellow-fg-props)) + ,(propertize "Hello World" 'font-lock-face `(,bright-yellow-fg-props))) ("\e[103mHello World\e[0m" - ,(propertize "Hello World" 'font-lock-face bright-yellow-bg-props)) + ,(propertize "Hello World" 'font-lock-face `(,bright-yellow-bg-props))) ("\e[1;33mHello World\e[0m" ,(propertize "Hello World" 'font-lock-face - `(,yellow-fg-props :inherit term-bold)) + `(,yellow-fg-props term-bold)) ,(propertize "Hello World" 'font-lock-face - `(,bright-yellow-fg-props :inherit term-bold))) + `(,bright-yellow-fg-props term-bold))) ("\e[33;1mHello World\e[0m" ,(propertize "Hello World" 'font-lock-face - `(,yellow-fg-props :inherit term-bold)) + `(,yellow-fg-props term-bold)) ,(propertize "Hello World" 'font-lock-face - `(,bright-yellow-fg-props :inherit term-bold))) + `(,bright-yellow-fg-props term-bold))) ("\e[1m\e[33mHello World\e[0m" ,(propertize "Hello World" 'font-lock-face - `(,yellow-fg-props :inherit term-bold)) + `(,yellow-fg-props term-bold)) ,(propertize "Hello World" 'font-lock-face - `(,bright-yellow-fg-props :inherit term-bold))) + `(,bright-yellow-fg-props term-bold))) ("\e[33m\e[1mHello World\e[0m" ,(propertize "Hello World" 'font-lock-face - `(,yellow-fg-props :inherit term-bold)) + `(,yellow-fg-props term-bold)) ,(propertize "Hello World" 'font-lock-face - `(,bright-yellow-fg-props :inherit term-bold))) + `(,bright-yellow-fg-props term-bold))) ("\e[38;5;3;1mHello World\e[0m" ,(propertize "Hello World" 'font-lock-face - `(,yellow-fg-props :inherit term-bold)) + `(,yellow-fg-props term-bold)) ,(propertize "Hello World" 'font-lock-face - `(,bright-yellow-fg-props :inherit term-bold))) + `(,bright-yellow-fg-props term-bold))) ("\e[38;5;123;1mHello World\e[0m" ,(propertize "Hello World" 'font-lock-face - `(,custom-color-fg-props :inherit term-bold))) + `(,custom-color-fg-props term-bold))) ("\e[38;2;135;255;255;1mHello World\e[0m" ,(propertize "Hello World" 'font-lock-face - `(,custom-color-fg-props :inherit term-bold))))) + `(,custom-color-fg-props term-bold))))) (defun term-test-screen-from-input (width height input &optional return-var) (with-temp-buffer commit 76895fcd0b667eadd78bfe6cf51619f8b00e157f Author: Miha Rihtaršič Date: Sat Sep 25 23:28:08 2021 +0200 Add support for 256-color and 24bit ANSI colors in term-mode (term-ansi-face-already-done): Make obsolete (term--maybe-brighten-color): Remove (term--color-as-hex): New function (term-handle-colors-array): Make obsolete in favour of the new function 'term--handle-colors-list'. (term--handle-colors-list): New function, that can also handle ANSI codes 38 and 48. (term-handle-ansi-escape): Use it * test/lisp/term-tests.el (ansi-test-strings): Add tests for 256-color and 24bit ANSI colors diff --git a/etc/NEWS b/etc/NEWS index c2dde4ea33..3c16e2fd4d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -89,6 +89,13 @@ mode (instead of at load time). 256-color and 24-bit color codes are now handled by ANSI color filters and displayed with the specified color. +** term-mode + +--- +*** Support for ANSI 256-color and 24-bit colors. +256-color and 24-bit color codes are now displayed with the specified +color. + * New Modes and Packages in Emacs 29.1 diff --git a/etc/e/README b/etc/e/README index dd2c8d64e2..1293292a87 100644 --- a/etc/e/README +++ b/etc/e/README @@ -1,12 +1,12 @@ -eterm-color.ti is a terminfo source file. eterm-color is a compiled -version produced by the terminfo compiler (tic). The compiled files -are binary, and depend on the version of tic, but they seem to be -system-independent and backwardly compatible. So there should be no -need to recompile the distributed binary version. If it is -necessary, use: +eterm-color.ti is a terminfo source file. eterm-color and +eterm-direct are compiled versions produced by the terminfo compiler +(tic). The compiled files are binary, and depend on the version of +tic, but they seem to be system-independent and backwardly compatible. +So there should be no need to recompile the distributed binary +version. If it is necessary, use: tic -o ../ ./eterm-color.ti -The compiled file is used by lisp/term.el, so if it is moved term.el -needs to be changed. terminfo requires it to be stored in an 'e' -subdirectory (the first character of the file name). +The compiled files are used by lisp/term.el, so if they are moved, +term.el needs to be changed. terminfo requires them to be stored in +an 'e' subdirectory (the first character of the file name). diff --git a/etc/e/eterm-color b/etc/e/eterm-color index bd3f5003ae..99603ba561 100644 Binary files a/etc/e/eterm-color and b/etc/e/eterm-color differ diff --git a/etc/e/eterm-color.ti b/etc/e/eterm-color.ti index a6ef814990..61c29e6dcc 100644 --- a/etc/e/eterm-color.ti +++ b/etc/e/eterm-color.ti @@ -9,10 +9,10 @@ eterm-color|Emacs term.el terminal emulator term-protocol-version 0.96, # Any change to this file should be done at the same time with a # corresponding change to the TERMCAP environment variable in term.el. # Comments in term.el specify where each of these capabilities is implemented. - colors#8, + colors#256, cols#80, lines#24, - pairs#64, + pairs#32767, am, mir, msgr, @@ -65,8 +65,8 @@ eterm-color|Emacs term.el terminal emulator term-protocol-version 0.96, rmul=\E[24m, rs1=\Ec, sc=\E7, - setab=\E[%p1%{40}%+%dm, - setaf=\E[%p1%{30}%+%dm, + setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m, + setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m, sgr0=\E[m, smir=\E[4h, smul=\E[4m, @@ -76,3 +76,10 @@ eterm-color|Emacs term.el terminal emulator term-protocol-version 0.96, # smcup=\E[?47h, # rmcup=\E[?47l, # rs2 may need to be added + +eterm-direct|Emacs term.el with direct-color indexing term-protocol-version 0.96, + use=eterm-color, + colors#0x1000000, + pairs#0x10000, + setab=\E[%?%p1%{8}%<%t4%p1%d%e48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%d%;m, + setaf=\E[%?%p1%{8}%<%t3%p1%d%e38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%d%;m, diff --git a/etc/e/eterm-direct b/etc/e/eterm-direct new file mode 100644 index 0000000000..35983ec8ad Binary files /dev/null and b/etc/e/eterm-direct differ diff --git a/lisp/term.el b/lisp/term.el index e76eb77647..771b73238f 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -303,6 +303,7 @@ (require 'ange-ftp) (require 'cl-lib)) (require 'comint) ; Password regexp. +(require 'ansi-color) (require 'ehelp) (require 'ring) (require 'shell) @@ -717,6 +718,9 @@ Buffer local variable.") (defvar term-ansi-current-reverse nil) (defvar term-ansi-current-invisible nil) +(make-obsolete-variable 'term-ansi-face-already-done + "it doesn't have any effect." "28.1") + ;;; Faces (defvar ansi-term-color-vector [term @@ -1039,10 +1043,6 @@ is buffer-local." (setq term-ansi-current-reverse nil) (setq term-ansi-current-color 0) (setq term-ansi-current-invisible nil) - ;; Stefan thought this should be t, but could not remember why. - ;; Setting it to t seems to cause bug#11785. Setting it to nil - ;; again to see if there are other consequences... - (setq term-ansi-face-already-done nil) (setq term-ansi-current-bg-color 0)) (define-derived-mode term-mode fundamental-mode "Term" @@ -1584,7 +1584,8 @@ Using \"emacs\" loses, because bash disables editing if $TERM == emacs.") :so=\\E[7m:se=\\E[m:us=\\E[4m:ue=\\E[m:md=\\E[1m:mr=\\E[7m:me=\\E[m\ :UP=\\E[%%dA:DO=\\E[%%dB:LE=\\E[%%dD:RI=\\E[%%dC\ :kl=\\EOD:kd=\\EOB:kr=\\EOC:ku=\\EOA:kN=\\E[6~:kP=\\E[5~:@7=\\E[4~:kh=\\E[1~\ -:mk=\\E[8m:cb=\\E[1K:op=\\E[39;49m:Co#8:pa#64:AB=\\E[4%%dm:AF=\\E[3%%dm:cr=^M\ +:mk=\\E[8m:cb=\\E[1K:op=\\E[39;49m:Co#256:pa#32767\ +:AB=\\E[48;5;%%dm:AF=\\E[38;5;%%dm:cr=^M\ :bl=^G:do=^J:le=^H:ta=^I:se=\\E[27m:ue=\\E[24m\ :kb=^?:kD=^[[3~:sc=\\E7:rc=\\E8:r1=\\Ec:" ;; : -undefine ic @@ -3285,133 +3286,125 @@ option is enabled. See `term-set-goto-process-mark'." (setq term-current-row 0) (setq term-current-column 1) (term--reset-scroll-region) - (setq term-insert-mode nil) - ;; FIXME: No idea why this is here, it looks wrong. --Stef - (setq term-ansi-face-already-done nil)) - -(defun term--maybe-brighten-color (color bold) - "Possibly convert COLOR to its bright variant. -COLOR is an index into `ansi-term-color-vector'. If BOLD and -`ansi-color-bold-is-bright' are non-nil and COLOR is a regular color, -return the bright version of COLOR; otherwise, return COLOR." - (if (and ansi-color-bold-is-bright bold (<= 1 color 8)) - (+ color 8) - color)) + (setq term-insert-mode nil)) + +(defun term--color-as-hex (for-foreground) + "Return the current ANSI color as a hexadecimal color string. +Use the current background color if FOR-FOREGROUND is nil, +otherwise use the current foreground color." + (let ((color (if for-foreground term-ansi-current-color + term-ansi-current-bg-color))) + (or (ansi-color--code-as-hex (1- color)) + (progn + (and ansi-color-bold-is-bright term-ansi-current-bold + (<= 1 color 8) + (setq color (+ color 8))) + (if for-foreground + (face-foreground (elt ansi-term-color-vector color) + nil 'default) + (face-background (elt ansi-term-color-vector color) + nil 'default)))))) ;; New function to deal with ansi colorized output, as you can see you can ;; have any bold/underline/fg/bg/reverse combination. -mm (defun term-handle-colors-array (parameter) - (cond - - ;; Bold (terminfo: bold) - ((eq parameter 1) - (setq term-ansi-current-bold t)) - - ;; Underline - ((eq parameter 4) - (setq term-ansi-current-underline t)) - - ;; Blink (unsupported by Emacs), will be translated to bold. - ;; This may change in the future though. - ((eq parameter 5) - (setq term-ansi-current-bold t)) - - ;; Reverse (terminfo: smso) - ((eq parameter 7) - (setq term-ansi-current-reverse t)) - - ;; Invisible - ((eq parameter 8) - (setq term-ansi-current-invisible t)) - - ;; Reset underline (terminfo: rmul) - ((eq parameter 24) - (setq term-ansi-current-underline nil)) - - ;; Reset reverse (terminfo: rmso) - ((eq parameter 27) - (setq term-ansi-current-reverse nil)) - - ;; Foreground - ((and (>= parameter 30) (<= parameter 37)) - (setq term-ansi-current-color (- parameter 29))) - - ;; Bright foreground - ((and (>= parameter 90) (<= parameter 97)) - (setq term-ansi-current-color (- parameter 81))) - - ;; Reset foreground - ((eq parameter 39) - (setq term-ansi-current-color 0)) - - ;; Background - ((and (>= parameter 40) (<= parameter 47)) - (setq term-ansi-current-bg-color (- parameter 39))) - - ;; Bright foreground - ((and (>= parameter 100) (<= parameter 107)) - (setq term-ansi-current-bg-color (- parameter 91))) - - ;; Reset background - ((eq parameter 49) - (setq term-ansi-current-bg-color 0)) - - ;; 0 (Reset) or unknown (reset anyway) - (t - (term-ansi-reset))) - - ;; (message "Debug: U-%d R-%d B-%d I-%d D-%d F-%d B-%d" - ;; term-ansi-current-underline - ;; term-ansi-current-reverse - ;; term-ansi-current-bold - ;; term-ansi-current-invisible - ;; term-ansi-face-already-done - ;; term-ansi-current-color - ;; term-ansi-current-bg-color) - - (unless term-ansi-face-already-done - (let ((current-color (term--maybe-brighten-color - term-ansi-current-color - term-ansi-current-bold)) - (current-bg-color (term--maybe-brighten-color - term-ansi-current-bg-color - term-ansi-current-bold))) - (if term-ansi-current-invisible - (let ((color - (if term-ansi-current-reverse - (face-foreground - (elt ansi-term-color-vector current-color) - nil 'default) - (face-background - (elt ansi-term-color-vector current-bg-color) - nil 'default)))) - (setq term-current-face - (list :background color - :foreground color)) - ) ;; No need to bother with anything else if it's invisible. - (setq term-current-face - (list :foreground - (face-foreground - (elt ansi-term-color-vector current-color) - nil 'default) - :background - (face-background - (elt ansi-term-color-vector current-bg-color) - nil 'default) - :inverse-video term-ansi-current-reverse)) - - (when term-ansi-current-bold - (setq term-current-face - `(,term-current-face :inherit term-bold))) - - (when term-ansi-current-underline - (setq term-current-face - `(,term-current-face :inherit term-underline)))))) - - ;; (message "Debug %S" term-current-face) - ;; FIXME: shouldn't we set term-ansi-face-already-done to t here? --Stef - (setq term-ansi-face-already-done nil)) + (declare (obsolete term--handle-colors-list "28.1")) + (term--handle-colors-list (list parameter))) + +(defun term--handle-colors-list (parameters) + (while parameters + (pcase (pop parameters) + (1 (setq term-ansi-current-bold t)) ; (terminfo: bold) + (4 (setq term-ansi-current-underline t)) ; (terminfo: smul) + (5 (setq term-ansi-current-bold t)) ; (terminfo: bold) + (7 (setq term-ansi-current-reverse t)) ; (terminfo: smso, rev) + (8 (setq term-ansi-current-invisible t)) ; (terminfo: invis) + (24 (setq term-ansi-current-underline nil)) ; (terminfo: rmul) + (27 (setq term-ansi-current-reverse nil)) ; (terminfo: rmso) + + ;; Foreground (terminfo: setaf) + ((and param (guard (<= 30 param 37))) + (setq term-ansi-current-color (- param 29))) + + ;; Bright foreground (terminfo: setaf) + ((and param (guard (<= 90 param 97))) + (setq term-ansi-current-color (- param 81))) + + ;; Extended foreground (terminfo: setaf) + (38 + (pcase (pop parameters) + ;; 256 color + (5 (if (setq term-ansi-current-color (pop parameters)) + (cl-incf term-ansi-current-color) + (term-ansi-reset))) + ;; Full 24-bit color + (2 (cl-loop with color = (1+ 256) ; Base + for i from 16 downto 0 by 8 + if (pop parameters) + do (setq color (+ color (ash it i))) + else return (term-ansi-reset) + finally + (if (> color (+ 1 256 #xFFFFFF)) + (term-ansi-reset) + (setq term-ansi-current-color color)))) + (_ (term-ansi-reset)))) + + ;; Reset foreground (terminfo: op) + (39 (setq term-ansi-current-color 0)) + + ;; Background (terminfo: setab) + ((and param (guard (<= 40 param 47))) + (setq term-ansi-current-bg-color (- param 39))) + + ;; Bright background (terminfo: setab) + ((and param (guard (<= 100 param 107))) + (setq term-ansi-current-bg-color (- param 91))) + + ;; Extended background (terminfo: setab) + (48 + (pcase (pop parameters) + ;; 256 color + (5 (if (setq term-ansi-current-bg-color (pop parameters)) + (cl-incf term-ansi-current-bg-color) + (term-ansi-reset))) + ;; Full 24-bit color + (2 (cl-loop with color = (1+ 256) ; Base + for i from 16 downto 0 by 8 + if (pop parameters) + do (setq color (+ color (ash it i))) + else return (term-ansi-reset) + finally + (if (> color (+ 1 256 #xFFFFFF)) + (term-ansi-reset) + (setq term-ansi-current-bg-color color)))) + (_ (term-ansi-reset)))) + + ;; Reset background (terminfo: op) + (49 (setq term-ansi-current-bg-color 0)) + + ;; 0 (Reset) (terminfo: sgr0) or unknown (reset anyway) + (_ (term-ansi-reset)))) + + (let (fg bg) + (if term-ansi-current-invisible + (setq bg (term--color-as-hex term-ansi-current-reverse) + fg bg) + (setq fg (term--color-as-hex t) + bg (term--color-as-hex nil))) + (setq term-current-face + `( :foreground ,fg + :background ,bg + ,@(unless term-ansi-current-invisible + (list :inverse-video term-ansi-current-reverse))))) + + (when term-ansi-current-bold + (setq term-current-face + `(,term-current-face :inherit term-bold))) + + (when term-ansi-current-underline + (setq term-current-face + `(,term-current-face :inherit term-underline)))) ;; Handle a character assuming (eq terminal-state 2) - @@ -3499,7 +3492,7 @@ return the bright version of COLOR; otherwise, return COLOR." ;; \E[m - Set/reset modes, set bg/fg ;;(terminfo: smso,rmso,smul,rmul,rev,bold,sgr0,invis,op,setab,setaf) ((eq char ?m) - (mapc #'term-handle-colors-array params)) + (term--handle-colors-list params)) ;; \E[6n - Report cursor position (terminfo: u7) ((eq char ?n) diff --git a/test/lisp/term-tests.el b/test/lisp/term-tests.el index 96b6d73488..b8adc62c9d 100644 --- a/test/lisp/term-tests.el +++ b/test/lisp/term-tests.el @@ -42,6 +42,9 @@ `( :foreground "unspecified-fg" :background ,(face-background 'term-color-bright-yellow nil 'default) :inverse-video nil)) +(defvar custom-color-fg-props + `( :foreground "#87FFFF" + :background "unspecified-bg" :inverse-video nil)) (defvar ansi-test-strings `(("\e[33mHello World\e[0m" @@ -71,7 +74,18 @@ ,(propertize "Hello World" 'font-lock-face `(,yellow-fg-props :inherit term-bold)) ,(propertize "Hello World" 'font-lock-face - `(,bright-yellow-fg-props :inherit term-bold))))) + `(,bright-yellow-fg-props :inherit term-bold))) + ("\e[38;5;3;1mHello World\e[0m" + ,(propertize "Hello World" 'font-lock-face + `(,yellow-fg-props :inherit term-bold)) + ,(propertize "Hello World" 'font-lock-face + `(,bright-yellow-fg-props :inherit term-bold))) + ("\e[38;5;123;1mHello World\e[0m" + ,(propertize "Hello World" 'font-lock-face + `(,custom-color-fg-props :inherit term-bold))) + ("\e[38;2;135;255;255;1mHello World\e[0m" + ,(propertize "Hello World" 'font-lock-face + `(,custom-color-fg-props :inherit term-bold))))) (defun term-test-screen-from-input (width height input &optional return-var) (with-temp-buffer commit 0fa2279b90bf5a638d8377032b71135e1374e8fb Author: Miha Rihtaršič Date: Tue Oct 5 08:53:36 2021 +0200 Add support for 256-color and 24bit ANSI colors in ansi-color * lisp/ansi-color.el (ansi-color--code-as-hex): New function to convert from 256-color and 24-bit ANSI codes. (ansi-color--face-vec-face): Add support for ANSI color codes greater than 16 (ansi-color--update-face-vec): Add support for ANSI codes 38 and 48 which can specify 256-color and 24bit ANSI colors. * test/lisp/ansi-color-tests.el (ansi-color-tests--strings): Add tests for ANSI codes 38 and 34 diff --git a/etc/NEWS b/etc/NEWS index ef8d95af0b..c2dde4ea33 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -82,6 +82,13 @@ mode (instead of at load time). +++ *** New macro 'with-memoization' provides a very primitive form of memoization +** ansi-color.el + +--- +*** Support for ANSI 256-color and 24-bit colors. +256-color and 24-bit color codes are now handled by ANSI color +filters and displayed with the specified color. + * New Modes and Packages in Emacs 29.1 diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index 3878c73ded..aaaf60cd00 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -594,22 +594,24 @@ code. It is usually stored as the car of the variable (when-let ((fg (car colors))) (push `(:foreground - ,(face-foreground - (aref (if (or bright (>= fg 8)) - ansi-color-bright-colors-vector - ansi-color-normal-colors-vector) - (mod fg 8)) - nil 'default)) + ,(or (ansi-color--code-as-hex fg) + (face-foreground + (aref (if (or bright (>= fg 8)) + ansi-color-bright-colors-vector + ansi-color-normal-colors-vector) + (mod fg 8)) + nil 'default))) faces)) (when-let ((bg (cadr colors))) (push `(:background - ,(face-background - (aref (if (or bright (>= bg 8)) - ansi-color-bright-colors-vector - ansi-color-normal-colors-vector) - (mod bg 8)) - nil 'default)) + ,(or (ansi-color--code-as-hex bg) + (face-background + (aref (if (or bright (>= bg 8)) + ansi-color-bright-colors-vector + ansi-color-normal-colors-vector) + (mod bg 8)) + nil 'default))) faces)) (let ((i 8)) @@ -622,6 +624,32 @@ code. It is usually stored as the car of the variable faces (car faces)))) +(defun ansi-color--code-as-hex (color) + "Convert COLOR to hexadecimal string representation. +COLOR is an ANSI color code. If it is between 16 and 255 +inclusive, it corresponds to a color from an 8-bit color cube. +If it is greater or equal than 256, it is subtracted by 256 to +directly specify a 24-bit color. + +Return a hexadecimal string, specifying the color, or nil, if +COLOR is less than 16." + (cond + ((< color 16) nil) + ((>= color 256) (format "#%06X" (- color 256))) + ((>= color 232) ;; Grayscale + (format "#%06X" (* #x010101 (+ 8 (* 10 (- color 232)))))) + (t ;; 6x6x6 color cube + (setq color (- color 16)) + (let ((res 0) + (frac (* 6 6))) + (while (<= 1 frac) ; Repeat 3 times + (setq res (* res #x000100)) + (let ((color-num (mod (/ color frac) 6))) + (unless (zerop color-num) + (setq res (+ res #x37 (* #x28 color-num))))) + (setq frac (/ frac 6))) + (format "#%06X" res))))) + ;; Working with regions (defvar-local ansi-color-context-region nil @@ -907,7 +935,23 @@ unset all properties and colors." (let ((r (mod new 10)) (cell (if (memq q '(3 9)) colors (cdr colors)))) (pcase r - (8 (setq do-clear t)) + (8 + (pcase (funcall iterator) + (5 (setq new (setcar cell (funcall iterator))) + (setq do-clear (or (null new) (>= new 256)))) + (2 + (let ((red (funcall iterator)) + (green (funcall iterator)) + (blue (funcall iterator))) + (if (and red green blue + (progn + (setq new (+ (* #x010000 red) + (* #x000100 green) + (* #x000001 blue))) + (<= new #xFFFFFF))) + (setcar cell (+ 256 new)) + (setq do-clear t)))) + (_ (setq do-clear t)))) (9 (setcar cell nil)) (_ (setcar cell (+ (if (memq q '(3 4)) 0 8) r)))))) (_ (setq do-clear t))) diff --git a/test/lisp/ansi-color-tests.el b/test/lisp/ansi-color-tests.el index 953fdff893..16a1ba4a89 100644 --- a/test/lisp/ansi-color-tests.el +++ b/test/lisp/ansi-color-tests.el @@ -27,7 +27,8 @@ (defvar ansi-color-tests--strings (let ((bright-yellow (face-foreground 'ansi-color-bright-yellow nil 'default)) - (yellow (face-foreground 'ansi-color-yellow nil 'default))) + (yellow (face-foreground 'ansi-color-yellow nil 'default)) + (custom-color "#87FFFF")) `(("Hello World" "Hello World") ("\e[33mHello World\e[0m" "Hello World" (:foreground ,yellow)) @@ -51,7 +52,14 @@ (ansi-color-bold (:foreground ,bright-yellow))) ("\e[1m\e[3m\e[5mbold italics blink\e[0m" "bold italics blink" (ansi-color-bold ansi-color-italic ansi-color-slow-blink)) - ("\e[10munrecognized\e[0m" "unrecognized")))) + ("\e[10munrecognized\e[0m" "unrecognized") + ("\e[38;5;3;1mHello World\e[0m" "Hello World" + (ansi-color-bold (:foreground ,yellow)) + (ansi-color-bold (:foreground ,bright-yellow))) + ("\e[48;5;123;1mHello World\e[0m" "Hello World" + (ansi-color-bold (:background ,custom-color))) + ("\e[48;2;135;255;255;1mHello World\e[0m" "Hello World" + (ansi-color-bold (:background ,custom-color)))))) (ert-deftest ansi-color-apply-on-region-test () (pcase-dolist (`(,input ,text ,face) ansi-color-tests--strings) commit 21dcb9830a46a6ed2c613e496b91f611ba7f6a27 Author: Miha Rihtaršič Date: Tue Oct 5 08:47:07 2021 +0200 Optimize ansi-color.el (ansi-color-context-region): (ansi-color-context): Adjust doc string to the new format of ansi-color context. (ansi-color--find-face): Rename to ansi-color--face-vec-face (ansi-color--face-vec-face): Adjust to the new format ansi-color context. (ansi-color-filter-apply): (ansi-color-apply): (ansi-color-filter-region): (ansi-color-apply-on-region): Adjust to the new format of ansi-color context in order to speed these functions up. (ansi-color-apply-sequence): Make it obsolete. (ansi-color--update-face-vec): New function to handle the new format of ansi-color context. (ansi-color-get-face-1): Make obsolete as this function isn't used any more (bug#50806). diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index b1c9cdaeca..3878c73ded 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -458,11 +458,18 @@ variable, and is meant to be used in `compilation-filter-hook'." ;; Working with strings (defvar-local ansi-color-context nil "Context saved between two calls to `ansi-color-apply'. -This is a list of the form (CODES FRAGMENT) or nil. CODES +This is a list of the form (FACE-VEC FRAGMENT) or nil. FACE-VEC represents the state the last call to `ansi-color-apply' ended -with, currently a list of ansi codes, and FRAGMENT is a string -starting with an escape sequence, possibly the start of a new -escape sequence.") +with, currently a list of the form: + + (BASIC-FACES FG BG) + +BASIC-FACES is a bool-vector that specifies which basic faces +from `ansi-color-basic-faces-vector' to apply. FG and BG are +ANSI color codes for the foreground and background color. + +FRAGMENT is a string starting with an escape sequence, possibly +the start of a new escape sequence.") (defun ansi-color-filter-apply (string) "Filter out all ANSI control sequences from STRING. @@ -473,17 +480,17 @@ will be used for the next call to `ansi-color-apply'. Set `ansi-color-context' to nil if you don't want this. This function can be added to `comint-preoutput-filter-functions'." - (let ((start 0) end result) + (let ((context (ansi-color--ensure-context 'ansi-color-context nil)) + (start 0) end result) ;; if context was saved and is a string, prepend it - (if (cadr ansi-color-context) - (setq string (concat (cadr ansi-color-context) string) - ansi-color-context nil)) + (setq string (concat (cadr context) string)) + (setcar (cdr context) "") ;; find the next escape sequence (while (setq end (string-match ansi-color-control-seq-regexp string start)) (push (substring string start end) result) (setq start (match-end 0))) ;; save context, add the remainder of the string to the result - (let (fragment) + (let ((fragment "")) (push (substring string start (if (string-match "\033" string start) (let ((pos (match-beginning 0))) @@ -491,25 +498,9 @@ This function can be added to `comint-preoutput-filter-functions'." pos) nil)) result) - (setq ansi-color-context (if fragment (list nil fragment)))) + (setcar (cdr context) fragment)) (apply #'concat (nreverse result)))) -(defun ansi-color--find-face (codes) - "Return the face corresponding to CODES." - ;; Sort the codes in ascending order to guarantee that "bold" comes before - ;; any of the colors. This ensures that `ansi-color-bold-is-bright' is - ;; applied correctly. - (let (faces bright (codes (sort (copy-sequence codes) #'<))) - (while codes - (when-let ((face (ansi-color-get-face-1 (pop codes) bright))) - (when (and ansi-color-bold-is-bright (eq face 'ansi-color-bold)) - (setq bright t)) - (push face faces))) - ;; Avoid some long-lived conses in the common case. - (if (cdr faces) - (nreverse faces) - (car faces)))) - (defun ansi-color-apply (string) "Translates SGR control sequences into text properties. Delete all other control sequences without processing them. @@ -524,49 +515,129 @@ This information will be used for the next call to `ansi-color-apply'. Set `ansi-color-context' to nil if you don't want this. This function can be added to `comint-preoutput-filter-functions'." - (let ((codes (car ansi-color-context)) - (start 0) end result) + (let* ((context + (ansi-color--ensure-context 'ansi-color-context nil)) + (face-vec (car context)) + (start 0) + end result) ;; If context was saved and is a string, prepend it. - (if (cadr ansi-color-context) - (setq string (concat (cadr ansi-color-context) string) - ansi-color-context nil)) + (setq string (concat (cadr context) string)) + (setcar (cdr context) "") ;; Find the next escape sequence. (while (setq end (string-match ansi-color-control-seq-regexp string start)) (let ((esc-end (match-end 0))) ;; Colorize the old block from start to end using old face. - (when codes + (when-let ((face (ansi-color--face-vec-face face-vec))) (put-text-property start end 'font-lock-face - (ansi-color--find-face codes) string)) + face string)) (push (substring string start end) result) (setq start (match-end 0)) ;; If this is a color escape sequence, (when (eq (aref string (1- esc-end)) ?m) ;; create a new face from it. - (setq codes (ansi-color-apply-sequence - (substring string end esc-end) codes))))) + (let ((cur-pos end)) + (ansi-color--update-face-vec + face-vec + (lambda () + (when (string-match ansi-color-parameter-regexp + string cur-pos) + (setq cur-pos (match-end 0)) + (when (<= cur-pos esc-end) + (string-to-number (match-string 1 string)))))))))) ;; if the rest of the string should have a face, put it there - (when codes + (when-let ((face (ansi-color--face-vec-face face-vec))) (put-text-property start (length string) - 'font-lock-face (ansi-color--find-face codes) string)) + 'font-lock-face face string)) ;; save context, add the remainder of the string to the result - (let (fragment) - (if (string-match "\033" string start) - (let ((pos (match-beginning 0))) - (setq fragment (substring string pos)) - (push (substring string start pos) result)) - (push (substring string start) result)) - (setq ansi-color-context (if (or codes fragment) (list codes fragment)))) + (if (string-match "\033" string start) + (let ((pos (match-beginning 0))) + (setcar (cdr context) (substring string pos)) + (push (substring string start pos) result)) + (push (substring string start) result)) (apply 'concat (nreverse result)))) +(defun ansi-color--ensure-context (context-sym position) + "Return CONTEXT-SYM's value as a valid context. +If it is nil, set CONTEXT-SYM's value to a new context and return +it. Context is a list of the form as described in +`ansi-color-context' if POSITION is nil, or +`ansi-color-context-region' if POSITION is non-nil. + +If CONTEXT-SYM's value is already non-nil, return it. If its +marker doesn't point anywhere yet, position it before character +number POSITION, if non-nil." + (let ((context (symbol-value context-sym))) + (if context + (if position + (let ((marker (cadr context))) + (unless (marker-position marker) + (set-marker marker position)) + context) + context) + (set context-sym + (list (list (make-bool-vector 8 nil) + nil nil) + (if position + (copy-marker position) + "")))))) + +(defun ansi-color--face-vec-face (face-vec) + "Return the face corresponding to FACE-VEC. +FACE-VEC is a list containing information about the ANSI sequence +code. It is usually stored as the car of the variable +`ansi-color-context-region'." + (let* ((basic-faces (car face-vec)) + (colors (cdr face-vec)) + (bright (and ansi-color-bold-is-bright (aref basic-faces 1))) + (faces nil)) + + (when-let ((fg (car colors))) + (push + `(:foreground + ,(face-foreground + (aref (if (or bright (>= fg 8)) + ansi-color-bright-colors-vector + ansi-color-normal-colors-vector) + (mod fg 8)) + nil 'default)) + faces)) + (when-let ((bg (cadr colors))) + (push + `(:background + ,(face-background + (aref (if (or bright (>= bg 8)) + ansi-color-bright-colors-vector + ansi-color-normal-colors-vector) + (mod bg 8)) + nil 'default)) + faces)) + + (let ((i 8)) + (while (> i 0) + (setq i (1- i)) + (when (aref basic-faces i) + (push (aref ansi-color-basic-faces-vector i) faces)))) + ;; Avoid some long-lived conses in the common case. + (if (cdr faces) + faces + (car faces)))) + ;; Working with regions (defvar-local ansi-color-context-region nil "Context saved between two calls to `ansi-color-apply-on-region'. -This is a list of the form (CODES MARKER) or nil. CODES +This is a list of the form (FACE-VEC MARKER) or nil. FACE-VEC represents the state the last call to `ansi-color-apply-on-region' -ended with, currently a list of ansi codes, and MARKER is a -buffer position within an escape sequence or the last position -processed.") +ended with, currently a list of the form + +(BASIC-FACES FG BG). + +BASIC-FACES is a bool-vector that specifies which basic faces +from `ansi-color-basic-faces-vector' to apply. FG and BG are +ANSI color codes for the foreground and background color. + +MARKER is a buffer position within an escape sequence or the last +position processed.") (defun ansi-color-filter-region (begin end) "Filter out all ANSI control sequences from region BEGIN to END. @@ -576,8 +647,10 @@ Every call to this function will set and use the buffer-local variable used for the next call to `ansi-color-apply-on-region'. Specifically, it will override BEGIN, the start of the region. Set `ansi-color-context-region' to nil if you don't want this." - (let ((end-marker (copy-marker end)) - (start (or (cadr ansi-color-context-region) begin))) + (let* ((end-marker (copy-marker end)) + (context (ansi-color--ensure-context + 'ansi-color-context-region begin)) + (start (cadr context))) (save-excursion (goto-char start) ;; Delete escape sequences. @@ -585,8 +658,8 @@ it will override BEGIN, the start of the region. Set (delete-region (match-beginning 0) (match-end 0))) ;; save context, add the remainder of the string to the result (if (re-search-forward "\033" end-marker t) - (setq ansi-color-context-region (list nil (match-beginning 0))) - (setq ansi-color-context-region nil))))) + (set-marker start (match-beginning 0)) + (set-marker start nil))))) (defun ansi-color-apply-on-region (begin end &optional preserve-sequences) "Translates SGR control sequences into overlays or extents. @@ -608,58 +681,58 @@ this. If PRESERVE-SEQUENCES is t, the sequences are hidden instead of being deleted." - (let ((codes (car ansi-color-context-region)) - (start-marker (or (cadr ansi-color-context-region) - (copy-marker begin))) - (end-marker (copy-marker end))) + (let* ((context (ansi-color--ensure-context + 'ansi-color-context-region begin)) + (face-vec (car context)) + (start-marker (cadr context)) + (end-marker (copy-marker end))) (save-excursion (goto-char start-marker) ;; Find the next escape sequence. (while (re-search-forward ansi-color-control-seq-regexp end-marker t) ;; Extract escape sequence. - (let ((esc-seq (buffer-substring - (match-beginning 0) (point)))) - (if preserve-sequences - ;; Make the escape sequence transparent. - (overlay-put (make-overlay (match-beginning 0) (point)) - 'invisible t) - ;; Otherwise, strip. - (delete-region (match-beginning 0) (point))) - + (let ((esc-beg (match-beginning 0)) + (esc-end (point))) ;; Colorize the old block from start to end using old face. (funcall ansi-color-apply-face-function (prog1 (marker-position start-marker) ;; Store new start position. - (set-marker start-marker (point))) - (match-beginning 0) (ansi-color--find-face codes)) + (set-marker start-marker esc-end)) + esc-beg (ansi-color--face-vec-face face-vec)) ;; If this is a color sequence, - (when (eq (aref esc-seq (1- (length esc-seq))) ?m) - ;; update the list of ansi codes. - (setq codes (ansi-color-apply-sequence esc-seq codes))))) + (when (eq (char-before esc-end) ?m) + (goto-char esc-beg) + (ansi-color--update-face-vec + face-vec (lambda () + (when (re-search-forward ansi-color-parameter-regexp + esc-end t) + (string-to-number (match-string 1)))))) + + (if preserve-sequences + ;; Make the escape sequence transparent. + (overlay-put (make-overlay esc-beg esc-end) 'invisible t) + ;; Otherwise, strip. + (delete-region esc-beg esc-end)))) ;; search for the possible start of a new escape sequence (if (re-search-forward "\033" end-marker t) - (progn - ;; if the rest of the region should have a face, put it there - (funcall ansi-color-apply-face-function - start-marker (point) (ansi-color--find-face codes)) - ;; save codes and point - (setq ansi-color-context-region - (list codes (copy-marker (match-beginning 0))))) - ;; if the rest of the region should have a face, put it there - (funcall ansi-color-apply-face-function - start-marker end-marker (ansi-color--find-face codes)) - ;; Save a restart position when there are codes active. It's - ;; convenient for man.el's process filter to pass `begin' - ;; positions that overlap regions previously colored; these - ;; `codes' should not be applied to that overlap, so we need - ;; to know where they should really start. - (setq ansi-color-context-region - (if codes (list codes (copy-marker (point))))))) - ;; Clean up our temporary markers. - (unless (eq start-marker (cadr ansi-color-context-region)) - (set-marker start-marker nil)) - (unless (eq end-marker (cadr ansi-color-context-region)) - (set-marker end-marker nil)))) + (progn + (while (re-search-forward "\033" end-marker t)) + (backward-char) + (funcall ansi-color-apply-face-function + start-marker (point) + (ansi-color--face-vec-face face-vec)) + (set-marker start-marker (point))) + (let ((faces (ansi-color--face-vec-face face-vec))) + (funcall ansi-color-apply-face-function + start-marker end-marker faces) + ;; Save a restart position when there are codes active. It's + ;; convenient for man.el's process filter to pass `begin' + ;; positions that overlap regions previously colored; these + ;; `codes' should not be applied to that overlap, so we need + ;; to know where they should really start. + (set-marker start-marker (when faces end-marker))))) + ;; Clean up our temporary marker. + (set-marker end-marker nil))) (defun ansi-color-apply-overlay-face (beg end face) "Make an overlay from BEG to END, and apply face FACE. @@ -767,6 +840,7 @@ the foreground color code is replaced or added resp. deleted; if it is 40-47 (or 100-107) resp. 49, the background color code is replaced or added resp. deleted; any other code is discarded together with the old codes. Finally, the so changed list of codes is returned." + (declare (obsolete ansi-color--update-face-vec "29.1")) (let ((new-codes (ansi-color-parse-sequence escape-sequence))) (while new-codes (let* ((new (pop new-codes)) @@ -795,6 +869,56 @@ old codes. Finally, the so changed list of codes is returned." (_ nil))))) codes)) +(defun ansi-color--update-face-vec (face-vec iterator) + "Apply escape sequences to FACE-VEC. + +Destructively modify FACE-VEC, which should be a list containing +face information. It is described in +`ansi-color-context-region'. ITERATOR is a function which is +called repeatedly with zero arguments and should return either +the next ANSI code in the current sequence as a number or nil if +there are no more ANSI codes left. + +For each new code, the following happens: if it is 1-7, set the +corresponding properties; if it is 21-25 or 27, unset appropriate +properties; if it is 30-37 (or 90-97) or resp. 39, set the +foreground color or resp. unset it; if it is 40-47 (or 100-107) +resp. 49, set the background color or resp. unset it; if it is 38 +or 48, the following codes are used to set the foreground or +background color and the correct color mode; any other code will +unset all properties and colors." + (let ((basic-faces (car face-vec)) + (colors (cdr face-vec)) + new q do-clear) + (while (setq new (funcall iterator)) + (setq q (/ new 10)) + (pcase q + (0 (if (memq new '(0 8 9)) + (setq do-clear t) + (aset basic-faces new t))) + (2 (if (memq new '(20 26 28 29)) + (setq do-clear t) + ;; The standard says `21 doubly underlined' while + ;; https://en.wikipedia.org/wiki/ANSI_escape_code claims + ;; `21 Bright/Bold: off or Underline: Double'. + (aset basic-faces (- new 20) nil) + (aset basic-faces (pcase new (22 1) (25 6) (_ 0)) nil))) + ((or 3 4 9 10) + (let ((r (mod new 10)) + (cell (if (memq q '(3 9)) colors (cdr colors)))) + (pcase r + (8 (setq do-clear t)) + (9 (setcar cell nil)) + (_ (setcar cell (+ (if (memq q '(3 4)) 0 8) r)))))) + (_ (setq do-clear t))) + + (when do-clear + (setq do-clear nil) + ;; Zero out our bool vector without any allocation. + (bool-vector-intersection basic-faces #&8"\0" basic-faces) + (setcar colors nil) + (setcar (cdr colors) nil))))) + (defun ansi-color-make-color-map () "Create a vector of face definitions and return it. @@ -859,6 +983,7 @@ This function is obsolete, and no longer needed to use ansi-color." "Get face definition for ANSI-CODE. BRIGHT, if non-nil, requests \"bright\" ANSI colors, even if ANSI-CODE is a normal-intensity color." + (declare (obsolete ansi-color--face-vec-face "29.1")) (when (and bright (<= 30 ansi-code 49)) (setq ansi-code (+ ansi-code 60))) (cond ((<= 0 ansi-code 7) commit e498e5be207ce53028af3f820c123def6f6968a8 Author: Lars Ingebrigtsen Date: Tue Oct 5 08:40:52 2021 +0200 Make `memory-report-object-size' work standalone * lisp/emacs-lisp/memory-report.el (memory-report--type-size): Default to nil so that the test in `memory-report-object-size' works. (memory-report--set-size): Initialize memory-report-object-size. diff --git a/lisp/emacs-lisp/memory-report.el b/lisp/emacs-lisp/memory-report.el index 3166d33e02..cda2dee6cb 100644 --- a/lisp/emacs-lisp/memory-report.el +++ b/lisp/emacs-lisp/memory-report.el @@ -31,7 +31,7 @@ (require 'subr-x) (require 'cl-lib) -(defvar memory-report--type-size (make-hash-table)) +(defvar memory-report--type-size nil) ;;;###autoload (defun memory-report () @@ -84,6 +84,7 @@ by counted more than once." (gethash 'object memory-report--type-size))) (defun memory-report--set-size (elems) + (setq memory-report--type-size (make-hash-table)) (setf (gethash 'string memory-report--type-size) (cadr (assq 'strings elems))) (setf (gethash 'cons memory-report--type-size) commit 66409422214a0a90e1d2a12ef2c4ebf86f2c01a9 Author: Stefan Kangas Date: Tue Oct 5 03:34:08 2021 +0200 Use format-prompt for many more prompts * lisp/bookmark.el (bookmark-completing-read): * lisp/calc/calc-prog.el (calc-user-define-formula): * lisp/calc/calc-store.el (calc-permanent-variable): * lisp/calc/calc-units.el (calc-convert-units) (calc-convert-exact-units, calc-convert-temperature): * lisp/cedet/semantic/complete.el (semantic-complete-read-tag-engine): * lisp/cus-edit.el (customize-read-group): * lisp/dired-aux.el (dired-do-chxxx): * lisp/dired-x.el (dired-mark-unmarked-files): * lisp/emacs-lisp/debug.el (cancel-debug-on-entry) (cancel-debug-on-variable-change): * lisp/emacs-lisp/edebug.el (edebug-cancel-on-entry) (edebug-remove-instrumentation): * lisp/epa.el (epa-read-file-name, epa-export-keys): * lisp/faces.el (read-face-name): * lisp/format.el (format-decode-buffer, format-decode-region): * lisp/gnus/gnus-art.el (gnus-read-save-file-name): * lisp/gnus/gnus-util.el (gnus-completing-read): * lisp/gnus/message.el (message-check-news-header-syntax): * lisp/info.el (Info-follow-reference): * lisp/international/mule-diag.el (describe-font) (describe-fontset): * lisp/international/quail.el (quail-show-keyboard-layout): * lisp/language/cyril-util.el (standard-display-cyrillic-translit): * lisp/mail/rmailkwd.el (rmail-read-label): * lisp/mail/rmailmm.el (rmail-mime-save): * lisp/mail/rmailout.el (rmail-output-read-file-name): * lisp/man.el (Man-goto-section, Man-follow-manual-reference): * lisp/menu-bar.el (emacs-index--prompt): * lisp/net/ange-ftp.el (ange-ftp-get-passwd): * lisp/proced.el (proced-send-signal): * lisp/progmodes/cpp.el (cpp-choose-face): * lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation): * lisp/progmodes/etags.el (visit-tags-table) (visit-tags-table-buffer): * lisp/progmodes/grep.el (grep-read-files): * lisp/progmodes/hideif.el (hide-ifdef-define): * lisp/progmodes/pascal.el (pascal-goto-defun): * lisp/progmodes/prolog.el (prolog-read-predicate): * lisp/progmodes/sql.el (sql-get-login-ext): * lisp/ses.el (ses-define-local-printer): * lisp/textmodes/artist.el (artist-figlet-choose-font): * lisp/textmodes/tex-mode.el (tex-compile): * lisp/vc/diff.el (diff): * lisp/vc/ediff-ptch.el (ediff-prompt-for-patch-file): * lisp/vc/ediff-util.el (ediff-read-file-name): * lisp/vc/pcvs.el (cvs-mode-mark-on-state): * lisp/vc/vc.el (vc-diff-build-argument-list-internal) (vc-revision-other-window, vc-retrieve-tag): * lisp/wid-edit.el: Prefer format-prompt unconditionally. * lisp/org/org-capture.el (org-capture-fill-template): * lisp/org/org-refile.el (org-refile-get-location): * lisp/progmodes/python.el (python-eldoc-at-point): * lisp/progmodes/verilog-mode.el (verilog-surelint-off) (verilog-goto-defun): * lisp/progmodes/xref.el (xref--read-identifier): Prefer format-prompt when it is fboundp. diff --git a/lisp/bookmark.el b/lisp/bookmark.el index d64966df5a..5c4a9803b3 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -498,11 +498,8 @@ If DEFAULT is nil then return empty string for empty input." 'string-lessp) (bookmark-all-names))) (let* ((completion-ignore-case bookmark-completion-ignore-case) - (default (unless (equal "" default) default)) - (prompt (concat prompt (if default - (format " (%s): " default) - ": ")))) - (completing-read prompt + (default (unless (equal "" default) default))) + (completing-read (format-prompt prompt default) (lambda (string pred action) (if (eq action 'metadata) '(metadata (category . bookmark)) diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el index f9dd9eb98a..77adf6b792 100644 --- a/lisp/calc/calc-prog.el +++ b/lisp/calc/calc-prog.el @@ -205,9 +205,8 @@ (progn (setq cmd-base-default (concat "User-" keyname)) (setq cmd (completing-read - (concat "Define M-x command name (default calc-" - cmd-base-default - "): ") + (format-prompt "Define M-x command name" + (concat "calc-" cmd-base-default)) obarray 'commandp nil (if (and odef (symbolp (cdr odef))) (symbol-name (cdr odef)) @@ -241,8 +240,8 @@ (setq func (concat "calcFunc-" (completing-read - (concat "Define algebraic function name (default " - cmd-base-default "): ") + (format-prompt "Define algebraic function name" + cmd-base-default) (mapcar (lambda (x) (substring x 9)) (all-completions "calcFunc-" obarray)) diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el index ee29c440fe..b3968555b6 100644 --- a/lisp/calc/calc-store.el +++ b/lisp/calc/calc-store.el @@ -586,7 +586,7 @@ (defun calc-permanent-variable (&optional var) (interactive) (calc-wrapper - (or var (setq var (calc-read-var-name "Save variable (default all): "))) + (or var (setq var (calc-read-var-name (format-prompt "Save variable" "all")))) (let (calc-pv-pos) (and var (or (and (boundp var) (symbol-value var)) (error "No such variable"))) diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el index fd6f3a7b67..f6d749db11 100644 --- a/lisp/calc/calc-units.el +++ b/lisp/calc/calc-units.el @@ -486,18 +486,13 @@ If COMP or STD is non-nil, put that in the units table instead." (setq defunits (math-get-default-units expr)) (unless new-units (setq new-units - (read-string (concat + (read-string (format-prompt (if (and uoldname (not nouold)) (concat "Old units: " uoldname ", new units") "New units") - (if defunits - (concat - " (default " - defunits - "): ") - ": ")))) + defunits))) (if (and (string= new-units "") defunits) @@ -533,14 +528,7 @@ If COMP or STD is non-nil, put that in the units table instead." (let* ((old-units (math-extract-units expr)) (defunits (math-get-default-units expr)) units - (new-units - (read-string (concat "New units" - (if defunits - (concat - " (default " - defunits - "): ") - ": "))))) + (new-units (read-string (format-prompt "New units" defunits)))) (if (and (string= new-units "") defunits) @@ -596,19 +584,14 @@ If COMP or STD is non-nil, put that in the units table instead." (setq expr (math-mul expr uold))) (setq defunits (math-get-default-units expr)) (setq unew (or new-units - (completing-read - (concat - (if uoldname - (concat "Old temperature units: " - uoldname - ", new units") - "New temperature units") - (if defunits - (concat " (default " - defunits - "): ") - ": ")) - tempunits))) + (completing-read (format-prompt + (if uoldname + (concat "Old temperature units: " + uoldname + ", new units") + "New temperature units") + defunits) + tempunits))) (setq unew (math-read-expr (if (string= unew "") defunits unew))) (when (eq (car-safe unew) 'error) (error "Bad format in units expression: %s" (nth 2 unew))) diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el index 6cfbdd5f03..375b97a7a5 100644 --- a/lisp/cedet/semantic/complete.el +++ b/lisp/cedet/semantic/complete.el @@ -224,11 +224,10 @@ HISTORY is a symbol representing a variable to story the history in." ;; @todo - move from () to into the editable area (if (string-match ":" prompt) - (setq prompt (concat - (substring prompt 0 (match-beginning 0)) - " (default " default-as-string ")" - (substring prompt (match-beginning 0)))) - (setq prompt (concat prompt " (" default-as-string "): ")))) + (setq prompt (format-prompt + (substring prompt 0 (match-beginning 0)) + default-as-string)) + (setq prompt (format-prompt prompt default-as-string)))) ;; ;; Perform the Completion ;; diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 814003587b..34a6db508d 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -1133,7 +1133,7 @@ for the MODE to customize." (defun customize-read-group () (let ((completion-ignore-case t)) - (completing-read "Customize group (default emacs): " + (completing-read (format-prompt "Customize group" "emacs") obarray (lambda (symbol) (or (and (get symbol 'custom-loads) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 4b8d271071..a1c6316d3f 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -444,10 +444,10 @@ List has a form of (file-name full-file-name (attribute-list))." ((eq op-symbol 'chgrp) (file-attribute-group-id (file-attributes default-file 'string)))))) - (prompt (concat "Change " attribute-name " of %s to" - (if (eq op-symbol 'touch) - " (default now): " - ": "))) + (prompt (format-prompt "Change %s of %%s to" + (when (eq op-symbol 'touch) + "now") + attribute-name)) (new-attribute (dired-mark-read-string prompt nil op-symbol arg files default (cond ((eq op-symbol 'chown) diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 7c6f49f2ae..7f889a2bfd 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -554,7 +554,7 @@ If the region is active in Transient Mark mode, operate only on files in the active region if `dired-mark-region' is non-nil." (interactive (list (read-regexp - "Mark unmarked files matching regexp (default all): " + (format-prompt "Mark unmarked files matching regexp" "all") nil 'dired-regexp-history) nil current-prefix-arg nil)) (let ((dired-marker-char (if unflag-p ?\s dired-marker-char))) diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index 0592db85df..163528acf6 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -701,7 +701,8 @@ To specify a nil argument interactively, exit with an empty minibuffer." (interactive (list (let ((name (completing-read - "Cancel debug on entry to function (default all functions): " + (format-prompt "Cancel debug on entry to function" + "all functions") (mapcar #'symbol-name (debug--function-list)) nil t))) (when name (unless (string= name "") @@ -804,7 +805,8 @@ To specify a nil argument interactively, exit with an empty minibuffer." (interactive (list (let ((name (completing-read - "Cancel debug on set for variable (default all variables): " + (format-prompt "Cancel debug on set for variable" + "all variables") (mapcar #'symbol-name (debug--variable-list)) nil t))) (when name (unless (string= name "") diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 4f3c05baa9..a38c8bd5ca 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -3519,7 +3519,8 @@ The removes the effect of `edebug-on-entry'. If FUNCTION is nil, remove `edebug-on-entry' on all functions." (interactive (list (let ((name (completing-read - "Cancel edebug on entry to (default all functions): " + (format-prompt "Cancel edebug on entry to" + "all functions") (let ((functions (edebug--edebug-on-entry-functions))) (unless functions (user-error "No functions have `edebug-on-entry'")) @@ -4548,7 +4549,8 @@ instrumentation for, defaulting to all functions." (user-error "Found no functions to remove instrumentation from")) (let ((name (completing-read - "Remove instrumentation from (default all functions): " + (format-prompt "Remove instrumentation from" + "all functions") functions))) (if (and name (not (equal name ""))) diff --git a/lisp/epa.el b/lisp/epa.el index 57d355cb3e..e4b89e984d 100644 --- a/lisp/epa.el +++ b/lisp/epa.el @@ -648,7 +648,7 @@ If SECRET is non-nil, list secret keys instead of public keys." (setq input (file-name-sans-extension (expand-file-name input))) (expand-file-name (read-file-name - (concat "To file (default " (file-name-nondirectory input) ") ") + (format-prompt "To file" (file-name-nondirectory input)) (file-name-directory input) input))) @@ -1236,9 +1236,7 @@ If no one is selected, symmetric encryption will be performed. ") (list keys (expand-file-name (read-file-name - (concat "To file (default " - (file-name-nondirectory default-name) - ") ") + (format-prompt "To file" (file-name-nondirectory default-name)) (file-name-directory default-name) default-name))))) (let ((context (epg-make-context epa-protocol))) diff --git a/lisp/faces.el b/lisp/faces.el index 7b96d938c5..302bfa245e 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1100,7 +1100,7 @@ returned. Otherwise, DEFAULT is returned verbatim." ;; prompt. If so, remove it. (setq prompt (replace-regexp-in-string ": ?\\'" "" prompt)) (let ((prompt (if default - (format-message "%s (default `%s'): " prompt default) + (format-prompt prompt default) (format "%s: " prompt))) aliasfaces nonaliasfaces faces) ;; Build up the completion tables. diff --git a/lisp/format.el b/lisp/format.el index 71cf885d41..a2f378efa7 100644 --- a/lisp/format.el +++ b/lisp/format.el @@ -320,7 +320,7 @@ If the format is not specified, attempt a regexp-based guess. Set `buffer-file-format' to the format used, and call any format-specific mode functions." (interactive - (list (format-read "Translate buffer from format (default guess): "))) + (list (format-read (format-prompt "Translate buffer from format" "guess")))) (save-excursion (goto-char (point-min)) (format-decode format (buffer-size) t))) @@ -331,7 +331,7 @@ Arg FORMAT is optional; if omitted the format will be determined by looking for identifying regular expressions at the beginning of the region." (interactive (list (region-beginning) (region-end) - (format-read "Translate region from format (default guess): "))) + (format-read (format-prompt "Translate region from format" "guess")))) (save-excursion (goto-char from) (format-decode format (- to from) nil))) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 7b6e15d6f8..c2ec3f1f97 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -3933,8 +3933,8 @@ This format is defined by the `gnus-article-time-format' variable." ;; No split name was found. ((null split-name) (read-file-name - (concat prompt " (default " - (file-name-nondirectory default-name) "): ") + (format-prompt prompt + (file-name-nondirectory default-name)) (file-name-directory default-name) default-name)) ;; A single group name is returned. @@ -3943,8 +3943,8 @@ This format is defined by the `gnus-article-time-format' variable." (funcall function split-name headers (symbol-value variable))) (read-file-name - (concat prompt " (default " - (file-name-nondirectory default-name) "): ") + (format-prompt prompt + (file-name-nondirectory default-name)) (file-name-directory default-name) default-name)) ;; A single split name was found @@ -3956,9 +3956,8 @@ This format is defined by the `gnus-article-time-format' variable." (file-name-as-directory name)) ((file-exists-p name) name) (t gnus-article-save-directory)))) - (read-file-name - (concat prompt " (default " name "): ") - dir name))) + (read-file-name (format-prompt prompt name) + dir name))) ;; A list of splits was found. (t (setq split-name (nreverse split-name)) diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index fb285962d6..5bf2869983 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -1310,9 +1310,7 @@ SPEC is a predicate specifier that contains stuff like `or', `and', initial-input history def) "Call `gnus-completing-read-function'." (funcall gnus-completing-read-function - (concat prompt (when def - (concat " (default " def ")")) - ": ") + (format-prompt prompt def) collection require-match initial-input history def)) (defun gnus-emacs-completing-read (prompt collection &optional require-match diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index b08d8c26c9..7ca43d603f 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -5349,7 +5349,7 @@ Otherwise, generate and save a value for `canlock-password' first." (zerop (length (setq to (completing-read - "Followups to (default no Followup-To header): " + (format-prompt "Followups to" "no Followup-To header") (mapcar #'list (cons "poster" (message-tokenize-header diff --git a/lisp/info.el b/lisp/info.el index 8c08eaec3c..41889d6de1 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -2604,12 +2604,9 @@ new buffer." (if (eq (length completions) 1) (setq default (car completions))) (if completions - (let ((input (completing-read (if default - (concat - "Follow reference named (default " - default "): ") - "Follow reference named: ") - completions nil t))) + (let ((input (completing-read (format-prompt "Follow reference named" + default) + completions nil t))) (list (if (equal input "") default input) current-prefix-arg)) diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index 862c577bd5..5cc73e4367 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el @@ -833,7 +833,7 @@ The IGNORED argument is ignored." "Display information about a font whose name is FONTNAME." (interactive (list (completing-read - "Font name (default current choice for ASCII chars): " + (format-prompt "Font name" "current choice for ASCII chars") (and window-system ;; Implied by `window-system'. (fboundp 'x-list-fonts) @@ -1004,7 +1004,7 @@ This shows which font is used for which character(s)." (mapcar 'cdr fontset-alias-alist))) (completion-ignore-case t)) (list (completing-read - "Fontset (default used by the current frame): " + (format-prompt "Fontset" "used by the current frame") fontset-list nil t))))) (if (= (length fontset) 0) (setq fontset (face-attribute 'default :fontset)) diff --git a/lisp/international/quail.el b/lisp/international/quail.el index 50ff307b73..89ab450aee 100644 --- a/lisp/international/quail.el +++ b/lisp/international/quail.el @@ -917,7 +917,7 @@ The format of KBD-LAYOUT is the same as `quail-keyboard-layout'." The variable `quail-keyboard-layout-type' holds the currently selected keyboard type." (interactive - (list (completing-read "Keyboard type (default current choice): " + (list (completing-read (format-prompt "Keyboard type" "current choice") quail-keyboard-layout-alist nil t))) (or (and keyboard-type (> (length keyboard-type) 0)) diff --git a/lisp/language/cyril-util.el b/lisp/language/cyril-util.el index 04e681d743..e404288ddc 100644 --- a/lisp/language/cyril-util.el +++ b/lisp/language/cyril-util.el @@ -60,7 +60,7 @@ If the argument is nil, we return the display table to its standard state." (list (let* ((completion-ignore-case t)) (completing-read - "Cyrillic language (default nil): " + (format-prompt "Cyrillic language" "nil") cyrillic-language-alist nil t nil nil nil)))) (or standard-display-table diff --git a/lisp/mail/rmailkwd.el b/lisp/mail/rmailkwd.el index 58a8eb7a37..d8fcc1c0a9 100644 --- a/lisp/mail/rmailkwd.el +++ b/lisp/mail/rmailkwd.el @@ -74,12 +74,9 @@ according to the choice made, and returns a symbol." (rmail-summary-exists) (and (setq old (rmail-get-keywords)) (mapc #'rmail-make-label (split-string old ", ")))) - (completing-read (concat prompt - (if rmail-last-label - (concat " (default " - (symbol-name rmail-last-label) - "): ") - ": ")) + (completing-read (format-prompt prompt + (and rmail-last-label + (symbol-name rmail-last-label))) rmail-label-obarray nil nil)))) diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index 99bff66657..66a1e9a4db 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -254,7 +254,7 @@ TRUNCATED is non-nil if the text of this entity was truncated.")) (unless (y-or-n-p "This entity is truncated; save anyway? ") (error "Aborted"))) (setq filename (expand-file-name - (read-file-name (format "Save as (default: %s): " filename) + (read-file-name (format-prompt "Save as" filename) directory (expand-file-name filename directory)) directory)) diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el index 91f86a234d..1f5bb2d9f1 100644 --- a/lisp/mail/rmailout.el +++ b/lisp/mail/rmailout.el @@ -107,9 +107,8 @@ error: %S\n" (read-file (expand-file-name (read-file-name - (concat "Output message to mail file (default " - (file-name-nondirectory default-file) - "): ") + (format-prompt "Output message to mail file" + (file-name-nondirectory default-file)) (file-name-directory default-file) (abbreviate-file-name default-file)) (file-name-directory default-file)))) diff --git a/lisp/man.el b/lisp/man.el index 4ef2deac4f..2bde1fc7fb 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1786,7 +1786,7 @@ Returns t if section is found, nil otherwise." Man--last-section (car Man--sections))) (completion-ignore-case t) - (prompt (concat "Go to section (default " default "): ")) + (prompt (format-prompt "Go to section" default)) (chosen (completing-read prompt Man--sections nil nil nil nil default))) (list chosen)) @@ -1850,7 +1850,7 @@ Specify which REFERENCE to use; default is based on word at point." (defaults (mapcar 'substring-no-properties (cons default Man--refpages))) - (prompt (concat "Refer to (default " default "): ")) + (prompt (format-prompt "Refer to" default)) (chosen (completing-read prompt Man--refpages nil nil nil nil defaults))) chosen))) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index b2577c085f..40a1730637 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1918,10 +1918,7 @@ key, a click, or a menu-item")) (let* ((default (thing-at-point 'sexp)) (topic (read-from-minibuffer - (format "Subject to look up%s: " - (if default - (format " (default \"%s\")" default) - "")) + (format-prompt "Subject to look up" default) nil nil nil nil default))) (list (if (zerop (length topic)) default diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index 56a1d76d71..876e138f28 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@ -1230,8 +1230,9 @@ only return the directory part of FILE." ;; found another machine with the same user. ;; Try that account. (read-passwd - (format "passwd for %s@%s (default same as %s@%s): " - user host user other) + (format-prompt "passwd for %s@%s" + (format "same as %s@%s" user other) + user host) nil (ange-ftp-lookup-passwd other user)) diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el index a9350c58d5..1756b34fc5 100644 --- a/lisp/org/org-capture.el +++ b/lisp/org/org-capture.el @@ -1815,10 +1815,13 @@ by their respective `org-store-link-plist' properties if present." ;; Load history list for current prompt. (setq org-capture--prompt-history (gethash prompt org-capture--prompt-history-table)) - (push (org-completing-read - (concat (or prompt "Enter string") - (and default (format " [%s]" default)) - ": ") + (push (org-completing-read + ;; `format-prompt' is new in Emacs 28.1. + (if (fboundp 'format-prompt) + (format-prompt (or prompt "Enter string") default) + (concat (or prompt "Enter string") + (and default (format " [%s]" default)) + ": ")) completions nil nil nil 'org-capture--prompt-history default) strings) diff --git a/lisp/org/org-refile.el b/lisp/org/org-refile.el index 678759e10d..73eaad6bf5 100644 --- a/lisp/org/org-refile.el +++ b/lisp/org/org-refile.el @@ -640,11 +640,13 @@ this function appends the default value from org-refile-target-table)) (completion-ignore-case t) cdef - (prompt (concat prompt - (or (and (car org-refile-history) - (concat " (default " (car org-refile-history) ")")) - (and (assoc cbnex tbl) (setq cdef cbnex) - (concat " (default " cbnex ")"))) ": ")) + (prompt (let ((default (or (car org-refile-history) + (and (assoc cbnex tbl) (setq cdef cbnex) + cbnex)))) + ;; `format-prompt' is new in Emacs 28.1. + (if (fboundp 'format-prompt) + (format-prompt prompt default) + (concat prompt " (default " default ": ")))) pa answ parent-target child parent old-hist) (setq old-hist org-refile-history) (setq answ (funcall cfunc prompt tbl nil (not new-nodes) diff --git a/lisp/proced.el b/lisp/proced.el index fec2a29c84..9a8eaf54e7 100644 --- a/lisp/proced.el +++ b/lisp/proced.el @@ -1772,8 +1772,8 @@ supported but discouraged. It will be removed in a future version of Emacs." `(:annotation-function ,(lambda (s) (cdr (assoc s proced-signal-list)))))) (proced-with-processes-buffer process-alist - (list (completing-read (concat "Send signal [" pnum - "] (default TERM): ") + (list (completing-read (format-prompt "Send signal [%s]" + "TERM" pnum) proced-signal-list nil nil nil nil "TERM") process-alist)))) @@ -1797,8 +1797,8 @@ supported but discouraged. It will be removed in a future version of Emacs." `(:annotation-function ,(lambda (s) (cdr (assoc s proced-signal-list)))))) (proced-with-processes-buffer process-alist - (setq signal (completing-read (concat "Send signal [" pnum - "] (default TERM): ") + (setq signal (completing-read (format-prompt "Send signal [%s]" + "TERM" pnum) proced-signal-list nil nil nil nil "TERM")))))) diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el index d800365e66..baee72b332 100644 --- a/lisp/progmodes/cpp.el +++ b/lisp/progmodes/cpp.el @@ -702,11 +702,8 @@ BRANCH should be either nil (false branch), t (true branch) or `both'." (x-popup-menu cpp-button-event (list prompt (cons prompt cpp-face-default-list))) (let ((name (car (rassq default cpp-face-default-list)))) - (cdr (assoc (completing-read (if name - (concat prompt - " (default " name "): ") - (concat prompt ": ")) - cpp-face-default-list nil t) + (cdr (assoc (completing-read (format-prompt "%s" name prompt) + cpp-face-default-list nil t) cpp-face-all-list)))) default)) diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el index ab0329d7ee..6e416d064a 100644 --- a/lisp/progmodes/ebrowse.el +++ b/lisp/progmodes/ebrowse.el @@ -1330,9 +1330,9 @@ Pop to member buffer if no prefix ARG, to tree buffer otherwise." "Set the indentation width of the tree display." (interactive) (let ((width (string-to-number (read-string - (concat "Indentation (default " - (int-to-string ebrowse--indentation) - "): ") + (format-prompt + "Indentation" + (int-to-string ebrowse--indentation)) nil nil ebrowse--indentation)))) (when (cl-plusp width) (setq-local ebrowse--indentation width) diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index f53b09d9e8..d2ce813daa 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -292,7 +292,7 @@ file the tag was in." (or (locate-dominating-file default-directory "TAGS") default-directory))) (list (read-file-name - "Visit tags table (default TAGS): " + (format-prompt "Visit tags table" "TAGS") ;; default to TAGS from default-directory up to root. default-tag-dir (expand-file-name "TAGS" default-tag-dir) @@ -625,7 +625,7 @@ Returns t if it visits a tags table, or nil if there are no more in the list." (car list)) ;; Finally, prompt the user for a file name. (expand-file-name - (read-file-name "Visit tags table (default TAGS): " + (read-file-name (format-prompt "Visit tags table" "TAGS") default-directory "TAGS" t)))))) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index ec2850737c..001989e39a 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -1057,11 +1057,9 @@ REGEXP is used as a string in the prompt." default-extension (car grep-files-history) (car (car grep-files-aliases)))) - (files (completing-read - (concat "Search for \"" regexp - "\" in files matching wildcard" - (if default (concat " (default " default ")")) - ": ") + (files (completing-read + (format-prompt "Search for \"%s\" in files matching wildcard" + default regexp) #'read-file-name-internal nil nil nil 'grep-files-history (delete-dups diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el index a18a67249a..87732c1048 100644 --- a/lisp/progmodes/hideif.el +++ b/lisp/progmodes/hideif.el @@ -2456,7 +2456,7 @@ This allows #ifdef VAR to be hidden." (t nil)))) (var (read-minibuffer "Define what? " default)) - (val (read-from-minibuffer (format "Set %s to? (default 1): " var) + (val (read-from-minibuffer (format-prompt "Set %s to?" "1" var) nil nil t nil "1"))) (list var val))) (hif-set-var var (or val 1)) diff --git a/lisp/progmodes/pascal.el b/lisp/progmodes/pascal.el index e6e6e40aa1..5938da542a 100644 --- a/lisp/progmodes/pascal.el +++ b/lisp/progmodes/pascal.el @@ -1357,9 +1357,7 @@ The default is a name found in the buffer around point." default "")) (label ;; Do completion with default. - (completing-read (if (not (string= default "")) - (concat "Label (default " default "): ") - "Label: ") + (completing-read (format-prompt "Label" default) ;; Complete with the defuns found in the ;; current-buffer. (let ((buf (current-buffer))) diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 74a023775f..118117131f 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -2484,11 +2484,8 @@ Interaction supports completion." (if (eq (try-completion default prolog-info-alist) nil) (setq default nil)) ;; Read the PredSpec from the user - (completing-read - (if (zerop (length default)) - "Help on predicate: " - (concat "Help on predicate (default " default "): ")) - prolog-info-alist nil t nil nil default))) + (completing-read (format-prompt "Help on predicate" default) + prolog-info-alist nil t nil nil default))) (defun prolog-build-info-alist (&optional verbose) "Build an alist of all builtins and library predicates. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 43ee3c0c15..b1f61c89a4 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -4773,10 +4773,14 @@ Interactively, prompt for symbol." (interactive (let ((symbol (python-eldoc--get-symbol-at-point)) (enable-recursive-minibuffers t)) - (list (read-string (if symbol - (format "Describe symbol (default %s): " symbol) - "Describe symbol: ") - nil nil symbol)))) + (list (read-string + ;; `format-prompt' is new in Emacs 28.1. + (if (fboundp 'format-prompt) + (format-prompt "Describe symbol" symbol) + (if symbol + (format "Describe symbol (default %s): " symbol) + "Describe symbol: ")) + nil nil symbol)))) (message (python-eldoc--get-doc-at-point symbol))) (defun python-describe-at-point (symbol process) diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 02eccb3301..283c057e52 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -3219,14 +3219,7 @@ For both `:file' and `:completion', there can also be a symbol (let* ((default (plist-get plist :default)) (last-value (sql-default-value symbol)) - (prompt-def - (if default - (if (string-match "\\(\\):[ \t]*\\'" prompt) - (replace-match (format " (default \"%s\")" default) t t prompt 1) - (replace-regexp-in-string "[ \t]*\\'" - (format " (default \"%s\") " default) - prompt t t)) - prompt)) + (prompt-def (format-prompt prompt default)) (use-dialog-box nil)) (cond ((plist-member plist :file) @@ -3311,7 +3304,7 @@ function like this: (sql-get-login \\='user \\='password \\='database)." (let ((plist (cdr-safe w))) (pcase (or (car-safe w) w) ('user - (sql-get-login-ext 'sql-user "User: " 'sql-user-history plist)) + (sql-get-login-ext 'sql-user "User" 'sql-user-history plist)) ('password (setq-default sql-password @@ -3330,14 +3323,14 @@ function like this: (sql-get-login \\='user \\='password \\='database)." (read-passwd "Password: " nil (sql-default-value 'sql-password))))) ('server - (sql-get-login-ext 'sql-server "Server: " 'sql-server-history plist)) + (sql-get-login-ext 'sql-server "Server" 'sql-server-history plist)) ('database - (sql-get-login-ext 'sql-database "Database: " + (sql-get-login-ext 'sql-database "Database" 'sql-database-history plist)) ('port - (sql-get-login-ext 'sql-port "Port: " + (sql-get-login-ext 'sql-port "Port" nil (append '(:number t) plist))))))) (defun sql-find-sqli-buffer (&optional product connection) diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index d98230d9a0..5ef382b91e 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -5478,8 +5478,11 @@ becomes: (let* ((pop-up-windows t)) (let ((name (expand-file-name (read-file-name - (format "Find this error in: (default %s) " - file) + ;; `format-prompt' is new in Emacs 28.1. + (if (fboundp 'format-prompt) + (format-prompt "Find this error in" file) + (format "Find this error in (default %s): " + file)) nil ;; dir file t)))) (setq buffer @@ -7863,14 +7866,14 @@ If search fails, other files are checked based on (let* ((default (verilog-get-default-symbol)) ;; The following variable is used in verilog-comp-function (verilog-buffer-to-use (current-buffer)) - (label (if (not (string= default "")) - ;; Do completion with default - (completing-read (concat "Goto-Label: (default " - default ") ") - #'verilog-comp-defun nil nil "") - ;; There is no default value. Complete without it - (completing-read "Goto-Label: " - #'verilog-comp-defun nil nil ""))) + (label + (completing-read (cond ((fboundp 'format-prompt) + ;; `format-prompt' is new in Emacs 28.1. + (format-prompt "Goto-Label" default)) + ((not (string= default "")) + (concat "Goto-Label (default " default "): ")) + (t "Goto-Label: ")) + #'verilog-comp-defun nil nil "")) pt) ;; Make sure library paths are correct, in case need to resolve module (verilog-auto-reeval-locals) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 267ee16400..210fc2b1d8 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1310,12 +1310,17 @@ definitions." (xref--prompt-p this-command)) (let ((id (completing-read - (if def - (format "%s (default %s): " - (substring prompt 0 (string-match - "[ :]+\\'" prompt)) - def) - prompt) + ;; `format-prompt' is new in Emacs 28.1 + (if (fboundp 'format-prompt) + (format-prompt (substring prompt 0 (string-match + "[ :]+\\'" prompt)) + def) + (if def + (format "%s (default %s): " + (substring prompt 0 (string-match + "[ :]+\\'" prompt)) + def) + prompt)) (xref-backend-identifier-completion-table backend) nil nil nil 'xref--read-identifier-history def))) diff --git a/lisp/ses.el b/lisp/ses.el index ea966295b1..51843eab03 100644 --- a/lisp/ses.el +++ b/lisp/ses.el @@ -3774,7 +3774,9 @@ function is redefined." (setq name (intern name)) (let* ((cur-printer (gethash name ses--local-printer-hashmap)) (default (and cur-printer (ses--locprn-def cur-printer)))) - (setq def (ses-read-printer (format "Enter definition of printer %S" name) + (setq def (ses-read-printer (format-prompt + "Enter definition of printer %S" + default name) default))) (list name def))) diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el index c42286e5bc..25f0c35aa5 100644 --- a/lisp/textmodes/artist.el +++ b/lisp/textmodes/artist.el @@ -2840,9 +2840,8 @@ Returns a list of strings." (if (memq system-type '(windows-nt ms-dos)) (artist-figlet-get-font-list-windows) (artist-figlet-get-font-list))) - (font (completing-read (concat "Select font (default " - artist-figlet-default-font - "): ") + (font (completing-read (format-prompt "Select font" + artist-figlet-default-font) (mapcar (lambda (font) (cons font font)) avail-fonts)))) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 6fd66b2502..5fba93c76e 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -2457,7 +2457,7 @@ Only applies the FSPEC to the args part of FORMAT." (default (tex-compile-default fspec))) (list default-directory (completing-read - (format "Command [%s]: " (tex-summarize-command default)) + (format-prompt "Command" (tex-summarize-command default)) (mapcar (lambda (x) (list (tex-format-cmd (eval (car x) t) fspec))) tex-compile-commands) diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el index 352fa693ff..4061fedd57 100644 --- a/lisp/vc/diff.el +++ b/lisp/vc/diff.el @@ -96,15 +96,15 @@ Non-interactively, OLD and NEW may each be a file or a buffer." (interactive (let* ((newf (if (and buffer-file-name (file-exists-p buffer-file-name)) (read-file-name - (concat "Diff new file (default " - (file-name-nondirectory buffer-file-name) "): ") + (format-prompt "Diff new file" + (file-name-nondirectory buffer-file-name)) nil buffer-file-name t) (read-file-name "Diff new file: " nil nil t))) (oldf (file-newest-backup newf))) (setq oldf (if (and oldf (file-exists-p oldf)) (read-file-name - (concat "Diff original file (default " - (file-name-nondirectory oldf) "): ") + (format-prompt "Diff original file" + (file-name-nondirectory oldf)) (file-name-directory oldf) oldf t) (read-file-name "Diff original file: " (file-name-directory newf) nil t))) diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el index 4135e8b470..7622cf4c19 100644 --- a/lisp/vc/ediff-ptch.el +++ b/lisp/vc/ediff-ptch.el @@ -503,15 +503,11 @@ are two possible targets for this %spatch. However, these files do not exist." patch-file-name) (setq patch-file-name (read-file-name - (format "Patch is in file%s: " - (cond ((and buffer-file-name - (equal (expand-file-name dir) - (file-name-directory buffer-file-name))) - (concat - " (default " - (file-name-nondirectory buffer-file-name) - ")")) - (t ""))) + (format-prompt "Patch is in file" + (and buffer-file-name + (equal (expand-file-name dir) + (file-name-directory buffer-file-name)) + (file-name-nondirectory buffer-file-name))) dir buffer-file-name 'must-match)) (if (file-directory-p patch-file-name) (error "Patch file cannot be a directory: %s" patch-file-name) diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index 9016d1df5c..346c3c0a66 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -3103,11 +3103,7 @@ Hit \\[ediff-recenter] to reset the windows afterward." (lambda () (when defaults (setq minibuffer-default defaults))) (read-file-name - (format "%s%s " - prompt - (cond (default-file - (concat " (default " default-file "):")) - (t (concat " (default " default-dir "):")))) + (format-prompt prompt (or default-file default-dir)) default-dir (or default-file default-dir) t ; must match, no-confirm diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el index bbc81ef195..8f662e8458 100644 --- a/lisp/vc/pcvs.el +++ b/lisp/vc/pcvs.el @@ -1284,8 +1284,7 @@ marked instead. A directory can never be marked." (intern (upcase (completing-read - (concat - "Mark files in state" (if default (concat " [" default "]")) ": ") + (format-prompt "Mark files in state" default) (mapcar (lambda (x) (list (downcase (symbol-name (car x))))) cvs-states) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 5b259fcdb3..edc4169465 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1863,13 +1863,10 @@ Return t if the buffer had changes, nil otherwise." (vc-working-revision first)))) (when (string= rev1-default "") (setq rev1-default nil)))) ;; construct argument list - (let* ((rev1-prompt (if rev1-default - (concat "Older revision (default " - rev1-default "): ") - "Older revision: ")) - (rev2-prompt (concat "Newer revision (default " - ;; (or rev2-default - "current source): ")) + (let* ((rev1-prompt (format-prompt "Older revision" rev1-default)) + (rev2-prompt (format-prompt "Newer revision" + ;; (or rev2-default + "current source")) (rev1 (vc-read-revision rev1-prompt files backend rev1-default)) (rev2 (vc-read-revision rev2-prompt files backend nil))) ;; rev2-default (when (string= rev1 "") (setq rev1 nil)) @@ -2082,7 +2079,7 @@ If `F.~REV~' already exists, use it instead of checking it out again." (with-current-buffer (or (buffer-base-buffer) (current-buffer)) (vc-ensure-vc-buffer) (list - (vc-read-revision "Revision to visit (default is working revision): " + (vc-read-revision (format-prompt "Revision to visit" "working revision") (list buffer-file-name))))) (set-buffer (or (buffer-base-buffer) (current-buffer))) (vc-ensure-vc-buffer) @@ -2378,7 +2375,7 @@ This function runs the hook `vc-retrieve-tag-hook' when finished." (read-directory-name "Directory: " default-directory nil t)))) (list dir - (vc-read-revision "Tag name to retrieve (default latest revisions): " + (vc-read-revision (format-prompt "Tag name to retrieve" "latest revisions") (list dir) (vc-responsible-backend dir))))) (let* ((backend (vc-responsible-backend dir)) diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 05606fbfb4..fb06a95f51 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -3325,7 +3325,7 @@ It reads a file name from an editable text field." ;;; (file (file-name-nondirectory value)) ;;; (menu-tag (widget-apply widget :menu-tag-get)) ;;; (must-match (widget-get widget :must-match)) -;;; (answer (read-file-name (concat menu-tag " (default " value "): ") +;;; (answer (read-file-name (format-prompt menu-tag value) ;;; dir nil must-match file))) ;;; (widget-value-set widget (abbreviate-file-name answer)) ;;; (widget-setup) commit 0a7bab689c4a113dd295c9db55d8e76a34d5f9e1 Author: Stefan Kangas Date: Mon Sep 27 23:56:55 2021 +0200 ; Minor stylistic fixes found by checkdoc diff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el index 668e7b91e8..f18d488854 100644 --- a/lisp/allout-widgets.el +++ b/lisp/allout-widgets.el @@ -880,7 +880,7 @@ encompassing condition-case." ;; reraise the error, or one concerning this function if unexpected: (if (equal mode 'error) (apply #'signal args) - (error "%s: unexpected mode, %s %s" this mode args)))) + (error "%s: Unexpected mode, %s %s" this mode args)))) ;;;_ > allout-widgets-changes-exceed-threshold-p () (defun allout-widgets-adjusting-message (message) "Post MESSAGE when pending are likely to make a big enough delay. diff --git a/lisp/allout.el b/lisp/allout.el index c123e8ded4..5102ee7341 100644 --- a/lisp/allout.el +++ b/lisp/allout.el @@ -823,12 +823,12 @@ such topics are encrypted.)" :group 'allout-encryption) (make-variable-buffer-local 'allout-encrypt-unencrypted-on-saves) (defvar allout-auto-save-temporarily-disabled nil - "True while topic encryption is pending and auto-saving was active. + "Non-nil while topic encryption is pending and auto-saving was active. The value of `buffer-saved-size' at the time of decryption is used, for restoring when all encryptions are established.") (defvar-local allout-just-did-undo nil - "True just after undo commands, until allout-post-command-business.") + "Non-nil just after undo commands, until allout-post-command-business.") ;;;_ + Developer ;;;_ = allout-developer group @@ -3190,7 +3190,7 @@ Set by `allout-pre-command-business', to support allout addons in coordinating with allout activity.") ;;;_ = allout-this-command-hid-text (defvar-local allout-this-command-hid-text nil - "True if the most recent allout-mode command hid any text.") + "Non-nil if the most recent `allout-mode' command hid any text.") ;;;_ > allout-post-command-business () (defun allout-post-command-business () "Outline `post-command-hook' function. @@ -4787,7 +4787,7 @@ Useful for coherently exposing to a random point in a hidden region." (setq bag-it (1+ bag-it)) (if (> bag-it 1) (error "allout-show-to-offshoot: %s" - "Stumped by aberrant nesting."))) + "Stumped by aberrant nesting"))) (if (> bag-it 0) (setq bag-it 0)) (allout-show-children) (goto-char orig-pref))) @@ -5402,7 +5402,7 @@ Defaults: ;; Specified but not a buffer -- get it: (let ((got (get-buffer frombuf))) (if (not got) - (error "allout-process-exposed: source buffer %s not found." + (error "allout-process-exposed: Source buffer %s not found" frombuf) (setq frombuf got)))) ;; not specified -- default it: diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el index f9dd9eb98a..3492b6d831 100644 --- a/lisp/calc/calc-prog.el +++ b/lisp/calc/calc-prog.el @@ -124,7 +124,7 @@ (or (memq (car-safe (car-safe place)) '(error xxxerror)) (setq place (aref (nth 2 (nth 2 (symbol-function 'calc-do))) 27))) (or (memq (car (car place)) '(error xxxerror)) - (error "foo")) + (error "Foo")) (setcar (car place) 'xxxerror)) (error (error "The calc-do function has been modified; unable to patch")))) diff --git a/lisp/cedet/semantic/wisent/python.el b/lisp/cedet/semantic/wisent/python.el index fb878dde71..2eeade6646 100644 --- a/lisp/cedet/semantic/wisent/python.el +++ b/lisp/cedet/semantic/wisent/python.el @@ -118,9 +118,9 @@ curly braces." ;; look-ahead assertions.) (when (and (= (- end start) 2) (looking-at "\"\\{3\\}\\|'\\{3\\}")) - (error "unterminated syntax")) + (error "Unterminated syntax")) (goto-char end)) - (error "unterminated syntax"))) + (error "Unterminated syntax"))) (defun wisent-python-forward-balanced-expression () "Move point to the end of the balanced expression at point. @@ -145,7 +145,7 @@ triple-quoted string syntax." ;; delimiter (backquote) characters, line continuation, and end ;; of comment characters (AKA newline characters in Python). ((zerop (skip-syntax-forward "-w_.$\\>")) - (error "can't figure out how to go forward from here")))) + (error "Can't figure out how to go forward from here")))) ;; Skip closing character. As a last resort this should raise an ;; error if we hit EOB before we find our closing character.. (forward-char 1))) diff --git a/lisp/cedet/srecode/dictionary.el b/lisp/cedet/srecode/dictionary.el index d6dfc58411..e47a09fd84 100644 --- a/lisp/cedet/srecode/dictionary.el +++ b/lisp/cedet/srecode/dictionary.el @@ -364,7 +364,7 @@ values but STATE is nil." ;; Value is some other object; create a compound value. (t (unless state - (error "Cannot insert compound values without state.")) + (error "Cannot insert compound values without state")) (srecode-dictionary-set-value dict name diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 4b8d271071..32375ac525 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2736,7 +2736,7 @@ This function takes some pains to conform to `ls -lR' output." ;; Check that it is valid to insert DIRNAME with SWITCHES. ;; Signal an error if invalid (e.g. user typed `i' on `..'). (or (file-in-directory-p dirname (expand-file-name default-directory)) - (error "%s: not in this directory tree" dirname)) + (error "%s: Not in this directory tree" dirname)) (let ((real-switches (or switches dired-subdir-switches))) (when real-switches (let (case-fold-search) diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index f620cdbb33..aaacba2c8e 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -462,7 +462,7 @@ if `autoload-timestamps' is non-nil, otherwise a fixed fake time is inserted)." (insert "\n" generate-autoload-section-continuation)))))) (defun autoload-find-file (file) - "Fetch file and put it in a temp buffer. Return the buffer." + "Fetch FILE and put it in a temp buffer. Return the buffer." ;; It is faster to avoid visiting the file. (setq file (expand-file-name file)) (with-current-buffer (get-buffer-create " *autoload-file*") @@ -482,10 +482,10 @@ if `autoload-timestamps' is non-nil, otherwise a fixed fake time is inserted)." "File local variable to prevent scanning this file for autoload cookies.") (defun autoload-file-load-name (file outfile) - "Compute the name that will be used to load FILE." - ;; OUTFILE should be the name of the global loaddefs.el file, which - ;; is expected to be at the root directory of the files we're - ;; scanning for autoloads and will be in the `load-path'. + "Compute the name that will be used to load FILE. +OUTFILE should be the name of the global loaddefs.el file, which +is expected to be at the root directory of the files we are +scanning for autoloads and will be in the `load-path'." (let* ((name (file-relative-name file (file-name-directory outfile))) (names '()) (dir (file-name-directory outfile))) diff --git a/lisp/emacs-lisp/avl-tree.el b/lisp/emacs-lisp/avl-tree.el index 4382985eb8..3f803107a1 100644 --- a/lisp/emacs-lisp/avl-tree.el +++ b/lisp/emacs-lisp/avl-tree.el @@ -330,8 +330,7 @@ inserted data." data))) (if (or (funcall cmpfun newdata data) (funcall cmpfun data newdata)) - (error "avl-tree-enter:\ - updated data does not match existing data")) + (error "avl-tree-enter: Updated data does not match existing data")) (setf (avl-tree--node-data br) newdata) (cons nil newdata)) ; return value )))) diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 35c80e524c..da86fa5cec 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -422,7 +422,8 @@ was first made obsolete, for example a date or a release number." &optional docstring) "Set OBSOLETE-NAME's function definition to CURRENT-NAME and mark it obsolete. -\(define-obsolete-function-alias \\='old-fun \\='new-fun \"28.1\" \"old-fun's doc.\") +\(define-obsolete-function-alias \\='old-fun \\='new-fun \"28.1\" \ +\"old-fun's doc.\") is equivalent to the following two lines of code: diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 0856626b7b..3f050d1b79 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1082,7 +1082,7 @@ If STR is something like \"Buffer foo.el\", return # (defconst emacs-lisp-compilation-parse-errors-filename-function #'emacs-lisp-compilation-file-name-or-buffer "The value for `compilation-parse-errors-filename-function' for when -we go into emacs-lisp-compilation-mode.") +we go into `emacs-lisp-compilation-mode'.") (defcustom emacs-lisp-compilation-search-path '(nil) "Directories to search for files named in byte-compile error messages. @@ -2810,8 +2810,8 @@ not to take responsibility for the actual compilation of the code." t))))) (defun byte-compile-output-as-comment (exp quoted) - "Print Lisp object EXP in the output file, inside a comment, -and return the file (byte) position it will have. + "Print Lisp object EXP in the output file, inside a comment. +Return the file (byte) position it will have. If QUOTED is non-nil, print with quoting; otherwise, print without quoting." (with-current-buffer byte-compile--outbuffer (let ((position (point))) diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 0ed7547509..499d26b737 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -336,7 +336,7 @@ non-nil value. ;;;###autoload (defun cl-isqrt (x) - "Return the integer square root of the (integer) argument." + "Return the integer square root of the (integer) argument X." (if (and (integerp x) (> x 0)) (let ((g (ash 2 (/ (logb x) 2))) g2) diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 72fe19461f..98cb1fd1cf 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -262,7 +262,7 @@ DATA is displayed to the user and should state the reason for skipping." ;; See Bug#24402 for why this exists (defun ert--should-signal-hook (error-symbol data) "Stupid hack to stop `condition-case' from catching ert signals. -It should only be stopped when ran from inside ert--run-test-internal." +It should only be stopped when ran from inside `ert--run-test-internal'." (when (and (not (symbolp debugger)) ; only run on anonymous debugger (memq error-symbol '(ert-test-failed ert-test-skipped))) (funcall debugger 'error (cons error-symbol data)))) diff --git a/lisp/emacs-lisp/ewoc.el b/lisp/emacs-lisp/ewoc.el index 68f94edafd..8636dc92a1 100644 --- a/lisp/emacs-lisp/ewoc.el +++ b/lisp/emacs-lisp/ewoc.el @@ -49,7 +49,7 @@ ;; ;; Ewoc is a package that implements a connection between an ;; dll (a doubly linked list) and the contents of a buffer. -;; Possible uses are dired (have all files in a list, and show them), +;; Possible uses are Dired (have all files in a list, and show them), ;; buffer-list, kom-prioritize (in the LysKOM elisp client) and ;; others. pcl-cvs.el and vc.el use ewoc.el. ;; @@ -381,7 +381,7 @@ arguments will be passed to MAP-FUNCTION." (defun ewoc-filter (ewoc predicate &rest args) "Remove all elements in EWOC for which PREDICATE returns nil. -Note that the buffer for EWOC will be current-buffer when PREDICATE +Note that the buffer for EWOC will be the current buffer when PREDICATE is called. PREDICATE must restore the current buffer before it returns if it changes it. The PREDICATE is called with the element as its first argument. If any diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index eac3c03cd1..fc7a7362cd 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -556,7 +556,7 @@ This will generate compile-time constants from BINDINGS." "Gaudy highlighting from Emacs Lisp mode used in Backtrace mode.") (defun lisp-string-in-doc-position-p (listbeg startpos) - "Return true if a doc string may occur at STARTPOS inside a list. + "Return non-nil if a doc string may occur at STARTPOS inside a list. LISTBEG is the position of the start of the innermost list containing STARTPOS." (let* ((firstsym (and listbeg @@ -589,7 +589,7 @@ containing STARTPOS." (= (point) startpos)))))) (defun lisp-string-after-doc-keyword-p (listbeg startpos) - "Return true if `:documentation' symbol ends at STARTPOS inside a list. + "Return non-nil if `:documentation' symbol ends at STARTPOS inside a list. LISTBEG is the position of the start of the innermost list containing STARTPOS." (and listbeg ; We are inside a Lisp form. diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index d775f152b3..8e14faea3a 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el @@ -1302,7 +1302,7 @@ Only meaningful when called from within `smie-rules-function'." (let ((tok (funcall smie-forward-token-function))) (unless tok (with-demoted-errors - (error "smie-rule-separator: can't skip token %s" + (error "smie-rule-separator: Can't skip token %s" smie--token)))) (skip-chars-forward " ") (unless (eolp) (point))))) diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el index 5210b2be5e..0ae355e591 100644 --- a/lisp/emacs-lisp/tabulated-list.el +++ b/lisp/emacs-lisp/tabulated-list.el @@ -256,7 +256,7 @@ Populated by `tabulated-list-init-header'.") (defvar tabulated-list--header-overlay nil) (defun tabulated-list-line-number-width () - "Return the width taken by display-line-numbers in the current buffer." + "Return the width taken by `display-line-numbers' in the current buffer." ;; line-number-display-width returns the value for the selected ;; window, which might not be the window in which the current buffer ;; is displayed. diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index 382f6bb1fa..1ef4931b7b 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -125,9 +125,12 @@ of SECS seconds since the epoch. SECS may be a fraction." (time-convert (cons (- more-ticks (% more-ticks trunc-s-ticks)) hz))))) (defun timer-relative-time (time secs &optional usecs psecs) - "Advance TIME by SECS seconds and optionally USECS microseconds -and PSECS picoseconds. SECS may be either an integer or a -floating point number." + "Advance TIME by SECS seconds. + +Optionally also advance it by USECS microseconds and PSECS +picoseconds. + +SECS may be either an integer or a floating point number." (let ((delta secs)) (if (or usecs psecs) (setq delta (time-add delta (list 0 0 (or usecs 0) (or psecs 0))))) @@ -138,9 +141,13 @@ floating point number." (time-less-p (timer--time t1) (timer--time t2))) (defun timer-inc-time (timer secs &optional usecs psecs) - "Increment the time set in TIMER by SECS seconds, USECS microseconds, -and PSECS picoseconds. SECS may be a fraction. If USECS or PSECS are -omitted, they are treated as zero." + "Increment the time set in TIMER by SECS seconds. + +Optionally also increment it by USECS microseconds, and PSECS +picoseconds. If USECS or PSECS are omitted, they are treated as +zero. + +SECS may be a fraction." (setf (timer--time timer) (timer-relative-time (timer--time timer) secs usecs psecs))) diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 3fcc14c99d..9f3d515bc6 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -3767,7 +3767,7 @@ Null string will repeat previous search." (define-key viper-vi-basic-map (cond ((characterp viper-buffer-search-char) (char-to-string viper-buffer-search-char)) - (t (error "viper-buffer-search-char: wrong value type, %S" + (t (error "viper-buffer-search-char: Wrong value type, %S" viper-buffer-search-char))) #'viper-command-argument) (aset viper-exec-array viper-buffer-search-char #'viper-exec-buffer-search) diff --git a/lisp/files.el b/lisp/files.el index 19b88e6621..64c69e685c 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5597,7 +5597,7 @@ Before and after saving the buffer, this function runs (if (not (file-directory-p dir)) (if (file-exists-p dir) (error "%s is not a directory" dir) - (error "%s: no such directory" dir)) + (error "%s: No such directory" dir)) (if (not (file-exists-p buffer-file-name)) (error "Directory %s write-protected" dir) (if (yes-or-no-p @@ -7948,7 +7948,7 @@ for the specified category of users." ((= char ?g) #o2070) ((= char ?o) #o1007) ((= char ?a) #o7777) - (t (error "%c: bad `who' character" char)))) + (t (error "%c: Bad `who' character" char)))) (defun file-modes-char-to-right (char &optional from) "Convert CHAR to a numeric value of mode bits. @@ -7971,7 +7971,7 @@ If CHAR is in [Xugo], the value is taken from FROM (or 0 if omitted)." (+ gright (/ gright #o10) (* gright #o10)))) ((= char ?o) (let ((oright (logand #o1007 from))) (+ oright (* oright #o10) (* oright #o100)))) - (t (error "%c: bad right character" char)))) + (t (error "%c: Bad right character" char)))) (defun file-modes-rights-to-number (rights who-mask &optional from) "Convert a symbolic mode string specification to an equivalent number. diff --git a/lisp/format.el b/lisp/format.el index 71cf885d41..6c0ba11641 100644 --- a/lisp/format.el +++ b/lisp/format.el @@ -519,7 +519,7 @@ the value of `foo'." (cdr list) (let ((p list)) (while (not (eq (cdr p) cons)) - (if (null p) (error "format-delq-cons: not an element")) + (if (null p) (error "format-delq-cons: Not an element")) (setq p (cdr p))) ;; Now (cdr p) is the cons to delete (setcdr p (cdr cons)) diff --git a/lisp/gnus/gnus-srvr.el b/lisp/gnus/gnus-srvr.el index 115efa9805..5f2fc46333 100644 --- a/lisp/gnus/gnus-srvr.el +++ b/lisp/gnus/gnus-srvr.el @@ -570,7 +570,7 @@ The following commands are available: (when (assoc to gnus-server-alist) (error "%s already exists" to)) (unless (gnus-server-to-method from) - (error "%s: no such server" from)) + (error "%s: No such server" from)) (let ((to-entry (cons from (copy-tree (gnus-server-to-method from))))) (setcar to-entry to) @@ -1128,7 +1128,7 @@ Requesting compaction of %s... (this may take a long time)" (customize-set-variable 'gnus-cloud-method server) ;; Note we can't use `Custom-save' here. (when (gnus-yes-or-no-p - (format "The new cloud host server is %S now. Save it? " server)) + (format "The new cloud host server is `%S' now. Save it?" server)) (customize-save-variable 'gnus-cloud-method server))) (when (gnus-yes-or-no-p (format "Upload Cloud data to %S now? " server)) (gnus-message 1 "Uploading all data to Emacs Cloud server %S" server) diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index e32cfc0d61..c7be958edd 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -2934,7 +2934,7 @@ SPECIFIC-VARIABLES, or those in `gnus-variable-list'." (nreverse olist))) (defun gnus-gnus-to-newsrc-format (&optional foreign-ok) - (interactive (list (gnus-y-or-n-p "write foreign groups too? "))) + (interactive (list (gnus-y-or-n-p "Write foreign groups too?"))) ;; Generate and save the .newsrc file. (with-current-buffer (create-file-buffer gnus-current-startup-file) (let ((standard-output (current-buffer)) diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el index b49793509f..f72d76ac02 100644 --- a/lisp/gnus/mml-sec.el +++ b/lisp/gnus/mml-sec.el @@ -238,7 +238,7 @@ You can also customize or set `mml-signencrypt-style-alist' instead." (goto-char (match-end 0)) (apply #'mml-insert-tag 'part (cons (if sign 'sign 'encrypt) (cons method tags)))) - (t (error "The message is corrupted. No mail header separator")))))) + (t (error "The message is corrupted. No mail header separator")))))) (defvar mml-secure-method (if (equal mml-default-encrypt-method mml-default-sign-method) @@ -328,7 +328,7 @@ either an error is raised or not." (unless (yes-or-no-p "Message for encryption contains Bcc header.\ This may give away all Bcc'ed identities to all recipients.\ Are you sure that this is safe?\ - (Customize `mml-secure-safe-bcc-list' to avoid this warning.) ") + (Customize `mml-secure-safe-bcc-list' to avoid this warning.)") (error "Aborted")))))))) ;; defuns that add the proper <#secure ...> tag to the top of the message body @@ -352,7 +352,7 @@ either an error is raised or not." (apply #'mml-insert-tag 'secure 'method method 'mode mode tags))) (t (error - "The message is corrupted. No mail header separator")))) + "The message is corrupted. No mail header separator")))) (when (eql insert-loc (point)) (forward-line 1)))) diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el index 97c9f18a60..0ac57e9e17 100644 --- a/lisp/gnus/nnrss.el +++ b/lisp/gnus/nnrss.el @@ -715,7 +715,7 @@ Read the file and attempt to subscribe to each Feed in the file." (when (and xmlurl (not (string-match "\\`[\t ]*\\'" xmlurl)) (prog1 - (y-or-n-p (format "Subscribe to %s " xmlurl)) + (y-or-n-p (format "Subscribe to %s?" xmlurl)) (message ""))) (condition-case err (progn diff --git a/lisp/hilit-chg.el b/lisp/hilit-chg.el index 8919e98238..d9fab6b875 100644 --- a/lisp/hilit-chg.el +++ b/lisp/hilit-chg.el @@ -444,7 +444,7 @@ This is the opposite of `hilit-chg-hide-changes'." ;; We set the change property so we can tell this is one ;; of our overlays (so we don't delete someone else's). (overlay-put ov 'hilit-chg t)) - (error "hilit-chg-make-ov: no face for prop: %s" prop)))) + (error "hilit-chg-make-ov: No face for prop: %s" prop)))) (defun hilit-chg-hide-changes (&optional beg end) "Remove face information for Highlight Changes mode. diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 7c95baf8cd..5b69a878e2 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -1210,7 +1210,7 @@ Interactively, prompt for NAME, and use the current filters." (_ (let ((type (assq (car qualifier) ibuffer-filtering-alist))) (unless qualifier - (error "Ibuffer: bad qualifier %s" qualifier)) + (error "Ibuffer: Bad qualifier %s" qualifier)) (concat " [" (cadr type) ": " (format "%s]" (cdr qualifier))))))) (defun ibuffer-list-buffer-modes (&optional include-parents) diff --git a/lisp/international/ccl.el b/lisp/international/ccl.el index 9be4d1ee95..629cd4c287 100644 --- a/lisp/international/ccl.el +++ b/lisp/international/ccl.el @@ -510,7 +510,7 @@ If READ-FLAG is non-nil, this statement has the form (arg (nth 2 condition))) (ccl-check-register rrr cmd) (or (integerp op) - (error "CCL: invalid operator: %s" (nth 1 condition))) + (error "CCL: Invalid operator: %s" (nth 1 condition))) (if (integerp arg) (progn (ccl-embed-code (if read-flag 'read-jump-cond-expr-const @@ -862,7 +862,7 @@ is a list of CCL-BLOCKs." rrr RRR 0) (ccl-embed-symbol Rrr 'translation-hash-table-id)) (t - (error "CCL: non-constant table: %s" cmd) + (error "CCL: Non-constant table: %s" cmd) ;; not implemented: (ccl-check-register Rrr cmd) (ccl-embed-extended-command 'lookup-int rrr RRR 0)))) @@ -882,7 +882,7 @@ is a list of CCL-BLOCKs." rrr RRR 0) (ccl-embed-symbol Rrr 'translation-hash-table-id)) (t - (error "CCL: non-constant table: %s" cmd) + (error "CCL: Non-constant table: %s" cmd) ;; not implemented: (ccl-check-register Rrr cmd) (ccl-embed-extended-command 'lookup-char rrr RRR 0)))) diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el index 608062fba4..fe686cb6f8 100644 --- a/lisp/mail/feedmail.el +++ b/lisp/mail/feedmail.el @@ -2020,7 +2020,7 @@ backup file names and the like)." ;; if can't find EOH, this is no message! (unless (feedmail-find-eoh t) (feedmail-say-chatter "Skipping %s; no mail-header-separator" maybe-file) - (error "FQM: you should never see this message")) + (error "FQM: You should never see this message")) (feedmail-say-debug "Prepping %s" maybe-file) ;; the catch is a way out for users to voluntarily skip sending a message (catch 'skip-me-q (funcall feedmail-queue-runner-message-sender arg)) diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index 56a1d76d71..2585833e1d 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@ -4723,7 +4723,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") ;; by using the ftp chmod command. (defun ange-ftp-call-chmod (args) (if (< (length args) 2) - (error "ange-ftp-call-chmod: missing mode and/or filename: %s" args)) + (error "ange-ftp-call-chmod: Missing mode and/or filename: %s" args)) (let ((mode (car args)) (rest (cdr args))) (if (equal "--" (car rest)) diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index 6e10b5c4e3..b4aed27981 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -860,7 +860,7 @@ contains a reference, retrieve the type of the reference." (if complex-type (setq type (soap-xs-parse-complex-type (car complex-type))) ;; else - (error "Soap-xs-parse-element: missing type or ref")))))) + (error "soap-xs-parse-element: Missing type or ref")))))) (make-soap-xs-element :name name ;; Use the full namespace name for now, we will @@ -2874,7 +2874,7 @@ decode function to perform the actual decoding." (unless wtype ;; The node has type info encoded in it, but we don't know how to ;; decode it... - (error "Soap-decode-array: node has unknown type: %s" type))) + (error "soap-decode-array: Node has unknown type: %s" type))) (dolist (e contents) (when (consp e) (push (if wtype diff --git a/lisp/net/soap-inspect.el b/lisp/net/soap-inspect.el index 5207ca8ff1..eca338eb22 100644 --- a/lisp/net/soap-inspect.el +++ b/lisp/net/soap-inspect.el @@ -220,7 +220,7 @@ to its sub elements. If ELEMENT is the WSDL document itself, the entire WSDL can be inspected." (let ((inspect (get (soap-type-of element) 'soap-inspect))) (unless inspect - (error "Soap-inspect: no inspector for element")) + (error "soap-inspect: No inspector for element")) (with-current-buffer (get-buffer-create "*soap-inspect*") (setq buffer-read-only t) diff --git a/lisp/obsolete/cust-print.el b/lisp/obsolete/cust-print.el index 01fcd38199..897b401588 100644 --- a/lisp/obsolete/cust-print.el +++ b/lisp/obsolete/cust-print.el @@ -643,11 +643,11 @@ See `custom-format' for the details." (let ((print-circle t)) (or (equal (prin1-to-string circ-list) "#1=(a b [1 2 #1# 4] #1# e f)") - (error "circular object with array printing"))) + (error "Circular object with array printing"))) (let ((print-circle t)) (or (equal (prin1-to-string dotted-circ-list) "#1=(a b c . #1#)") - (error "circular object with array printing"))) + (error "Circular object with array printing"))) (let* ((print-circle t) (x (list 'p 'q)) @@ -655,16 +655,16 @@ See `custom-format' for the details." (setcdr (cdr (cdr (cdr y))) (cdr y)) (or (equal (prin1-to-string y) "((a b) . #1=(#2=(p q) foo #2# . #1#))" ) - (error "circular list example from CL manual"))) + (error "Circular list example from CL manual"))) (let ((print-circle nil)) ;; cl-packages.el is required to print uninterned symbols like #:FOO. ;; (require 'cl-packages) (or (equal (prin1-to-string circ-sym) "(#:FOO #:FOO)") - (error "uninterned symbols in list"))) + (error "Uninterned symbols in list"))) (let ((print-circle t)) (or (equal (prin1-to-string circ-sym) "(#1=FOO #1#)") - (error "circular uninterned symbols in list"))) + (error "Circular uninterned symbols in list"))) (uninstall-custom-print) ) diff --git a/lisp/obsolete/landmark.el b/lisp/obsolete/landmark.el index 83e7649a69..16c41c76ad 100644 --- a/lisp/obsolete/landmark.el +++ b/lisp/obsolete/landmark.el @@ -757,9 +757,9 @@ If the game is finished, this command requests for another game." (let ((square (landmark-point-square)) score) (cond ((null square) - (error "Your point is not on a square. Retry!")) + (error "Your point is not on a square. Retry!")) ((not (zerop (aref landmark-board square))) - (error "Your point is not on a free square. Retry!")) + (error "Your point is not on a free square. Retry!")) (t (setq score (aref landmark-score-table square)) (landmark-play-move square 1) @@ -823,14 +823,14 @@ If the game is finished, this command requests for another game." (defun landmark-prompt-for-other-game () "Ask for another game, and start it." (if (y-or-n-p "Another game? ") - (if (y-or-n-p "Retain learned weights ") + (if (y-or-n-p "Retain learned weights?") (landmark 2) (landmark 1)) (message "Chicken!"))) (defun landmark-offer-a-draw () "Offer a draw and return t if Human accepted it." - (or (y-or-n-p "I offer you a draw. Do you accept it? ") + (or (y-or-n-p "I offer you a draw. Do you accept it?") (not (setq landmark-human-refused-draw t)))) @@ -1512,9 +1512,9 @@ If the game is finished, this command requests for another game." (t (let ((square (landmark-point-square))) (cond ((null square) - (error "Your point is not on a square. Retry!")) + (error "Your point is not on a square. Retry!")) ((not (zerop (aref landmark-board square))) - (error "Your point is not on a free square. Retry!")) + (error "Your point is not on a free square. Retry!")) (t (progn (landmark-plot-square square 1) diff --git a/lisp/obsolete/tls.el b/lisp/obsolete/tls.el index 5cba18d789..ff01008613 100644 --- a/lisp/obsolete/tls.el +++ b/lisp/obsolete/tls.el @@ -260,14 +260,14 @@ Fourth arg PORT is an integer specifying a port to connect to." NOT trusted." host)) (not (yes-or-no-p (format-message "\ -The certificate presented by `%s' is NOT trusted. Accept anyway? " host))))) +The certificate presented by `%s' is NOT trusted. Accept anyway?" host))))) (and tls-hostmismatch (save-excursion (goto-char (point-min)) (re-search-forward tls-hostmismatch nil t)) (not (yes-or-no-p (format "Host name in certificate doesn't \ -match `%s'. Connect anyway? " host)))))) +match `%s'. Connect anyway?" host)))))) (setq done nil) (delete-process process)) ;; Delete all the informational messages that could confuse diff --git a/lisp/obsolete/vip.el b/lisp/obsolete/vip.el index 16906b68a6..2fa8c95153 100644 --- a/lisp/obsolete/vip.el +++ b/lisp/obsolete/vip.el @@ -615,11 +615,11 @@ obtained so far, and COM is the command part obtained so far." (cond ((null arg) nil) ((consp arg) (car arg)) ((numberp arg) arg) - (t (error "strange arg"))) + (t (error "Strange arg"))) (cond ((null arg) nil) ((consp arg) (cdr arg)) ((numberp arg) nil) - (t (error "strange arg")))) + (t (error "Strange arg")))) (quit (setq vip-use-register nil) (signal 'quit nil)))) @@ -2248,7 +2248,7 @@ a token has type \(command, address, end-mark) and value." (setq ex-token-type "end-mark") (setq ex-token "goto")) (t - (error "invalid token"))))) + (error "Invalid token"))))) (defun vip-ex (&optional string) "ex commands within VIP." @@ -2333,7 +2333,7 @@ a token has type \(command, address, end-mark) and value." (cond ((looking-at "[a-z]") (vip-get-ex-com-subr) (if (string= ex-token-type "non-command") - (error "%s: not an editor command" ex-token))) + (error "%s: Not an editor command" ex-token))) ((looking-at "[!=><&~]") (setq ex-token (char-to-string (following-char))) (forward-char 1)) @@ -2378,7 +2378,7 @@ a token has type \(command, address, end-mark) and value." (progn (setq ex-flag t) (setq cont nil)) - (error "address expected"))) + (error "Address expected"))) ((string= ex-token-type "end-mark") (setq cont nil)) ((string= ex-token-type "whole") @@ -2568,7 +2568,7 @@ a token has type \(command, address, end-mark) and value." (string= ex-token "insert") (string= ex-token "open") ) - (error "%s: no such command from VIP" ex-token)) + (error "%s: No such command from VIP" ex-token)) ((or (string= ex-token "abbreviate") (string= ex-token "list") (string= ex-token "next") @@ -2581,7 +2581,7 @@ a token has type \(command, address, end-mark) and value." (string= ex-token "xit") (string= ex-token "z") ) - (error "%s: not implemented in VIP" ex-token)) + (error "%s: Not implemented in VIP" ex-token)) (t (error "%s: Not an editor command" ex-token)))) (defun ex-goto () diff --git a/lisp/printing.el b/lisp/printing.el index fb718f9aa6..dfa5a6ef76 100644 --- a/lisp/printing.el +++ b/lisp/printing.el @@ -5133,7 +5133,7 @@ If menu binding was not done, calls `pr-menu-bind'." (and (eq (symbol-value infile-sym) t) (set infile-sym (pr-ps-infile-preprint prompt))) (or (symbol-value infile-sym) - (error "%s: input PostScript file name is missing" prompt)) + (error "%s: Input PostScript file name is missing" prompt)) ;; output file (and (eq (symbol-value outfile-sym) t) (set outfile-sym (and current-prefix-arg diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index d40433a9b0..a9a52636b7 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -64,7 +64,6 @@ point is used to decide where the old indentation is on a lines that is otherwise empty (ignoring any line continuation backslash), but that's not done if IGNORE-POINT-POS is non-nil. Returns the amount of indentation change \(in columns)." - (let ((line-cont-backslash (save-excursion (end-of-line) (eq (char-before) ?\\))) @@ -2058,9 +2057,9 @@ the open-parenthesis that starts a defun; see `beginning-of-defun'." (= arg 0)))) (defun c-defun-name-1 () - "Return the name of the current defun, at the current narrowing, -or nil if there isn't one. \"Defun\" here means a function, or -other top level construct with a brace block." + "Return name of current defun, at current narrowing, or nil if there isn't one. +\"Defun\" here means a function, or other top level construct +with a brace block." (c-save-buffer-state (beginning-of-defun-function end-of-defun-function where pos decl0 decl type-pos tag-pos case-fold-search) @@ -3655,9 +3654,9 @@ continuation backslashes, unless `c-auto-align-backslashes' is nil." (set-marker here nil)))) (defun c-indent-region (start end &optional quiet) - "Indent syntactically every line whose first char is between START -and END inclusive. If the optional argument QUIET is non-nil then no -syntactic errors are reported, even if `c-report-syntactic-errors' is + "Indent syntactically lines whose first char is between START and END inclusive. +If the optional argument QUIET is non-nil then no syntactic +errors are reported, even if `c-report-syntactic-errors' is non-nil." (save-excursion (goto-char end) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 8b30241449..c9b7a95df6 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1402,7 +1402,7 @@ Note that the style variables are always made local to the buffer." (memq (char-after) c-string-delims)) (c-clear-syn-tab (point))))) (c-clear-syn-tab (point))) - (t (c-benign-error "c-remove-string-fences: wrong position"))))) + (t (c-benign-error "c-remove-string-fences: Wrong position"))))) (defun c-before-change-check-unbalanced-strings (beg end) ;; If BEG or END is inside an unbalanced string, remove the syntax-table diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 8869c56573..d843c783ed 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1770,7 +1770,7 @@ variables.") ; all XEmacsen. ((null c-macro-names-with-semicolon) nil) - (t (error "c-make-macro-with-semi-re: invalid \ + (t (error "c-make-macro-with-semi-re: Invalid \ c-macro-names-with-semicolon: %s" c-macro-names-with-semicolon)))))) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index c371a84b9d..1afeb60ac5 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -507,9 +507,9 @@ Currently used with `cperl-check-syntax' only." :group 'cperl-help-system) (defcustom cperl-indent-region-fix-constructs 1 - "Amount of space to insert between `}' and `else' or `elsif' -in `cperl-indent-region'. Set to nil to leave as is. Values other -than 1 and nil will probably not work." + "Amount of space to insert between `}' and `else' or `elsif'. +Used by `cperl-indent-region'. Set to nil to leave as is. +Values other than 1 and nil will probably not work." :type '(choice (const nil) (const 1)) :group 'cperl-indentation-details) diff --git a/lisp/progmodes/ebnf-dtd.el b/lisp/progmodes/ebnf-dtd.el index 9185711848..d4bfdaa995 100644 --- a/lisp/progmodes/ebnf-dtd.el +++ b/lisp/progmodes/ebnf-dtd.el @@ -62,7 +62,7 @@ ;; ;; Document authors are encouraged to avoid "compatibility characters", as ;; defined in section 6.8 of [Unicode] (see also D21 in section 3.6 of -;; [Unicode3]). The characters defined in the following ranges are also +;; [Unicode3]). The characters defined in the following ranges are also ;; discouraged. They are either control characters or permanently undefined ;; Unicode characters: ;; diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el index fc3d603f06..5a31ad3508 100644 --- a/lisp/progmodes/idlw-shell.el +++ b/lisp/progmodes/idlw-shell.el @@ -105,8 +105,9 @@ process buffer." :type 'regexp) (defcustom idlwave-shell-process-name "idl" - "Name to be associated with the IDL process. The buffer for the -process output is made by surrounding this name with `*'s." + "Name to be associated with the IDL process. +The buffer for the process output is made by surrounding this +name with `*'s." :group 'idlwave-shell-general-setup :type 'string) diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index 4224e47d16..9aaabd8a0e 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -245,7 +245,7 @@ would yield: :type 'boolean) (defcustom idlwave-indent-parens-nested nil - "Non-nil means, indent continuation lines with parens by nesting + "Non-nil means indent continuation lines with parens by nesting lines at consecutively deeper levels." :group 'idlwave-code-formatting :type 'boolean) @@ -7286,8 +7286,7 @@ The list is cached in `idlwave-class-info' for faster access." inherits)) (if (> (cdr cl) 999) (error - "Class scan: inheritance depth exceeded. Circular inheritance?") - )) + "Class scan: inheritance depth exceeded. Circular inheritance?"))) (setq all-inherits (nreverse rtn)) (nconc info (list (cons 'all-inherits all-inherits))) all-inherits)))))) diff --git a/lisp/progmodes/opascal.el b/lisp/progmodes/opascal.el index e55b09d8fc..495c77bbd9 100644 --- a/lisp/progmodes/opascal.el +++ b/lisp/progmodes/opascal.el @@ -1540,7 +1540,7 @@ If no extension is specified, .pas is assumed. Creates a buffer for the unit." (defun opascal-find-current-def () "Find the definition of the identifier under the current point." (interactive) - (error "opascal-find-current-def: not implemented yet")) + (error "opascal-find-current-def: Not implemented yet")) (defun opascal-find-current-xdef () "Find the definition of the identifier under the current point, searching @@ -1548,13 +1548,13 @@ in external units if necessary (as listed in the current unit's use clause). The set of directories to search for a unit is specified by the global variable `opascal-search-path'." (interactive) - (error "opascal-find-current-xdef: not implemented yet")) + (error "opascal-find-current-xdef: Not implemented yet")) (defun opascal-find-current-body () "Find the body of the identifier under the current point, assuming it is a routine." (interactive) - (error "opascal-find-current-body: not implemented yet")) + (error "opascal-find-current-body: Not implemented yet")) (defun opascal-fill-comment () "Fill the text of the current comment, according to `fill-column'. diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 74a023775f..59004e413e 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -512,7 +512,7 @@ to automatically indent if-then-else constructs." :type 'boolean) (defcustom prolog-electric-colon-flag nil - "Makes `:' electric (inserts `:-' on a new line). + "Non-nil means make `:' electric (inserts `:-' on a new line). If non-nil, pressing `:' at the end of a line that starts in the first column (i.e., clause heads) inserts ` :-' and newline." :version "24.1" @@ -520,7 +520,7 @@ the first column (i.e., clause heads) inserts ` :-' and newline." :type 'boolean) (defcustom prolog-electric-dash-flag nil - "Makes `-' electric (inserts a `-->' on a new line). + "Non-nil means make `-' electric (inserts a `-->' on a new line). If non-nil, pressing `-' at the end of a line that starts in the first column (i.e., DCG heads) inserts ` -->' and newline." :version "24.1" diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 3b6774aa14..0dd9f2b4fa 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -2522,7 +2522,7 @@ overwritten if sh-styles-alist nil t))) (let ((sl (assoc name sh-styles-alist))) (if (null sl) - (error "sh-load-style - style %s not known" name) + (error "sh-load-style: Style %s not known" name) (dolist (var (cdr sl)) (set (car var) (cdr var)))))) diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 02eccb3301..5dfbf87e45 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -3976,13 +3976,13 @@ for each match." (cond ((numberp c) (match-string c)) ((stringp c) (match-substitute-replacement c)) - (t (error "sql-redirect-value: unknown REGEXP-GROUPS value - %s" c)))) + (t (error "sql-redirect-value: Unknown REGEXP-GROUPS value - %s" c)))) regexp-groups)) ;; String is specified; return replacement string ((stringp regexp-groups) (match-substitute-replacement regexp-groups)) (t - (error "sql-redirect-value: unknown REGEXP-GROUPS value - %s" + (error "sql-redirect-value: Unknown REGEXP-GROUPS value - %s" regexp-groups))) results))) diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index d98230d9a0..52c34d9fbc 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -87,7 +87,7 @@ ;; ;; If you want to customize Verilog mode to fit your needs better, ;; you may add the below lines (the values of the variables presented -;; here are the defaults). Note also that if you use an Emacs that +;; here are the defaults). Note also that if you use an Emacs that ;; supports custom, it's probably better to use the custom menu to ;; edit these. If working as a member of a large team these settings ;; should be common across all users (in a site-start file), or set @@ -4827,7 +4827,7 @@ Limit search to point LIM." ((match-end 1) ; [ (setq colon (1+ colon)) (if (>= colon 0) - (error "%s: unbalanced [" (verilog-point-text)))) + (error "%s: Unbalanced [" (verilog-point-text)))) ((match-end 2) ; ] (setq colon (1- colon))) diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index fc0d406f73..3a9185b334 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -5917,16 +5917,16 @@ Skip backwards if DIRECTION is negative, skip forward otherwise." ;; Functions to help finding the correct indentation column: (defun vhdl-first-word (point) - "If the keyword at POINT is at boi, then return (current-column) at -that point, else nil." + "If the keyword at POINT is at boi, return (current-column) at that point. +Otherwise return nil." (save-excursion (and (goto-char point) (eq (point) (vhdl-point 'boi)) (current-column)))) (defun vhdl-last-word (point) - "If the keyword at POINT is at eoi, then return (current-column) at -that point, else nil." + "If keyword at POINT is at eoi, then return (current-column) at that point. +Otherwise, return nil." (save-excursion (and (goto-char point) (save-excursion (or (eq (progn (forward-sexp) (point)) @@ -6266,13 +6266,11 @@ of an identifier that just happens to contain an \"end\" keyword." (defconst vhdl-statement-fwd-re "\\b\\(if\\|for\\|while\\|loop\\)\\b\\([^_]\\|\\'\\)" - "A regular expression for searching forward that matches all known -\"statement\" keywords.") + "Regexp for searching forward that matches all known \"statement\" keywords.") (defconst vhdl-statement-bwd-re "\\b\\(if\\|for\\|while\\|loop\\)\\b[^_]" - "A regular expression for searching backward that matches all known -\"statement\" keywords.") + "Regexp for searching backward that matches all known \"statement\" keywords.") (defun vhdl-statement-p (&optional _lim) "Return t if we are looking at a real \"statement\" keyword. @@ -6723,8 +6721,9 @@ search, and an argument indicating an interactive call." vhdl-begin-bwd-re "\\|" vhdl-statement-bwd-re)) (defun vhdl-beginning-of-statement-1 (&optional lim) - "Move to the start of the current statement, or the previous -statement if already at the beginning of one." + "Move to the start of the current statement. +If already at the beginning of a statement, move to the start of +the previous statement instead." (let ((lim (or lim (point-min))) (here (point)) (pos (point)) diff --git a/lisp/progmodes/xscheme.el b/lisp/progmodes/xscheme.el index 1874f2698a..26ffe33b83 100644 --- a/lisp/progmodes/xscheme.el +++ b/lisp/progmodes/xscheme.el @@ -562,7 +562,7 @@ The strings are concatenated and terminated by a newline." (defun xscheme-yank (&optional arg) "Insert the most recent expression at point. -With just C-U as argument, same but put point in front (and mark at end). +With just \\[universal-argument] as argument, same but put point in front (and mark at end). With argument n, reinsert the nth most recently sent expression. See also the commands \\[xscheme-yank-pop] and \\[xscheme-yank-push]." (interactive "*P") diff --git a/lisp/ps-print.el b/lisp/ps-print.el index 1f4ed4e44d..b1d03fda1d 100644 --- a/lisp/ps-print.el +++ b/lisp/ps-print.el @@ -3878,7 +3878,7 @@ Note: No major/minor-mode is activated and no local variables are evaluated for (with-temp-buffer (insert-file-contents filename) (buffer-string)) - (error "ps-print PostScript prologue `%s' file was not found" + (error "ps-print: PostScript prologue `%s' file was not found" filename)))) diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el index cc8b3244b9..b90c21339c 100644 --- a/lisp/textmodes/reftex-global.el +++ b/lisp/textmodes/reftex-global.el @@ -348,7 +348,7 @@ Also checks if buffers visiting the files are in read-only mode." (with-current-buffer buf buffer-read-only)) (ding) - (or (y-or-n-p (format "Buffer %s is read-only. Continue?" + (or (y-or-n-p (format "Buffer %s is read-only. Continue?" (buffer-name buf))) (error "Abort")))))) diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el index a5d83c34d6..15d86b359c 100644 --- a/lisp/textmodes/reftex-ref.el +++ b/lisp/textmodes/reftex-ref.el @@ -230,7 +230,7 @@ This function is controlled by the settings of reftex-insert-label-flags." (symbol-value reftex-docstruct-symbol))) (ding) (if (y-or-n-p - (format-message "Label `%s' exists. Use anyway? " label)) + (format-message "Label `%s' exists. Use anyway?" label)) (setq valid t))) ;; Label is ok diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el index 843bbb2bca..6862da6046 100644 --- a/lisp/textmodes/texnfo-upd.el +++ b/lisp/textmodes/texnfo-upd.el @@ -1508,7 +1508,7 @@ will be at some level higher in the Texinfo file. The fourth argument 'normal 'no-pointer)) (t - (error "texinfo-find-pointer: lack proper arguments"))))) + (error "texinfo-find-pointer: Lack proper arguments"))))) (defun texinfo-pointer-name (kind) "Return the node name preceding the section command. @@ -1676,7 +1676,7 @@ or `Up' pointer." 'normal 'no-pointer)) (t - (error "texinfo-sequential-find-pointer: lack proper arguments"))))) + (error "texinfo-sequential-find-pointer: Lack proper arguments"))))) ;;; Inserting `@node' lines diff --git a/lisp/vc/ediff-mult.el b/lisp/vc/ediff-mult.el index fa26b0b32f..bec0ec0120 100644 --- a/lisp/vc/ediff-mult.el +++ b/lisp/vc/ediff-mult.el @@ -1677,7 +1677,7 @@ With prefix arg UNHIDE, unhide instead." (setq custom-diff-buf ediff-custom-diff-buffer))))) (or (ediff-buffer-live-p meta-diff-buff) - (user-error "Ediff: something wrong--killed multiple diff's buffer")) + (user-error "Ediff: Something wrong--killed multiple diff's buffer")) (cond ((ediff-buffer-live-p custom-diff-buf) ;; for live session buffers we do them first because the user may diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index 9016d1df5c..7c36291eea 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -3220,7 +3220,7 @@ Hit \\[ediff-recenter] to reset the windows afterward." (if (buffer-modified-p) ;; If buffer is not obsolete and is modified, offer to save (if (yes-or-no-p - (format "Buffer %s has been modified. Save it in file %s? " + (format "Buffer %s has been modified. Save it in file %s?" (buffer-name) buffer-file-name)) (condition-case nil diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index e0a87ba941..4d151d555c 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -891,7 +891,7 @@ name or time." Actually, the narrowed region doesn't include the date line. A \"page\" in a ChangeLog file is the area between two dates." (or (eq major-mode 'change-log-mode) - (error "log-edit-narrow-changelog: current buffer isn't a ChangeLog")) + (error "log-edit-narrow-changelog: Current buffer isn't a ChangeLog")) (goto-char (point-min)) commit e2861e2d08afd5dba9f676aa1e1d151a4d7dbc8f Author: Stefan Kangas Date: Tue Oct 5 02:01:27 2021 +0200 ; * etc/NEWS: Fix typo. diff --git a/etc/NEWS b/etc/NEWS index 340db82e75..0d44092f8d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3048,7 +3048,7 @@ See 'rcirc-reconnect-attempts'. --- *** New command 'mpc-goto-playing-song'. This command, bound to 'o' in any 'mpc-mode' buffer, moves point to -the currently playing song in the "*Songs*" buffer. +the currently playing song in the "*MPC-Songs*" buffer. --- *** New user option 'mpc-cover-image-re'. commit 1a65d49931ebc37adc48cd2406220b586e62f778 Author: Paul Eggert Date: Mon Oct 4 12:11:39 2021 -0700 Port recent Gnulib changes to MS-Windows * nt/gnulib-cfg.mk (OMIT_GNULIB_MODULE_free-posix) (OMIT_GNULIB_MODULE_malloc-posix) (OMIT_GNULIB_MODULE_realloc-gnu) (OMIT_GNULIB_MODULE_realloc-posix): New macros, since we don’t want these modules on MS-Windows. * src/w32heap.c (heap_alloc, heap_realloc): New functions. (malloc_after_dump, realloc_after_dump, realloc_before_dump): Use them. diff --git a/nt/gnulib-cfg.mk b/nt/gnulib-cfg.mk index c85b9150f0..f1f4c4c279 100644 --- a/nt/gnulib-cfg.mk +++ b/nt/gnulib-cfg.mk @@ -49,10 +49,14 @@ OMIT_GNULIB_MODULE_dirent = true OMIT_GNULIB_MODULE_dirfd = true OMIT_GNULIB_MODULE_fcntl = true OMIT_GNULIB_MODULE_fcntl-h = true +OMIT_GNULIB_MODULE_free-posix = true OMIT_GNULIB_MODULE_fsusage = true OMIT_GNULIB_MODULE_inttypes-incomplete = true +OMIT_GNULIB_MODULE_malloc-posix = true OMIT_GNULIB_MODULE_open = true OMIT_GNULIB_MODULE_pipe2 = true +OMIT_GNULIB_MODULE_realloc-gnu = true +OMIT_GNULIB_MODULE_realloc-posix = true OMIT_GNULIB_MODULE_secure_getenv = true OMIT_GNULIB_MODULE_signal-h = true OMIT_GNULIB_MODULE_stdio = true diff --git a/src/w32heap.c b/src/w32heap.c index 0f228bfb22..a0d4c070be 100644 --- a/src/w32heap.c +++ b/src/w32heap.c @@ -189,6 +189,26 @@ malloc_fn the_malloc_fn; realloc_fn the_realloc_fn; free_fn the_free_fn; +static void * +heap_alloc (size_t size) +{ + void *p = size <= PTRDIFF_MAX ? HeapAlloc (heap, 0, size | !size) : NULL; + if (!p) + errno = ENOMEM; + return p; +} + +static void * +heap_realloc (void *ptr, size_t size) +{ + void *p = (size <= PTRDIFF_MAX + ? HeapReAlloc (heap, 0, ptr, size | !size) + : NULL); + if (!p) + errno = ENOMEM; + return p; +} + /* It doesn't seem to be useful to allocate from a file mapping. It would be if the memory was shared. https://stackoverflow.com/questions/307060/what-is-the-purpose-of-allocating-pages-in-the-pagefile-with-createfilemapping */ @@ -346,7 +366,7 @@ void * malloc_after_dump (size_t size) { /* Use the new private heap. */ - void *p = HeapAlloc (heap, 0, size); + void *p = heap_alloc (size); /* After dump, keep track of the "brk value" for sbrk(0). */ if (p) @@ -356,8 +376,6 @@ malloc_after_dump (size_t size) if (new_brk > data_region_end) data_region_end = new_brk; } - else - errno = ENOMEM; return p; } @@ -373,9 +391,7 @@ malloc_before_dump (size_t size) if (size < MaxBlockSize) { /* Use the private heap if possible. */ - p = HeapAlloc (heap, 0, size); - if (!p) - errno = ENOMEM; + p = heap_alloc (size); } else { @@ -433,18 +449,14 @@ realloc_after_dump (void *ptr, size_t size) if (FREEABLE_P (ptr)) { /* Reallocate the block since it lies in the new heap. */ - p = HeapReAlloc (heap, 0, ptr, size); - if (!p) - errno = ENOMEM; + p = heap_realloc (ptr, size); } else { /* If the block lies in the dumped data, do not free it. Only allocate a new one. */ - p = HeapAlloc (heap, 0, size); - if (!p) - errno = ENOMEM; - else if (ptr) + p = heap_alloc (size); + if (p && ptr) CopyMemory (p, ptr, size); } /* After dump, keep track of the "brk value" for sbrk(0). */ @@ -467,9 +479,7 @@ realloc_before_dump (void *ptr, size_t size) if (dumped_data < (unsigned char *)ptr && (unsigned char *)ptr < bc_limit && size <= MaxBlockSize) { - p = HeapReAlloc (heap, 0, ptr, size); - if (!p) - errno = ENOMEM; + p = heap_realloc (ptr, size); } else { commit 68a256c89270ef9e97bca6097967a9ed2b050f4a Author: Paul Eggert Date: Mon Oct 4 12:11:39 2021 -0700 Update from Gnulib Make the following changes by hand, and run 'admin/merge-gnulib'. * .gitignore: Add lib/malloc/*.gl.h. * admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h directly from Gnulib, without worrying about Gnulib modules, as these files are special cases. (AVOIDED_MODULES): Remove malloc-posix. * lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4: * m4/year2038.m4: New files, copied from Gnulib. * lib/malloca.c, lib/malloca.h: * m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4: Remove. These are either no longer present in Gnulib, or are no longer needed by modules that Emacs uses. * oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first; needed for new Gnulib. * src/xmenu.c: Call emacs_abort, not abort. diff --git a/.gitignore b/.gitignore index e49e970d09..c7a6ec56d0 100644 --- a/.gitignore +++ b/.gitignore @@ -65,6 +65,7 @@ lib/ieee754.h lib/inttypes.h lib/libgnu.a lib/limits.h +lib/malloc/*.gl.h lib/signal.h lib/std*.h !lib/std*.in.h diff --git a/INSTALL b/INSTALL index b6f681a153..8c036f2e60 100644 --- a/INSTALL +++ b/INSTALL @@ -322,8 +322,11 @@ Use --without-toolkit-scroll-bars to disable Motif or Xaw3d scroll bars. Use --without-xim to inhibit the default use of X Input Methods. In this case, the X resource useXIM can be used to turn on use of XIM. -Use --disable-largefile to omit support for files larger than 2GB on -systems which support that. +Use --disable-largefile to omit support for files larger than 2GB, and +--disable-year2038 to omit support for timestamps past the year 2038, +on systems which allow omitting such support. This may help when +linking Emacs to a library with an ABI that requires a particular +width for off_t or for time_t. Use --without-sound to disable sound support. diff --git a/admin/merge-gnulib b/admin/merge-gnulib index c12e83dd2f..10cc73aa73 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib @@ -50,7 +50,7 @@ GNULIB_MODULES=' AVOIDED_MODULES=' btowc close dup fchdir fstat langinfo lock - malloc-posix mbrtowc mbsinit memchr mkdir msvc-inval msvc-nothrow nl_langinfo + mbrtowc mbsinit memchr mkdir msvc-inval msvc-nothrow nl_langinfo openat-die opendir pthread-h raise save-cwd select setenv sigprocmask stat stdarg stdbool threadlib tzset unsetenv utime utime-h @@ -118,5 +118,8 @@ cp -- "$gnulib_srcdir"/build-aux/config.guess \ "$gnulib_srcdir"/build-aux/install-sh \ "$gnulib_srcdir"/build-aux/move-if-change \ "$src"build-aux && +cp -- "$gnulib_srcdir"/lib/af_alg.h \ + "$gnulib_srcdir"/lib/save-cwd.h \ + "$src"lib && { test -z "$src" || cd "$src"; } && ./autogen.sh diff --git a/build-aux/config.guess b/build-aux/config.guess index f7727026b7..e81d3ae7c2 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -2,7 +2,9 @@ # Attempt to guess a canonical system name. # Copyright 1992-2021 Free Software Foundation, Inc. -timestamp='2021-01-01' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2021-06-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -32,7 +34,15 @@ timestamp='2021-01-01' # Please send patches to . -me=$(echo "$0" | sed -e 's,.*/,,') +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + +me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] @@ -84,6 +94,9 @@ if test $# != 0; then exit 1 fi +# Just in case it came from the environment. +GUESS= + # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a @@ -102,8 +115,8 @@ set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" - # shellcheck disable=SC2039 - { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } || + # shellcheck disable=SC2039,SC3028 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } @@ -112,7 +125,7 @@ set_cc_for_build() { ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then - CC_FOR_BUILD="$driver" + CC_FOR_BUILD=$driver break fi done @@ -131,12 +144,12 @@ if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi -UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown -UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown -UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown -UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "$UNAME_SYSTEM" in +case $UNAME_SYSTEM in Linux|GNU|GNU/*) LIBC=unknown @@ -157,7 +170,8 @@ Linux|GNU|GNU/*) #endif #endif EOF - eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')" + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" # Second heuristic to detect musl libc. if [ "$LIBC" = unknown ] && @@ -176,7 +190,7 @@ esac # Note: order is significant - the case branches are not exclusive. -case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -188,12 +202,11 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \ - "/sbin/$sysctl" 2>/dev/null || \ - "/usr/sbin/$sysctl" 2>/dev/null || \ - echo unknown)) - case "$UNAME_MACHINE_ARCH" in + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + echo unknown)` + case $UNAME_MACHINE_ARCH in aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; @@ -201,15 +214,15 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) - arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,') - endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p') - machine="${arch}${endian}"-unknown + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown ;; - *) machine="$UNAME_MACHINE_ARCH"-unknown ;; + *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in earm*) os=netbsdelf ;; @@ -230,10 +243,10 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in ;; esac # Determine ABI tags. - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr") + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release @@ -241,76 +254,82 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. - case "$UNAME_VERSION" in + case $UNAME_VERSION in Debian*) release='-gnu' ;; *) - release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2) + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "$machine-${os}${release}${abi-}" - exit ;; + GUESS=$machine-${os}${release}${abi-} + ;; *:Bitrig:*:*) - UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//') - echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" - exit ;; + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//') - echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" - exit ;; + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; *:LibertyBSD:*:*) - UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//') - echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" - exit ;; + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; *:MidnightBSD:*:*) - echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; *:ekkoBSD:*:*) - echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; *:SolidBSD:*:*) - echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; *:OS108:*:*) - echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; *:MirBSD:*:*) - echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; *:Sortix:*:*) - echo "$UNAME_MACHINE"-unknown-sortix - exit ;; + GUESS=$UNAME_MACHINE-unknown-sortix + ;; *:Twizzler:*:*) - echo "$UNAME_MACHINE"-unknown-twizzler - exit ;; + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; *:Redox:*:*) - echo "$UNAME_MACHINE"-unknown-redox - exit ;; + GUESS=$UNAME_MACHINE-unknown-redox + ;; mips:OSF1:*.*) - echo mips-dec-osf1 - exit ;; + GUESS=mips-dec-osf1 + ;; alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 case $UNAME_RELEASE in *4.0) - UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}') + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) - UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}') + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1) - case "$ALPHA_CPU_TYPE" in + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case $ALPHA_CPU_TYPE in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") @@ -347,68 +366,69 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)" - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; + GUESS=m68k-unknown-sysv4 + ;; *:[Aa]miga[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-amigaos - exit ;; + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; *:[Mm]orph[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-morphos - exit ;; + GUESS=$UNAME_MACHINE-unknown-morphos + ;; *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; + GUESS=i370-ibm-openedition + ;; *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; + GUESS=s390-ibm-zvmoe + ;; *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; + GUESS=powerpc-ibm-os400 + ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix"$UNAME_RELEASE" - exit ;; + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; + GUESS=arm-unknown-riscos + ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; + GUESS=hppa1.1-hitachi-hiuxmpp + ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "$( (/bin/universe) 2>/dev/null)" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; + GUESS=pyramid-pyramid-svr4 + ;; DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; + GUESS=sparc-icl-nx6 + ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case $(/usr/bin/uname -p) in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; + case `/usr/bin/uname -p` in + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; s390x:SunOS:*:*) - echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux"$UNAME_RELEASE" - exit ;; + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 @@ -423,41 +443,44 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in SUN_ARCH=x86_64 fi fi - echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; sun4*:SunOS:*:*) - case "$(/usr/bin/arch -k)" in + case `/usr/bin/arch -k` in Series*|S4*) - UNAME_RELEASE=$(uname -v) + UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; sun3*:SunOS:*:*) - echo m68k-sun-sunos"$UNAME_RELEASE" - exit ;; + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; sun*:*:4.2BSD:*) - UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 - case "$(/bin/arch)" in + case `/bin/arch` in sun3) - echo m68k-sun-sunos"$UNAME_RELEASE" + GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) - echo sparc-sun-sunos"$UNAME_RELEASE" + GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac - exit ;; + ;; aushp:SunOS:*:*) - echo sparc-auspex-sunos"$UNAME_RELEASE" - exit ;; + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -467,41 +490,41 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; m68k:machten:*:*) - echo m68k-apple-machten"$UNAME_RELEASE" - exit ;; + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; powerpc:machten:*:*) - echo powerpc-apple-machten"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; + GUESS=mips-dec-mach_bsd4.3 + ;; RISC*:ULTRIX:*:*) - echo mips-dec-ultrix"$UNAME_RELEASE" - exit ;; + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix"$UNAME_RELEASE" - exit ;; + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix"$UNAME_RELEASE" - exit ;; + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" @@ -526,78 +549,79 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && - dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') && - SYSTEM_NAME=$("$dummy" "$dummyarg") && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos"$UNAME_RELEASE" - exit ;; + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; + GUESS=powerpc-motorola-powermax + ;; Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; + GUESS=powerpc-harris-powerunix + ;; m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; + GUESS=m88k-harris-cxux7 + ;; m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; + GUESS=m88k-motorola-sysv4 + ;; m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=$(/usr/bin/uname -p) + UNAME_PROCESSOR=`/usr/bin/uname -p` if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ test "$TARGET_BINARY_INTERFACE"x = x then - echo m88k-dg-dgux"$UNAME_RELEASE" + GUESS=m88k-dg-dgux$UNAME_RELEASE else - echo m88k-dg-dguxbcs"$UNAME_RELEASE" + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else - echo i586-dg-dgux"$UNAME_RELEASE" + GUESS=i586-dg-dgux$UNAME_RELEASE fi - exit ;; + ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; + GUESS=m88k-dolphin-sysv3 + ;; M88*:*:R3*:*) # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; + GUESS=m88k-tektronix-sysv3 + ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; + GUESS=m68k-tektronix-bsd + ;; *:IRIX*:*:*) - echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')" - exit ;; + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'$(uname -s)'" gives 'AIX ' + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; + GUESS=i386-ibm-aix + ;; ia64:AIX:*:*) if test -x /usr/bin/oslevel ; then - IBM_REV=$(/usr/bin/oslevel) + IBM_REV=`/usr/bin/oslevel` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" - exit ;; + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build @@ -612,68 +636,68 @@ EOF exit(0); } EOF - if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then - echo "$SYSTEM_NAME" + GUESS=$SYSTEM_NAME else - echo rs6000-ibm-aix3.2.5 + GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 + GUESS=rs6000-ibm-aix3.2.4 else - echo rs6000-ibm-aix3.2 + GUESS=rs6000-ibm-aix3.2 fi - exit ;; + ;; *:AIX:*:[4567]) - IBM_CPU_ID=$(/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }') + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if test -x /usr/bin/lslpp ; then - IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc | - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/) + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo "$IBM_ARCH"-ibm-aix"$IBM_REV" - exit ;; + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; + GUESS=rs6000-ibm-aix + ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) - echo romp-ibm-bsd4.4 - exit ;; + GUESS=romp-ibm-bsd4.4 + ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; + GUESS=rs6000-bull-bosx + ;; DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; + GUESS=m68k-bull-sysv3 + ;; 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; + GUESS=m68k-hp-bsd + ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; + GUESS=m68k-hp-bsd4.4 + ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') - case "$UNAME_MACHINE" in + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + case $UNAME_MACHINE in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if test -x /usr/bin/getconf; then - sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 2>/dev/null) - sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null) - case "$sc_cpu_version" in + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case $sc_cpu_version in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 - case "$sc_kernel_bits" in + case $sc_kernel_bits in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 @@ -715,7 +739,7 @@ EOF exit (0); } EOF - (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=$("$dummy") + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac @@ -740,12 +764,12 @@ EOF HP_ARCH=hppa64 fi fi - echo "$HP_ARCH"-hp-hpux"$HPUX_REV" - exit ;; + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; ia64:HP-UX:*:*) - HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') - echo ia64-hp-hpux"$HPUX_REV" - exit ;; + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" @@ -773,38 +797,38 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") && + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; + GUESS=unknown-hitachi-hiuxwe2 + ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) - echo hppa1.1-hp-bsd - exit ;; + GUESS=hppa1.1-hp-bsd + ;; 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; + GUESS=hppa1.0-hp-bsd + ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; + GUESS=hppa1.0-hp-mpeix + ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) - echo hppa1.1-hp-osf - exit ;; + GUESS=hppa1.1-hp-osf + ;; hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; + GUESS=hppa1.0-hp-osf + ;; i*86:OSF1:*:*) if test -x /usr/sbin/sysversion ; then - echo "$UNAME_MACHINE"-unknown-osf1mk + GUESS=$UNAME_MACHINE-unknown-osf1mk else - echo "$UNAME_MACHINE"-unknown-osf1 + GUESS=$UNAME_MACHINE-unknown-osf1 fi - exit ;; + ;; parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; + GUESS=hppa1.1-hp-lites + ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; + GUESS=c1-convex-bsd + ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd @@ -812,17 +836,18 @@ EOF fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; + GUESS=c34-convex-bsd + ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; + GUESS=c38-convex-bsd + ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; + GUESS=c4-convex-bsd + ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ @@ -830,114 +855,126 @@ EOF -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) - echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; CRAY*SV1:*:*:*) - echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz) - FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') - FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/') - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') - FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/') - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; *:BSD/OS:*:*) - echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; arm:FreeBSD:*:*) - UNAME_PROCESSOR=$(uname -p) + UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi else - echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf fi - exit ;; + ;; *:FreeBSD:*:*) - UNAME_PROCESSOR=$(/usr/bin/uname -p) - case "$UNAME_PROCESSOR" in + UNAME_PROCESSOR=`/usr/bin/uname -p` + case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac - echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" - exit ;; + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; i*:CYGWIN*:*) - echo "$UNAME_MACHINE"-pc-cygwin - exit ;; + GUESS=$UNAME_MACHINE-pc-cygwin + ;; *:MINGW64*:*) - echo "$UNAME_MACHINE"-pc-mingw64 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; *:MINGW*:*) - echo "$UNAME_MACHINE"-pc-mingw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; *:MSYS*:*) - echo "$UNAME_MACHINE"-pc-msys - exit ;; + GUESS=$UNAME_MACHINE-pc-msys + ;; i*:PW*:*) - echo "$UNAME_MACHINE"-pc-pw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-pw32 + ;; *:Interix*:*) - case "$UNAME_MACHINE" in + case $UNAME_MACHINE in x86) - echo i586-pc-interix"$UNAME_RELEASE" - exit ;; + GUESS=i586-pc-interix$UNAME_RELEASE + ;; authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix"$UNAME_RELEASE" - exit ;; + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; IA64) - echo ia64-unknown-interix"$UNAME_RELEASE" - exit ;; + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; esac ;; i*:UWIN*:*) - echo "$UNAME_MACHINE"-pc-uwin - exit ;; + GUESS=$UNAME_MACHINE-pc-uwin + ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-pc-cygwin - exit ;; + GUESS=x86_64-pc-cygwin + ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; *:GNU:*:*) # the GNU system - echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')" - exit ;; + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC" - exit ;; + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; *:Minix:*:*) - echo "$UNAME_MACHINE"-unknown-minix - exit ;; + GUESS=$UNAME_MACHINE-unknown-minix + ;; aarch64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; alpha:Linux:*:*) - case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; @@ -948,63 +985,63 @@ EOF esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi - exit ;; + ;; avr32*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; cris:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; crisv32:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; e2k:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; frv:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; hexagon:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; ia64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; k1om:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m32r*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m68*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 @@ -1049,65 +1086,66 @@ EOF #endif #endif EOF - eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')" + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; openrisc*:Linux:*:*) - echo or1k-unknown-linux-"$LIBC" - exit ;; + GUESS=or1k-unknown-linux-$LIBC + ;; or32:Linux:*:* | or1k*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; padre:Linux:*:*) - echo sparc-unknown-linux-"$LIBC" - exit ;; + GUESS=sparc-unknown-linux-$LIBC + ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-"$LIBC" - exit ;; + GUESS=hppa64-unknown-linux-$LIBC + ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level - case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in - PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; - PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; - *) echo hppa-unknown-linux-"$LIBC" ;; + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; esac - exit ;; + ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc64-unknown-linux-$LIBC + ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc-unknown-linux-$LIBC + ;; ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc64le-unknown-linux-$LIBC + ;; ppcle:Linux:*:*) - echo powerpcle-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpcle-unknown-linux-$LIBC + ;; riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; s390:Linux:*:* | s390x:Linux:*:*) - echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; sh64*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sh*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; tile*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; vax:Linux:*:*) - echo "$UNAME_MACHINE"-dec-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; x86_64:Linux:*:*) set_cc_for_build LIBCABI=$LIBC @@ -1116,71 +1154,71 @@ EOF (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_X32 >/dev/null then - LIBCABI="$LIBC"x32 + LIBCABI=${LIBC}x32 fi fi - echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI" - exit ;; + GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI + ;; xtensa*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; + GUESS=i386-sequent-sysv4 + ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. - echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" - exit ;; + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. - echo "$UNAME_MACHINE"-pc-os2-emx - exit ;; + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; i*86:XTS-300:*:STOP) - echo "$UNAME_MACHINE"-unknown-stop - exit ;; + GUESS=$UNAME_MACHINE-unknown-stop + ;; i*86:atheos:*:*) - echo "$UNAME_MACHINE"-unknown-atheos - exit ;; + GUESS=$UNAME_MACHINE-unknown-atheos + ;; i*86:syllable:*:*) - echo "$UNAME_MACHINE"-pc-syllable - exit ;; + GUESS=$UNAME_MACHINE-pc-syllable + ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; i*86:*DOS:*:*) - echo "$UNAME_MACHINE"-pc-msdosdjgpp - exit ;; + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; i*86:*:4.*:*) - UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//') + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else - echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi - exit ;; + ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. - case $(/bin/uname -X | grep "^Machine") in + case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" - exit ;; + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then - UNAME_REL=$(sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //')) + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 @@ -1188,11 +1226,11 @@ EOF && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 - echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else - echo "$UNAME_MACHINE"-pc-sysv32 + GUESS=$UNAME_MACHINE-pc-sysv32 fi - exit ;; + ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about @@ -1200,37 +1238,37 @@ EOF # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; + GUESS=i586-pc-msdosdjgpp + ;; Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; + GUESS=i386-pc-mach3 + ;; paragon:*:*:*) - echo i860-intel-osf1 - exit ;; + GUESS=i860-intel-osf1 + ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi - exit ;; + ;; mini*:CTIX:SYS*5:*) # "miniframe" - echo m68010-convergent-sysv - exit ;; + GUESS=m68010-convergent-sysv + ;; mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; + GUESS=m68k-convergent-sysv + ;; M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; + GUESS=m68k-diab-dnix + ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ - && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ @@ -1241,7 +1279,7 @@ EOF NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ - && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ @@ -1249,118 +1287,118 @@ EOF /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; + GUESS=m68k-atari-sysv4 + ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv"$UNAME_RELEASE" - exit ;; + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=$( (uname -p) 2>/dev/null) - echo "$UNAME_MACHINE"-sni-sysv4 + UNAME_MACHINE=`(uname -p) 2>/dev/null` + GUESS=$UNAME_MACHINE-sni-sysv4 else - echo ns32k-sni-sysv + GUESS=ns32k-sni-sysv fi - exit ;; + ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says - echo i586-unisys-sysv4 - exit ;; + GUESS=i586-unisys-sysv4 + ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; + GUESS=hppa1.1-stratus-sysv4 + ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; + GUESS=i860-stratus-sysv4 + ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. - echo "$UNAME_MACHINE"-stratus-vos - exit ;; + GUESS=$UNAME_MACHINE-stratus-vos + ;; *:VOS:*:*) # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; + GUESS=hppa1.1-stratus-vos + ;; mc68*:A/UX:*:*) - echo m68k-apple-aux"$UNAME_RELEASE" - exit ;; + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; + GUESS=mips-sony-newsos6 + ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if test -d /usr/nec; then - echo mips-nec-sysv"$UNAME_RELEASE" + GUESS=mips-nec-sysv$UNAME_RELEASE else - echo mips-unknown-sysv"$UNAME_RELEASE" + GUESS=mips-unknown-sysv$UNAME_RELEASE fi - exit ;; + ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; + GUESS=powerpc-be-beos + ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; + GUESS=powerpc-apple-beos + ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; + GUESS=i586-pc-beos + ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; + GUESS=i586-pc-haiku + ;; x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; + GUESS=x86_64-unknown-haiku + ;; SX-4:SUPER-UX:*:*) - echo sx4-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; SX-5:SUPER-UX:*:*) - echo sx5-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; SX-6:SUPER-UX:*:*) - echo sx6-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; SX-7:SUPER-UX:*:*) - echo sx7-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; SX-8:SUPER-UX:*:*) - echo sx8-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; SX-ACE:SUPER-UX:*:*) - echo sxace-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; *:Rhapsody:*:*) - echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; arm64:Darwin:*:*) - echo aarch64-apple-darwin"$UNAME_RELEASE" - exit ;; + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; *:Darwin:*:*) - UNAME_PROCESSOR=$(uname -p) + UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac @@ -1394,109 +1432,116 @@ EOF # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi - echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=$(uname -p) + UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; *:QNX:*:4*) - echo i386-pc-qnx - exit ;; + GUESS=i386-pc-qnx + ;; NEO-*:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; NSR-*:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; NSV-*:NONSTOP_KERNEL:*:*) - echo nsv-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; NSX-*:NONSTOP_KERNEL:*:*) - echo nsx-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; + GUESS=mips-compaq-nonstopux + ;; BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; + GUESS=bs2000-siemens-sysv + ;; DS/*:UNIX_System_V:*:*) - echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - # shellcheck disable=SC2154 - if test "$cputype" = 386; then + if test "${cputype-}" = 386; then UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype fi - echo "$UNAME_MACHINE"-unknown-plan9 - exit ;; + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; + GUESS=pdp10-unknown-tops10 + ;; *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; + GUESS=pdp10-unknown-tenex + ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; + GUESS=pdp10-dec-tops20 + ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; + GUESS=pdp10-xkl-tops20 + ;; *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; + GUESS=pdp10-unknown-tops20 + ;; *:ITS:*:*) - echo pdp10-unknown-its - exit ;; + GUESS=pdp10-unknown-its + ;; SEI:*:*:SEIUX) - echo mips-sei-seiux"$UNAME_RELEASE" - exit ;; + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; *:DragonFly:*:*) - echo "$UNAME_MACHINE"-unknown-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" - exit ;; + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; *:*VMS:*:*) - UNAME_MACHINE=$( (uname -p) 2>/dev/null) - case "$UNAME_MACHINE" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; + GUESS=i386-pc-xenix + ;; i*86:skyos:*:*) - echo "$UNAME_MACHINE"-pc-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ .*$//')" - exit ;; + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; i*86:rdos:*:*) - echo "$UNAME_MACHINE"-pc-rdos - exit ;; - i*86:AROS:*:*) - echo "$UNAME_MACHINE"-pc-aros - exit ;; + GUESS=$UNAME_MACHINE-pc-rdos + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; x86_64:VMkernel:*:*) - echo "$UNAME_MACHINE"-unknown-esx - exit ;; + GUESS=$UNAME_MACHINE-unknown-esx + ;; amd64:Isilon\ OneFS:*:*) - echo x86_64-unknown-onefs - exit ;; + GUESS=x86_64-unknown-onefs + ;; *:Unleashed:*:*) - echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; esac +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" </dev/null); + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else @@ -1628,7 +1673,7 @@ main () } EOF -$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=$($dummy) && +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. @@ -1636,7 +1681,7 @@ test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 -case "$UNAME_MACHINE:$UNAME_SYSTEM" in +case $UNAME_MACHINE:$UNAME_SYSTEM in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 </dev/null || echo unknown) -uname -r = $( (uname -r) 2>/dev/null || echo unknown) -uname -s = $( (uname -s) 2>/dev/null || echo unknown) -uname -v = $( (uname -v) 2>/dev/null || echo unknown) +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` -/usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null) -/bin/uname -X = $( (/bin/uname -X) 2>/dev/null) +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` -hostinfo = $( (hostinfo) 2>/dev/null) -/bin/universe = $( (/bin/universe) 2>/dev/null) -/usr/bin/arch -k = $( (/usr/bin/arch -k) 2>/dev/null) -/bin/arch = $( (/bin/arch) 2>/dev/null) -/usr/bin/oslevel = $( (/usr/bin/oslevel) 2>/dev/null) -/usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null) +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" diff --git a/build-aux/config.sub b/build-aux/config.sub index b0f8492348..d74fb6deac 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -2,7 +2,9 @@ # Configuration validation subroutine script. # Copyright 1992-2021 Free Software Foundation, Inc. -timestamp='2021-01-07' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2021-08-14' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -50,7 +52,14 @@ timestamp='2021-01-07' # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. -me=$(echo "$0" | sed -e 's,.*/,,') +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + +me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS @@ -112,9 +121,11 @@ esac # Split fields of configuration type # shellcheck disable=SC2162 +saved_IFS=$IFS IFS="-" read field1 field2 field3 field4 <&2 @@ -1751,6 +1778,8 @@ case $kernel-$os in ;; kfreebsd*-gnu* | kopensolaris*-gnu*) ;; + vxworks-simlinux | vxworks-simwindows | vxworks-spe) + ;; nto-qnx*) ;; os2-emx) diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog index de76f658d4..9ff15f6019 100755 --- a/build-aux/gitlog-to-changelog +++ b/build-aux/gitlog-to-changelog @@ -35,7 +35,7 @@ eval 'exec perl -wSx "$0" "$@"' if 0; -my $VERSION = '2020-04-04 15:07'; # UTC +my $VERSION = '2021-02-24 23:42'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook @@ -455,7 +455,8 @@ sub git_dir_option($) # If there were any lines if (@line == 0) { - warn "$ME: warning: empty commit message:\n $date_line\n"; + warn "$ME: warning: empty commit message:\n" + . " commit $sha\n $date_line\n"; } else { diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index a91181b116..e48383defc 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,9 +3,9 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2020-11-25.18} +\def\texinfoversion{2021-04-25.21} % -% Copyright 1985, 1986, 1988, 1990-2020 Free Software Foundation, Inc. +% Copyright 1985, 1986, 1988, 1990-2021 Free Software Foundation, Inc. % % This texinfo.tex file is free software: you can redistribute it and/or % modify it under the terms of the GNU General Public License as @@ -574,7 +574,7 @@ % @end foo calls \checkenv and executes the definition of \Efoo. -\parseargdef\end{ +\parseargdef\end{% \if 1\csname iscond.#1\endcsname \else % The general wording of \badenverr may not be ideal. @@ -1002,6 +1002,14 @@ \global\everypar = {}% } +% leave vertical mode without cancelling any first paragraph indent +\gdef\imageindent{% + \toks0=\everypar + \everypar={}% + \ptexnoindent + \global\everypar=\toks0 +} + % @refill is a no-op. \let\refill=\relax @@ -1181,7 +1189,7 @@ % double any backslashes. Otherwise, a name like "\node" will be % interpreted as a newline (\n), followed by o, d, e. Not good. % -% See https://mailman.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and +% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and % related messages. The final outcome is that it is up to the TeX user % to double the backslashes and otherwise make the string valid, so % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to @@ -1862,19 +1870,23 @@ \closein 1 \endgroup % - \def\xetexpdfext{pdf}% - \ifx\xeteximgext\xetexpdfext - \XeTeXpdffile "#1".\xeteximgext "" - \else - \def\xetexpdfext{PDF}% + % Putting an \hbox around the image can prevent an over-long line + % after the image. + \hbox\bgroup + \def\xetexpdfext{pdf}% \ifx\xeteximgext\xetexpdfext \XeTeXpdffile "#1".\xeteximgext "" \else - \XeTeXpicfile "#1".\xeteximgext "" + \def\xetexpdfext{PDF}% + \ifx\xeteximgext\xetexpdfext + \XeTeXpdffile "#1".\xeteximgext "" + \else + \XeTeXpicfile "#1".\xeteximgext "" + \fi \fi - \fi - \ifdim \wd0 >0pt width \xeteximagewidth \fi - \ifdim \wd2 >0pt height \xeteximageheight \fi \relax + \ifdim \wd0 >0pt width \xeteximagewidth \fi + \ifdim \wd2 >0pt height \xeteximageheight \fi \relax + \egroup } \fi @@ -3539,7 +3551,7 @@ % We use the free feym* fonts from the eurosym package by Henrik % Theiling, which support regular, slanted, bold and bold slanted (and % "outlined" (blackboard board, sort of) versions, which we don't need). -% It is available from https://www.ctan.org/tex-archive/fonts/eurosym. +% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. % % Although only regular is the truly official Euro symbol, we ignore % that. The Euro is designed to be slightly taller than the regular @@ -4289,82 +4301,8 @@ \doitemize{#1.}\flushcr } -% @alphaenumerate and @capsenumerate are abbreviations for giving an arg -% to @enumerate. -% -\def\alphaenumerate{\enumerate{a}} -\def\capsenumerate{\enumerate{A}} -\def\Ealphaenumerate{\Eenumerate} -\def\Ecapsenumerate{\Eenumerate} - % @multitable macros -% Amy Hendrickson, 8/18/94, 3/6/96 -% -% @multitable ... @end multitable will make as many columns as desired. -% Contents of each column will wrap at width given in preamble. Width -% can be specified either with sample text given in a template line, -% or in percent of \hsize, the current width of text on page. - -% Table can continue over pages but will only break between lines. - -% To make preamble: -% -% Either define widths of columns in terms of percent of \hsize: -% @multitable @columnfractions .25 .3 .45 -% @item ... -% -% Numbers following @columnfractions are the percent of the total -% current hsize to be used for each column. You may use as many -% columns as desired. - - -% Or use a template: -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item ... -% using the widest term desired in each column. - -% Each new table line starts with @item, each subsequent new column -% starts with @tab. Empty columns may be produced by supplying @tab's -% with nothing between them for as many times as empty columns are needed, -% ie, @tab@tab@tab will produce two empty columns. - -% @item, @tab do not need to be on their own lines, but it will not hurt -% if they are. - -% Sample multitable: - -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item first col stuff @tab second col stuff @tab third col -% @item -% first col stuff -% @tab -% second col stuff -% @tab -% third col -% @item first col stuff @tab second col stuff -% @tab Many paragraphs of text may be used in any column. -% -% They will wrap at the width determined by the template. -% @item@tab@tab This will be in third column. -% @end multitable - -% Default dimensions may be reset by user. -% @multitableparskip is vertical space between paragraphs in table. -% @multitableparindent is paragraph indent in table. -% @multitablecolmargin is horizontal space to be left between columns. -% @multitablelinespace is space to leave between table items, baseline -% to baseline. -% 0pt means it depends on current normal line spacing. -% -\newskip\multitableparskip -\newskip\multitableparindent -\newdimen\multitablecolspace -\newskip\multitablelinespace -\multitableparskip=0pt -\multitableparindent=6pt -\multitablecolspace=12pt -\multitablelinespace=0pt % Macros used to set up halign preamble: % @@ -4412,8 +4350,6 @@ \go } -% multitable-only commands. -% % @headitem starts a heading row, which we typeset in bold. Assignments % have to be global since we are inside the implicit group of an % alignment entry. \everycr below resets \everytab so we don't have to @@ -4430,14 +4366,8 @@ % default for tables with no headings. \let\headitemcrhook=\relax % -% A \tab used to include \hskip1sp. But then the space in a template -% line is not enough. That is bad. So let's go back to just `&' until -% we again encounter the problem the 1sp was intended to solve. -% --karl, nathan@acm.org, 20apr99. \def\tab{\checkenv\multitable &\the\everytab}% -% @multitable ... @end multitable definitions: -% \newtoks\everytab % insert after every tab. % \envdef\multitable{% @@ -4452,9 +4382,8 @@ % \tolerance=9500 \hbadness=9500 - \setmultitablespacing - \parskip=\multitableparskip - \parindent=\multitableparindent + \parskip=0pt + \parindent=6pt \overfullrule=0pt \global\colcount=0 % @@ -4484,47 +4413,24 @@ % continue for many paragraphs if desired. \halign\bgroup &% \global\advance\colcount by 1 - \multistrut + \strut \vtop{% - % Use the current \colcount to find the correct column width: + \advance\hsize by -1\leftskip + % Find the correct column width \hsize=\expandafter\csname col\the\colcount\endcsname % - % In order to keep entries from bumping into each other - % we will add a \leftskip of \multitablecolspace to all columns after - % the first one. - % - % If a template has been used, we will add \multitablecolspace - % to the width of each template entry. - % - % If the user has set preamble in terms of percent of \hsize we will - % use that dimension as the width of the column, and the \leftskip - % will keep entries from bumping into each other. Table will start at - % left margin and final column will justify at right margin. - % - % Make sure we don't inherit \rightskip from the outer environment. \rightskip=0pt \ifnum\colcount=1 - % The first column will be indented with the surrounding text. - \advance\hsize by\leftskip + \advance\hsize by\leftskip % Add indent of surrounding text \else - \ifsetpercent \else - % If user has not set preamble in terms of percent of \hsize - % we will advance \hsize by \multitablecolspace. - \advance\hsize by \multitablecolspace - \fi - % In either case we will make \leftskip=\multitablecolspace: - \leftskip=\multitablecolspace + % In order to keep entries from bumping into each other. + \leftskip=12pt + \ifsetpercent \else + % If a template has been used + \advance\hsize by \leftskip + \fi \fi - % Ignoring space at the beginning and end avoids an occasional spurious - % blank line, when TeX decides to break the line at the space before the - % box from the multistrut, so the strut ends up on a line by itself. - % For example: - % @multitable @columnfractions .11 .89 - % @item @code{#} - % @tab Legal holiday which is valid in major parts of the whole country. - % Is automatically provided with highlighting sequences respectively - % marking characters. - \noindent\ignorespaces##\unskip\multistrut + \noindent\ignorespaces##\unskip\strut }\cr } \def\Emultitable{% @@ -4533,31 +4439,6 @@ \global\setpercentfalse } -\def\setmultitablespacing{% - \def\multistrut{\strut}% just use the standard line spacing - % - % Compute \multitablelinespace (if not defined by user) for use in - % \multitableparskip calculation. We used define \multistrut based on - % this, but (ironically) that caused the spacing to be off. - % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. -\ifdim\multitablelinespace=0pt -\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip -\global\advance\multitablelinespace by-\ht0 -\fi -% Test to see if parskip is larger than space between lines of -% table. If not, do nothing. -% If so, set to same dimension as multitablelinespace. -\ifdim\multitableparskip>\multitablelinespace -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller - % than skip between lines in the table. -\fi% -\ifdim\multitableparskip=0pt -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller - % than skip between lines in the table. -\fi} - \message{conditionals,} @@ -5171,30 +5052,29 @@ \let\lbracechar\{% \let\rbracechar\}% % + % Non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\DH{DZZ}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\TH{TH}% + \def\aa{aa}% + \def\ae{ae}% + \def\dh{dzz}% + \def\exclamdown{!}% + \def\l{l}% + \def\oe{oe}% + \def\ordf{a}% + \def\ordm{o}% + \def\o{o}% + \def\questiondown{?}% + \def\ss{ss}% + \def\th{th}% % \let\do\indexnofontsdef % - % Non-English letters. - \do\AA{AA}% - \do\AE{AE}% - \do\DH{DZZ}% - \do\L{L}% - \do\OE{OE}% - \do\O{O}% - \do\TH{TH}% - \do\aa{aa}% - \do\ae{ae}% - \do\dh{dzz}% - \do\exclamdown{!}% - \do\l{l}% - \do\oe{oe}% - \do\ordf{a}% - \do\ordm{o}% - \do\o{o}% - \do\questiondown{?}% - \do\ss{ss}% - \do\th{th}% - % \do\LaTeX{LaTeX}% \do\TeX{TeX}% % @@ -8931,7 +8811,7 @@ \else \ifhavexrefs % We (should) know the real title if we have the xref values. - \def\printedrefname{\refx{#1-title}{}}% + \def\printedrefname{\refx{#1-title}}% \else % Otherwise just copy the Info node name. \def\printedrefname{\ignorespaces #1}% @@ -9025,7 +8905,7 @@ % If the user specified the print name (third arg) to the ref, % print it instead of our usual "Figure 1.2". \ifdim\wd\printedrefnamebox = 0pt - \refx{#1-snt}{}% + \refx{#1-snt}% \else \printedrefname \fi @@ -9060,9 +8940,9 @@ \else % Reference within this manual. % - % Only output a following space if the -snt ref is nonempty; for - % @unnumbered and @anchor, it won't be. - \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% + % Only output a following space if the -snt ref is nonempty, as the ref + % will be empty for @unnumbered and @anchor. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}% \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi % % output the `[mynode]' via the macro below so it can be overridden. @@ -9073,7 +8953,7 @@ ,\space % % output the `page 3'. - \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + \turnoffactive \putwordpage\tie\refx{#1-pg}% % Add a , if xref followed by a space \if\space\noexpand\tokenafterxref ,% \else\ifx\ \tokenafterxref ,% @TAB @@ -9150,9 +9030,8 @@ \fi\fi\fi } -% \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX -% is output afterwards if non-empty. -\def\refx#1#2{% +% \refx{NAME} - reference a cross-reference string named NAME. +\def\refx#1{% \requireauxfile {% \indexnofonts @@ -9179,7 +9058,6 @@ % It's defined, so just use it. \thisrefX \fi - #2% Output the suffix in any case. } % This is the macro invoked by entries in the aux file. Define a control @@ -9289,10 +9167,10 @@ \catcode`\[=\other \catcode`\]=\other \catcode`\"=\other - \catcode`\_=\other - \catcode`\|=\other - \catcode`\<=\other - \catcode`\>=\other + \catcode`\_=\active + \catcode`\|=\active + \catcode`\<=\active + \catcode`\>=\active \catcode`\$=\other \catcode`\#=\other \catcode`\&=\other @@ -9539,7 +9417,7 @@ % On the other hand, if we are in the case of @center @image, we don't % want to start a paragraph, which will create a hsize-width box and % eradicate the centering. - \ifx\centersub\centerV\else \noindent \fi + \ifx\centersub\centerV \else \imageindent \fi % % Output the image. \ifpdf @@ -11731,3 +11609,4 @@ @c vim:sw=2: @enablebackslashhack + diff --git a/etc/NEWS b/etc/NEWS index 7e6143d932..340db82e75 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -79,6 +79,14 @@ at build time. This was only ever relevant when building from a repository checkout. This now requires makeinfo, which is part of the texinfo package. +--- +** There is a new configure option '--disable-year2038' to cause +Emacs to use only 32-bit time_t on platforms that have both 32- and +64-bit time_t. This may help link Emacs to a library with ABI +requiring traditional 32-bit time_t. This option currently affects +only 32-bit ARM and x86 running GNU/Linux with glibc 2.34 and later. +Emacs now defaults to 64-bit time_t on these platforms. + --- ** Support for building with '-fcheck-pointer-bounds' has been removed. GCC has withdrawn the '-fcheck-pointer-bounds' option and support for diff --git a/lib/_Noreturn.h b/lib/_Noreturn.h index fb718bc069..6fed3c7971 100644 --- a/lib/_Noreturn.h +++ b/lib/_Noreturn.h @@ -2,16 +2,16 @@ Copyright (C) 2011-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, or + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _Noreturn @@ -29,7 +29,7 @@ # elif ((!defined __cplusplus || defined __clang__) \ && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ || (!defined __STRICT_ANSI__ \ - && (__4 < __GNUC__ + (7 <= __GNUC_MINOR__) \ + && (4 < __GNUC__ + (7 <= __GNUC_MINOR__) \ || (defined __apple_build_version__ \ ? 6000000 <= __apple_build_version__ \ : 3 < __clang_major__ + (5 <= __clang_minor__)))))) diff --git a/lib/af_alg.h b/lib/af_alg.h index 4c5854cc99..f0fe7fc055 100644 --- a/lib/af_alg.h +++ b/lib/af_alg.h @@ -1,18 +1,18 @@ /* af_alg.h - Compute message digests from file streams and buffers. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* Written by Matteo Croce , 2018. Documentation by Bruno Haible , 2018. */ diff --git a/lib/alloca.in.h b/lib/alloca.in.h index 0a6137e037..65c2d4d939 100644 --- a/lib/alloca.in.h +++ b/lib/alloca.in.h @@ -3,20 +3,18 @@ Copyright (C) 1995, 1999, 2001-2004, 2006-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public - License along with this program; if not, see - . - */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H means there is a real alloca function. */ diff --git a/lib/allocator.c b/lib/allocator.c index 2c1a3da03a..2262de9ff3 100644 --- a/lib/allocator.c +++ b/lib/allocator.c @@ -1,3 +1,20 @@ +/* Memory allocators such as malloc+free. + + Copyright (C) 2011-2021 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + #define _GL_USE_STDLIB_ALLOC 1 #include #include "allocator.h" diff --git a/lib/allocator.h b/lib/allocator.h index cfa0535774..f0e8f34896 100644 --- a/lib/allocator.h +++ b/lib/allocator.h @@ -2,17 +2,17 @@ Copyright (C) 2011-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ diff --git a/lib/arg-nonnull.h b/lib/arg-nonnull.h index 5b81b50a87..b4de241e90 100644 --- a/lib/arg-nonnull.h +++ b/lib/arg-nonnull.h @@ -2,16 +2,16 @@ Copyright (C) 2009-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, or + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools diff --git a/lib/attribute.h b/lib/attribute.h index 82245279eb..eb36188d48 100644 --- a/lib/attribute.h +++ b/lib/attribute.h @@ -2,17 +2,17 @@ Copyright 2020-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ @@ -32,7 +32,7 @@ /* This file defines two types of attributes: - * C2X standard attributes. These have macro names that do not begin with + * C2x standard attributes. These have macro names that do not begin with 'ATTRIBUTE_'. * Selected GCC attributes; see: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html @@ -76,6 +76,14 @@ /* Applies to: function, pointer to function, function types. */ #define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE (args) +/* ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers + that can be freed by passing them as the Ith argument to the + function F. + ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that + can be freed via 'free'; it can be used only after declaring 'free'. */ +/* Applies to: functions. Cannot be used on inline functions. */ +#define ATTRIBUTE_DEALLOC(f, i) _GL_ATTRIBUTE_DEALLOC(f, i) +#define ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC_FREE /* Attributes for variadic functions. */ diff --git a/lib/binary-io.c b/lib/binary-io.c index f2678972ef..adc0ae2b0c 100644 --- a/lib/binary-io.c +++ b/lib/binary-io.c @@ -1,17 +1,17 @@ /* Binary mode I/O. Copyright 2017-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include diff --git a/lib/binary-io.h b/lib/binary-io.h index 8654fd2d39..642f08b1ba 100644 --- a/lib/binary-io.h +++ b/lib/binary-io.h @@ -1,17 +1,17 @@ /* Binary mode I/O. Copyright (C) 2001, 2003, 2005, 2008-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _BINARY_H @@ -47,7 +47,7 @@ _GL_INLINE_HEADER_BEGIN /* Use a function rather than a macro, to avoid gcc warnings "warning: statement with no effect". */ BINARY_IO_INLINE int -__gl_setmode (int fd _GL_UNUSED, int mode _GL_UNUSED) +__gl_setmode (_GL_UNUSED int fd, _GL_UNUSED int mode) { return O_BINARY; } diff --git a/lib/byteswap.in.h b/lib/byteswap.in.h index 2b7d5abe1b..113f878027 100644 --- a/lib/byteswap.in.h +++ b/lib/byteswap.in.h @@ -2,17 +2,17 @@ Copyright (C) 2005, 2007, 2009-2021 Free Software Foundation, Inc. Written by Oskar Liljeblad , 2005. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _GL_BYTESWAP_H diff --git a/lib/c++defs.h b/lib/c++defs.h index 39df1bc76b..a47b61a009 100644 --- a/lib/c++defs.h +++ b/lib/c++defs.h @@ -2,16 +2,16 @@ Copyright (C) 2010-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, or + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _GL_CXXDEFS_H diff --git a/lib/c-ctype.c b/lib/c-ctype.c index 5d9d4d87a6..300f97c292 100644 --- a/lib/c-ctype.c +++ b/lib/c-ctype.c @@ -1,3 +1,21 @@ +/* Character handling in C locale. + + Copyright (C) 2003-2021 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + #include + #define C_CTYPE_INLINE _GL_EXTERN_INLINE #include "c-ctype.h" diff --git a/lib/c-ctype.h b/lib/c-ctype.h index bf24a88310..3a652ac1f2 100644 --- a/lib/c-ctype.h +++ b/lib/c-ctype.h @@ -7,18 +7,18 @@ Copyright (C) 2000-2003, 2006, 2008-2021 Free Software Foundation, Inc. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, see . */ + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifndef C_CTYPE_H #define C_CTYPE_H diff --git a/lib/c-strcase.h b/lib/c-strcase.h index 089edfe7eb..82f99bb06b 100644 --- a/lib/c-strcase.h +++ b/lib/c-strcase.h @@ -2,18 +2,18 @@ Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifndef C_STRCASE_H #define C_STRCASE_H diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c index 55479d6a33..3c22455082 100644 --- a/lib/c-strcasecmp.c +++ b/lib/c-strcasecmp.c @@ -1,18 +1,18 @@ /* c-strcasecmp.c -- case insensitive string comparator in C locale Copyright (C) 1998-1999, 2005-2006, 2009-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #include diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c index 02bc0f2ecd..f3ca786cb3 100644 --- a/lib/c-strncasecmp.c +++ b/lib/c-strncasecmp.c @@ -1,18 +1,18 @@ /* c-strncasecmp.c -- case insensitive string comparator in C locale Copyright (C) 1998-1999, 2005-2006, 2009-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #include diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c index b7dba08994..92e9639720 100644 --- a/lib/canonicalize-lgpl.c +++ b/lib/canonicalize-lgpl.c @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ @@ -21,7 +21,6 @@ optimizes away the name == NULL test below. */ # define _GL_ARG_NONNULL(params) -# define _GL_USE_STDLIB_ALLOC 1 # include #endif @@ -75,7 +74,12 @@ # define __pathconf pathconf # define __rawmemchr rawmemchr # define __readlink readlink -# define __stat stat +# if IN_RELOCWRAPPER + /* When building the relocatable program wrapper, use the system's memmove + function, not the gnulib override, otherwise we would get a link error. + */ +# undef memmove +# endif #endif /* Suppress bogus GCC -Wmaybe-uninitialized warnings. */ @@ -100,7 +104,7 @@ file_accessible (char const *file) return __faccessat (AT_FDCWD, file, F_OK, AT_EACCESS) == 0; # else struct stat st; - return __stat (file, &st) == 0 || errno == EOVERFLOW; + return stat (file, &st) == 0 || errno == EOVERFLOW; # endif } diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c index 18cfc114b6..9d0c125ecb 100644 --- a/lib/careadlinkat.c +++ b/lib/careadlinkat.c @@ -3,17 +3,17 @@ Copyright (C) 2001, 2003-2004, 2007, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ @@ -22,6 +22,9 @@ #include "careadlinkat.h" +#include "idx.h" +#include "minmax.h" + #include #include #include @@ -65,11 +68,6 @@ readlink_stk (int fd, char const *filename, ssize_t (*preadlinkat) (int, char const *, char *, size_t), char stack_buf[STACK_BUF_SIZE]) { - char *buf; - size_t buf_size; - size_t buf_size_max = - SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX; - if (! alloc) alloc = &stdlib_allocator; @@ -79,14 +77,14 @@ readlink_stk (int fd, char const *filename, buffer_size = STACK_BUF_SIZE; } - buf = buffer; - buf_size = buffer_size; + char *buf = buffer; + idx_t buf_size_max = MIN (IDX_MAX, MIN (SSIZE_MAX, SIZE_MAX)); + idx_t buf_size = MIN (buffer_size, buf_size_max); while (buf) { /* Attempt to read the link into the current buffer. */ - ssize_t link_length = preadlinkat (fd, filename, buf, buf_size); - size_t link_size; + idx_t link_length = preadlinkat (fd, filename, buf, buf_size); if (link_length < 0) { if (buf != buffer) @@ -98,7 +96,7 @@ readlink_stk (int fd, char const *filename, return NULL; } - link_size = link_length; + idx_t link_size = link_length; if (link_size < buf_size) { @@ -127,17 +125,13 @@ readlink_stk (int fd, char const *filename, if (buf != buffer) alloc->free (buf); - if (buf_size < buf_size_max / 2) - buf_size = 2 * buf_size + 1; - else if (buf_size < buf_size_max) - buf_size = buf_size_max; - else if (buf_size_max < SIZE_MAX) + if (buf_size_max / 2 <= buf_size) { errno = ENAMETOOLONG; return NULL; } - else - break; + + buf_size = 2 * buf_size + 1; buf = alloc->allocate (buf_size); } diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h index c506fac3cb..a3517b827a 100644 --- a/lib/careadlinkat.h +++ b/lib/careadlinkat.h @@ -2,17 +2,17 @@ Copyright (C) 2011-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ diff --git a/lib/cdefs.h b/lib/cdefs.h index 17a0919cd8..4dac9d264d 100644 --- a/lib/cdefs.h +++ b/lib/cdefs.h @@ -2,16 +2,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ @@ -259,9 +259,7 @@ # define __attribute_const__ /* Ignore */ #endif -#if defined __STDC_VERSION__ && 201710L < __STDC_VERSION__ -# define __attribute_maybe_unused__ [[__maybe_unused__]] -#elif __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__) +#if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__) # define __attribute_maybe_unused__ __attribute__ ((__unused__)) #else # define __attribute_maybe_unused__ /* Ignore */ @@ -320,16 +318,28 @@ #endif /* The nonnull function attribute marks pointer parameters that - must not be NULL. */ -#ifndef __nonnull + must not be NULL. This has the name __nonnull in glibc, + and __attribute_nonnull__ in files shared with Gnulib to avoid + collision with a different __nonnull in DragonFlyBSD 5.9. */ +#ifndef __attribute_nonnull__ # if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__) -# define __nonnull(params) __attribute__ ((__nonnull__ params)) +# define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params)) +# else +# define __attribute_nonnull__(params) +# endif +#endif +#ifndef __nonnull +# define __nonnull(params) __attribute_nonnull__ (params) +#endif + +/* The returns_nonnull function attribute marks the return type of the function + as always being non-null. */ +#ifndef __returns_nonnull +# if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__returns_nonnull__) +# define __returns_nonnull __attribute__ ((__returns_nonnull__)) # else -# define __nonnull(params) +# define __returns_nonnull # endif -#elif !defined __GLIBC__ -# undef __nonnull -# define __nonnull(params) _GL_ATTRIBUTE_NONNULL (params) #endif /* If fortification mode, we warn about unused results of certain @@ -485,9 +495,9 @@ [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] #endif -/* The #ifndef lets Gnulib avoid including these on non-glibc - platforms, where the includes typically do not exist. */ -#ifndef __WORDSIZE +/* Gnulib avoids including these, as they don't work on non-glibc or + older glibc platforms. */ +#ifndef __GNULIB_CDEFS # include # include #endif @@ -594,9 +604,26 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf array according to access mode, or at least one element when size-index is not provided: access (access-mode, [, ]) */ -#define __attr_access(x) __attribute__ ((__access__ x)) +# define __attr_access(x) __attribute__ ((__access__ x)) +# if __GNUC_PREREQ (11, 0) +# define __attr_access_none(argno) __attribute__ ((__access__ (__none__, argno))) +# else +# define __attr_access_none(argno) +# endif #else # define __attr_access(x) +# define __attr_access_none(argno) +#endif + +#if __GNUC_PREREQ (11, 0) +/* Designates dealloc as a function to call to deallocate objects + allocated by the declared function. */ +# define __attr_dealloc(dealloc, argno) \ + __attribute__ ((__malloc__ (dealloc, argno))) +# define __attr_dealloc_free __attr_dealloc (__builtin_free, 1) +#else +# define __attr_dealloc(dealloc, argno) +# define __attr_dealloc_free #endif /* Specify that a function such as setjmp or vfork may return diff --git a/lib/cloexec.c b/lib/cloexec.c index 8363ddaa60..7defa93446 100644 --- a/lib/cloexec.c +++ b/lib/cloexec.c @@ -2,20 +2,20 @@ Copyright (C) 1991, 2004-2006, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ - The code is taken from glibc/manual/llio.texi */ +/* The code is taken from glibc/manual/llio.texi */ #include diff --git a/lib/cloexec.h b/lib/cloexec.h index 5ca0e6413e..97a3659efb 100644 --- a/lib/cloexec.h +++ b/lib/cloexec.h @@ -2,20 +2,18 @@ Copyright (C) 2004, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -*/ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #include diff --git a/lib/close-stream.h b/lib/close-stream.h index be3d4196b0..8a58a48e61 100644 --- a/lib/close-stream.h +++ b/lib/close-stream.h @@ -1,2 +1,20 @@ +/* Close a stream, with nicer error checking than fclose's. + + Copyright (C) 2006-2021 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + #include + int close_stream (FILE *stream); diff --git a/lib/copy-file-range.c b/lib/copy-file-range.c index e73c78b5aa..17df577055 100644 --- a/lib/copy-file-range.c +++ b/lib/copy-file-range.c @@ -1,17 +1,17 @@ /* Stub for copy_file_range Copyright 2019-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include diff --git a/lib/count-leading-zeros.c b/lib/count-leading-zeros.c index d0c0704f58..7cf1ac2ff0 100644 --- a/lib/count-leading-zeros.c +++ b/lib/count-leading-zeros.c @@ -1,3 +1,21 @@ +/* Count the number of leading 0 bits in a word. + + Copyright (C) 2012-2021 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + #include + #define COUNT_LEADING_ZEROS_INLINE _GL_EXTERN_INLINE #include "count-leading-zeros.h" diff --git a/lib/count-leading-zeros.h b/lib/count-leading-zeros.h index 575ec3b4d0..cef529ac13 100644 --- a/lib/count-leading-zeros.h +++ b/lib/count-leading-zeros.h @@ -1,17 +1,17 @@ /* count-leading-zeros.h -- counts the number of leading 0 bits in a word. Copyright (C) 2012-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Eric Blake. */ diff --git a/lib/count-one-bits.c b/lib/count-one-bits.c index 66341d77cd..d9b4f5e848 100644 --- a/lib/count-one-bits.c +++ b/lib/count-one-bits.c @@ -1,4 +1,22 @@ +/* Count the number of 1-bits in a word. + + Copyright (C) 2012-2021 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + #include + #define COUNT_ONE_BITS_INLINE _GL_EXTERN_INLINE #include "count-one-bits.h" diff --git a/lib/count-one-bits.h b/lib/count-one-bits.h index 1a14f11f15..5e87a572b0 100644 --- a/lib/count-one-bits.h +++ b/lib/count-one-bits.h @@ -1,17 +1,17 @@ /* count-one-bits.h -- counts the number of 1-bits in a word. Copyright (C) 2007-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Ben Pfaff. */ diff --git a/lib/count-trailing-zeros.c b/lib/count-trailing-zeros.c index f3da886742..538b01dc02 100644 --- a/lib/count-trailing-zeros.c +++ b/lib/count-trailing-zeros.c @@ -1,3 +1,21 @@ +/* Count the number of trailing 0 bits in a word. + + Copyright 2013-2021 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + #include + #define COUNT_TRAILING_ZEROS_INLINE _GL_EXTERN_INLINE #include "count-trailing-zeros.h" diff --git a/lib/count-trailing-zeros.h b/lib/count-trailing-zeros.h index 5a8ef563ea..f81674c571 100644 --- a/lib/count-trailing-zeros.h +++ b/lib/count-trailing-zeros.h @@ -1,17 +1,17 @@ /* count-trailing-zeros.h -- counts the number of trailing 0 bits in a word. Copyright 2013-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ diff --git a/lib/dirent.in.h b/lib/dirent.in.h index 4666972b15..4deb0cb466 100644 --- a/lib/dirent.in.h +++ b/lib/dirent.in.h @@ -1,17 +1,17 @@ /* A GNU-like . Copyright (C) 2006-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _@GUARD_PREFIX@_DIRENT_H @@ -55,6 +55,28 @@ typedef struct gl_directory DIR; # endif #endif +/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers + that can be freed by passing them as the Ith argument to the + function F. */ +#ifndef _GL_ATTRIBUTE_DEALLOC +# if __GNUC__ >= 11 +# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) +# else +# define _GL_ATTRIBUTE_DEALLOC(f, i) +# endif +#endif + +/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly + allocated memory. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_MALLOC +# if __GNUC__ >= 3 || defined __clang__ +# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +# else +# define _GL_ATTRIBUTE_MALLOC +# endif +#endif + /* The __attribute__ feature is available in gcc versions 2.5 and later. The attribute __pure__ was added in gcc 2.96. */ #ifndef _GL_ATTRIBUTE_PURE @@ -74,6 +96,30 @@ typedef struct gl_directory DIR; /* Declare overridden functions. */ +#if @GNULIB_CLOSEDIR@ +# if @REPLACE_CLOSEDIR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef closedir +# define closedir rpl_closedir +# define GNULIB_defined_closedir 1 +# endif +_GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (closedir, int, (DIR *dirp)); +# else +# if !@HAVE_CLOSEDIR@ +_GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (closedir, int, (DIR *dirp)); +# endif +_GL_CXXALIASWARN (closedir); +#elif defined GNULIB_POSIXCHECK +# undef closedir +# if HAVE_RAW_DECL_CLOSEDIR +_GL_WARN_ON_USE (closedir, "closedir is not portable - " + "use gnulib module closedir for portability"); +# endif +#endif + #if @GNULIB_OPENDIR@ # if @REPLACE_OPENDIR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -81,20 +127,36 @@ typedef struct gl_directory DIR; # define opendir rpl_opendir # define GNULIB_defined_opendir 1 # endif -_GL_FUNCDECL_RPL (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (opendir, DIR *, + (const char *dir_name) + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); _GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name)); # else -# if !@HAVE_OPENDIR@ -_GL_FUNCDECL_SYS (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1))); +# if !@HAVE_OPENDIR@ || __GNUC__ >= 11 +_GL_FUNCDECL_SYS (opendir, DIR *, + (const char *dir_name) + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); # endif _GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name)); # endif _GL_CXXALIASWARN (opendir); -#elif defined GNULIB_POSIXCHECK -# undef opendir -# if HAVE_RAW_DECL_OPENDIR +#else +# if @GNULIB_CLOSEDIR@ && __GNUC__ >= 11 && !defined opendir +/* For -Wmismatched-dealloc: Associate opendir with closedir or + rpl_closedir. */ +_GL_FUNCDECL_SYS (opendir, DIR *, + (const char *dir_name) + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); +# endif +# if defined GNULIB_POSIXCHECK +# undef opendir +# if HAVE_RAW_DECL_OPENDIR _GL_WARN_ON_USE (opendir, "opendir is not portable - " "use gnulib module opendir for portability"); +# endif # endif #endif @@ -126,30 +188,6 @@ _GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - " # endif #endif -#if @GNULIB_CLOSEDIR@ -# if @REPLACE_CLOSEDIR@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef closedir -# define closedir rpl_closedir -# define GNULIB_defined_closedir 1 -# endif -_GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (closedir, int, (DIR *dirp)); -# else -# if !@HAVE_CLOSEDIR@ -_GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (closedir, int, (DIR *dirp)); -# endif -_GL_CXXALIASWARN (closedir); -#elif defined GNULIB_POSIXCHECK -# undef closedir -# if HAVE_RAW_DECL_CLOSEDIR -_GL_WARN_ON_USE (closedir, "closedir is not portable - " - "use gnulib module closedir for portability"); -# endif -#endif - #if @GNULIB_DIRFD@ /* Return the file descriptor associated with the given directory stream, or -1 if none exists. */ @@ -200,20 +238,33 @@ _GL_WARN_ON_USE (dirfd, "dirfd is unportable - " # undef fdopendir # define fdopendir rpl_fdopendir # endif -_GL_FUNCDECL_RPL (fdopendir, DIR *, (int fd)); +_GL_FUNCDECL_RPL (fdopendir, DIR *, + (int fd) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); _GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd)); # else -# if !@HAVE_FDOPENDIR@ || !@HAVE_DECL_FDOPENDIR@ -_GL_FUNCDECL_SYS (fdopendir, DIR *, (int fd)); +# if !@HAVE_FDOPENDIR@ || !@HAVE_DECL_FDOPENDIR@ || __GNUC__ >= 11 +_GL_FUNCDECL_SYS (fdopendir, DIR *, + (int fd) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); # endif _GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd)); # endif _GL_CXXALIASWARN (fdopendir); -#elif defined GNULIB_POSIXCHECK -# undef fdopendir -# if HAVE_RAW_DECL_FDOPENDIR +#else +# if @GNULIB_CLOSEDIR@ && __GNUC__ >= 11 && !defined fdopendir +/* For -Wmismatched-dealloc: Associate fdopendir with closedir or + rpl_closedir. */ +_GL_FUNCDECL_SYS (fdopendir, DIR *, + (int fd) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); +# endif +# if defined GNULIB_POSIXCHECK +# undef fdopendir +# if HAVE_RAW_DECL_FDOPENDIR _GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - " "use gnulib module fdopendir for portability"); +# endif # endif #endif diff --git a/lib/dirfd.c b/lib/dirfd.c index ced7531c5e..640cb4ff13 100644 --- a/lib/dirfd.c +++ b/lib/dirfd.c @@ -2,17 +2,17 @@ Copyright (C) 2001, 2006, 2008-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Jim Meyering. */ diff --git a/lib/dtoastr.c b/lib/dtoastr.c index aed181d66b..5baba92922 100644 --- a/lib/dtoastr.c +++ b/lib/dtoastr.c @@ -1,2 +1,19 @@ +/* Convert 'double' to accurate string. + + Copyright (C) 2010-2021 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + #define LENGTH 2 #include "ftoastr.c" diff --git a/lib/dup2.c b/lib/dup2.c index c4a0a29fbd..53e5552132 100644 --- a/lib/dup2.c +++ b/lib/dup2.c @@ -2,17 +2,17 @@ Copyright (C) 1999, 2004-2007, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Paul Eggert */ diff --git a/lib/dynarray.h b/lib/dynarray.h index 6da3e87e55..ec64273b3a 100644 --- a/lib/dynarray.h +++ b/lib/dynarray.h @@ -1,31 +1,284 @@ /* Type-safe arrays which grow dynamically. Copyright 2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ -/* Written by Paul Eggert, 2021. */ +/* Written by Paul Eggert and Bruno Haible, 2021. */ #ifndef _GL_DYNARRAY_H #define _GL_DYNARRAY_H -#include +/* Before including this file, you need to define: + DYNARRAY_STRUCT + The struct tag of dynamic array to be defined. + + DYNARRAY_ELEMENT + The type name of the element type. Elements are copied + as if by memcpy, and can change address as the dynamic + array grows. + + DYNARRAY_PREFIX + The prefix of the functions which are defined. + + The following parameters are optional: + + DYNARRAY_ELEMENT_FREE + DYNARRAY_ELEMENT_FREE (E) is evaluated to deallocate the + contents of elements. E is of type DYNARRAY_ELEMENT *. + + DYNARRAY_ELEMENT_INIT + DYNARRAY_ELEMENT_INIT (E) is evaluated to initialize a new + element. E is of type DYNARRAY_ELEMENT *. + If DYNARRAY_ELEMENT_FREE but not DYNARRAY_ELEMENT_INIT is + defined, new elements are automatically zero-initialized. + Otherwise, new elements have undefined contents. + + DYNARRAY_INITIAL_SIZE + The size of the statically allocated array (default: + at least 2, more elements if they fit into 128 bytes). + Must be a preprocessor constant. If DYNARRAY_INITIAL_SIZE is 0, + there is no statically allocated array at, and all non-empty + arrays are heap-allocated. + + DYNARRAY_FINAL_TYPE + The name of the type which holds the final array. If not + defined, is PREFIX##finalize not provided. DYNARRAY_FINAL_TYPE + must be a struct type, with members of type DYNARRAY_ELEMENT and + size_t at the start (in this order). + + These macros are undefined after this header file has been + included. + + The following types are provided (their members are private to the + dynarray implementation): + + struct DYNARRAY_STRUCT + + The following functions are provided: + */ + +/* Initialize a dynamic array object. This must be called before any + use of the object. */ +#if 0 +static void + DYNARRAY_PREFIX##init (struct DYNARRAY_STRUCT *list); +#endif + +/* Deallocate the dynamic array and its elements. */ +#if 0 +static void + DYNARRAY_PREFIX##free (struct DYNARRAY_STRUCT *list); +#endif + +/* Return true if the dynamic array is in an error state. */ +#if 0 +static bool + DYNARRAY_PREFIX##has_failed (const struct DYNARRAY_STRUCT *list); +#endif + +/* Mark the dynamic array as failed. All elements are deallocated as + a side effect. */ +#if 0 +static void + DYNARRAY_PREFIX##mark_failed (struct DYNARRAY_STRUCT *list); +#endif + +/* Return the number of elements which have been added to the dynamic + array. */ +#if 0 +static size_t + DYNARRAY_PREFIX##size (const struct DYNARRAY_STRUCT *list); +#endif + +/* Return a pointer to the first array element, if any. For a + zero-length array, the pointer can be NULL even though the dynamic + array has not entered the failure state. */ +#if 0 +static DYNARRAY_ELEMENT * + DYNARRAY_PREFIX##begin (const struct DYNARRAY_STRUCT *list); +#endif + +/* Return a pointer one element past the last array element. For a + zero-length array, the pointer can be NULL even though the dynamic + array has not entered the failure state. */ +#if 0 +static DYNARRAY_ELEMENT * + DYNARRAY_PREFIX##end (const struct DYNARRAY_STRUCT *list); +#endif + +/* Return a pointer to the array element at INDEX. Terminate the + process if INDEX is out of bounds. */ +#if 0 +static DYNARRAY_ELEMENT * + DYNARRAY_PREFIX##at (struct DYNARRAY_STRUCT *list, size_t index); +#endif + +/* Add ITEM at the end of the array, enlarging it by one element. + Mark *LIST as failed if the dynamic array allocation size cannot be + increased. */ +#if 0 +static void + DYNARRAY_PREFIX##add (struct DYNARRAY_STRUCT *list, + DYNARRAY_ELEMENT item); +#endif + +/* Allocate a place for a new element in *LIST and return a pointer to + it. The pointer can be NULL if the dynamic array cannot be + enlarged due to a memory allocation failure. */ +#if 0 +static DYNARRAY_ELEMENT * + DYNARRAY_PREFIX##emplace (struct DYNARRAY_STRUCT *list); +#endif + +/* Change the size of *LIST to SIZE. If SIZE is larger than the + existing size, new elements are added (which can be initialized). + Otherwise, the list is truncated, and elements are freed. Return + false on memory allocation failure (and mark *LIST as failed). */ +#if 0 +static bool + DYNARRAY_PREFIX##resize (struct DYNARRAY_STRUCT *list, size_t size); +#endif + +/* Remove the last element of LIST if it is present. */ +#if 0 +static void + DYNARRAY_PREFIX##remove_last (struct DYNARRAY_STRUCT *list); +#endif + +/* Remove all elements from the list. The elements are freed, but the + list itself is not. */ +#if 0 +static void + DYNARRAY_PREFIX##clear (struct DYNARRAY_STRUCT *list); +#endif + +#if defined DYNARRAY_FINAL_TYPE +/* Transfer the dynamic array to a permanent location at *RESULT. + Returns true on success on false on allocation failure. In either + case, *LIST is re-initialized and can be reused. A NULL pointer is + stored in *RESULT if LIST refers to an empty list. On success, the + pointer in *RESULT is heap-allocated and must be deallocated using + free. */ +#if 0 +static bool + DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *list, + DYNARRAY_FINAL_TYPE *result); +#endif +#else /* !defined DYNARRAY_FINAL_TYPE */ +/* Transfer the dynamic array to a heap-allocated array and return a + pointer to it. The pointer is NULL if memory allocation fails, or + if the array is empty, so this function should be used only for + arrays which are known not be empty (usually because they always + have a sentinel at the end). If LENGTHP is not NULL, the array + length is written to *LENGTHP. *LIST is re-initialized and can be + reused. */ +#if 0 +static DYNARRAY_ELEMENT * + DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *list, + size_t *lengthp); +#endif +#endif + +/* A minimal example which provides a growing list of integers can be + defined like this: + + struct int_array + { + // Pointer to result array followed by its length, + // as required by DYNARRAY_FINAL_TYPE. + int *array; + size_t length; + }; + + #define DYNARRAY_STRUCT dynarray_int + #define DYNARRAY_ELEMENT int + #define DYNARRAY_PREFIX dynarray_int_ + #define DYNARRAY_FINAL_TYPE struct int_array + #include + + To create a three-element array with elements 1, 2, 3, use this + code: + + struct dynarray_int dyn; + dynarray_int_init (&dyn); + for (int i = 1; i <= 3; ++i) + { + int *place = dynarray_int_emplace (&dyn); + assert (place != NULL); + *place = i; + } + struct int_array result; + bool ok = dynarray_int_finalize (&dyn, &result); + assert (ok); + assert (result.length == 3); + assert (result.array[0] == 1); + assert (result.array[1] == 2); + assert (result.array[2] == 3); + free (result.array); + + If the elements contain resources which must be freed, define + DYNARRAY_ELEMENT_FREE appropriately, like this: + + struct str_array + { + char **array; + size_t length; + }; + + #define DYNARRAY_STRUCT dynarray_str + #define DYNARRAY_ELEMENT char * + #define DYNARRAY_ELEMENT_FREE(ptr) free (*ptr) + #define DYNARRAY_PREFIX dynarray_str_ + #define DYNARRAY_FINAL_TYPE struct str_array + #include + */ + + +/* The implementation is imported from glibc. */ + +/* Avoid possible conflicts with symbols exported by the GNU libc. */ #define __libc_dynarray_at_failure gl_dynarray_at_failure #define __libc_dynarray_emplace_enlarge gl_dynarray_emplace_enlarge #define __libc_dynarray_finalize gl_dynarray_finalize #define __libc_dynarray_resize_clear gl_dynarray_resize_clear #define __libc_dynarray_resize gl_dynarray_resize -#include + +#if defined DYNARRAY_STRUCT || defined DYNARRAY_ELEMENT || defined DYNARRAY_PREFIX + +# ifndef _GL_LIKELY +/* Rely on __builtin_expect, as provided by the module 'builtin-expect'. */ +# define _GL_LIKELY(cond) __builtin_expect ((cond), 1) +# define _GL_UNLIKELY(cond) __builtin_expect ((cond), 0) +# endif + +/* Define auxiliary structs and declare auxiliary functions, common to all + instantiations of dynarray. */ +# include + +/* Define the instantiation, specified through + DYNARRAY_STRUCT + DYNARRAY_ELEMENT + DYNARRAY_PREFIX + etc. */ +# include + +#else + +/* This file is being included from one of the malloc/dynarray_*.c files. */ +# include + +#endif #endif /* _GL_DYNARRAY_H */ diff --git a/lib/eloop-threshold.h b/lib/eloop-threshold.h index 27d07a7296..fcd30ab1e6 100644 --- a/lib/eloop-threshold.h +++ b/lib/eloop-threshold.h @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/errno.in.h b/lib/errno.in.h index c6ab4e88e1..3cad9e2d62 100644 --- a/lib/errno.in.h +++ b/lib/errno.in.h @@ -2,18 +2,18 @@ Copyright (C) 2008-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifndef _@GUARD_PREFIX@_ERRNO_H diff --git a/lib/euidaccess.c b/lib/euidaccess.c index ef65961d81..a86cebd179 100644 --- a/lib/euidaccess.c +++ b/lib/euidaccess.c @@ -5,17 +5,17 @@ This file is part of the GNU C Library. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by David MacKenzie and Torbjorn Granlund. diff --git a/lib/execinfo.c b/lib/execinfo.c index 0bcd9f078b..18a1051b25 100644 --- a/lib/execinfo.c +++ b/lib/execinfo.c @@ -1,3 +1,21 @@ +/* Information about executables. + + Copyright (C) 2012-2021 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + #include + #define _GL_EXECINFO_INLINE _GL_EXTERN_INLINE #include "execinfo.h" diff --git a/lib/execinfo.in.h b/lib/execinfo.in.h index 790bec087e..98bb8039b7 100644 --- a/lib/execinfo.in.h +++ b/lib/execinfo.in.h @@ -3,16 +3,16 @@ Copyright (C) 2012-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c index f50ed0875d..2906c04d0f 100644 --- a/lib/explicit_bzero.c +++ b/lib/explicit_bzero.c @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/fcntl.c b/lib/fcntl.c index 9d6b10fa30..c744eb91e6 100644 --- a/lib/fcntl.c +++ b/lib/fcntl.c @@ -2,17 +2,17 @@ Copyright (C) 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Eric Blake . */ diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index 0b14467c54..26dedc3041 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -2,17 +2,17 @@ Copyright (C) 2006-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Paul Eggert */ diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c index c667ae9d24..800af227cc 100644 --- a/lib/file-has-acl.c +++ b/lib/file-has-acl.c @@ -1,6 +1,6 @@ /* Test whether a file has a nontrivial ACL. -*- coding: utf-8 -*- - Copyright (C) 2002-2003, 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -206,9 +206,7 @@ file_has_acl (char const *name, struct stat const *sb) ; else { - int saved_errno = errno; free (malloced); - errno = saved_errno; return -1; } } @@ -281,9 +279,7 @@ file_has_acl (char const *name, struct stat const *sb) ; else { - int saved_errno = errno; free (malloced); - errno = saved_errno; return -1; } } @@ -353,7 +349,7 @@ file_has_acl (char const *name, struct stat const *sb) { struct stat statbuf; - if (stat (name, &statbuf) < 0) + if (stat (name, &statbuf) == -1 && errno != EOVERFLOW) return -1; return acl_nontrivial (count, entries); @@ -418,11 +414,7 @@ file_has_acl (char const *name, struct stat const *sb) if (errno != ENOSPC) { if (acl != aclbuf) - { - int saved_errno = errno; - free (acl); - errno = saved_errno; - } + free (acl); return -1; } aclsize = 2 * aclsize; diff --git a/lib/filename.h b/lib/filename.h index 541ffec0d5..dafe3dfddb 100644 --- a/lib/filename.h +++ b/lib/filename.h @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/filevercmp.c b/lib/filevercmp.c index 6b7226de6c..fca23ec4fc 100644 --- a/lib/filevercmp.c +++ b/lib/filevercmp.c @@ -3,18 +3,18 @@ Copyright (C) 2001 Anthony Towns Copyright (C) 2008-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #include #include "filevercmp.h" diff --git a/lib/filevercmp.h b/lib/filevercmp.h index 5de212f436..c210452938 100644 --- a/lib/filevercmp.h +++ b/lib/filevercmp.h @@ -3,18 +3,18 @@ Copyright (C) 2001 Anthony Towns Copyright (C) 2008-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifndef FILEVERCMP_H #define FILEVERCMP_H diff --git a/lib/flexmember.h b/lib/flexmember.h index 9f6e1bf110..1b19a2bfd9 100644 --- a/lib/flexmember.h +++ b/lib/flexmember.h @@ -5,16 +5,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . diff --git a/lib/free.c b/lib/free.c index 5c89787aba..780f03dd11 100644 --- a/lib/free.c +++ b/lib/free.c @@ -2,32 +2,36 @@ Copyright (C) 2003, 2006, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Paul Eggert */ #include +/* Specification. */ #include -#include +/* A function definition is only needed if HAVE_FREE_POSIX is not defined. */ +#if !HAVE_FREE_POSIX + +# include void rpl_free (void *p) -#undef free +# undef free { -#if defined __GNUC__ && !defined __clang__ +# if defined __GNUC__ && !defined __clang__ /* An invalid GCC optimization would optimize away the assignments in the code below, when link-time @@ -39,9 +43,11 @@ rpl_free (void *p) errno = 0; free (p); errno = err[errno == 0]; -#else +# else int err = errno; free (p); errno = err; -#endif +# endif } + +#endif diff --git a/lib/fsusage.c b/lib/fsusage.c index 35de136cd8..740cdc219a 100644 --- a/lib/fsusage.c +++ b/lib/fsusage.c @@ -3,17 +3,17 @@ Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include diff --git a/lib/fsusage.h b/lib/fsusage.h index e0657b3651..b3f58d9994 100644 --- a/lib/fsusage.h +++ b/lib/fsusage.h @@ -3,17 +3,17 @@ Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Space usage statistics for a file system. Blocks are 512-byte. */ diff --git a/lib/fsync.c b/lib/fsync.c index a5280f281c..99a932d770 100644 --- a/lib/fsync.c +++ b/lib/fsync.c @@ -9,17 +9,17 @@ Copyright (C) 2008-2021 Free Software Foundation, Inc. - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This file 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. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include diff --git a/lib/futimens.c b/lib/futimens.c index 99eaba95df..273cc87187 100644 --- a/lib/futimens.c +++ b/lib/futimens.c @@ -1,17 +1,17 @@ /* Set the access and modification time of an open fd. Copyright (C) 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Eric Blake */ diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c index 56eaf5d32c..5006c2d5c5 100644 --- a/lib/getdtablesize.c +++ b/lib/getdtablesize.c @@ -2,17 +2,17 @@ Copyright (C) 2008-2021 Free Software Foundation, Inc. Written by Bruno Haible , 2008. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include diff --git a/lib/getgroups.c b/lib/getgroups.c index af602a74d3..96665257f2 100644 --- a/lib/getgroups.c +++ b/lib/getgroups.c @@ -2,17 +2,17 @@ Copyright (C) 1996, 1999, 2003, 2006-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Jim Meyering */ @@ -30,7 +30,7 @@ /* Provide a stub that fails with ENOSYS, since there is no group information available on mingw. */ int -getgroups (int n _GL_UNUSED, GETGROUPS_T *groups _GL_UNUSED) +getgroups (_GL_UNUSED int n, _GL_UNUSED GETGROUPS_T *groups) { errno = ENOSYS; return -1; @@ -70,7 +70,6 @@ rpl_getgroups (int n, gid_t *group) { int n_groups; GETGROUPS_T *gbuf; - int saved_errno; if (n < 0) { @@ -99,9 +98,7 @@ rpl_getgroups (int n, gid_t *group) while (n--) group[n] = gbuf[n]; } - saved_errno = errno; free (gbuf); - errno = saved_errno; return result; } @@ -121,10 +118,7 @@ rpl_getgroups (int n, gid_t *group) n *= 2; } - saved_errno = errno; free (gbuf); - errno = saved_errno; - return n_groups; } diff --git a/lib/getopt-cdefs.in.h b/lib/getopt-cdefs.in.h index 11fe536ff2..33e3d4b3d8 100644 --- a/lib/getopt-cdefs.in.h +++ b/lib/getopt-cdefs.in.h @@ -4,19 +4,18 @@ Unlike most of the getopt implementation, it is NOT shared with the GNU C Library. - This file is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 3 of - the License, or (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This file 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. + This file 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 Lesser General Public License for more details. - You should have received a copy of the GNU General Public - License along with gnulib; if not, see - . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifndef _GETOPT_CDEFS_H #define _GETOPT_CDEFS_H 1 diff --git a/lib/getopt-core.h b/lib/getopt-core.h index 05d16b0740..ceb14d0597 100644 --- a/lib/getopt-core.h +++ b/lib/getopt-core.h @@ -4,16 +4,16 @@ Patches to this file should be submitted to both projects. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/getopt-ext.h b/lib/getopt-ext.h index 9b11b47f0f..f82a8c6129 100644 --- a/lib/getopt-ext.h +++ b/lib/getopt-ext.h @@ -4,16 +4,16 @@ Patches to this file should be submitted to both projects. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/getopt-pfx-core.h b/lib/getopt-pfx-core.h index 78990a345a..b1733a3497 100644 --- a/lib/getopt-pfx-core.h +++ b/lib/getopt-pfx-core.h @@ -4,19 +4,18 @@ Unlike most of the getopt implementation, it is NOT shared with the GNU C Library. - This file is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 3 of - the License, or (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This file 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. + This file 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 Lesser General Public License for more details. - You should have received a copy of the GNU General Public - License along with gnulib; if not, see - . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifndef _GETOPT_PFX_CORE_H #define _GETOPT_PFX_CORE_H 1 diff --git a/lib/getopt-pfx-ext.h b/lib/getopt-pfx-ext.h index 61ea8d2b1d..b9a14ba05a 100644 --- a/lib/getopt-pfx-ext.h +++ b/lib/getopt-pfx-ext.h @@ -4,19 +4,18 @@ Unlike most of the getopt implementation, it is NOT shared with the GNU C Library. - This file is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 3 of - the License, or (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This file 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. + This file 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 Lesser General Public License for more details. - You should have received a copy of the GNU General Public - License along with gnulib; if not, see - . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifndef _GETOPT_PFX_EXT_H #define _GETOPT_PFX_EXT_H 1 diff --git a/lib/getopt.c b/lib/getopt.c index dd96c18407..7f3aa5aa3d 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -4,16 +4,16 @@ Patches to this file should be submitted to both projects. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ @@ -378,8 +378,8 @@ process_long_option (int argc, char **argv, const char *optstring, /* Initialize internal data upon the first call to getopt. */ static const char * -_getopt_initialize (int argc _GL_UNUSED, - char **argv _GL_UNUSED, const char *optstring, +_getopt_initialize (_GL_UNUSED int argc, + _GL_UNUSED char **argv, const char *optstring, struct _getopt_data *d, int posixly_correct) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 diff --git a/lib/getopt.in.h b/lib/getopt.in.h index 541fb9da2e..bf884f0322 100644 --- a/lib/getopt.in.h +++ b/lib/getopt.in.h @@ -5,18 +5,18 @@ with the GNU C Library, which supplies a different version of this file. - This file is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 3 of - the License, or (at your option) any later version. - - This file 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 gnulib; if not, see . */ + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifndef _@GUARD_PREFIX@_GETOPT_H diff --git a/lib/getopt1.c b/lib/getopt1.c index ca24eb811f..5a928062fd 100644 --- a/lib/getopt1.c +++ b/lib/getopt1.c @@ -4,16 +4,16 @@ Patches to this file should be submitted to both projects. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/getopt_int.h b/lib/getopt_int.h index b70ff5badf..91254e487d 100644 --- a/lib/getopt_int.h +++ b/lib/getopt_int.h @@ -4,16 +4,16 @@ Patches to this file should be submitted to both projects. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/getrandom.c b/lib/getrandom.c index 41212fb329..a186c4d3bd 100644 --- a/lib/getrandom.c +++ b/lib/getrandom.c @@ -2,17 +2,17 @@ Copyright 2020-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ @@ -178,7 +178,11 @@ getrandom (void *buffer, size_t length, unsigned int flags) + (flags & GRND_NONBLOCK ? O_NONBLOCK : 0)); fd = open (randdevice[devrandom], oflags); if (fd < 0) - return fd; + { + if (errno == ENOENT || errno == ENOTDIR) + errno = ENOSYS; + return -1; + } randfd[devrandom] = fd; } diff --git a/lib/gettext.h b/lib/gettext.h index 3552157efd..f1c7a24075 100644 --- a/lib/gettext.h +++ b/lib/gettext.h @@ -2,18 +2,18 @@ Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 diff --git a/lib/gettime.c b/lib/gettime.c index fb721b2cda..8f28a32df1 100644 --- a/lib/gettime.c +++ b/lib/gettime.c @@ -2,17 +2,17 @@ Copyright (C) 2002, 2004-2007, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c index b1c93e1c3a..2a222fc5b7 100644 --- a/lib/gettimeofday.c +++ b/lib/gettimeofday.c @@ -2,18 +2,18 @@ Copyright (C) 2001-2003, 2005-2007, 2009-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* written by Jim Meyering */ diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 0b9aaf6d9e..584c7141d8 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -41,7 +41,6 @@ # --avoid=fstat \ # --avoid=langinfo \ # --avoid=lock \ -# --avoid=malloc-posix \ # --avoid=mbrtowc \ # --avoid=mbsinit \ # --avoid=memchr \ @@ -172,9 +171,7 @@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ ALSA_CFLAGS = @ALSA_CFLAGS@ ALSA_LIBS = @ALSA_LIBS@ -AM_DEFAULT_V = @AM_DEFAULT_V@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AM_V = @AM_V@ APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@ AR = @AR@ ARFLAGS = @ARFLAGS@ @@ -213,6 +210,7 @@ DEFS = @DEFS@ DESLIB = @DESLIB@ DOCMISC_W32 = @DOCMISC_W32@ DUMPING = @DUMPING@ +DYNLIB_OBJ = @DYNLIB_OBJ@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -255,297 +253,300 @@ GL_GENERATE_MINI_GMP_H = @GL_GENERATE_MINI_GMP_H@ GL_GENERATE_STDALIGN_H = @GL_GENERATE_STDALIGN_H@ GL_GENERATE_STDDEF_H = @GL_GENERATE_STDDEF_H@ GL_GENERATE_STDINT_H = @GL_GENERATE_STDINT_H@ +GL_GNULIB_ACCESS = @GL_GNULIB_ACCESS@ +GL_GNULIB_ALIGNED_ALLOC = @GL_GNULIB_ALIGNED_ALLOC@ +GL_GNULIB_ALPHASORT = @GL_GNULIB_ALPHASORT@ +GL_GNULIB_ATOLL = @GL_GNULIB_ATOLL@ +GL_GNULIB_CALLOC_POSIX = @GL_GNULIB_CALLOC_POSIX@ +GL_GNULIB_CANONICALIZE_FILE_NAME = @GL_GNULIB_CANONICALIZE_FILE_NAME@ +GL_GNULIB_CHDIR = @GL_GNULIB_CHDIR@ +GL_GNULIB_CHOWN = @GL_GNULIB_CHOWN@ +GL_GNULIB_CLOSE = @GL_GNULIB_CLOSE@ +GL_GNULIB_CLOSEDIR = @GL_GNULIB_CLOSEDIR@ +GL_GNULIB_COPY_FILE_RANGE = @GL_GNULIB_COPY_FILE_RANGE@ +GL_GNULIB_CREAT = @GL_GNULIB_CREAT@ +GL_GNULIB_CTIME = @GL_GNULIB_CTIME@ +GL_GNULIB_DIRFD = @GL_GNULIB_DIRFD@ +GL_GNULIB_DPRINTF = @GL_GNULIB_DPRINTF@ +GL_GNULIB_DUP = @GL_GNULIB_DUP@ +GL_GNULIB_DUP2 = @GL_GNULIB_DUP2@ +GL_GNULIB_DUP3 = @GL_GNULIB_DUP3@ +GL_GNULIB_ENVIRON = @GL_GNULIB_ENVIRON@ +GL_GNULIB_EUIDACCESS = @GL_GNULIB_EUIDACCESS@ +GL_GNULIB_EXECL = @GL_GNULIB_EXECL@ +GL_GNULIB_EXECLE = @GL_GNULIB_EXECLE@ +GL_GNULIB_EXECLP = @GL_GNULIB_EXECLP@ +GL_GNULIB_EXECV = @GL_GNULIB_EXECV@ +GL_GNULIB_EXECVE = @GL_GNULIB_EXECVE@ +GL_GNULIB_EXECVP = @GL_GNULIB_EXECVP@ +GL_GNULIB_EXECVPE = @GL_GNULIB_EXECVPE@ +GL_GNULIB_EXPLICIT_BZERO = @GL_GNULIB_EXPLICIT_BZERO@ +GL_GNULIB_FACCESSAT = @GL_GNULIB_FACCESSAT@ +GL_GNULIB_FCHDIR = @GL_GNULIB_FCHDIR@ +GL_GNULIB_FCHMODAT = @GL_GNULIB_FCHMODAT@ +GL_GNULIB_FCHOWNAT = @GL_GNULIB_FCHOWNAT@ +GL_GNULIB_FCLOSE = @GL_GNULIB_FCLOSE@ +GL_GNULIB_FCNTL = @GL_GNULIB_FCNTL@ +GL_GNULIB_FDATASYNC = @GL_GNULIB_FDATASYNC@ +GL_GNULIB_FDOPEN = @GL_GNULIB_FDOPEN@ +GL_GNULIB_FDOPENDIR = @GL_GNULIB_FDOPENDIR@ +GL_GNULIB_FFLUSH = @GL_GNULIB_FFLUSH@ +GL_GNULIB_FFSL = @GL_GNULIB_FFSL@ +GL_GNULIB_FFSLL = @GL_GNULIB_FFSLL@ +GL_GNULIB_FGETC = @GL_GNULIB_FGETC@ +GL_GNULIB_FGETS = @GL_GNULIB_FGETS@ +GL_GNULIB_FOPEN = @GL_GNULIB_FOPEN@ +GL_GNULIB_FPRINTF = @GL_GNULIB_FPRINTF@ +GL_GNULIB_FPRINTF_POSIX = @GL_GNULIB_FPRINTF_POSIX@ +GL_GNULIB_FPURGE = @GL_GNULIB_FPURGE@ +GL_GNULIB_FPUTC = @GL_GNULIB_FPUTC@ +GL_GNULIB_FPUTS = @GL_GNULIB_FPUTS@ +GL_GNULIB_FREAD = @GL_GNULIB_FREAD@ +GL_GNULIB_FREE_POSIX = @GL_GNULIB_FREE_POSIX@ +GL_GNULIB_FREOPEN = @GL_GNULIB_FREOPEN@ +GL_GNULIB_FSCANF = @GL_GNULIB_FSCANF@ +GL_GNULIB_FSEEK = @GL_GNULIB_FSEEK@ +GL_GNULIB_FSEEKO = @GL_GNULIB_FSEEKO@ +GL_GNULIB_FSTAT = @GL_GNULIB_FSTAT@ +GL_GNULIB_FSTATAT = @GL_GNULIB_FSTATAT@ +GL_GNULIB_FSYNC = @GL_GNULIB_FSYNC@ +GL_GNULIB_FTELL = @GL_GNULIB_FTELL@ +GL_GNULIB_FTELLO = @GL_GNULIB_FTELLO@ +GL_GNULIB_FTRUNCATE = @GL_GNULIB_FTRUNCATE@ +GL_GNULIB_FUTIMENS = @GL_GNULIB_FUTIMENS@ +GL_GNULIB_FWRITE = @GL_GNULIB_FWRITE@ +GL_GNULIB_GETC = @GL_GNULIB_GETC@ +GL_GNULIB_GETCHAR = @GL_GNULIB_GETCHAR@ +GL_GNULIB_GETCWD = @GL_GNULIB_GETCWD@ +GL_GNULIB_GETDELIM = @GL_GNULIB_GETDELIM@ +GL_GNULIB_GETDOMAINNAME = @GL_GNULIB_GETDOMAINNAME@ +GL_GNULIB_GETDTABLESIZE = @GL_GNULIB_GETDTABLESIZE@ +GL_GNULIB_GETENTROPY = @GL_GNULIB_GETENTROPY@ +GL_GNULIB_GETGROUPS = @GL_GNULIB_GETGROUPS@ +GL_GNULIB_GETHOSTNAME = @GL_GNULIB_GETHOSTNAME@ +GL_GNULIB_GETLINE = @GL_GNULIB_GETLINE@ +GL_GNULIB_GETLOADAVG = @GL_GNULIB_GETLOADAVG@ +GL_GNULIB_GETLOGIN = @GL_GNULIB_GETLOGIN@ +GL_GNULIB_GETLOGIN_R = @GL_GNULIB_GETLOGIN_R@ +GL_GNULIB_GETOPT_POSIX = @GL_GNULIB_GETOPT_POSIX@ +GL_GNULIB_GETPAGESIZE = @GL_GNULIB_GETPAGESIZE@ +GL_GNULIB_GETPASS = @GL_GNULIB_GETPASS@ +GL_GNULIB_GETRANDOM = @GL_GNULIB_GETRANDOM@ +GL_GNULIB_GETSUBOPT = @GL_GNULIB_GETSUBOPT@ +GL_GNULIB_GETTIMEOFDAY = @GL_GNULIB_GETTIMEOFDAY@ +GL_GNULIB_GETUMASK = @GL_GNULIB_GETUMASK@ +GL_GNULIB_GETUSERSHELL = @GL_GNULIB_GETUSERSHELL@ +GL_GNULIB_GRANTPT = @GL_GNULIB_GRANTPT@ +GL_GNULIB_GROUP_MEMBER = @GL_GNULIB_GROUP_MEMBER@ +GL_GNULIB_IMAXABS = @GL_GNULIB_IMAXABS@ +GL_GNULIB_IMAXDIV = @GL_GNULIB_IMAXDIV@ +GL_GNULIB_ISATTY = @GL_GNULIB_ISATTY@ +GL_GNULIB_LCHMOD = @GL_GNULIB_LCHMOD@ +GL_GNULIB_LCHOWN = @GL_GNULIB_LCHOWN@ +GL_GNULIB_LINK = @GL_GNULIB_LINK@ +GL_GNULIB_LINKAT = @GL_GNULIB_LINKAT@ +GL_GNULIB_LOCALTIME = @GL_GNULIB_LOCALTIME@ +GL_GNULIB_LSEEK = @GL_GNULIB_LSEEK@ +GL_GNULIB_LSTAT = @GL_GNULIB_LSTAT@ +GL_GNULIB_MALLOC_POSIX = @GL_GNULIB_MALLOC_POSIX@ +GL_GNULIB_MBSCASECMP = @GL_GNULIB_MBSCASECMP@ +GL_GNULIB_MBSCASESTR = @GL_GNULIB_MBSCASESTR@ +GL_GNULIB_MBSCHR = @GL_GNULIB_MBSCHR@ +GL_GNULIB_MBSCSPN = @GL_GNULIB_MBSCSPN@ +GL_GNULIB_MBSLEN = @GL_GNULIB_MBSLEN@ +GL_GNULIB_MBSNCASECMP = @GL_GNULIB_MBSNCASECMP@ +GL_GNULIB_MBSNLEN = @GL_GNULIB_MBSNLEN@ +GL_GNULIB_MBSPBRK = @GL_GNULIB_MBSPBRK@ +GL_GNULIB_MBSPCASECMP = @GL_GNULIB_MBSPCASECMP@ +GL_GNULIB_MBSRCHR = @GL_GNULIB_MBSRCHR@ +GL_GNULIB_MBSSEP = @GL_GNULIB_MBSSEP@ +GL_GNULIB_MBSSPN = @GL_GNULIB_MBSSPN@ +GL_GNULIB_MBSSTR = @GL_GNULIB_MBSSTR@ +GL_GNULIB_MBSTOK_R = @GL_GNULIB_MBSTOK_R@ +GL_GNULIB_MBTOWC = @GL_GNULIB_MBTOWC@ +GL_GNULIB_MDA_ACCESS = @GL_GNULIB_MDA_ACCESS@ +GL_GNULIB_MDA_CHDIR = @GL_GNULIB_MDA_CHDIR@ +GL_GNULIB_MDA_CHMOD = @GL_GNULIB_MDA_CHMOD@ +GL_GNULIB_MDA_CLOSE = @GL_GNULIB_MDA_CLOSE@ +GL_GNULIB_MDA_CREAT = @GL_GNULIB_MDA_CREAT@ +GL_GNULIB_MDA_DUP = @GL_GNULIB_MDA_DUP@ +GL_GNULIB_MDA_DUP2 = @GL_GNULIB_MDA_DUP2@ +GL_GNULIB_MDA_ECVT = @GL_GNULIB_MDA_ECVT@ +GL_GNULIB_MDA_EXECL = @GL_GNULIB_MDA_EXECL@ +GL_GNULIB_MDA_EXECLE = @GL_GNULIB_MDA_EXECLE@ +GL_GNULIB_MDA_EXECLP = @GL_GNULIB_MDA_EXECLP@ +GL_GNULIB_MDA_EXECV = @GL_GNULIB_MDA_EXECV@ +GL_GNULIB_MDA_EXECVE = @GL_GNULIB_MDA_EXECVE@ +GL_GNULIB_MDA_EXECVP = @GL_GNULIB_MDA_EXECVP@ +GL_GNULIB_MDA_EXECVPE = @GL_GNULIB_MDA_EXECVPE@ +GL_GNULIB_MDA_FCLOSEALL = @GL_GNULIB_MDA_FCLOSEALL@ +GL_GNULIB_MDA_FCVT = @GL_GNULIB_MDA_FCVT@ +GL_GNULIB_MDA_FDOPEN = @GL_GNULIB_MDA_FDOPEN@ +GL_GNULIB_MDA_FILENO = @GL_GNULIB_MDA_FILENO@ +GL_GNULIB_MDA_GCVT = @GL_GNULIB_MDA_GCVT@ +GL_GNULIB_MDA_GETCWD = @GL_GNULIB_MDA_GETCWD@ +GL_GNULIB_MDA_GETPID = @GL_GNULIB_MDA_GETPID@ +GL_GNULIB_MDA_GETW = @GL_GNULIB_MDA_GETW@ +GL_GNULIB_MDA_ISATTY = @GL_GNULIB_MDA_ISATTY@ +GL_GNULIB_MDA_LSEEK = @GL_GNULIB_MDA_LSEEK@ +GL_GNULIB_MDA_MEMCCPY = @GL_GNULIB_MDA_MEMCCPY@ +GL_GNULIB_MDA_MKDIR = @GL_GNULIB_MDA_MKDIR@ +GL_GNULIB_MDA_MKTEMP = @GL_GNULIB_MDA_MKTEMP@ +GL_GNULIB_MDA_OPEN = @GL_GNULIB_MDA_OPEN@ +GL_GNULIB_MDA_PUTENV = @GL_GNULIB_MDA_PUTENV@ +GL_GNULIB_MDA_PUTW = @GL_GNULIB_MDA_PUTW@ +GL_GNULIB_MDA_READ = @GL_GNULIB_MDA_READ@ +GL_GNULIB_MDA_RMDIR = @GL_GNULIB_MDA_RMDIR@ +GL_GNULIB_MDA_STRDUP = @GL_GNULIB_MDA_STRDUP@ +GL_GNULIB_MDA_SWAB = @GL_GNULIB_MDA_SWAB@ +GL_GNULIB_MDA_TEMPNAM = @GL_GNULIB_MDA_TEMPNAM@ +GL_GNULIB_MDA_TZSET = @GL_GNULIB_MDA_TZSET@ +GL_GNULIB_MDA_UMASK = @GL_GNULIB_MDA_UMASK@ +GL_GNULIB_MDA_UNLINK = @GL_GNULIB_MDA_UNLINK@ +GL_GNULIB_MDA_WRITE = @GL_GNULIB_MDA_WRITE@ +GL_GNULIB_MEMCHR = @GL_GNULIB_MEMCHR@ +GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@ +GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@ +GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@ +GL_GNULIB_MKDIR = @GL_GNULIB_MKDIR@ +GL_GNULIB_MKDIRAT = @GL_GNULIB_MKDIRAT@ +GL_GNULIB_MKDTEMP = @GL_GNULIB_MKDTEMP@ +GL_GNULIB_MKFIFO = @GL_GNULIB_MKFIFO@ +GL_GNULIB_MKFIFOAT = @GL_GNULIB_MKFIFOAT@ +GL_GNULIB_MKNOD = @GL_GNULIB_MKNOD@ +GL_GNULIB_MKNODAT = @GL_GNULIB_MKNODAT@ +GL_GNULIB_MKOSTEMP = @GL_GNULIB_MKOSTEMP@ +GL_GNULIB_MKOSTEMPS = @GL_GNULIB_MKOSTEMPS@ +GL_GNULIB_MKSTEMP = @GL_GNULIB_MKSTEMP@ +GL_GNULIB_MKSTEMPS = @GL_GNULIB_MKSTEMPS@ +GL_GNULIB_MKTIME = @GL_GNULIB_MKTIME@ +GL_GNULIB_NANOSLEEP = @GL_GNULIB_NANOSLEEP@ +GL_GNULIB_NONBLOCKING = @GL_GNULIB_NONBLOCKING@ +GL_GNULIB_OBSTACK_PRINTF = @GL_GNULIB_OBSTACK_PRINTF@ +GL_GNULIB_OBSTACK_PRINTF_POSIX = @GL_GNULIB_OBSTACK_PRINTF_POSIX@ +GL_GNULIB_OPEN = @GL_GNULIB_OPEN@ +GL_GNULIB_OPENAT = @GL_GNULIB_OPENAT@ +GL_GNULIB_OPENDIR = @GL_GNULIB_OPENDIR@ +GL_GNULIB_OVERRIDES_STRUCT_STAT = @GL_GNULIB_OVERRIDES_STRUCT_STAT@ +GL_GNULIB_PCLOSE = @GL_GNULIB_PCLOSE@ +GL_GNULIB_PERROR = @GL_GNULIB_PERROR@ +GL_GNULIB_PIPE = @GL_GNULIB_PIPE@ +GL_GNULIB_PIPE2 = @GL_GNULIB_PIPE2@ +GL_GNULIB_POPEN = @GL_GNULIB_POPEN@ +GL_GNULIB_POSIX_MEMALIGN = @GL_GNULIB_POSIX_MEMALIGN@ +GL_GNULIB_POSIX_OPENPT = @GL_GNULIB_POSIX_OPENPT@ +GL_GNULIB_PREAD = @GL_GNULIB_PREAD@ +GL_GNULIB_PRINTF = @GL_GNULIB_PRINTF@ +GL_GNULIB_PRINTF_POSIX = @GL_GNULIB_PRINTF_POSIX@ +GL_GNULIB_PSELECT = @GL_GNULIB_PSELECT@ +GL_GNULIB_PTHREAD_SIGMASK = @GL_GNULIB_PTHREAD_SIGMASK@ +GL_GNULIB_PTSNAME = @GL_GNULIB_PTSNAME@ +GL_GNULIB_PTSNAME_R = @GL_GNULIB_PTSNAME_R@ +GL_GNULIB_PUTC = @GL_GNULIB_PUTC@ +GL_GNULIB_PUTCHAR = @GL_GNULIB_PUTCHAR@ +GL_GNULIB_PUTENV = @GL_GNULIB_PUTENV@ +GL_GNULIB_PUTS = @GL_GNULIB_PUTS@ +GL_GNULIB_PWRITE = @GL_GNULIB_PWRITE@ +GL_GNULIB_QSORT_R = @GL_GNULIB_QSORT_R@ +GL_GNULIB_RAISE = @GL_GNULIB_RAISE@ +GL_GNULIB_RANDOM = @GL_GNULIB_RANDOM@ +GL_GNULIB_RANDOM_R = @GL_GNULIB_RANDOM_R@ +GL_GNULIB_RAWMEMCHR = @GL_GNULIB_RAWMEMCHR@ +GL_GNULIB_READ = @GL_GNULIB_READ@ +GL_GNULIB_READDIR = @GL_GNULIB_READDIR@ +GL_GNULIB_READLINK = @GL_GNULIB_READLINK@ +GL_GNULIB_READLINKAT = @GL_GNULIB_READLINKAT@ +GL_GNULIB_REALLOCARRAY = @GL_GNULIB_REALLOCARRAY@ +GL_GNULIB_REALLOC_POSIX = @GL_GNULIB_REALLOC_POSIX@ +GL_GNULIB_REALPATH = @GL_GNULIB_REALPATH@ +GL_GNULIB_REMOVE = @GL_GNULIB_REMOVE@ +GL_GNULIB_RENAME = @GL_GNULIB_RENAME@ +GL_GNULIB_RENAMEAT = @GL_GNULIB_RENAMEAT@ +GL_GNULIB_REWINDDIR = @GL_GNULIB_REWINDDIR@ +GL_GNULIB_RMDIR = @GL_GNULIB_RMDIR@ +GL_GNULIB_RPMATCH = @GL_GNULIB_RPMATCH@ +GL_GNULIB_SCANDIR = @GL_GNULIB_SCANDIR@ +GL_GNULIB_SCANF = @GL_GNULIB_SCANF@ +GL_GNULIB_SECURE_GETENV = @GL_GNULIB_SECURE_GETENV@ +GL_GNULIB_SELECT = @GL_GNULIB_SELECT@ +GL_GNULIB_SETENV = @GL_GNULIB_SETENV@ +GL_GNULIB_SETHOSTNAME = @GL_GNULIB_SETHOSTNAME@ +GL_GNULIB_SIGABBREV_NP = @GL_GNULIB_SIGABBREV_NP@ +GL_GNULIB_SIGACTION = @GL_GNULIB_SIGACTION@ +GL_GNULIB_SIGDESCR_NP = @GL_GNULIB_SIGDESCR_NP@ +GL_GNULIB_SIGNAL_H_SIGPIPE = @GL_GNULIB_SIGNAL_H_SIGPIPE@ +GL_GNULIB_SIGPROCMASK = @GL_GNULIB_SIGPROCMASK@ +GL_GNULIB_SLEEP = @GL_GNULIB_SLEEP@ +GL_GNULIB_SNPRINTF = @GL_GNULIB_SNPRINTF@ +GL_GNULIB_SPRINTF_POSIX = @GL_GNULIB_SPRINTF_POSIX@ +GL_GNULIB_STAT = @GL_GNULIB_STAT@ +GL_GNULIB_STDIO_H_NONBLOCKING = @GL_GNULIB_STDIO_H_NONBLOCKING@ +GL_GNULIB_STDIO_H_SIGPIPE = @GL_GNULIB_STDIO_H_SIGPIPE@ +GL_GNULIB_STPCPY = @GL_GNULIB_STPCPY@ +GL_GNULIB_STPNCPY = @GL_GNULIB_STPNCPY@ +GL_GNULIB_STRCASESTR = @GL_GNULIB_STRCASESTR@ +GL_GNULIB_STRCHRNUL = @GL_GNULIB_STRCHRNUL@ +GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@ +GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@ +GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@ +GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@ +GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@ +GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@ +GL_GNULIB_STRNDUP = @GL_GNULIB_STRNDUP@ +GL_GNULIB_STRNLEN = @GL_GNULIB_STRNLEN@ +GL_GNULIB_STRPBRK = @GL_GNULIB_STRPBRK@ +GL_GNULIB_STRPTIME = @GL_GNULIB_STRPTIME@ +GL_GNULIB_STRSEP = @GL_GNULIB_STRSEP@ +GL_GNULIB_STRSIGNAL = @GL_GNULIB_STRSIGNAL@ +GL_GNULIB_STRSTR = @GL_GNULIB_STRSTR@ +GL_GNULIB_STRTOD = @GL_GNULIB_STRTOD@ +GL_GNULIB_STRTOIMAX = @GL_GNULIB_STRTOIMAX@ +GL_GNULIB_STRTOK_R = @GL_GNULIB_STRTOK_R@ +GL_GNULIB_STRTOL = @GL_GNULIB_STRTOL@ +GL_GNULIB_STRTOLD = @GL_GNULIB_STRTOLD@ +GL_GNULIB_STRTOLL = @GL_GNULIB_STRTOLL@ +GL_GNULIB_STRTOUL = @GL_GNULIB_STRTOUL@ +GL_GNULIB_STRTOULL = @GL_GNULIB_STRTOULL@ +GL_GNULIB_STRTOUMAX = @GL_GNULIB_STRTOUMAX@ +GL_GNULIB_STRVERSCMP = @GL_GNULIB_STRVERSCMP@ +GL_GNULIB_SYMLINK = @GL_GNULIB_SYMLINK@ +GL_GNULIB_SYMLINKAT = @GL_GNULIB_SYMLINKAT@ +GL_GNULIB_SYSTEM_POSIX = @GL_GNULIB_SYSTEM_POSIX@ +GL_GNULIB_TIMEGM = @GL_GNULIB_TIMEGM@ +GL_GNULIB_TIMESPEC_GET = @GL_GNULIB_TIMESPEC_GET@ +GL_GNULIB_TIME_R = @GL_GNULIB_TIME_R@ +GL_GNULIB_TIME_RZ = @GL_GNULIB_TIME_RZ@ +GL_GNULIB_TMPFILE = @GL_GNULIB_TMPFILE@ +GL_GNULIB_TRUNCATE = @GL_GNULIB_TRUNCATE@ +GL_GNULIB_TTYNAME_R = @GL_GNULIB_TTYNAME_R@ +GL_GNULIB_TZSET = @GL_GNULIB_TZSET@ +GL_GNULIB_UNISTD_H_GETOPT = @GL_GNULIB_UNISTD_H_GETOPT@ +GL_GNULIB_UNISTD_H_NONBLOCKING = @GL_GNULIB_UNISTD_H_NONBLOCKING@ +GL_GNULIB_UNISTD_H_SIGPIPE = @GL_GNULIB_UNISTD_H_SIGPIPE@ +GL_GNULIB_UNLINK = @GL_GNULIB_UNLINK@ +GL_GNULIB_UNLINKAT = @GL_GNULIB_UNLINKAT@ +GL_GNULIB_UNLOCKPT = @GL_GNULIB_UNLOCKPT@ +GL_GNULIB_UNSETENV = @GL_GNULIB_UNSETENV@ +GL_GNULIB_USLEEP = @GL_GNULIB_USLEEP@ +GL_GNULIB_UTIMENSAT = @GL_GNULIB_UTIMENSAT@ +GL_GNULIB_VASPRINTF = @GL_GNULIB_VASPRINTF@ +GL_GNULIB_VDPRINTF = @GL_GNULIB_VDPRINTF@ +GL_GNULIB_VFPRINTF = @GL_GNULIB_VFPRINTF@ +GL_GNULIB_VFPRINTF_POSIX = @GL_GNULIB_VFPRINTF_POSIX@ +GL_GNULIB_VFSCANF = @GL_GNULIB_VFSCANF@ +GL_GNULIB_VPRINTF = @GL_GNULIB_VPRINTF@ +GL_GNULIB_VPRINTF_POSIX = @GL_GNULIB_VPRINTF_POSIX@ +GL_GNULIB_VSCANF = @GL_GNULIB_VSCANF@ +GL_GNULIB_VSNPRINTF = @GL_GNULIB_VSNPRINTF@ +GL_GNULIB_VSPRINTF_POSIX = @GL_GNULIB_VSPRINTF_POSIX@ +GL_GNULIB_WCTOMB = @GL_GNULIB_WCTOMB@ +GL_GNULIB_WRITE = @GL_GNULIB_WRITE@ +GL_GNULIB__EXIT = @GL_GNULIB__EXIT@ GMALLOC_OBJ = @GMALLOC_OBJ@ GMP_H = @GMP_H@ -GNULIB_ACCESS = @GNULIB_ACCESS@ -GNULIB_ALIGNED_ALLOC = @GNULIB_ALIGNED_ALLOC@ -GNULIB_ALPHASORT = @GNULIB_ALPHASORT@ -GNULIB_ATOLL = @GNULIB_ATOLL@ -GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ -GNULIB_CANONICALIZE_FILE_NAME = @GNULIB_CANONICALIZE_FILE_NAME@ -GNULIB_CHDIR = @GNULIB_CHDIR@ -GNULIB_CHOWN = @GNULIB_CHOWN@ -GNULIB_CLOSE = @GNULIB_CLOSE@ -GNULIB_CLOSEDIR = @GNULIB_CLOSEDIR@ -GNULIB_COPY_FILE_RANGE = @GNULIB_COPY_FILE_RANGE@ -GNULIB_CREAT = @GNULIB_CREAT@ -GNULIB_CTIME = @GNULIB_CTIME@ -GNULIB_DIRFD = @GNULIB_DIRFD@ -GNULIB_DPRINTF = @GNULIB_DPRINTF@ -GNULIB_DUP = @GNULIB_DUP@ -GNULIB_DUP2 = @GNULIB_DUP2@ -GNULIB_DUP3 = @GNULIB_DUP3@ -GNULIB_ENVIRON = @GNULIB_ENVIRON@ -GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ -GNULIB_EXECL = @GNULIB_EXECL@ -GNULIB_EXECLE = @GNULIB_EXECLE@ -GNULIB_EXECLP = @GNULIB_EXECLP@ -GNULIB_EXECV = @GNULIB_EXECV@ -GNULIB_EXECVE = @GNULIB_EXECVE@ -GNULIB_EXECVP = @GNULIB_EXECVP@ -GNULIB_EXECVPE = @GNULIB_EXECVPE@ -GNULIB_EXPLICIT_BZERO = @GNULIB_EXPLICIT_BZERO@ -GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ -GNULIB_FCHDIR = @GNULIB_FCHDIR@ -GNULIB_FCHMODAT = @GNULIB_FCHMODAT@ -GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ -GNULIB_FCLOSE = @GNULIB_FCLOSE@ -GNULIB_FCNTL = @GNULIB_FCNTL@ -GNULIB_FDATASYNC = @GNULIB_FDATASYNC@ -GNULIB_FDOPEN = @GNULIB_FDOPEN@ -GNULIB_FDOPENDIR = @GNULIB_FDOPENDIR@ -GNULIB_FFLUSH = @GNULIB_FFLUSH@ -GNULIB_FFSL = @GNULIB_FFSL@ -GNULIB_FFSLL = @GNULIB_FFSLL@ -GNULIB_FGETC = @GNULIB_FGETC@ -GNULIB_FGETS = @GNULIB_FGETS@ -GNULIB_FOPEN = @GNULIB_FOPEN@ -GNULIB_FPRINTF = @GNULIB_FPRINTF@ -GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ -GNULIB_FPURGE = @GNULIB_FPURGE@ -GNULIB_FPUTC = @GNULIB_FPUTC@ -GNULIB_FPUTS = @GNULIB_FPUTS@ -GNULIB_FREAD = @GNULIB_FREAD@ -GNULIB_FREE_POSIX = @GNULIB_FREE_POSIX@ -GNULIB_FREOPEN = @GNULIB_FREOPEN@ -GNULIB_FSCANF = @GNULIB_FSCANF@ -GNULIB_FSEEK = @GNULIB_FSEEK@ -GNULIB_FSEEKO = @GNULIB_FSEEKO@ -GNULIB_FSTAT = @GNULIB_FSTAT@ -GNULIB_FSTATAT = @GNULIB_FSTATAT@ -GNULIB_FSYNC = @GNULIB_FSYNC@ -GNULIB_FTELL = @GNULIB_FTELL@ -GNULIB_FTELLO = @GNULIB_FTELLO@ -GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ -GNULIB_FUTIMENS = @GNULIB_FUTIMENS@ -GNULIB_FWRITE = @GNULIB_FWRITE@ -GNULIB_GETC = @GNULIB_GETC@ -GNULIB_GETCHAR = @GNULIB_GETCHAR@ -GNULIB_GETCWD = @GNULIB_GETCWD@ -GNULIB_GETDELIM = @GNULIB_GETDELIM@ -GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ -GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ -GNULIB_GETENTROPY = @GNULIB_GETENTROPY@ -GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ -GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ -GNULIB_GETLINE = @GNULIB_GETLINE@ -GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ -GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ -GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ -GNULIB_GETOPT_POSIX = @GNULIB_GETOPT_POSIX@ -GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ -GNULIB_GETPASS = @GNULIB_GETPASS@ -GNULIB_GETRANDOM = @GNULIB_GETRANDOM@ -GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ -GNULIB_GETUMASK = @GNULIB_GETUMASK@ -GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ -GNULIB_GL_UNISTD_H_GETOPT = @GNULIB_GL_UNISTD_H_GETOPT@ -GNULIB_GRANTPT = @GNULIB_GRANTPT@ -GNULIB_GROUP_MEMBER = @GNULIB_GROUP_MEMBER@ -GNULIB_IMAXABS = @GNULIB_IMAXABS@ -GNULIB_IMAXDIV = @GNULIB_IMAXDIV@ -GNULIB_ISATTY = @GNULIB_ISATTY@ -GNULIB_LCHMOD = @GNULIB_LCHMOD@ -GNULIB_LCHOWN = @GNULIB_LCHOWN@ -GNULIB_LINK = @GNULIB_LINK@ -GNULIB_LINKAT = @GNULIB_LINKAT@ -GNULIB_LOCALTIME = @GNULIB_LOCALTIME@ -GNULIB_LSEEK = @GNULIB_LSEEK@ -GNULIB_LSTAT = @GNULIB_LSTAT@ -GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ -GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ -GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ -GNULIB_MBSCHR = @GNULIB_MBSCHR@ -GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ -GNULIB_MBSLEN = @GNULIB_MBSLEN@ -GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ -GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ -GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ -GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ -GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ -GNULIB_MBSSEP = @GNULIB_MBSSEP@ -GNULIB_MBSSPN = @GNULIB_MBSSPN@ -GNULIB_MBSSTR = @GNULIB_MBSSTR@ -GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ -GNULIB_MBTOWC = @GNULIB_MBTOWC@ -GNULIB_MDA_ACCESS = @GNULIB_MDA_ACCESS@ -GNULIB_MDA_CHDIR = @GNULIB_MDA_CHDIR@ -GNULIB_MDA_CHMOD = @GNULIB_MDA_CHMOD@ -GNULIB_MDA_CLOSE = @GNULIB_MDA_CLOSE@ -GNULIB_MDA_CREAT = @GNULIB_MDA_CREAT@ -GNULIB_MDA_DUP = @GNULIB_MDA_DUP@ -GNULIB_MDA_DUP2 = @GNULIB_MDA_DUP2@ -GNULIB_MDA_ECVT = @GNULIB_MDA_ECVT@ -GNULIB_MDA_EXECL = @GNULIB_MDA_EXECL@ -GNULIB_MDA_EXECLE = @GNULIB_MDA_EXECLE@ -GNULIB_MDA_EXECLP = @GNULIB_MDA_EXECLP@ -GNULIB_MDA_EXECV = @GNULIB_MDA_EXECV@ -GNULIB_MDA_EXECVE = @GNULIB_MDA_EXECVE@ -GNULIB_MDA_EXECVP = @GNULIB_MDA_EXECVP@ -GNULIB_MDA_EXECVPE = @GNULIB_MDA_EXECVPE@ -GNULIB_MDA_FCLOSEALL = @GNULIB_MDA_FCLOSEALL@ -GNULIB_MDA_FCVT = @GNULIB_MDA_FCVT@ -GNULIB_MDA_FDOPEN = @GNULIB_MDA_FDOPEN@ -GNULIB_MDA_FILENO = @GNULIB_MDA_FILENO@ -GNULIB_MDA_GCVT = @GNULIB_MDA_GCVT@ -GNULIB_MDA_GETCWD = @GNULIB_MDA_GETCWD@ -GNULIB_MDA_GETPID = @GNULIB_MDA_GETPID@ -GNULIB_MDA_GETW = @GNULIB_MDA_GETW@ -GNULIB_MDA_ISATTY = @GNULIB_MDA_ISATTY@ -GNULIB_MDA_LSEEK = @GNULIB_MDA_LSEEK@ -GNULIB_MDA_MEMCCPY = @GNULIB_MDA_MEMCCPY@ -GNULIB_MDA_MKDIR = @GNULIB_MDA_MKDIR@ -GNULIB_MDA_MKTEMP = @GNULIB_MDA_MKTEMP@ -GNULIB_MDA_OPEN = @GNULIB_MDA_OPEN@ -GNULIB_MDA_PUTENV = @GNULIB_MDA_PUTENV@ -GNULIB_MDA_PUTW = @GNULIB_MDA_PUTW@ -GNULIB_MDA_READ = @GNULIB_MDA_READ@ -GNULIB_MDA_RMDIR = @GNULIB_MDA_RMDIR@ -GNULIB_MDA_STRDUP = @GNULIB_MDA_STRDUP@ -GNULIB_MDA_SWAB = @GNULIB_MDA_SWAB@ -GNULIB_MDA_TEMPNAM = @GNULIB_MDA_TEMPNAM@ -GNULIB_MDA_TZSET = @GNULIB_MDA_TZSET@ -GNULIB_MDA_UMASK = @GNULIB_MDA_UMASK@ -GNULIB_MDA_UNLINK = @GNULIB_MDA_UNLINK@ -GNULIB_MDA_WRITE = @GNULIB_MDA_WRITE@ -GNULIB_MEMCHR = @GNULIB_MEMCHR@ -GNULIB_MEMMEM = @GNULIB_MEMMEM@ -GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ -GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ -GNULIB_MKDIR = @GNULIB_MKDIR@ -GNULIB_MKDIRAT = @GNULIB_MKDIRAT@ -GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ -GNULIB_MKFIFO = @GNULIB_MKFIFO@ -GNULIB_MKFIFOAT = @GNULIB_MKFIFOAT@ -GNULIB_MKNOD = @GNULIB_MKNOD@ -GNULIB_MKNODAT = @GNULIB_MKNODAT@ -GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@ -GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@ -GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ -GNULIB_MKSTEMPS = @GNULIB_MKSTEMPS@ -GNULIB_MKTIME = @GNULIB_MKTIME@ -GNULIB_NANOSLEEP = @GNULIB_NANOSLEEP@ -GNULIB_NONBLOCKING = @GNULIB_NONBLOCKING@ -GNULIB_OBSTACK_PRINTF = @GNULIB_OBSTACK_PRINTF@ -GNULIB_OBSTACK_PRINTF_POSIX = @GNULIB_OBSTACK_PRINTF_POSIX@ -GNULIB_OPEN = @GNULIB_OPEN@ -GNULIB_OPENAT = @GNULIB_OPENAT@ -GNULIB_OPENDIR = @GNULIB_OPENDIR@ -GNULIB_OVERRIDES_STRUCT_STAT = @GNULIB_OVERRIDES_STRUCT_STAT@ GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ -GNULIB_PCLOSE = @GNULIB_PCLOSE@ -GNULIB_PERROR = @GNULIB_PERROR@ -GNULIB_PIPE = @GNULIB_PIPE@ -GNULIB_PIPE2 = @GNULIB_PIPE2@ -GNULIB_POPEN = @GNULIB_POPEN@ -GNULIB_POSIX_MEMALIGN = @GNULIB_POSIX_MEMALIGN@ -GNULIB_POSIX_OPENPT = @GNULIB_POSIX_OPENPT@ -GNULIB_PREAD = @GNULIB_PREAD@ -GNULIB_PRINTF = @GNULIB_PRINTF@ -GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@ -GNULIB_PSELECT = @GNULIB_PSELECT@ -GNULIB_PTHREAD_SIGMASK = @GNULIB_PTHREAD_SIGMASK@ -GNULIB_PTSNAME = @GNULIB_PTSNAME@ -GNULIB_PTSNAME_R = @GNULIB_PTSNAME_R@ -GNULIB_PUTC = @GNULIB_PUTC@ -GNULIB_PUTCHAR = @GNULIB_PUTCHAR@ -GNULIB_PUTENV = @GNULIB_PUTENV@ -GNULIB_PUTS = @GNULIB_PUTS@ -GNULIB_PWRITE = @GNULIB_PWRITE@ -GNULIB_QSORT_R = @GNULIB_QSORT_R@ -GNULIB_RAISE = @GNULIB_RAISE@ -GNULIB_RANDOM = @GNULIB_RANDOM@ -GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ -GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ -GNULIB_READ = @GNULIB_READ@ -GNULIB_READDIR = @GNULIB_READDIR@ -GNULIB_READLINK = @GNULIB_READLINK@ -GNULIB_READLINKAT = @GNULIB_READLINKAT@ -GNULIB_REALLOCARRAY = @GNULIB_REALLOCARRAY@ -GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ -GNULIB_REALPATH = @GNULIB_REALPATH@ -GNULIB_REMOVE = @GNULIB_REMOVE@ -GNULIB_RENAME = @GNULIB_RENAME@ -GNULIB_RENAMEAT = @GNULIB_RENAMEAT@ -GNULIB_REWINDDIR = @GNULIB_REWINDDIR@ -GNULIB_RMDIR = @GNULIB_RMDIR@ -GNULIB_RPMATCH = @GNULIB_RPMATCH@ -GNULIB_SCANDIR = @GNULIB_SCANDIR@ -GNULIB_SCANF = @GNULIB_SCANF@ -GNULIB_SECURE_GETENV = @GNULIB_SECURE_GETENV@ -GNULIB_SELECT = @GNULIB_SELECT@ -GNULIB_SETENV = @GNULIB_SETENV@ -GNULIB_SETHOSTNAME = @GNULIB_SETHOSTNAME@ -GNULIB_SIGABBREV_NP = @GNULIB_SIGABBREV_NP@ -GNULIB_SIGACTION = @GNULIB_SIGACTION@ -GNULIB_SIGDESCR_NP = @GNULIB_SIGDESCR_NP@ -GNULIB_SIGNAL_H_SIGPIPE = @GNULIB_SIGNAL_H_SIGPIPE@ -GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@ -GNULIB_SLEEP = @GNULIB_SLEEP@ -GNULIB_SNPRINTF = @GNULIB_SNPRINTF@ -GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@ -GNULIB_STAT = @GNULIB_STAT@ -GNULIB_STDIO_H_NONBLOCKING = @GNULIB_STDIO_H_NONBLOCKING@ -GNULIB_STDIO_H_SIGPIPE = @GNULIB_STDIO_H_SIGPIPE@ -GNULIB_STPCPY = @GNULIB_STPCPY@ -GNULIB_STPNCPY = @GNULIB_STPNCPY@ -GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ -GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ -GNULIB_STRDUP = @GNULIB_STRDUP@ -GNULIB_STRERROR = @GNULIB_STRERROR@ -GNULIB_STRERRORNAME_NP = @GNULIB_STRERRORNAME_NP@ -GNULIB_STRERROR_R = @GNULIB_STRERROR_R@ -GNULIB_STRFTIME = @GNULIB_STRFTIME@ -GNULIB_STRNCAT = @GNULIB_STRNCAT@ -GNULIB_STRNDUP = @GNULIB_STRNDUP@ -GNULIB_STRNLEN = @GNULIB_STRNLEN@ -GNULIB_STRPBRK = @GNULIB_STRPBRK@ -GNULIB_STRPTIME = @GNULIB_STRPTIME@ -GNULIB_STRSEP = @GNULIB_STRSEP@ -GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ -GNULIB_STRSTR = @GNULIB_STRSTR@ -GNULIB_STRTOD = @GNULIB_STRTOD@ -GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ -GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ -GNULIB_STRTOLD = @GNULIB_STRTOLD@ -GNULIB_STRTOLL = @GNULIB_STRTOLL@ -GNULIB_STRTOULL = @GNULIB_STRTOULL@ -GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ -GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ -GNULIB_SYMLINK = @GNULIB_SYMLINK@ -GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ -GNULIB_SYSTEM_POSIX = @GNULIB_SYSTEM_POSIX@ -GNULIB_TIMEGM = @GNULIB_TIMEGM@ -GNULIB_TIMESPEC_GET = @GNULIB_TIMESPEC_GET@ -GNULIB_TIME_R = @GNULIB_TIME_R@ -GNULIB_TIME_RZ = @GNULIB_TIME_RZ@ -GNULIB_TMPFILE = @GNULIB_TMPFILE@ -GNULIB_TRUNCATE = @GNULIB_TRUNCATE@ -GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ -GNULIB_TZSET = @GNULIB_TZSET@ -GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@ -GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ -GNULIB_UNLINK = @GNULIB_UNLINK@ -GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ -GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@ -GNULIB_UNSETENV = @GNULIB_UNSETENV@ -GNULIB_USLEEP = @GNULIB_USLEEP@ -GNULIB_UTIMENSAT = @GNULIB_UTIMENSAT@ -GNULIB_VASPRINTF = @GNULIB_VASPRINTF@ -GNULIB_VDPRINTF = @GNULIB_VDPRINTF@ -GNULIB_VFPRINTF = @GNULIB_VFPRINTF@ -GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@ -GNULIB_VFSCANF = @GNULIB_VFSCANF@ -GNULIB_VPRINTF = @GNULIB_VPRINTF@ -GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ -GNULIB_VSCANF = @GNULIB_VSCANF@ -GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ -GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ GNULIB_WARN_CFLAGS = @GNULIB_WARN_CFLAGS@ -GNULIB_WCTOMB = @GNULIB_WCTOMB@ -GNULIB_WRITE = @GNULIB_WRITE@ -GNULIB__EXIT = @GNULIB__EXIT@ GNUSTEP_CFLAGS = @GNUSTEP_CFLAGS@ GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ @@ -653,10 +654,11 @@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_LCHMOD = @HAVE_LCHMOD@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LIBGMP = @HAVE_LIBGMP@ +HAVE_LIBSECCOMP = @HAVE_LIBSECCOMP@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LSTAT = @HAVE_LSTAT@ -HAVE_MAKEINFO = @HAVE_MAKEINFO@ +HAVE_MACPORTS = @HAVE_MACPORTS@ HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBTOWC = @HAVE_MBTOWC@ @@ -673,6 +675,7 @@ HAVE_MKSTEMP = @HAVE_MKSTEMP@ HAVE_MKSTEMPS = @HAVE_MKSTEMPS@ HAVE_MODULES = @HAVE_MODULES@ HAVE_NANOSLEEP = @HAVE_NANOSLEEP@ +HAVE_NATIVE_COMP = @HAVE_NATIVE_COMP@ HAVE_OPENAT = @HAVE_OPENAT@ HAVE_OPENDIR = @HAVE_OPENDIR@ HAVE_OS_H = @HAVE_OS_H@ @@ -705,6 +708,7 @@ HAVE_RENAMEAT = @HAVE_RENAMEAT@ HAVE_REWINDDIR = @HAVE_REWINDDIR@ HAVE_RPMATCH = @HAVE_RPMATCH@ HAVE_SCANDIR = @HAVE_SCANDIR@ +HAVE_SECCOMP = @HAVE_SECCOMP@ HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@ @@ -729,8 +733,10 @@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRPTIME = @HAVE_STRPTIME@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ +HAVE_STRTOL = @HAVE_STRTOL@ HAVE_STRTOLD = @HAVE_STRTOLD@ HAVE_STRTOLL = @HAVE_STRTOLL@ +HAVE_STRTOUL = @HAVE_STRTOUL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ HAVE_STRUCT_SIGACTION_SA_SIGACTION = @HAVE_STRUCT_SIGACTION_SA_SIGACTION@ @@ -790,6 +796,8 @@ LD_SWITCH_SYSTEM = @LD_SWITCH_SYSTEM@ LD_SWITCH_SYSTEM_TEMACS = @LD_SWITCH_SYSTEM_TEMACS@ LD_SWITCH_X_SITE = @LD_SWITCH_X_SITE@ LD_SWITCH_X_SITE_RPATH = @LD_SWITCH_X_SITE_RPATH@ +LIBGCCJIT_CFLAGS = @LIBGCCJIT_CFLAGS@ +LIBGCCJIT_LIBS = @LIBGCCJIT_LIBS@ LIBGIF = @LIBGIF@ LIBGMP = @LIBGMP@ LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@ @@ -807,6 +815,8 @@ LIBOTF_LIBS = @LIBOTF_LIBS@ LIBPNG = @LIBPNG@ LIBRESOLV = @LIBRESOLV@ LIBS = @LIBS@ +LIBSECCOMP_CFLAGS = @LIBSECCOMP_CFLAGS@ +LIBSECCOMP_LIBS = @LIBSECCOMP_LIBS@ LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ LIBSOUND = @LIBSOUND@ LIBSYSTEMD_CFLAGS = @LIBSYSTEMD_CFLAGS@ @@ -832,6 +842,7 @@ LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ LIB_EACCESS = @LIB_EACCESS@ LIB_EXECINFO = @LIB_EXECINFO@ LIB_GETRANDOM = @LIB_GETRANDOM@ +LIB_HAS_ACL = @LIB_HAS_ACL@ LIB_MATH = @LIB_MATH@ LIB_PTHREAD = @LIB_PTHREAD@ LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@ @@ -1023,6 +1034,7 @@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ +REPLACE_REALLOCARRAY = @REPLACE_REALLOCARRAY@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ REPLACE_RENAME = @REPLACE_RENAME@ @@ -1053,7 +1065,11 @@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ +REPLACE_STRTOL = @REPLACE_STRTOL@ REPLACE_STRTOLD = @REPLACE_STRTOLD@ +REPLACE_STRTOLL = @REPLACE_STRTOLL@ +REPLACE_STRTOUL = @REPLACE_STRTOUL@ +REPLACE_STRTOULL = @REPLACE_STRTOULL@ REPLACE_STRTOUMAX = @REPLACE_STRTOUMAX@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ @@ -1104,6 +1120,7 @@ UNISTD_H_HAVE_SYS_RANDOM_H = @UNISTD_H_HAVE_SYS_RANDOM_H@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ USE_ACL = @USE_ACL@ +USE_STARTUP_NOTIFICATION = @USE_STARTUP_NOTIFICATION@ VMLIMIT_OBJ = @VMLIMIT_OBJ@ W32_LIBS = @W32_LIBS@ W32_OBJ = @W32_OBJ@ @@ -1172,17 +1189,19 @@ gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7 = @gl_GNULIB_ENABLED_03e0aaad gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b = @gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b@ gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31 = @gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31@ gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c = @gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c@ +gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4 = @gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4@ gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec = @gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec@ gl_GNULIB_ENABLED_925677f0343de64b89a9f0c790b4104c = @gl_GNULIB_ENABLED_925677f0343de64b89a9f0c790b4104c@ gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1 = @gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1@ gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36 = @gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36@ gl_GNULIB_ENABLED_cloexec = @gl_GNULIB_ENABLED_cloexec@ +gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b = @gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b@ gl_GNULIB_ENABLED_dirfd = @gl_GNULIB_ENABLED_dirfd@ gl_GNULIB_ENABLED_dynarray = @gl_GNULIB_ENABLED_dynarray@ +gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866 = @gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866@ gl_GNULIB_ENABLED_euidaccess = @gl_GNULIB_ENABLED_euidaccess@ gl_GNULIB_ENABLED_getdtablesize = @gl_GNULIB_ENABLED_getdtablesize@ gl_GNULIB_ENABLED_getgroups = @gl_GNULIB_ENABLED_getgroups@ -gl_GNULIB_ENABLED_idx = @gl_GNULIB_ENABLED_idx@ gl_GNULIB_ENABLED_lchmod = @gl_GNULIB_ENABLED_lchmod@ gl_GNULIB_ENABLED_open = @gl_GNULIB_ENABLED_open@ gl_GNULIB_ENABLED_rawmemchr = @gl_GNULIB_ENABLED_rawmemchr@ @@ -1206,6 +1225,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ liblockfile = @liblockfile@ lispdir = @lispdir@ +lispdirrel = @lispdirrel@ lisppath = @lisppath@ localedir = @localedir@ locallisppath = @locallisppath@ @@ -1213,6 +1233,8 @@ localstatedir = @localstatedir@ mandir = @mandir@ ns_appbindir = @ns_appbindir@ ns_appdir = @ns_appdir@ +ns_applibdir = @ns_applibdir@ +ns_applibexecdir = @ns_applibexecdir@ ns_appresdir = @ns_appresdir@ ns_appsrc = @ns_appsrc@ ns_check_file = @ns_check_file@ @@ -1222,6 +1244,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -1514,14 +1537,14 @@ dirent.h: dirent.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_DIRENT_H''@|$(NEXT_DIRENT_H)|g' \ - -e 's/@''GNULIB_OPENDIR''@/$(GNULIB_OPENDIR)/g' \ - -e 's/@''GNULIB_READDIR''@/$(GNULIB_READDIR)/g' \ - -e 's/@''GNULIB_REWINDDIR''@/$(GNULIB_REWINDDIR)/g' \ - -e 's/@''GNULIB_CLOSEDIR''@/$(GNULIB_CLOSEDIR)/g' \ - -e 's/@''GNULIB_DIRFD''@/$(GNULIB_DIRFD)/g' \ - -e 's/@''GNULIB_FDOPENDIR''@/$(GNULIB_FDOPENDIR)/g' \ - -e 's/@''GNULIB_SCANDIR''@/$(GNULIB_SCANDIR)/g' \ - -e 's/@''GNULIB_ALPHASORT''@/$(GNULIB_ALPHASORT)/g' \ + -e 's/@''GNULIB_OPENDIR''@/$(GL_GNULIB_OPENDIR)/g' \ + -e 's/@''GNULIB_READDIR''@/$(GL_GNULIB_READDIR)/g' \ + -e 's/@''GNULIB_REWINDDIR''@/$(GL_GNULIB_REWINDDIR)/g' \ + -e 's/@''GNULIB_CLOSEDIR''@/$(GL_GNULIB_CLOSEDIR)/g' \ + -e 's/@''GNULIB_DIRFD''@/$(GL_GNULIB_DIRFD)/g' \ + -e 's/@''GNULIB_FDOPENDIR''@/$(GL_GNULIB_FDOPENDIR)/g' \ + -e 's/@''GNULIB_SCANDIR''@/$(GL_GNULIB_SCANDIR)/g' \ + -e 's/@''GNULIB_ALPHASORT''@/$(GL_GNULIB_ALPHASORT)/g' \ -e 's/@''HAVE_OPENDIR''@/$(HAVE_OPENDIR)/g' \ -e 's/@''HAVE_READDIR''@/$(HAVE_READDIR)/g' \ -e 's/@''HAVE_REWINDDIR''@/$(HAVE_REWINDDIR)/g' \ @@ -1596,6 +1619,32 @@ endif ifeq (,$(OMIT_GNULIB_MODULE_dynarray)) ifneq (,$(gl_GNULIB_ENABLED_dynarray)) +BUILT_SOURCES += malloc/dynarray.gl.h malloc/dynarray-skeleton.gl.h + +malloc/dynarray.gl.h: malloc/dynarray.h + $(AM_V_at)$(MKDIR_P) malloc + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e '/libc_hidden_proto/d' < $(srcdir)/malloc/dynarray.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += malloc/dynarray.gl.h malloc/dynarray.gl.h-t + +malloc/dynarray-skeleton.gl.h: malloc/dynarray-skeleton.c + $(AM_V_at)$(MKDIR_P) malloc + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|||g' \ + -e 's|__attribute_maybe_unused__|_GL_ATTRIBUTE_MAYBE_UNUSED|g' \ + -e 's|__attribute_nonnull__|_GL_ATTRIBUTE_NONNULL|g' \ + -e 's|__attribute_warn_unused_result__|_GL_ATTRIBUTE_NODISCARD|g' \ + -e 's|__glibc_likely|_GL_LIKELY|g' \ + -e 's|__glibc_unlikely|_GL_UNLIKELY|g' \ + < $(srcdir)/malloc/dynarray-skeleton.c; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += malloc/dynarray-skeleton.gl.h malloc/dynarray-skeleton.gl.h-t + libgnu_a_SOURCES += malloc/dynarray_at_failure.c malloc/dynarray_emplace_enlarge.c malloc/dynarray_finalize.c malloc/dynarray_resize.c malloc/dynarray_resize_clear.c endif @@ -1752,13 +1801,13 @@ fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ - -e 's/@''GNULIB_CREAT''@/$(GNULIB_CREAT)/g' \ - -e 's/@''GNULIB_FCNTL''@/$(GNULIB_FCNTL)/g' \ - -e 's/@''GNULIB_NONBLOCKING''@/$(GNULIB_NONBLOCKING)/g' \ - -e 's/@''GNULIB_OPEN''@/$(GNULIB_OPEN)/g' \ - -e 's/@''GNULIB_OPENAT''@/$(GNULIB_OPENAT)/g' \ - -e 's/@''GNULIB_MDA_CREAT''@/$(GNULIB_MDA_CREAT)/g' \ - -e 's/@''GNULIB_MDA_OPEN''@/$(GNULIB_MDA_OPEN)/g' \ + -e 's/@''GNULIB_CREAT''@/$(GL_GNULIB_CREAT)/g' \ + -e 's/@''GNULIB_FCNTL''@/$(GL_GNULIB_FCNTL)/g' \ + -e 's/@''GNULIB_NONBLOCKING''@/$(GL_GNULIB_NONBLOCKING)/g' \ + -e 's/@''GNULIB_OPEN''@/$(GL_GNULIB_OPEN)/g' \ + -e 's/@''GNULIB_OPENAT''@/$(GL_GNULIB_OPENAT)/g' \ + -e 's/@''GNULIB_MDA_CREAT''@/$(GL_GNULIB_MDA_CREAT)/g' \ + -e 's/@''GNULIB_MDA_OPEN''@/$(GL_GNULIB_MDA_OPEN)/g' \ -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ -e 's|@''REPLACE_CREAT''@|$(REPLACE_CREAT)|g' \ @@ -2043,10 +2092,8 @@ endif ## begin gnulib module idx ifeq (,$(OMIT_GNULIB_MODULE_idx)) -ifneq (,$(gl_GNULIB_ENABLED_idx)) libgnu_a_SOURCES += idx.h -endif endif ## end gnulib module idx @@ -2111,10 +2158,10 @@ inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_U -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \ -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \ - -e 's/@''GNULIB_IMAXABS''@/$(GNULIB_IMAXABS)/g' \ - -e 's/@''GNULIB_IMAXDIV''@/$(GNULIB_IMAXDIV)/g' \ - -e 's/@''GNULIB_STRTOIMAX''@/$(GNULIB_STRTOIMAX)/g' \ - -e 's/@''GNULIB_STRTOUMAX''@/$(GNULIB_STRTOUMAX)/g' \ + -e 's/@''GNULIB_IMAXABS''@/$(GL_GNULIB_IMAXABS)/g' \ + -e 's/@''GNULIB_IMAXDIV''@/$(GL_GNULIB_IMAXDIV)/g' \ + -e 's/@''GNULIB_STRTOIMAX''@/$(GL_GNULIB_STRTOIMAX)/g' \ + -e 's/@''GNULIB_STRTOUMAX''@/$(GL_GNULIB_STRTOUMAX)/g' \ -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \ -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \ -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \ @@ -2232,6 +2279,19 @@ EXTRA_libgnu_a_SOURCES += lstat.c endif ## end gnulib module lstat +## begin gnulib module malloc-posix +ifeq (,$(OMIT_GNULIB_MODULE_malloc-posix)) + +ifneq (,$(gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866)) + +endif +EXTRA_DIST += malloc.c + +EXTRA_libgnu_a_SOURCES += malloc.c + +endif +## end gnulib module malloc-posix + ## begin gnulib module memmem-simple ifeq (,$(OMIT_GNULIB_MODULE_memmem-simple)) @@ -2424,6 +2484,32 @@ EXTRA_libgnu_a_SOURCES += at-func.c readlinkat.c endif ## end gnulib module readlinkat +## begin gnulib module realloc-gnu +ifeq (,$(OMIT_GNULIB_MODULE_realloc-gnu)) + +ifneq (,$(gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b)) + +endif +EXTRA_DIST += realloc.c + +EXTRA_libgnu_a_SOURCES += realloc.c + +endif +## end gnulib module realloc-gnu + +## begin gnulib module realloc-posix +ifeq (,$(OMIT_GNULIB_MODULE_realloc-posix)) + +ifneq (,$(gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4)) + +endif +EXTRA_DIST += realloc.c + +EXTRA_libgnu_a_SOURCES += realloc.c + +endif +## end gnulib module realloc-posix + ## begin gnulib module regex ifeq (,$(OMIT_GNULIB_MODULE_regex)) @@ -2450,6 +2536,21 @@ endif ifeq (,$(OMIT_GNULIB_MODULE_scratch_buffer)) ifneq (,$(gl_GNULIB_ENABLED_scratch_buffer)) +BUILT_SOURCES += malloc/scratch_buffer.gl.h + +malloc/scratch_buffer.gl.h: malloc/scratch_buffer.h + $(AM_V_at)$(MKDIR_P) malloc + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|__always_inline|inline _GL_ATTRIBUTE_ALWAYS_INLINE|g' \ + -e 's|__glibc_likely|_GL_LIKELY|g' \ + -e 's|__glibc_unlikely|_GL_UNLIKELY|g' \ + -e '/libc_hidden_proto/d' \ + < $(srcdir)/malloc/scratch_buffer.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += malloc/scratch_buffer.gl.h malloc/scratch_buffer.gl.h-t + libgnu_a_SOURCES += malloc/scratch_buffer_dupfree.c malloc/scratch_buffer_grow.c malloc/scratch_buffer_grow_preserve.c malloc/scratch_buffer_set_array_size.c endif @@ -2495,11 +2596,11 @@ signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \ - -e 's/@''GNULIB_PTHREAD_SIGMASK''@/$(GNULIB_PTHREAD_SIGMASK)/g' \ - -e 's/@''GNULIB_RAISE''@/$(GNULIB_RAISE)/g' \ - -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GNULIB_SIGNAL_H_SIGPIPE)/g' \ - -e 's/@''GNULIB_SIGPROCMASK''@/$(GNULIB_SIGPROCMASK)/g' \ - -e 's/@''GNULIB_SIGACTION''@/$(GNULIB_SIGACTION)/g' \ + -e 's/@''GNULIB_PTHREAD_SIGMASK''@/$(GL_GNULIB_PTHREAD_SIGMASK)/g' \ + -e 's/@''GNULIB_RAISE''@/$(GL_GNULIB_RAISE)/g' \ + -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GL_GNULIB_SIGNAL_H_SIGPIPE)/g' \ + -e 's/@''GNULIB_SIGPROCMASK''@/$(GL_GNULIB_SIGPROCMASK)/g' \ + -e 's/@''GNULIB_SIGACTION''@/$(GL_GNULIB_SIGACTION)/g' \ -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ -e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \ -e 's|@''HAVE_RAISE''@|$(HAVE_RAISE)|g' \ @@ -2685,7 +2786,7 @@ stdint.h: stdint.in.h $(top_builddir)/config.status -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ - -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ + -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \ < $(srcdir)/stdint.in.h; \ } > $@-t && \ mv $@-t $@ @@ -2715,65 +2816,65 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ - -e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \ - -e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/g' \ - -e 's/@''GNULIB_FDOPEN''@/$(GNULIB_FDOPEN)/g' \ - -e 's/@''GNULIB_FFLUSH''@/$(GNULIB_FFLUSH)/g' \ - -e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \ - -e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/g' \ - -e 's/@''GNULIB_FOPEN''@/$(GNULIB_FOPEN)/g' \ - -e 's/@''GNULIB_FPRINTF''@/$(GNULIB_FPRINTF)/g' \ - -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GNULIB_FPRINTF_POSIX)/g' \ - -e 's/@''GNULIB_FPURGE''@/$(GNULIB_FPURGE)/g' \ - -e 's/@''GNULIB_FPUTC''@/$(GNULIB_FPUTC)/g' \ - -e 's/@''GNULIB_FPUTS''@/$(GNULIB_FPUTS)/g' \ - -e 's/@''GNULIB_FREAD''@/$(GNULIB_FREAD)/g' \ - -e 's/@''GNULIB_FREOPEN''@/$(GNULIB_FREOPEN)/g' \ - -e 's/@''GNULIB_FSCANF''@/$(GNULIB_FSCANF)/g' \ - -e 's/@''GNULIB_FSEEK''@/$(GNULIB_FSEEK)/g' \ - -e 's/@''GNULIB_FSEEKO''@/$(GNULIB_FSEEKO)/g' \ - -e 's/@''GNULIB_FTELL''@/$(GNULIB_FTELL)/g' \ - -e 's/@''GNULIB_FTELLO''@/$(GNULIB_FTELLO)/g' \ - -e 's/@''GNULIB_FWRITE''@/$(GNULIB_FWRITE)/g' \ - -e 's/@''GNULIB_GETC''@/$(GNULIB_GETC)/g' \ - -e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \ - -e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \ - -e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \ - -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \ - -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \ - -e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \ - -e 's/@''GNULIB_PERROR''@/$(GNULIB_PERROR)/g' \ - -e 's/@''GNULIB_POPEN''@/$(GNULIB_POPEN)/g' \ - -e 's/@''GNULIB_PRINTF''@/$(GNULIB_PRINTF)/g' \ - -e 's/@''GNULIB_PRINTF_POSIX''@/$(GNULIB_PRINTF_POSIX)/g' \ - -e 's/@''GNULIB_PUTC''@/$(GNULIB_PUTC)/g' \ - -e 's/@''GNULIB_PUTCHAR''@/$(GNULIB_PUTCHAR)/g' \ - -e 's/@''GNULIB_PUTS''@/$(GNULIB_PUTS)/g' \ - -e 's/@''GNULIB_REMOVE''@/$(GNULIB_REMOVE)/g' \ - -e 's/@''GNULIB_RENAME''@/$(GNULIB_RENAME)/g' \ - -e 's/@''GNULIB_RENAMEAT''@/$(GNULIB_RENAMEAT)/g' \ - -e 's/@''GNULIB_SCANF''@/$(GNULIB_SCANF)/g' \ - -e 's/@''GNULIB_SNPRINTF''@/$(GNULIB_SNPRINTF)/g' \ - -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GNULIB_SPRINTF_POSIX)/g' \ - -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GNULIB_STDIO_H_NONBLOCKING)/g' \ - -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GNULIB_STDIO_H_SIGPIPE)/g' \ - -e 's/@''GNULIB_TMPFILE''@/$(GNULIB_TMPFILE)/g' \ - -e 's/@''GNULIB_VASPRINTF''@/$(GNULIB_VASPRINTF)/g' \ - -e 's/@''GNULIB_VDPRINTF''@/$(GNULIB_VDPRINTF)/g' \ - -e 's/@''GNULIB_VFPRINTF''@/$(GNULIB_VFPRINTF)/g' \ - -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GNULIB_VFPRINTF_POSIX)/g' \ - -e 's/@''GNULIB_VFSCANF''@/$(GNULIB_VFSCANF)/g' \ - -e 's/@''GNULIB_VSCANF''@/$(GNULIB_VSCANF)/g' \ - -e 's/@''GNULIB_VPRINTF''@/$(GNULIB_VPRINTF)/g' \ - -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GNULIB_VPRINTF_POSIX)/g' \ - -e 's/@''GNULIB_VSNPRINTF''@/$(GNULIB_VSNPRINTF)/g' \ - -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GNULIB_VSPRINTF_POSIX)/g' \ - -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GNULIB_MDA_FCLOSEALL)/g' \ - -e 's/@''GNULIB_MDA_FDOPEN''@/$(GNULIB_MDA_FDOPEN)/g' \ - -e 's/@''GNULIB_MDA_FILENO''@/$(GNULIB_MDA_FILENO)/g' \ - -e 's/@''GNULIB_MDA_GETW''@/$(GNULIB_MDA_GETW)/g' \ - -e 's/@''GNULIB_MDA_PUTW''@/$(GNULIB_MDA_PUTW)/g' \ - -e 's/@''GNULIB_MDA_TEMPNAM''@/$(GNULIB_MDA_TEMPNAM)/g' \ + -e 's/@''GNULIB_DPRINTF''@/$(GL_GNULIB_DPRINTF)/g' \ + -e 's/@''GNULIB_FCLOSE''@/$(GL_GNULIB_FCLOSE)/g' \ + -e 's/@''GNULIB_FDOPEN''@/$(GL_GNULIB_FDOPEN)/g' \ + -e 's/@''GNULIB_FFLUSH''@/$(GL_GNULIB_FFLUSH)/g' \ + -e 's/@''GNULIB_FGETC''@/$(GL_GNULIB_FGETC)/g' \ + -e 's/@''GNULIB_FGETS''@/$(GL_GNULIB_FGETS)/g' \ + -e 's/@''GNULIB_FOPEN''@/$(GL_GNULIB_FOPEN)/g' \ + -e 's/@''GNULIB_FPRINTF''@/$(GL_GNULIB_FPRINTF)/g' \ + -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GL_GNULIB_FPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_FPURGE''@/$(GL_GNULIB_FPURGE)/g' \ + -e 's/@''GNULIB_FPUTC''@/$(GL_GNULIB_FPUTC)/g' \ + -e 's/@''GNULIB_FPUTS''@/$(GL_GNULIB_FPUTS)/g' \ + -e 's/@''GNULIB_FREAD''@/$(GL_GNULIB_FREAD)/g' \ + -e 's/@''GNULIB_FREOPEN''@/$(GL_GNULIB_FREOPEN)/g' \ + -e 's/@''GNULIB_FSCANF''@/$(GL_GNULIB_FSCANF)/g' \ + -e 's/@''GNULIB_FSEEK''@/$(GL_GNULIB_FSEEK)/g' \ + -e 's/@''GNULIB_FSEEKO''@/$(GL_GNULIB_FSEEKO)/g' \ + -e 's/@''GNULIB_FTELL''@/$(GL_GNULIB_FTELL)/g' \ + -e 's/@''GNULIB_FTELLO''@/$(GL_GNULIB_FTELLO)/g' \ + -e 's/@''GNULIB_FWRITE''@/$(GL_GNULIB_FWRITE)/g' \ + -e 's/@''GNULIB_GETC''@/$(GL_GNULIB_GETC)/g' \ + -e 's/@''GNULIB_GETCHAR''@/$(GL_GNULIB_GETCHAR)/g' \ + -e 's/@''GNULIB_GETDELIM''@/$(GL_GNULIB_GETDELIM)/g' \ + -e 's/@''GNULIB_GETLINE''@/$(GL_GNULIB_GETLINE)/g' \ + -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GL_GNULIB_OBSTACK_PRINTF)/g' \ + -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GL_GNULIB_OBSTACK_PRINTF_POSIX)/g' \ + -e 's/@''GNULIB_PCLOSE''@/$(GL_GNULIB_PCLOSE)/g' \ + -e 's/@''GNULIB_PERROR''@/$(GL_GNULIB_PERROR)/g' \ + -e 's/@''GNULIB_POPEN''@/$(GL_GNULIB_POPEN)/g' \ + -e 's/@''GNULIB_PRINTF''@/$(GL_GNULIB_PRINTF)/g' \ + -e 's/@''GNULIB_PRINTF_POSIX''@/$(GL_GNULIB_PRINTF_POSIX)/g' \ + -e 's/@''GNULIB_PUTC''@/$(GL_GNULIB_PUTC)/g' \ + -e 's/@''GNULIB_PUTCHAR''@/$(GL_GNULIB_PUTCHAR)/g' \ + -e 's/@''GNULIB_PUTS''@/$(GL_GNULIB_PUTS)/g' \ + -e 's/@''GNULIB_REMOVE''@/$(GL_GNULIB_REMOVE)/g' \ + -e 's/@''GNULIB_RENAME''@/$(GL_GNULIB_RENAME)/g' \ + -e 's/@''GNULIB_RENAMEAT''@/$(GL_GNULIB_RENAMEAT)/g' \ + -e 's/@''GNULIB_SCANF''@/$(GL_GNULIB_SCANF)/g' \ + -e 's/@''GNULIB_SNPRINTF''@/$(GL_GNULIB_SNPRINTF)/g' \ + -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GL_GNULIB_SPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GL_GNULIB_STDIO_H_NONBLOCKING)/g' \ + -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GL_GNULIB_STDIO_H_SIGPIPE)/g' \ + -e 's/@''GNULIB_TMPFILE''@/$(GL_GNULIB_TMPFILE)/g' \ + -e 's/@''GNULIB_VASPRINTF''@/$(GL_GNULIB_VASPRINTF)/g' \ + -e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \ + -e 's/@''GNULIB_VFPRINTF''@/$(GL_GNULIB_VFPRINTF)/g' \ + -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GL_GNULIB_VFPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_VFSCANF''@/$(GL_GNULIB_VFSCANF)/g' \ + -e 's/@''GNULIB_VSCANF''@/$(GL_GNULIB_VSCANF)/g' \ + -e 's/@''GNULIB_VPRINTF''@/$(GL_GNULIB_VPRINTF)/g' \ + -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GL_GNULIB_VPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_VSNPRINTF''@/$(GL_GNULIB_VSNPRINTF)/g' \ + -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GL_GNULIB_VSPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GL_GNULIB_MDA_FCLOSEALL)/g' \ + -e 's/@''GNULIB_MDA_FDOPEN''@/$(GL_GNULIB_MDA_FDOPEN)/g' \ + -e 's/@''GNULIB_MDA_FILENO''@/$(GL_GNULIB_MDA_FILENO)/g' \ + -e 's/@''GNULIB_MDA_GETW''@/$(GL_GNULIB_MDA_GETW)/g' \ + -e 's/@''GNULIB_MDA_PUTW''@/$(GL_GNULIB_MDA_PUTW)/g' \ + -e 's/@''GNULIB_MDA_TEMPNAM''@/$(GL_GNULIB_MDA_TEMPNAM)/g' \ < $(srcdir)/stdio.in.h | \ sed -e 's|@''HAVE_DECL_FCLOSEALL''@|$(HAVE_DECL_FCLOSEALL)|g' \ -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \ @@ -2853,49 +2954,51 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ - -e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \ - -e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GNULIB_ALIGNED_ALLOC)/g' \ - -e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \ - -e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \ - -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \ - -e 's/@''GNULIB_FREE_POSIX''@/$(GNULIB_FREE_POSIX)/g' \ - -e 's/@''GNULIB_GETLOADAVG''@/$(GNULIB_GETLOADAVG)/g' \ - -e 's/@''GNULIB_GETSUBOPT''@/$(GNULIB_GETSUBOPT)/g' \ - -e 's/@''GNULIB_GRANTPT''@/$(GNULIB_GRANTPT)/g' \ - -e 's/@''GNULIB_MALLOC_POSIX''@/$(GNULIB_MALLOC_POSIX)/g' \ - -e 's/@''GNULIB_MBTOWC''@/$(GNULIB_MBTOWC)/g' \ - -e 's/@''GNULIB_MKDTEMP''@/$(GNULIB_MKDTEMP)/g' \ - -e 's/@''GNULIB_MKOSTEMP''@/$(GNULIB_MKOSTEMP)/g' \ - -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \ - -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \ - -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \ - -e 's/@''GNULIB_POSIX_MEMALIGN''@/$(GNULIB_POSIX_MEMALIGN)/g' \ - -e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \ - -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \ - -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \ - -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \ - -e 's/@''GNULIB_QSORT_R''@/$(GNULIB_QSORT_R)/g' \ - -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \ - -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ - -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ - -e 's/@''GNULIB_REALLOCARRAY''@/$(GNULIB_REALLOCARRAY)/g' \ - -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ - -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \ - -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \ - -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \ - -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \ - -e 's/@''GNULIB_STRTOLD''@/$(GNULIB_STRTOLD)/g' \ - -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \ - -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \ - -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \ - -e 's/@''GNULIB_UNLOCKPT''@/$(GNULIB_UNLOCKPT)/g' \ - -e 's/@''GNULIB_UNSETENV''@/$(GNULIB_UNSETENV)/g' \ - -e 's/@''GNULIB_WCTOMB''@/$(GNULIB_WCTOMB)/g' \ - -e 's/@''GNULIB_MDA_ECVT''@/$(GNULIB_MDA_ECVT)/g' \ - -e 's/@''GNULIB_MDA_FCVT''@/$(GNULIB_MDA_FCVT)/g' \ - -e 's/@''GNULIB_MDA_GCVT''@/$(GNULIB_MDA_GCVT)/g' \ - -e 's/@''GNULIB_MDA_MKTEMP''@/$(GNULIB_MDA_MKTEMP)/g' \ - -e 's/@''GNULIB_MDA_PUTENV''@/$(GNULIB_MDA_PUTENV)/g' \ + -e 's/@''GNULIB__EXIT''@/$(GL_GNULIB__EXIT)/g' \ + -e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GL_GNULIB_ALIGNED_ALLOC)/g' \ + -e 's/@''GNULIB_ATOLL''@/$(GL_GNULIB_ATOLL)/g' \ + -e 's/@''GNULIB_CALLOC_POSIX''@/$(GL_GNULIB_CALLOC_POSIX)/g' \ + -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GL_GNULIB_CANONICALIZE_FILE_NAME)/g' \ + -e 's/@''GNULIB_FREE_POSIX''@/$(GL_GNULIB_FREE_POSIX)/g' \ + -e 's/@''GNULIB_GETLOADAVG''@/$(GL_GNULIB_GETLOADAVG)/g' \ + -e 's/@''GNULIB_GETSUBOPT''@/$(GL_GNULIB_GETSUBOPT)/g' \ + -e 's/@''GNULIB_GRANTPT''@/$(GL_GNULIB_GRANTPT)/g' \ + -e 's/@''GNULIB_MALLOC_POSIX''@/$(GL_GNULIB_MALLOC_POSIX)/g' \ + -e 's/@''GNULIB_MBTOWC''@/$(GL_GNULIB_MBTOWC)/g' \ + -e 's/@''GNULIB_MKDTEMP''@/$(GL_GNULIB_MKDTEMP)/g' \ + -e 's/@''GNULIB_MKOSTEMP''@/$(GL_GNULIB_MKOSTEMP)/g' \ + -e 's/@''GNULIB_MKOSTEMPS''@/$(GL_GNULIB_MKOSTEMPS)/g' \ + -e 's/@''GNULIB_MKSTEMP''@/$(GL_GNULIB_MKSTEMP)/g' \ + -e 's/@''GNULIB_MKSTEMPS''@/$(GL_GNULIB_MKSTEMPS)/g' \ + -e 's/@''GNULIB_POSIX_MEMALIGN''@/$(GL_GNULIB_POSIX_MEMALIGN)/g' \ + -e 's/@''GNULIB_POSIX_OPENPT''@/$(GL_GNULIB_POSIX_OPENPT)/g' \ + -e 's/@''GNULIB_PTSNAME''@/$(GL_GNULIB_PTSNAME)/g' \ + -e 's/@''GNULIB_PTSNAME_R''@/$(GL_GNULIB_PTSNAME_R)/g' \ + -e 's/@''GNULIB_PUTENV''@/$(GL_GNULIB_PUTENV)/g' \ + -e 's/@''GNULIB_QSORT_R''@/$(GL_GNULIB_QSORT_R)/g' \ + -e 's/@''GNULIB_RANDOM''@/$(GL_GNULIB_RANDOM)/g' \ + -e 's/@''GNULIB_RANDOM_R''@/$(GL_GNULIB_RANDOM_R)/g' \ + -e 's/@''GNULIB_REALLOC_POSIX''@/$(GL_GNULIB_REALLOC_POSIX)/g' \ + -e 's/@''GNULIB_REALLOCARRAY''@/$(GL_GNULIB_REALLOCARRAY)/g' \ + -e 's/@''GNULIB_REALPATH''@/$(GL_GNULIB_REALPATH)/g' \ + -e 's/@''GNULIB_RPMATCH''@/$(GL_GNULIB_RPMATCH)/g' \ + -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \ + -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \ + -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \ + -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \ + -e 's/@''GNULIB_STRTOLD''@/$(GL_GNULIB_STRTOLD)/g' \ + -e 's/@''GNULIB_STRTOLL''@/$(GL_GNULIB_STRTOLL)/g' \ + -e 's/@''GNULIB_STRTOUL''@/$(GL_GNULIB_STRTOUL)/g' \ + -e 's/@''GNULIB_STRTOULL''@/$(GL_GNULIB_STRTOULL)/g' \ + -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GL_GNULIB_SYSTEM_POSIX)/g' \ + -e 's/@''GNULIB_UNLOCKPT''@/$(GL_GNULIB_UNLOCKPT)/g' \ + -e 's/@''GNULIB_UNSETENV''@/$(GL_GNULIB_UNSETENV)/g' \ + -e 's/@''GNULIB_WCTOMB''@/$(GL_GNULIB_WCTOMB)/g' \ + -e 's/@''GNULIB_MDA_ECVT''@/$(GL_GNULIB_MDA_ECVT)/g' \ + -e 's/@''GNULIB_MDA_FCVT''@/$(GL_GNULIB_MDA_FCVT)/g' \ + -e 's/@''GNULIB_MDA_GCVT''@/$(GL_GNULIB_MDA_GCVT)/g' \ + -e 's/@''GNULIB_MDA_MKTEMP''@/$(GL_GNULIB_MDA_MKTEMP)/g' \ + -e 's/@''GNULIB_MDA_PUTENV''@/$(GL_GNULIB_MDA_PUTENV)/g' \ < $(srcdir)/stdlib.in.h | \ sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ -e 's|@''HAVE_ALIGNED_ALLOC''@|$(HAVE_ALIGNED_ALLOC)|g' \ @@ -2931,8 +3034,10 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_SETSTATE''@|$(HAVE_SETSTATE)|g' \ -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ + -e 's|@''HAVE_STRTOL''@|$(HAVE_STRTOL)|g' \ -e 's|@''HAVE_STRTOLD''@|$(HAVE_STRTOLD)|g' \ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ + -e 's|@''HAVE_STRTOUL''@|$(HAVE_STRTOUL)|g' \ -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ @@ -2954,11 +3059,16 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \ -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ + -e 's|@''REPLACE_REALLOCARRAY''@|$(REPLACE_REALLOCARRAY)|g' \ -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ -e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ + -e 's|@''REPLACE_STRTOL''@|$(REPLACE_STRTOL)|g' \ -e 's|@''REPLACE_STRTOLD''@|$(REPLACE_STRTOLD)|g' \ + -e 's|@''REPLACE_STRTOLL''@|$(REPLACE_STRTOLL)|g' \ + -e 's|@''REPLACE_STRTOUL''@|$(REPLACE_STRTOUL)|g' \ + -e 's|@''REPLACE_STRTOULL''@|$(REPLACE_STRTOULL)|g' \ -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ @@ -3000,49 +3110,50 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ - -e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GNULIB_EXPLICIT_BZERO)/g' \ - -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \ - -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \ - -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \ - -e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \ - -e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \ - -e 's/@''GNULIB_MBSRCHR''@/$(GNULIB_MBSRCHR)/g' \ - -e 's/@''GNULIB_MBSSTR''@/$(GNULIB_MBSSTR)/g' \ - -e 's/@''GNULIB_MBSCASECMP''@/$(GNULIB_MBSCASECMP)/g' \ - -e 's/@''GNULIB_MBSNCASECMP''@/$(GNULIB_MBSNCASECMP)/g' \ - -e 's/@''GNULIB_MBSPCASECMP''@/$(GNULIB_MBSPCASECMP)/g' \ - -e 's/@''GNULIB_MBSCASESTR''@/$(GNULIB_MBSCASESTR)/g' \ - -e 's/@''GNULIB_MBSCSPN''@/$(GNULIB_MBSCSPN)/g' \ - -e 's/@''GNULIB_MBSPBRK''@/$(GNULIB_MBSPBRK)/g' \ - -e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \ - -e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \ - -e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \ - -e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \ - -e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \ - -e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \ - -e 's/@''GNULIB_MEMRCHR''@/$(GNULIB_MEMRCHR)/g' \ - -e 's/@''GNULIB_RAWMEMCHR''@/$(GNULIB_RAWMEMCHR)/g' \ - -e 's/@''GNULIB_STPCPY''@/$(GNULIB_STPCPY)/g' \ - -e 's/@''GNULIB_STPNCPY''@/$(GNULIB_STPNCPY)/g' \ - -e 's/@''GNULIB_STRCHRNUL''@/$(GNULIB_STRCHRNUL)/g' \ - -e 's/@''GNULIB_STRDUP''@/$(GNULIB_STRDUP)/g' \ - -e 's/@''GNULIB_STRNCAT''@/$(GNULIB_STRNCAT)/g' \ - -e 's/@''GNULIB_STRNDUP''@/$(GNULIB_STRNDUP)/g' \ - -e 's/@''GNULIB_STRNLEN''@/$(GNULIB_STRNLEN)/g' \ - -e 's/@''GNULIB_STRPBRK''@/$(GNULIB_STRPBRK)/g' \ - -e 's/@''GNULIB_STRSEP''@/$(GNULIB_STRSEP)/g' \ - -e 's/@''GNULIB_STRSTR''@/$(GNULIB_STRSTR)/g' \ - -e 's/@''GNULIB_STRCASESTR''@/$(GNULIB_STRCASESTR)/g' \ - -e 's/@''GNULIB_STRTOK_R''@/$(GNULIB_STRTOK_R)/g' \ - -e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \ - -e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \ - -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GNULIB_STRERRORNAME_NP)/g' \ - -e 's/@''GNULIB_SIGABBREV_NP''@/$(GNULIB_SIGABBREV_NP)/g' \ - -e 's/@''GNULIB_SIGDESCR_NP''@/$(GNULIB_SIGDESCR_NP)/g' \ - -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \ - -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \ - -e 's/@''GNULIB_MDA_MEMCCPY''@/$(GNULIB_MDA_MEMCCPY)/g' \ - -e 's/@''GNULIB_MDA_STRDUP''@/$(GNULIB_MDA_STRDUP)/g' \ + -e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GL_GNULIB_EXPLICIT_BZERO)/g' \ + -e 's/@''GNULIB_FFSL''@/$(GL_GNULIB_FFSL)/g' \ + -e 's/@''GNULIB_FFSLL''@/$(GL_GNULIB_FFSLL)/g' \ + -e 's/@''GNULIB_MBSLEN''@/$(GL_GNULIB_MBSLEN)/g' \ + -e 's/@''GNULIB_MBSNLEN''@/$(GL_GNULIB_MBSNLEN)/g' \ + -e 's/@''GNULIB_MBSCHR''@/$(GL_GNULIB_MBSCHR)/g' \ + -e 's/@''GNULIB_MBSRCHR''@/$(GL_GNULIB_MBSRCHR)/g' \ + -e 's/@''GNULIB_MBSSTR''@/$(GL_GNULIB_MBSSTR)/g' \ + -e 's/@''GNULIB_MBSCASECMP''@/$(GL_GNULIB_MBSCASECMP)/g' \ + -e 's/@''GNULIB_MBSNCASECMP''@/$(GL_GNULIB_MBSNCASECMP)/g' \ + -e 's/@''GNULIB_MBSPCASECMP''@/$(GL_GNULIB_MBSPCASECMP)/g' \ + -e 's/@''GNULIB_MBSCASESTR''@/$(GL_GNULIB_MBSCASESTR)/g' \ + -e 's/@''GNULIB_MBSCSPN''@/$(GL_GNULIB_MBSCSPN)/g' \ + -e 's/@''GNULIB_MBSPBRK''@/$(GL_GNULIB_MBSPBRK)/g' \ + -e 's/@''GNULIB_MBSSPN''@/$(GL_GNULIB_MBSSPN)/g' \ + -e 's/@''GNULIB_MBSSEP''@/$(GL_GNULIB_MBSSEP)/g' \ + -e 's/@''GNULIB_MBSTOK_R''@/$(GL_GNULIB_MBSTOK_R)/g' \ + -e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \ + -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \ + -e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \ + -e 's/@''GNULIB_MEMRCHR''@/$(GL_GNULIB_MEMRCHR)/g' \ + -e 's/@''GNULIB_RAWMEMCHR''@/$(GL_GNULIB_RAWMEMCHR)/g' \ + -e 's/@''GNULIB_STPCPY''@/$(GL_GNULIB_STPCPY)/g' \ + -e 's/@''GNULIB_STPNCPY''@/$(GL_GNULIB_STPNCPY)/g' \ + -e 's/@''GNULIB_STRCHRNUL''@/$(GL_GNULIB_STRCHRNUL)/g' \ + -e 's/@''GNULIB_STRDUP''@/$(GL_GNULIB_STRDUP)/g' \ + -e 's/@''GNULIB_STRNCAT''@/$(GL_GNULIB_STRNCAT)/g' \ + -e 's/@''GNULIB_STRNDUP''@/$(GL_GNULIB_STRNDUP)/g' \ + -e 's/@''GNULIB_STRNLEN''@/$(GL_GNULIB_STRNLEN)/g' \ + -e 's/@''GNULIB_STRPBRK''@/$(GL_GNULIB_STRPBRK)/g' \ + -e 's/@''GNULIB_STRSEP''@/$(GL_GNULIB_STRSEP)/g' \ + -e 's/@''GNULIB_STRSTR''@/$(GL_GNULIB_STRSTR)/g' \ + -e 's/@''GNULIB_STRCASESTR''@/$(GL_GNULIB_STRCASESTR)/g' \ + -e 's/@''GNULIB_STRTOK_R''@/$(GL_GNULIB_STRTOK_R)/g' \ + -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \ + -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \ + -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \ + -e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \ + -e 's/@''GNULIB_SIGDESCR_NP''@/$(GL_GNULIB_SIGDESCR_NP)/g' \ + -e 's/@''GNULIB_STRSIGNAL''@/$(GL_GNULIB_STRSIGNAL)/g' \ + -e 's/@''GNULIB_STRVERSCMP''@/$(GL_GNULIB_STRVERSCMP)/g' \ + -e 's/@''GNULIB_MDA_MEMCCPY''@/$(GL_GNULIB_MDA_MEMCCPY)/g' \ + -e 's/@''GNULIB_MDA_STRDUP''@/$(GL_GNULIB_MDA_STRDUP)/g' \ + -e 's/@''GNULIB_FREE_POSIX''@/$(GL_GNULIB_FREE_POSIX)/g' \ < $(srcdir)/string.in.h | \ sed -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \ -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ @@ -3071,6 +3182,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''REPLACE_FFSLL''@|$(REPLACE_FFSLL)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ + -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \ -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ @@ -3161,7 +3273,7 @@ sys/random.h: sys_random.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_N -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_RANDOM_H''@|$(NEXT_SYS_RANDOM_H)|g' \ -e 's|@''HAVE_SYS_RANDOM_H''@|$(HAVE_SYS_RANDOM_H)|g' \ - -e 's/@''GNULIB_GETRANDOM''@/$(GNULIB_GETRANDOM)/g' \ + -e 's/@''GNULIB_GETRANDOM''@/$(GL_GNULIB_GETRANDOM)/g' \ -e 's/@''HAVE_GETRANDOM''@/$(HAVE_GETRANDOM)/g' \ -e 's/@''REPLACE_GETRANDOM''@/$(REPLACE_GETRANDOM)/g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ @@ -3195,8 +3307,8 @@ sys/select.h: sys_select.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_SELECT_H''@|$(NEXT_SYS_SELECT_H)|g' \ -e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \ - -e 's/@''GNULIB_PSELECT''@/$(GNULIB_PSELECT)/g' \ - -e 's/@''GNULIB_SELECT''@/$(GNULIB_SELECT)/g' \ + -e 's/@''GNULIB_PSELECT''@/$(GL_GNULIB_PSELECT)/g' \ + -e 's/@''GNULIB_SELECT''@/$(GL_GNULIB_SELECT)/g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's|@''HAVE_PSELECT''@|$(HAVE_PSELECT)|g' \ -e 's|@''REPLACE_PSELECT''@|$(REPLACE_PSELECT)|g' \ @@ -3232,25 +3344,25 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \ -e 's|@''WINDOWS_STAT_TIMESPEC''@|$(WINDOWS_STAT_TIMESPEC)|g' \ - -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \ - -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \ - -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ - -e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \ - -e 's/@''GNULIB_GETUMASK''@/$(GNULIB_GETUMASK)/g' \ - -e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \ - -e 's/@''GNULIB_LSTAT''@/$(GNULIB_LSTAT)/g' \ - -e 's/@''GNULIB_MKDIR''@/$(GNULIB_MKDIR)/g' \ - -e 's/@''GNULIB_MKDIRAT''@/$(GNULIB_MKDIRAT)/g' \ - -e 's/@''GNULIB_MKFIFO''@/$(GNULIB_MKFIFO)/g' \ - -e 's/@''GNULIB_MKFIFOAT''@/$(GNULIB_MKFIFOAT)/g' \ - -e 's/@''GNULIB_MKNOD''@/$(GNULIB_MKNOD)/g' \ - -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \ - -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \ - -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \ - -e 's/@''GNULIB_OVERRIDES_STRUCT_STAT''@/$(GNULIB_OVERRIDES_STRUCT_STAT)/g' \ - -e 's/@''GNULIB_MDA_CHMOD''@/$(GNULIB_MDA_CHMOD)/g' \ - -e 's/@''GNULIB_MDA_MKDIR''@/$(GNULIB_MDA_MKDIR)/g' \ - -e 's/@''GNULIB_MDA_UMASK''@/$(GNULIB_MDA_UMASK)/g' \ + -e 's/@''GNULIB_FCHMODAT''@/$(GL_GNULIB_FCHMODAT)/g' \ + -e 's/@''GNULIB_FSTAT''@/$(GL_GNULIB_FSTAT)/g' \ + -e 's/@''GNULIB_FSTATAT''@/$(GL_GNULIB_FSTATAT)/g' \ + -e 's/@''GNULIB_FUTIMENS''@/$(GL_GNULIB_FUTIMENS)/g' \ + -e 's/@''GNULIB_GETUMASK''@/$(GL_GNULIB_GETUMASK)/g' \ + -e 's/@''GNULIB_LCHMOD''@/$(GL_GNULIB_LCHMOD)/g' \ + -e 's/@''GNULIB_LSTAT''@/$(GL_GNULIB_LSTAT)/g' \ + -e 's/@''GNULIB_MKDIR''@/$(GL_GNULIB_MKDIR)/g' \ + -e 's/@''GNULIB_MKDIRAT''@/$(GL_GNULIB_MKDIRAT)/g' \ + -e 's/@''GNULIB_MKFIFO''@/$(GL_GNULIB_MKFIFO)/g' \ + -e 's/@''GNULIB_MKFIFOAT''@/$(GL_GNULIB_MKFIFOAT)/g' \ + -e 's/@''GNULIB_MKNOD''@/$(GL_GNULIB_MKNOD)/g' \ + -e 's/@''GNULIB_MKNODAT''@/$(GL_GNULIB_MKNODAT)/g' \ + -e 's/@''GNULIB_STAT''@/$(GL_GNULIB_STAT)/g' \ + -e 's/@''GNULIB_UTIMENSAT''@/$(GL_GNULIB_UTIMENSAT)/g' \ + -e 's/@''GNULIB_OVERRIDES_STRUCT_STAT''@/$(GL_GNULIB_OVERRIDES_STRUCT_STAT)/g' \ + -e 's/@''GNULIB_MDA_CHMOD''@/$(GL_GNULIB_MDA_CHMOD)/g' \ + -e 's/@''GNULIB_MDA_MKDIR''@/$(GL_GNULIB_MDA_MKDIR)/g' \ + -e 's/@''GNULIB_MDA_UMASK''@/$(GL_GNULIB_MDA_UMASK)/g' \ -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ @@ -3306,7 +3418,7 @@ sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \ - -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \ + -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GL_GNULIB_GETTIMEOFDAY)/g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \ -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \ @@ -3378,18 +3490,18 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ - -e 's/@''GNULIB_CTIME''@/$(GNULIB_CTIME)/g' \ - -e 's/@''GNULIB_LOCALTIME''@/$(GNULIB_LOCALTIME)/g' \ - -e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \ - -e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \ - -e 's/@''GNULIB_STRFTIME''@/$(GNULIB_STRFTIME)/g' \ - -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \ - -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \ - -e 's/@''GNULIB_TIMESPEC_GET''@/$(GNULIB_TIMESPEC_GET)/g' \ - -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \ - -e 's/@''GNULIB_TIME_RZ''@/$(GNULIB_TIME_RZ)/g' \ - -e 's/@''GNULIB_TZSET''@/$(GNULIB_TZSET)/g' \ - -e 's/@''GNULIB_MDA_TZSET''@/$(GNULIB_MDA_TZSET)/g' \ + -e 's/@''GNULIB_CTIME''@/$(GL_GNULIB_CTIME)/g' \ + -e 's/@''GNULIB_LOCALTIME''@/$(GL_GNULIB_LOCALTIME)/g' \ + -e 's/@''GNULIB_MKTIME''@/$(GL_GNULIB_MKTIME)/g' \ + -e 's/@''GNULIB_NANOSLEEP''@/$(GL_GNULIB_NANOSLEEP)/g' \ + -e 's/@''GNULIB_STRFTIME''@/$(GL_GNULIB_STRFTIME)/g' \ + -e 's/@''GNULIB_STRPTIME''@/$(GL_GNULIB_STRPTIME)/g' \ + -e 's/@''GNULIB_TIMEGM''@/$(GL_GNULIB_TIMEGM)/g' \ + -e 's/@''GNULIB_TIMESPEC_GET''@/$(GL_GNULIB_TIMESPEC_GET)/g' \ + -e 's/@''GNULIB_TIME_R''@/$(GL_GNULIB_TIME_R)/g' \ + -e 's/@''GNULIB_TIME_RZ''@/$(GL_GNULIB_TIME_RZ)/g' \ + -e 's/@''GNULIB_TZSET''@/$(GL_GNULIB_TZSET)/g' \ + -e 's/@''GNULIB_MDA_TZSET''@/$(GL_GNULIB_MDA_TZSET)/g' \ -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ @@ -3510,89 +3622,89 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ - -e 's/@''GNULIB_ACCESS''@/$(GNULIB_ACCESS)/g' \ - -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \ - -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ - -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ - -e 's/@''GNULIB_COPY_FILE_RANGE''@/$(GNULIB_COPY_FILE_RANGE)/g' \ - -e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/g' \ - -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \ - -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \ - -e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \ - -e 's/@''GNULIB_EUIDACCESS''@/$(GNULIB_EUIDACCESS)/g' \ - -e 's/@''GNULIB_EXECL''@/$(GNULIB_EXECL)/g' \ - -e 's/@''GNULIB_EXECLE''@/$(GNULIB_EXECLE)/g' \ - -e 's/@''GNULIB_EXECLP''@/$(GNULIB_EXECLP)/g' \ - -e 's/@''GNULIB_EXECV''@/$(GNULIB_EXECV)/g' \ - -e 's/@''GNULIB_EXECVE''@/$(GNULIB_EXECVE)/g' \ - -e 's/@''GNULIB_EXECVP''@/$(GNULIB_EXECVP)/g' \ - -e 's/@''GNULIB_EXECVPE''@/$(GNULIB_EXECVPE)/g' \ - -e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \ - -e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \ - -e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \ - -e 's/@''GNULIB_FDATASYNC''@/$(GNULIB_FDATASYNC)/g' \ - -e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \ - -e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \ - -e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \ - -e 's/@''GNULIB_GETDOMAINNAME''@/$(GNULIB_GETDOMAINNAME)/g' \ - -e 's/@''GNULIB_GETDTABLESIZE''@/$(GNULIB_GETDTABLESIZE)/g' \ - -e 's/@''GNULIB_GETENTROPY''@/$(GNULIB_GETENTROPY)/g' \ - -e 's/@''GNULIB_GETGROUPS''@/$(GNULIB_GETGROUPS)/g' \ - -e 's/@''GNULIB_GETHOSTNAME''@/$(GNULIB_GETHOSTNAME)/g' \ - -e 's/@''GNULIB_GETLOGIN''@/$(GNULIB_GETLOGIN)/g' \ - -e 's/@''GNULIB_GETLOGIN_R''@/$(GNULIB_GETLOGIN_R)/g' \ - -e 's/@''GNULIB_GETOPT_POSIX''@/$(GNULIB_GETOPT_POSIX)/g' \ - -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \ - -e 's/@''GNULIB_GETPASS''@/$(GNULIB_GETPASS)/g' \ - -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \ - -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \ - -e 's/@''GNULIB_ISATTY''@/$(GNULIB_ISATTY)/g' \ - -e 's/@''GNULIB_LCHOWN''@/$(GNULIB_LCHOWN)/g' \ - -e 's/@''GNULIB_LINK''@/$(GNULIB_LINK)/g' \ - -e 's/@''GNULIB_LINKAT''@/$(GNULIB_LINKAT)/g' \ - -e 's/@''GNULIB_LSEEK''@/$(GNULIB_LSEEK)/g' \ - -e 's/@''GNULIB_PIPE''@/$(GNULIB_PIPE)/g' \ - -e 's/@''GNULIB_PIPE2''@/$(GNULIB_PIPE2)/g' \ - -e 's/@''GNULIB_PREAD''@/$(GNULIB_PREAD)/g' \ - -e 's/@''GNULIB_PWRITE''@/$(GNULIB_PWRITE)/g' \ - -e 's/@''GNULIB_READ''@/$(GNULIB_READ)/g' \ - -e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \ - -e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \ - -e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \ - -e 's/@''GNULIB_SETHOSTNAME''@/$(GNULIB_SETHOSTNAME)/g' \ - -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \ - -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \ - -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \ - -e 's/@''GNULIB_TRUNCATE''@/$(GNULIB_TRUNCATE)/g' \ - -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \ - -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \ - -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \ - -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GNULIB_UNISTD_H_SIGPIPE)/g' \ - -e 's/@''GNULIB_UNLINK''@/$(GNULIB_UNLINK)/g' \ - -e 's/@''GNULIB_UNLINKAT''@/$(GNULIB_UNLINKAT)/g' \ - -e 's/@''GNULIB_USLEEP''@/$(GNULIB_USLEEP)/g' \ - -e 's/@''GNULIB_WRITE''@/$(GNULIB_WRITE)/g' \ - -e 's/@''GNULIB_MDA_ACCESS''@/$(GNULIB_MDA_ACCESS)/g' \ - -e 's/@''GNULIB_MDA_CHDIR''@/$(GNULIB_MDA_CHDIR)/g' \ - -e 's/@''GNULIB_MDA_CLOSE''@/$(GNULIB_MDA_CLOSE)/g' \ - -e 's/@''GNULIB_MDA_DUP''@/$(GNULIB_MDA_DUP)/g' \ - -e 's/@''GNULIB_MDA_DUP2''@/$(GNULIB_MDA_DUP2)/g' \ - -e 's/@''GNULIB_MDA_EXECL''@/$(GNULIB_MDA_EXECL)/g' \ - -e 's/@''GNULIB_MDA_EXECLE''@/$(GNULIB_MDA_EXECLE)/g' \ - -e 's/@''GNULIB_MDA_EXECLP''@/$(GNULIB_MDA_EXECLP)/g' \ - -e 's/@''GNULIB_MDA_EXECV''@/$(GNULIB_MDA_EXECV)/g' \ - -e 's/@''GNULIB_MDA_EXECVE''@/$(GNULIB_MDA_EXECVE)/g' \ - -e 's/@''GNULIB_MDA_EXECVP''@/$(GNULIB_MDA_EXECVP)/g' \ - -e 's/@''GNULIB_MDA_EXECVPE''@/$(GNULIB_MDA_EXECVPE)/g' \ - -e 's/@''GNULIB_MDA_GETCWD''@/$(GNULIB_MDA_GETCWD)/g' \ - -e 's/@''GNULIB_MDA_GETPID''@/$(GNULIB_MDA_GETPID)/g' \ - -e 's/@''GNULIB_MDA_ISATTY''@/$(GNULIB_MDA_ISATTY)/g' \ - -e 's/@''GNULIB_MDA_LSEEK''@/$(GNULIB_MDA_LSEEK)/g' \ - -e 's/@''GNULIB_MDA_READ''@/$(GNULIB_MDA_READ)/g' \ - -e 's/@''GNULIB_MDA_RMDIR''@/$(GNULIB_MDA_RMDIR)/g' \ - -e 's/@''GNULIB_MDA_SWAB''@/$(GNULIB_MDA_SWAB)/g' \ - -e 's/@''GNULIB_MDA_UNLINK''@/$(GNULIB_MDA_UNLINK)/g' \ - -e 's/@''GNULIB_MDA_WRITE''@/$(GNULIB_MDA_WRITE)/g' \ + -e 's/@''GNULIB_ACCESS''@/$(GL_GNULIB_ACCESS)/g' \ + -e 's/@''GNULIB_CHDIR''@/$(GL_GNULIB_CHDIR)/g' \ + -e 's/@''GNULIB_CHOWN''@/$(GL_GNULIB_CHOWN)/g' \ + -e 's/@''GNULIB_CLOSE''@/$(GL_GNULIB_CLOSE)/g' \ + -e 's/@''GNULIB_COPY_FILE_RANGE''@/$(GL_GNULIB_COPY_FILE_RANGE)/g' \ + -e 's/@''GNULIB_DUP''@/$(GL_GNULIB_DUP)/g' \ + -e 's/@''GNULIB_DUP2''@/$(GL_GNULIB_DUP2)/g' \ + -e 's/@''GNULIB_DUP3''@/$(GL_GNULIB_DUP3)/g' \ + -e 's/@''GNULIB_ENVIRON''@/$(GL_GNULIB_ENVIRON)/g' \ + -e 's/@''GNULIB_EUIDACCESS''@/$(GL_GNULIB_EUIDACCESS)/g' \ + -e 's/@''GNULIB_EXECL''@/$(GL_GNULIB_EXECL)/g' \ + -e 's/@''GNULIB_EXECLE''@/$(GL_GNULIB_EXECLE)/g' \ + -e 's/@''GNULIB_EXECLP''@/$(GL_GNULIB_EXECLP)/g' \ + -e 's/@''GNULIB_EXECV''@/$(GL_GNULIB_EXECV)/g' \ + -e 's/@''GNULIB_EXECVE''@/$(GL_GNULIB_EXECVE)/g' \ + -e 's/@''GNULIB_EXECVP''@/$(GL_GNULIB_EXECVP)/g' \ + -e 's/@''GNULIB_EXECVPE''@/$(GL_GNULIB_EXECVPE)/g' \ + -e 's/@''GNULIB_FACCESSAT''@/$(GL_GNULIB_FACCESSAT)/g' \ + -e 's/@''GNULIB_FCHDIR''@/$(GL_GNULIB_FCHDIR)/g' \ + -e 's/@''GNULIB_FCHOWNAT''@/$(GL_GNULIB_FCHOWNAT)/g' \ + -e 's/@''GNULIB_FDATASYNC''@/$(GL_GNULIB_FDATASYNC)/g' \ + -e 's/@''GNULIB_FSYNC''@/$(GL_GNULIB_FSYNC)/g' \ + -e 's/@''GNULIB_FTRUNCATE''@/$(GL_GNULIB_FTRUNCATE)/g' \ + -e 's/@''GNULIB_GETCWD''@/$(GL_GNULIB_GETCWD)/g' \ + -e 's/@''GNULIB_GETDOMAINNAME''@/$(GL_GNULIB_GETDOMAINNAME)/g' \ + -e 's/@''GNULIB_GETDTABLESIZE''@/$(GL_GNULIB_GETDTABLESIZE)/g' \ + -e 's/@''GNULIB_GETENTROPY''@/$(GL_GNULIB_GETENTROPY)/g' \ + -e 's/@''GNULIB_GETGROUPS''@/$(GL_GNULIB_GETGROUPS)/g' \ + -e 's/@''GNULIB_GETHOSTNAME''@/$(GL_GNULIB_GETHOSTNAME)/g' \ + -e 's/@''GNULIB_GETLOGIN''@/$(GL_GNULIB_GETLOGIN)/g' \ + -e 's/@''GNULIB_GETLOGIN_R''@/$(GL_GNULIB_GETLOGIN_R)/g' \ + -e 's/@''GNULIB_GETOPT_POSIX''@/$(GL_GNULIB_GETOPT_POSIX)/g' \ + -e 's/@''GNULIB_GETPAGESIZE''@/$(GL_GNULIB_GETPAGESIZE)/g' \ + -e 's/@''GNULIB_GETPASS''@/$(GL_GNULIB_GETPASS)/g' \ + -e 's/@''GNULIB_GETUSERSHELL''@/$(GL_GNULIB_GETUSERSHELL)/g' \ + -e 's/@''GNULIB_GROUP_MEMBER''@/$(GL_GNULIB_GROUP_MEMBER)/g' \ + -e 's/@''GNULIB_ISATTY''@/$(GL_GNULIB_ISATTY)/g' \ + -e 's/@''GNULIB_LCHOWN''@/$(GL_GNULIB_LCHOWN)/g' \ + -e 's/@''GNULIB_LINK''@/$(GL_GNULIB_LINK)/g' \ + -e 's/@''GNULIB_LINKAT''@/$(GL_GNULIB_LINKAT)/g' \ + -e 's/@''GNULIB_LSEEK''@/$(GL_GNULIB_LSEEK)/g' \ + -e 's/@''GNULIB_PIPE''@/$(GL_GNULIB_PIPE)/g' \ + -e 's/@''GNULIB_PIPE2''@/$(GL_GNULIB_PIPE2)/g' \ + -e 's/@''GNULIB_PREAD''@/$(GL_GNULIB_PREAD)/g' \ + -e 's/@''GNULIB_PWRITE''@/$(GL_GNULIB_PWRITE)/g' \ + -e 's/@''GNULIB_READ''@/$(GL_GNULIB_READ)/g' \ + -e 's/@''GNULIB_READLINK''@/$(GL_GNULIB_READLINK)/g' \ + -e 's/@''GNULIB_READLINKAT''@/$(GL_GNULIB_READLINKAT)/g' \ + -e 's/@''GNULIB_RMDIR''@/$(GL_GNULIB_RMDIR)/g' \ + -e 's/@''GNULIB_SETHOSTNAME''@/$(GL_GNULIB_SETHOSTNAME)/g' \ + -e 's/@''GNULIB_SLEEP''@/$(GL_GNULIB_SLEEP)/g' \ + -e 's/@''GNULIB_SYMLINK''@/$(GL_GNULIB_SYMLINK)/g' \ + -e 's/@''GNULIB_SYMLINKAT''@/$(GL_GNULIB_SYMLINKAT)/g' \ + -e 's/@''GNULIB_TRUNCATE''@/$(GL_GNULIB_TRUNCATE)/g' \ + -e 's/@''GNULIB_TTYNAME_R''@/$(GL_GNULIB_TTYNAME_R)/g' \ + -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GL_GNULIB_UNISTD_H_GETOPT)/g' \ + -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GL_GNULIB_UNISTD_H_NONBLOCKING)/g' \ + -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GL_GNULIB_UNISTD_H_SIGPIPE)/g' \ + -e 's/@''GNULIB_UNLINK''@/$(GL_GNULIB_UNLINK)/g' \ + -e 's/@''GNULIB_UNLINKAT''@/$(GL_GNULIB_UNLINKAT)/g' \ + -e 's/@''GNULIB_USLEEP''@/$(GL_GNULIB_USLEEP)/g' \ + -e 's/@''GNULIB_WRITE''@/$(GL_GNULIB_WRITE)/g' \ + -e 's/@''GNULIB_MDA_ACCESS''@/$(GL_GNULIB_MDA_ACCESS)/g' \ + -e 's/@''GNULIB_MDA_CHDIR''@/$(GL_GNULIB_MDA_CHDIR)/g' \ + -e 's/@''GNULIB_MDA_CLOSE''@/$(GL_GNULIB_MDA_CLOSE)/g' \ + -e 's/@''GNULIB_MDA_DUP''@/$(GL_GNULIB_MDA_DUP)/g' \ + -e 's/@''GNULIB_MDA_DUP2''@/$(GL_GNULIB_MDA_DUP2)/g' \ + -e 's/@''GNULIB_MDA_EXECL''@/$(GL_GNULIB_MDA_EXECL)/g' \ + -e 's/@''GNULIB_MDA_EXECLE''@/$(GL_GNULIB_MDA_EXECLE)/g' \ + -e 's/@''GNULIB_MDA_EXECLP''@/$(GL_GNULIB_MDA_EXECLP)/g' \ + -e 's/@''GNULIB_MDA_EXECV''@/$(GL_GNULIB_MDA_EXECV)/g' \ + -e 's/@''GNULIB_MDA_EXECVE''@/$(GL_GNULIB_MDA_EXECVE)/g' \ + -e 's/@''GNULIB_MDA_EXECVP''@/$(GL_GNULIB_MDA_EXECVP)/g' \ + -e 's/@''GNULIB_MDA_EXECVPE''@/$(GL_GNULIB_MDA_EXECVPE)/g' \ + -e 's/@''GNULIB_MDA_GETCWD''@/$(GL_GNULIB_MDA_GETCWD)/g' \ + -e 's/@''GNULIB_MDA_GETPID''@/$(GL_GNULIB_MDA_GETPID)/g' \ + -e 's/@''GNULIB_MDA_ISATTY''@/$(GL_GNULIB_MDA_ISATTY)/g' \ + -e 's/@''GNULIB_MDA_LSEEK''@/$(GL_GNULIB_MDA_LSEEK)/g' \ + -e 's/@''GNULIB_MDA_READ''@/$(GL_GNULIB_MDA_READ)/g' \ + -e 's/@''GNULIB_MDA_RMDIR''@/$(GL_GNULIB_MDA_RMDIR)/g' \ + -e 's/@''GNULIB_MDA_SWAB''@/$(GL_GNULIB_MDA_SWAB)/g' \ + -e 's/@''GNULIB_MDA_UNLINK''@/$(GL_GNULIB_MDA_UNLINK)/g' \ + -e 's/@''GNULIB_MDA_WRITE''@/$(GL_GNULIB_MDA_WRITE)/g' \ < $(srcdir)/unistd.in.h | \ sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ -e 's|@''HAVE_COPY_FILE_RANGE''@|$(HAVE_COPY_FILE_RANGE)|g' \ @@ -3699,14 +3811,14 @@ EXTRA_DIST += unistd.in.h endif ## end gnulib module unistd -## begin gnulib module unlocked-io -ifeq (,$(OMIT_GNULIB_MODULE_unlocked-io)) +## begin gnulib module unlocked-io-internal +ifeq (,$(OMIT_GNULIB_MODULE_unlocked-io-internal)) EXTRA_DIST += unlocked-io.h endif -## end gnulib module unlocked-io +## end gnulib module unlocked-io-internal ## begin gnulib module update-copyright ifeq (,$(OMIT_GNULIB_MODULE_update-copyright)) diff --git a/lib/group-member.c b/lib/group-member.c index 52159016ea..24aea3599c 100644 --- a/lib/group-member.c +++ b/lib/group-member.c @@ -3,17 +3,17 @@ Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include @@ -25,7 +25,7 @@ #include #include -#include "xalloc-oversized.h" +#include "intprops.h" /* Most processes have no more than this many groups, and for these processes we can avoid using malloc. */ @@ -53,10 +53,10 @@ get_group_info (struct group_info *gi) if (n_groups < 0) { int n_group_slots = getgroups (0, NULL); - if (0 <= n_group_slots - && ! xalloc_oversized (n_group_slots, sizeof *gi->group)) + size_t nbytes; + if (! INT_MULTIPLY_WRAPV (n_group_slots, sizeof *gi->group, &nbytes)) { - gi->group = malloc (n_group_slots * sizeof *gi->group); + gi->group = malloc (nbytes); if (gi->group) n_groups = getgroups (n_group_slots, gi->group); } diff --git a/lib/idx.h b/lib/idx.h index 681c8c90f1..54ad5d81fe 100644 --- a/lib/idx.h +++ b/lib/idx.h @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ @@ -56,6 +56,26 @@ * Because 'size_t' is an unsigned type, and a signed type is better. See above. + Why not use 'ssize_t'? + + * 'ptrdiff_t' is more portable; it is standardized by ISO C + whereas 'ssize_t' is standardized only by POSIX. + + * 'ssize_t' is not required to be as wide as 'size_t', and some + now-obsolete POSIX platforms had 'size_t' wider than 'ssize_t'. + + * Conversely, some now-obsolete platforms had 'ptrdiff_t' wider + than 'size_t', which can be a win and conforms to POSIX. + + Won't this cause a problem with objects larger than PTRDIFF_MAX? + + * Typical modern or large platforms do not allocate such objects, + so this is not much of a problem in practice; for example, you + can safely write 'idx_t len = strlen (s);'. To port to older + small platforms where allocations larger than PTRDIFF_MAX could + in theory be a problem, you can use Gnulib's ialloc module, or + functions like ximalloc in Gnulib's xalloc module. + Why not use 'ptrdiff_t' directly? * Maintainability: When reading and modifying code, it helps to know that diff --git a/lib/ieee754.in.h b/lib/ieee754.in.h index ce13efc918..ce371cbcea 100644 --- a/lib/ieee754.in.h +++ b/lib/ieee754.in.h @@ -2,16 +2,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/ignore-value.h b/lib/ignore-value.h index 0a3cf1e95b..6099abad97 100644 --- a/lib/ignore-value.h +++ b/lib/ignore-value.h @@ -2,17 +2,17 @@ Copyright (C) 2008-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Jim Meyering, Eric Blake and Pádraig Brady. */ diff --git a/lib/intprops.h b/lib/intprops.h index 2a420ac831..3fe64e82e9 100644 --- a/lib/intprops.h +++ b/lib/intprops.h @@ -3,19 +3,18 @@ Copyright (C) 2001-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, or + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ -/* Written by Paul Eggert. */ #ifndef _GL_INTPROPS_H #define _GL_INTPROPS_H @@ -133,7 +132,8 @@ operators might not yield numerically correct answers due to arithmetic overflow. They do not rely on undefined or implementation-defined behavior. Their implementations are simple - and straightforward, but they are a bit harder to use than the + and straightforward, but they are harder to use and may be less + efficient than the INT__WRAPV, INT__OK, and INT__OVERFLOW macros described below. Example usage: @@ -158,6 +158,9 @@ must have minimum value MIN and maximum MAX. Unsigned types should use a zero MIN of the proper type. + Because all arguments are subject to integer promotions, these + macros typically do not work on types narrower than 'int'. + These macros are tuned for constant MIN and MAX. For commutative operations such as A + B, they are also tuned for constant B. */ @@ -339,9 +342,15 @@ arguments should not have side effects. The WRAPV macros are not constant expressions. They support only - +, binary -, and *. Because the WRAPV macros convert the result, - they report overflow in different circumstances than the OVERFLOW - macros do. + +, binary -, and *. + + Because the WRAPV macros convert the result, they report overflow + in different circumstances than the OVERFLOW macros do. For + example, in the typical case with 16-bit 'short' and 32-bit 'int', + if A, B and R are all of type 'short' then INT_ADD_OVERFLOW (A, B) + returns false because the addition cannot overflow after A and B + are converted to 'int', whereas INT_ADD_WRAPV (A, B, &R) returns + true or false depending on whether the sum fits into 'short'. These macros are tuned for their last input argument being a constant. diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h index e9ee500e3e..41cb4220ce 100644 --- a/lib/inttypes.in.h +++ b/lib/inttypes.in.h @@ -2,17 +2,17 @@ Written by Paul Eggert, Bruno Haible, Derek Price. This file is part of gnulib. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* diff --git a/lib/libc-config.h b/lib/libc-config.h index c0eac707cf..886c11f37f 100644 --- a/lib/libc-config.h +++ b/lib/libc-config.h @@ -3,16 +3,16 @@ Copyright 2017-2021 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -28,14 +28,17 @@ When compiled as part of glibc this is a no-op; when compiled as part of Gnulib this includes Gnulib's and defines macros - that glibc library code would normally assume. */ + that glibc library code would normally assume. + + Note: This header file MUST NOT be included by public header files + of Gnulib. */ #include /* On glibc this includes and and #defines - _FEATURES_H, __WORDSIZE, and __set_errno. On FreeBSD 11 it - includes which defines __nonnull. Elsewhere it - is harmless. */ + _FEATURES_H, __WORDSIZE, and __set_errno. On FreeBSD 11 and + DragonFlyBSD 5.9 it includes which defines __nonnull. + Elsewhere it is harmless. */ #include /* From glibc . */ @@ -71,7 +74,7 @@ # endif #endif -#ifndef __attribute_maybe_unused__ +#ifndef __attribute_nonnull__ /* either does not exist, or is too old for Gnulib. Prepare to include , which is Gnulib's version of a more-recent glibc . */ @@ -80,13 +83,9 @@ # ifndef _FEATURES_H # define _FEATURES_H 1 # endif -/* Define __WORDSIZE so that does not attempt to include - nonexistent files. Make it a syntax error, since Gnulib does not - use __WORDSIZE now, and if Gnulib uses it later the syntax error - will let us know that __WORDSIZE needs configuring. */ -# ifndef __WORDSIZE -# define __WORDSIZE %%% -# endif +/* Define __GNULIB_CDEFS so that does not attempt to include + nonexistent files. */ +# define __GNULIB_CDEFS /* Undef the macros unconditionally defined by our copy of glibc , so that they do not clash with any system-defined versions. */ @@ -118,6 +117,9 @@ # undef __THROW # undef __THROWNL # undef __attr_access +# undef __attr_access_none +# undef __attr_dealloc +# undef __attr_dealloc_free # undef __attribute__ # undef __attribute_alloc_size__ # undef __attribute_artificial__ diff --git a/lib/limits.in.h b/lib/limits.in.h index 076ab9ef54..2ecafebb00 100644 --- a/lib/limits.in.h +++ b/lib/limits.in.h @@ -2,18 +2,18 @@ Copyright 2016-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 3, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -99,10 +99,11 @@ # endif #endif -/* Macros specified by ISO/IEC TS 18661-1:2014. */ +/* Macros specified by C2x and by ISO/IEC TS 18661-1:2014. */ #if (! defined ULLONG_WIDTH \ - && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) + && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__ \ + || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))) # define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX) # define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX) # define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX) @@ -114,7 +115,16 @@ # define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX) # define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX) # define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX) -#endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ +#endif + +/* Macros specified by C2x. */ + +#if (! defined BOOL_WIDTH \ + && (defined _GNU_SOURCE \ + || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))) +# define BOOL_MAX 1 +# define BOOL_WIDTH 1 +#endif #endif /* _@GUARD_PREFIX@_LIMITS_H */ #endif /* _@GUARD_PREFIX@_LIMITS_H */ diff --git a/lib/lstat.c b/lib/lstat.c index a584c6aa06..7de0bf1027 100644 --- a/lib/lstat.c +++ b/lib/lstat.c @@ -2,17 +2,17 @@ Copyright (C) 1997-2006, 2008-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* written by Jim Meyering */ diff --git a/lib/malloc.c b/lib/malloc.c new file mode 100644 index 0000000000..0d8b3596ca --- /dev/null +++ b/lib/malloc.c @@ -0,0 +1,51 @@ +/* malloc() function that is glibc compatible. + + Copyright (C) 1997-1998, 2006-2007, 2009-2021 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* written by Jim Meyering and Bruno Haible */ + +#define _GL_USE_STDLIB_ALLOC 1 +#include + +#include + +#include + +#include "xalloc-oversized.h" + +/* Allocate an N-byte block of memory from the heap, even if N is 0. */ + +void * +rpl_malloc (size_t n) +{ + if (n == 0) + n = 1; + + if (xalloc_oversized (n, 1)) + { + errno = ENOMEM; + return NULL; + } + + void *result = malloc (n); + +#if !HAVE_MALLOC_POSIX + if (result == NULL) + errno = ENOMEM; +#endif + + return result; +} diff --git a/lib/malloc/dynarray-skeleton.c b/lib/malloc/dynarray-skeleton.c index 4995fd1c04..48210e3252 100644 --- a/lib/malloc/dynarray-skeleton.c +++ b/lib/malloc/dynarray-skeleton.c @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ @@ -192,7 +192,7 @@ DYNARRAY_NAME (free__array__) (struct DYNARRAY_STRUCT *list) /* Initialize a dynamic array object. This must be called before any use of the object. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static void DYNARRAY_NAME (init) (struct DYNARRAY_STRUCT *list) { @@ -202,7 +202,7 @@ DYNARRAY_NAME (init) (struct DYNARRAY_STRUCT *list) } /* Deallocate the dynamic array and its elements. */ -__attribute_maybe_unused__ __nonnull ((1)) +__attribute_maybe_unused__ __attribute_nonnull__ ((1)) static void DYNARRAY_FREE (struct DYNARRAY_STRUCT *list) { @@ -213,7 +213,7 @@ DYNARRAY_FREE (struct DYNARRAY_STRUCT *list) } /* Return true if the dynamic array is in an error state. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static inline bool DYNARRAY_NAME (has_failed) (const struct DYNARRAY_STRUCT *list) { @@ -222,7 +222,7 @@ DYNARRAY_NAME (has_failed) (const struct DYNARRAY_STRUCT *list) /* Mark the dynamic array as failed. All elements are deallocated as a side effect. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static void DYNARRAY_NAME (mark_failed) (struct DYNARRAY_STRUCT *list) { @@ -236,7 +236,7 @@ DYNARRAY_NAME (mark_failed) (struct DYNARRAY_STRUCT *list) /* Return the number of elements which have been added to the dynamic array. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static inline size_t DYNARRAY_NAME (size) (const struct DYNARRAY_STRUCT *list) { @@ -245,7 +245,7 @@ DYNARRAY_NAME (size) (const struct DYNARRAY_STRUCT *list) /* Return a pointer to the array element at INDEX. Terminate the process if INDEX is out of bounds. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static inline DYNARRAY_ELEMENT * DYNARRAY_NAME (at) (struct DYNARRAY_STRUCT *list, size_t index) { @@ -257,7 +257,7 @@ DYNARRAY_NAME (at) (struct DYNARRAY_STRUCT *list, size_t index) /* Return a pointer to the first array element, if any. For a zero-length array, the pointer can be NULL even though the dynamic array has not entered the failure state. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static inline DYNARRAY_ELEMENT * DYNARRAY_NAME (begin) (struct DYNARRAY_STRUCT *list) { @@ -267,7 +267,7 @@ DYNARRAY_NAME (begin) (struct DYNARRAY_STRUCT *list) /* Return a pointer one element past the last array element. For a zero-length array, the pointer can be NULL even though the dynamic array has not entered the failure state. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static inline DYNARRAY_ELEMENT * DYNARRAY_NAME (end) (struct DYNARRAY_STRUCT *list) { @@ -294,7 +294,7 @@ DYNARRAY_NAME (add__) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item) /* Add ITEM at the end of the array, enlarging it by one element. Mark *LIST as failed if the dynamic array allocation size cannot be increased. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static inline void DYNARRAY_NAME (add) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item) { @@ -348,7 +348,8 @@ DYNARRAY_NAME (emplace__) (struct DYNARRAY_STRUCT *list) /* Allocate a place for a new element in *LIST and return a pointer to it. The pointer can be NULL if the dynamic array cannot be enlarged due to a memory allocation failure. */ -__attribute_maybe_unused__ __attribute_warn_unused_result__ __nonnull ((1)) +__attribute_maybe_unused__ __attribute_warn_unused_result__ +__attribute_nonnull__ ((1)) static /* Avoid inlining with the larger initialization code. */ #if !(defined (DYNARRAY_ELEMENT_INIT) || defined (DYNARRAY_ELEMENT_FREE)) @@ -372,7 +373,7 @@ DYNARRAY_NAME (emplace) (struct DYNARRAY_STRUCT *list) existing size, new elements are added (which can be initialized). Otherwise, the list is truncated, and elements are freed. Return false on memory allocation failure (and mark *LIST as failed). */ -__attribute_maybe_unused__ __nonnull ((1)) +__attribute_maybe_unused__ __attribute_nonnull__ ((1)) static bool DYNARRAY_NAME (resize) (struct DYNARRAY_STRUCT *list, size_t size) { @@ -417,7 +418,7 @@ DYNARRAY_NAME (resize) (struct DYNARRAY_STRUCT *list, size_t size) } /* Remove the last element of LIST if it is present. */ -__attribute_maybe_unused__ __nonnull ((1)) +__attribute_maybe_unused__ __attribute_nonnull__ ((1)) static void DYNARRAY_NAME (remove_last) (struct DYNARRAY_STRUCT *list) { @@ -434,7 +435,7 @@ DYNARRAY_NAME (remove_last) (struct DYNARRAY_STRUCT *list) /* Remove all elements from the list. The elements are freed, but the list itself is not. */ -__attribute_maybe_unused__ __nonnull ((1)) +__attribute_maybe_unused__ __attribute_nonnull__ ((1)) static void DYNARRAY_NAME (clear) (struct DYNARRAY_STRUCT *list) { @@ -452,7 +453,8 @@ DYNARRAY_NAME (clear) (struct DYNARRAY_STRUCT *list) stored in *RESULT if LIST refers to an empty list. On success, the pointer in *RESULT is heap-allocated and must be deallocated using free. */ -__attribute_maybe_unused__ __attribute_warn_unused_result__ __nonnull ((1, 2)) +__attribute_maybe_unused__ __attribute_warn_unused_result__ +__attribute_nonnull__ ((1, 2)) static bool DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, DYNARRAY_FINAL_TYPE *result) @@ -483,7 +485,8 @@ DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, have a sentinel at the end). If LENGTHP is not NULL, the array length is written to *LENGTHP. *LIST is re-initialized and can be reused. */ -__attribute_maybe_unused__ __attribute_warn_unused_result__ __nonnull ((1)) +__attribute_maybe_unused__ __attribute_warn_unused_result__ +__attribute_nonnull__ ((1)) static DYNARRAY_ELEMENT * DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, size_t *lengthp) { diff --git a/lib/malloc/dynarray.h b/lib/malloc/dynarray.h index 84e4394bf3..638c33f986 100644 --- a/lib/malloc/dynarray.h +++ b/lib/malloc/dynarray.h @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/malloc/dynarray_at_failure.c b/lib/malloc/dynarray_at_failure.c index a442459374..8dd6850787 100644 --- a/lib/malloc/dynarray_at_failure.c +++ b/lib/malloc/dynarray_at_failure.c @@ -3,22 +3,26 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ +#ifndef _LIBC +# include +# include +#endif + #include #include -#include void __libc_dynarray_at_failure (size_t size, size_t index) @@ -28,6 +32,7 @@ __libc_dynarray_at_failure (size_t size, size_t index) __snprintf (buf, sizeof (buf), "Fatal glibc error: " "array index %zu not less than array length %zu\n", index, size); + __libc_fatal (buf); #else abort (); #endif diff --git a/lib/malloc/dynarray_emplace_enlarge.c b/lib/malloc/dynarray_emplace_enlarge.c index 7ac4b6db40..0f8baf94ad 100644 --- a/lib/malloc/dynarray_emplace_enlarge.c +++ b/lib/malloc/dynarray_emplace_enlarge.c @@ -3,19 +3,23 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ +#ifndef _LIBC +# include +#endif + #include #include #include diff --git a/lib/malloc/dynarray_finalize.c b/lib/malloc/dynarray_finalize.c index be9441e313..c33da41389 100644 --- a/lib/malloc/dynarray_finalize.c +++ b/lib/malloc/dynarray_finalize.c @@ -3,19 +3,23 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ +#ifndef _LIBC +# include +#endif + #include #include #include diff --git a/lib/malloc/dynarray_resize.c b/lib/malloc/dynarray_resize.c index 92bbddd446..5a57166a84 100644 --- a/lib/malloc/dynarray_resize.c +++ b/lib/malloc/dynarray_resize.c @@ -3,19 +3,23 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ +#ifndef _LIBC +# include +#endif + #include #include #include diff --git a/lib/malloc/dynarray_resize_clear.c b/lib/malloc/dynarray_resize_clear.c index 99c2cc87c3..9c43b00c3a 100644 --- a/lib/malloc/dynarray_resize_clear.c +++ b/lib/malloc/dynarray_resize_clear.c @@ -3,19 +3,23 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ +#ifndef _LIBC +# include +#endif + #include #include diff --git a/lib/malloc/scratch_buffer.h b/lib/malloc/scratch_buffer.h index 26e306212d..36d0bef4bb 100644 --- a/lib/malloc/scratch_buffer.h +++ b/lib/malloc/scratch_buffer.h @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/malloc/scratch_buffer_dupfree.c b/lib/malloc/scratch_buffer_dupfree.c index 775bff5609..07363b9bc8 100644 --- a/lib/malloc/scratch_buffer_dupfree.c +++ b/lib/malloc/scratch_buffer_dupfree.c @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/malloc/scratch_buffer_grow.c b/lib/malloc/scratch_buffer_grow.c index e7606d81cd..22c8c7781e 100644 --- a/lib/malloc/scratch_buffer_grow.c +++ b/lib/malloc/scratch_buffer_grow.c @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/malloc/scratch_buffer_grow_preserve.c b/lib/malloc/scratch_buffer_grow_preserve.c index 59f8c71000..2b2b819289 100644 --- a/lib/malloc/scratch_buffer_grow_preserve.c +++ b/lib/malloc/scratch_buffer_grow_preserve.c @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/malloc/scratch_buffer_set_array_size.c b/lib/malloc/scratch_buffer_set_array_size.c index e2b9f31211..a47f9276a8 100644 --- a/lib/malloc/scratch_buffer_set_array_size.c +++ b/lib/malloc/scratch_buffer_set_array_size.c @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/malloca.c b/lib/malloca.c deleted file mode 100644 index d68d233dcb..0000000000 --- a/lib/malloca.c +++ /dev/null @@ -1,106 +0,0 @@ -/* Safe automatic memory allocation. - Copyright (C) 2003, 2006-2007, 2009-2021 Free Software Foundation, - Inc. - Written by Bruno Haible , 2003, 2018. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ - -#define _GL_USE_STDLIB_ALLOC 1 -#include - -/* Specification. */ -#include "malloca.h" - -#include "verify.h" - -/* The speed critical point in this file is freea() applied to an alloca() - result: it must be fast, to match the speed of alloca(). The speed of - mmalloca() and freea() in the other case are not critical, because they - are only invoked for big memory sizes. - Here we use a bit in the address as an indicator, an idea by Ondřej Bílka. - malloca() can return three types of pointers: - - Pointers ≡ 0 mod 2*sa_alignment_max come from stack allocation. - - Pointers ≡ sa_alignment_max mod 2*sa_alignment_max come from heap - allocation. - - NULL comes from a failed heap allocation. */ - -/* Type for holding very small pointer differences. */ -typedef unsigned char small_t; -/* Verify that it is wide enough. */ -verify (2 * sa_alignment_max - 1 <= (small_t) -1); - -void * -mmalloca (size_t n) -{ -#if HAVE_ALLOCA - /* Allocate one more word, used to determine the address to pass to freea(), - and room for the alignment ≡ sa_alignment_max mod 2*sa_alignment_max. */ - size_t nplus = n + sizeof (small_t) + 2 * sa_alignment_max - 1; - - if (nplus >= n) - { - char *mem = (char *) malloc (nplus); - - if (mem != NULL) - { - char *p = - (char *)((((uintptr_t)mem + sizeof (small_t) + sa_alignment_max - 1) - & ~(uintptr_t)(2 * sa_alignment_max - 1)) - + sa_alignment_max); - /* Here p >= mem + sizeof (small_t), - and p <= mem + sizeof (small_t) + 2 * sa_alignment_max - 1 - hence p + n <= mem + nplus. - So, the memory range [p, p+n) lies in the allocated memory range - [mem, mem + nplus). */ - ((small_t *) p)[-1] = p - mem; - /* p ≡ sa_alignment_max mod 2*sa_alignment_max. */ - return p; - } - } - /* Out of memory. */ - return NULL; -#else -# if !MALLOC_0_IS_NONNULL - if (n == 0) - n = 1; -# endif - return malloc (n); -#endif -} - -#if HAVE_ALLOCA -void -freea (void *p) -{ - /* Check argument. */ - if ((uintptr_t) p & (sa_alignment_max - 1)) - { - /* p was not the result of a malloca() call. Invalid argument. */ - abort (); - } - /* Determine whether p was a non-NULL pointer returned by mmalloca(). */ - if ((uintptr_t) p & sa_alignment_max) - { - void *mem = (char *) p - ((small_t *) p)[-1]; - free (mem); - } -} -#endif - -/* - * Hey Emacs! - * Local Variables: - * coding: utf-8 - * End: - */ diff --git a/lib/malloca.h b/lib/malloca.h deleted file mode 100644 index a04e54593f..0000000000 --- a/lib/malloca.h +++ /dev/null @@ -1,123 +0,0 @@ -/* Safe automatic memory allocation. - Copyright (C) 2003-2007, 2009-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2003. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ - -#ifndef _MALLOCA_H -#define _MALLOCA_H - -#include -#include -#include -#include - -#include "xalloc-oversized.h" - - -#ifdef __cplusplus -extern "C" { -#endif - - -/* safe_alloca(N) is equivalent to alloca(N) when it is safe to call - alloca(N); otherwise it returns NULL. It either returns N bytes of - memory allocated on the stack, that lasts until the function returns, - or NULL. - Use of safe_alloca should be avoided: - - inside arguments of function calls - undefined behaviour, - - in inline functions - the allocation may actually last until the - calling function returns. -*/ -#if HAVE_ALLOCA -/* The OS usually guarantees only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - allocate anything larger than 4096 bytes. Also care for the possibility - of a few compiler-allocated temporary stack slots. - This must be a macro, not a function. */ -# define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL) -#else -# define safe_alloca(N) ((void) (N), NULL) -#endif - -/* malloca(N) is a safe variant of alloca(N). It allocates N bytes of - memory allocated on the stack, that must be freed using freea() before - the function returns. Upon failure, it returns NULL. */ -#if HAVE_ALLOCA -# define malloca(N) \ - ((N) < 4032 - (2 * sa_alignment_max - 1) \ - ? (void *) (((uintptr_t) (char *) alloca ((N) + 2 * sa_alignment_max - 1) \ - + (2 * sa_alignment_max - 1)) \ - & ~(uintptr_t)(2 * sa_alignment_max - 1)) \ - : mmalloca (N)) -#else -# define malloca(N) \ - mmalloca (N) -#endif -extern void * mmalloca (size_t n); - -/* Free a block of memory allocated through malloca(). */ -#if HAVE_ALLOCA -extern void freea (void *p); -#else -# define freea free -#endif - -/* nmalloca(N,S) is an overflow-safe variant of malloca (N * S). - It allocates an array of N objects, each with S bytes of memory, - on the stack. S must be positive and N must be nonnegative. - The array must be freed using freea() before the function returns. */ -#define nmalloca(n, s) (xalloc_oversized (n, s) ? NULL : malloca ((n) * (s))) - - -#ifdef __cplusplus -} -#endif - - -/* ------------------- Auxiliary, non-public definitions ------------------- */ - -/* Determine the alignment of a type at compile time. */ -#if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__ -# define sa_alignof __alignof__ -#elif defined __cplusplus - template struct sa_alignof_helper { char __slot1; type __slot2; }; -# define sa_alignof(type) offsetof (sa_alignof_helper, __slot2) -#elif defined __hpux - /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof - values. */ -# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) -#elif defined _AIX - /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof - values. */ -# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) -#else -# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) -#endif - -enum -{ -/* The desired alignment of memory allocations is the maximum alignment - among all elementary types. */ - sa_alignment_long = sa_alignof (long), - sa_alignment_double = sa_alignof (double), - sa_alignment_longlong = sa_alignof (long long), - sa_alignment_longdouble = sa_alignof (long double), - sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1) - | (sa_alignment_longlong - 1) - | (sa_alignment_longdouble - 1) - ) + 1 -}; - -#endif /* _MALLOCA_H */ diff --git a/lib/md5.c b/lib/md5.c index e7eeeaab03..7955665ccd 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -4,23 +4,24 @@ Foundation, Inc. This file is part of the GNU C Library. - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* Written by Ulrich Drepper , 1995. */ #include +/* Specification. */ #if HAVE_OPENSSL_MD5 # define GL_OPENSSL_INLINE _GL_EXTERN_INLINE #endif @@ -28,14 +29,9 @@ #include #include -#include #include #include -#if USE_UNLOCKED_IO -# include "unlocked-io.h" -#endif - #ifdef _LIBC # include # if __BYTE_ORDER == __BIG_ENDIAN @@ -48,7 +44,6 @@ # define md5_process_bytes __md5_process_bytes # define md5_finish_ctx __md5_finish_ctx # define md5_read_ctx __md5_read_ctx -# define md5_stream __md5_stream # define md5_buffer __md5_buffer #endif @@ -59,12 +54,8 @@ # define SWAP(n) (n) #endif -#define BLOCKSIZE 32768 -#if BLOCKSIZE % 64 != 0 -# error "invalid BLOCKSIZE" -#endif - #if ! HAVE_OPENSSL_MD5 + /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. (RFC 1321, 3.1: Step 1) */ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; @@ -132,93 +123,7 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) return md5_read_ctx (ctx, resbuf); } -#endif - -#if defined _LIBC || defined GL_COMPILE_CRYPTO_STREAM - -#include "af_alg.h" - -/* Compute MD5 message digest for bytes read from STREAM. The - resulting message digest number will be written into the 16 bytes - beginning at RESBLOCK. */ -int -md5_stream (FILE *stream, void *resblock) -{ - switch (afalg_stream (stream, "md5", resblock, MD5_DIGEST_SIZE)) - { - case 0: return 0; - case -EIO: return 1; - } - - char *buffer = malloc (BLOCKSIZE + 72); - if (!buffer) - return 1; - - struct md5_ctx ctx; - md5_init_ctx (&ctx); - size_t sum; - - /* Iterate over full file contents. */ - while (1) - { - /* We read the file in blocks of BLOCKSIZE bytes. One call of the - computation function processes the whole buffer so that with the - next round of the loop another block can be read. */ - size_t n; - sum = 0; - - /* Read block. Take care for partial reads. */ - while (1) - { - /* Either process a partial fread() from this loop, - or the fread() in afalg_stream may have gotten EOF. - We need to avoid a subsequent fread() as EOF may - not be sticky. For details of such systems, see: - https://sourceware.org/bugzilla/show_bug.cgi?id=1190 */ - if (feof (stream)) - goto process_partial_block; - - n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); - - sum += n; - - if (sum == BLOCKSIZE) - break; - - if (n == 0) - { - /* Check for the error flag IFF N == 0, so that we don't - exit the loop after a partial read due to e.g., EAGAIN - or EWOULDBLOCK. */ - if (ferror (stream)) - { - free (buffer); - return 1; - } - goto process_partial_block; - } - } - - /* Process buffer with BLOCKSIZE bytes. Note that - BLOCKSIZE % 64 == 0 - */ - md5_process_block (buffer, BLOCKSIZE, &ctx); - } - -process_partial_block: - - /* Process any remaining bytes. */ - if (sum > 0) - md5_process_bytes (buffer, sum, &ctx); - - /* Construct result in desired memory. */ - md5_finish_ctx (&ctx, resblock); - free (buffer); - return 0; -} -#endif -#if ! HAVE_OPENSSL_MD5 /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message @@ -479,6 +384,7 @@ md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx) ctx->C = C; ctx->D = D; } + #endif /* diff --git a/lib/md5.h b/lib/md5.h index aa4b0805d5..bae5960a8c 100644 --- a/lib/md5.h +++ b/lib/md5.h @@ -4,18 +4,18 @@ Foundation, Inc. This file is part of the GNU C Library. - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifndef _MD5_H #define _MD5_H 1 @@ -124,6 +124,7 @@ extern void *__md5_buffer (const char *buffer, size_t len, void *restrict resblock) __THROW; # endif + /* Compute MD5 message digest for bytes read from STREAM. STREAM is an open file stream. Regular files are handled more efficiently. The contents of STREAM from its current position to its end will be read. diff --git a/lib/memmem.c b/lib/memmem.c index 87266fa87a..142de576d9 100644 --- a/lib/memmem.c +++ b/lib/memmem.c @@ -2,18 +2,18 @@ Foundation, Inc. This file is part of the GNU C Library. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* This particular implementation was written by Eric Blake, 2008. */ diff --git a/lib/mempcpy.c b/lib/mempcpy.c index fea618a9e5..cacacdbc62 100644 --- a/lib/mempcpy.c +++ b/lib/mempcpy.c @@ -1,24 +1,27 @@ /* Copy memory area and return pointer after last written byte. Copyright (C) 2003, 2007, 2009-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #include /* Specification. */ #include +/* A function definition is only needed if HAVE_MEMPCPY is not defined. */ +#if !HAVE_MEMPCPY + /* Copy N bytes of SRC to DEST, return pointer to bytes after the last written byte. */ void * @@ -26,3 +29,5 @@ mempcpy (void *dest, const void *src, size_t n) { return (char *) memcpy (dest, src, n) + n; } + +#endif diff --git a/lib/memrchr.c b/lib/memrchr.c index dcd24fafc6..e0d47d13d7 100644 --- a/lib/memrchr.c +++ b/lib/memrchr.c @@ -9,17 +9,17 @@ adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu), and implemented by Roland McGrath (roland@ai.mit.edu). - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #if defined _LIBC diff --git a/lib/mini-gmp-gnulib.c b/lib/mini-gmp-gnulib.c index d46c2b993b..08aa8f97c1 100644 --- a/lib/mini-gmp-gnulib.c +++ b/lib/mini-gmp-gnulib.c @@ -2,18 +2,26 @@ Copyright 2018-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, + This file is free software. + It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+". + You can redistribute it and/or modify it under either + - the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version, or + - the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) + any later version, or + - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+". + + This file 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. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License and the GNU General Public License + for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + You should have received a copy of the GNU Lesser General Public + License and of the GNU General Public License along with this + program. If not, see . */ #include diff --git a/lib/mini-gmp.c b/lib/mini-gmp.c index de061e673a..8577b59ef6 100644 --- a/lib/mini-gmp.c +++ b/lib/mini-gmp.c @@ -2,21 +2,21 @@ Contributed to the GNU project by Niels Möller -Copyright 1991-1997, 1999-2020 Free Software Foundation, Inc. +Copyright 1991-1997, 1999-2021 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify it under the terms of either: - * the GNU General Public License as published by the Free + * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software - Foundation; either version 3 of the License, or (at your option) any + Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. @@ -27,7 +27,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the -GNU General Public License along with the GNU MP Library. If not, +GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ /* NOTE: All functions in this file which are not declared in @@ -148,6 +148,7 @@ see https://www.gnu.org/licenses/. */ mp_limb_t __x0, __x1, __x2, __x3; \ unsigned __ul, __vl, __uh, __vh; \ mp_limb_t __u = (u), __v = (v); \ + assert (sizeof (unsigned) * 2 >= sizeof (mp_limb_t)); \ \ __ul = __u & GMP_LLIMB_MASK; \ __uh = __u >> (GMP_LIMB_BITS / 2); \ @@ -783,6 +784,7 @@ mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0) mp_limb_t p, ql; unsigned ul, uh, qh; + assert (sizeof (unsigned) * 2 >= sizeof (mp_limb_t)); /* For notation, let b denote the half-limb base, so that B = b^2. Split u1 = b uh + ul. */ ul = u1 & GMP_LLIMB_MASK; @@ -3198,6 +3200,7 @@ void mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z) { int sgn; + mp_bitcnt_t bc; mpz_t t, u; sgn = y->_mp_size < 0; @@ -3216,7 +3219,8 @@ mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z) mpz_init (u); mpz_init (t); - mpz_setbit (t, mpz_sizeinbase (y, 2) / z + 1); + bc = (mpz_sizeinbase (y, 2) - 1) / z + 1; + mpz_setbit (t, bc); if (z == 2) /* simplify sqrt loop: z-1 == 1 */ do { @@ -3523,7 +3527,8 @@ gmp_stronglucas (const mpz_t x, mpz_t Qk) mpz_init (V); /* n-(D/n) = n+1 = d*2^{b0}, with d = (n>>b0) | 1 */ - b0 = mpz_scan0 (n, 0); + b0 = mpn_common_scan (~ n->_mp_d[0], 0, n->_mp_d, n->_mp_size, GMP_LIMB_MAX); + /* b0 = mpz_scan0 (n, 0); */ /* D= P^2 - 4Q; P = 1; Q = (1-D)/4 */ Q = (D & 2) ? (long) (D >> 2) + 1 : -(long) (D >> 2); @@ -3555,11 +3560,6 @@ gmp_millerrabin (const mpz_t n, const mpz_t nm1, mpz_t y, mpz_powm_ui (y, y, 2, n); if (mpz_cmp (y, nm1) == 0) return 1; - /* y == 1 means that the previous y was a non-trivial square root - of 1 (mod n). y == 0 means that n is a power of the base. - In either case, n is not prime. */ - if (mpz_cmp_ui (y, 1) <= 0) - return 0; } return 0; } diff --git a/lib/mini-gmp.h b/lib/mini-gmp.h index 59a37e6494..59c24cf511 100644 --- a/lib/mini-gmp.h +++ b/lib/mini-gmp.h @@ -1,20 +1,20 @@ /* mini-gmp, a minimalistic implementation of a GNU GMP subset. -Copyright 2011-2015, 2017, 2019-2020 Free Software Foundation, Inc. +Copyright 2011-2015, 2017, 2019-2021 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify it under the terms of either: - * the GNU General Public License as published by the Free + * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software - Foundation; either version 3 of the License, or (at your option) any + Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. @@ -25,7 +25,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the -GNU General Public License along with the GNU MP Library. If not, +GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ /* About mini-gmp: This is a minimal implementation of a subset of the @@ -296,6 +296,7 @@ int mpz_init_set_str (mpz_t, const char *, int); || defined (_STDIO_H_INCLUDED) /* QNX4 */ \ || defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \ || defined (__STDIO_LOADED) /* VMS */ \ + || defined (_STDIO) /* HPE NonStop */ \ || defined (__DEFINED_FILE) /* musl */ size_t mpz_out_str (FILE *, int, const mpz_t); #endif diff --git a/lib/minmax.h b/lib/minmax.h index eb9fb09a54..a03361bafa 100644 --- a/lib/minmax.h +++ b/lib/minmax.h @@ -2,18 +2,18 @@ Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifndef _MINMAX_H #define _MINMAX_H diff --git a/lib/mkostemp.c b/lib/mkostemp.c index 9d733ddd10..285f1badf8 100644 --- a/lib/mkostemp.c +++ b/lib/mkostemp.c @@ -2,17 +2,17 @@ Foundation, Inc. This file is derived from the one in the GNU C Library. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #if !_LIBC diff --git a/lib/mktime-internal.h b/lib/mktime-internal.h index 9c447bd7b0..7386625d3d 100644 --- a/lib/mktime-internal.h +++ b/lib/mktime-internal.h @@ -4,16 +4,16 @@ Contributed by Paul Eggert . The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/mktime.c b/lib/mktime.c index 2c7cd7ba83..ae721c72e6 100644 --- a/lib/mktime.c +++ b/lib/mktime.c @@ -4,16 +4,16 @@ Contributed by Paul Eggert . The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/nstrftime.c b/lib/nstrftime.c index 2f5e4fbe63..7f258e8727 100644 --- a/lib/nstrftime.c +++ b/lib/nstrftime.c @@ -1,19 +1,18 @@ /* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - The GNU C Library is distributed in the hope that it will be useful, + This file 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. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public - License along with the GNU C Library; if not, see - . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifdef _LIBC # define USE_IN_EXTENDED_LOCALE_MODEL 1 diff --git a/lib/open.c b/lib/open.c index 8599185331..372cda8816 100644 --- a/lib/open.c +++ b/lib/open.c @@ -1,17 +1,17 @@ /* Open a descriptor to a file. Copyright (C) 2007-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2007. */ diff --git a/lib/pathmax.h b/lib/pathmax.h index 49cf4629c7..716f4a9aae 100644 --- a/lib/pathmax.h +++ b/lib/pathmax.h @@ -2,18 +2,18 @@ Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifndef _PATHMAX_H # define _PATHMAX_H diff --git a/lib/pipe2.c b/lib/pipe2.c index adbaa4a102..9ba8c3b703 100644 --- a/lib/pipe2.c +++ b/lib/pipe2.c @@ -1,18 +1,18 @@ /* Create a pipe, with specific opening flags. Copyright (C) 2009-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #include @@ -41,7 +41,7 @@ pipe2 (int fd[2], int flags) { /* Mingw _pipe() corrupts fd on failure; also, if we succeed at creating the pipe but later fail at changing fcntl, we want - to leave fd unchanged: https://austingroupbugs.net/view.php?id=467 */ + to leave fd unchanged: http://austingroupbugs.net/view.php?id=467 */ int tmp[2]; tmp[0] = fd[0]; tmp[1] = fd[1]; diff --git a/lib/pselect.c b/lib/pselect.c index 0fda4eef6e..b5fadc6728 100644 --- a/lib/pselect.c +++ b/lib/pselect.c @@ -4,18 +4,18 @@ This file is part of gnulib. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* written by Paul Eggert */ diff --git a/lib/pthread_sigmask.c b/lib/pthread_sigmask.c index 8a692048a0..11b7091e7f 100644 --- a/lib/pthread_sigmask.c +++ b/lib/pthread_sigmask.c @@ -1,17 +1,17 @@ /* POSIX compatible signal blocking for threads. Copyright (C) 2011-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include diff --git a/lib/rawmemchr.c b/lib/rawmemchr.c index bbb250feb8..e7a00b8030 100644 --- a/lib/rawmemchr.c +++ b/lib/rawmemchr.c @@ -1,17 +1,17 @@ /* Searching in a string. Copyright (C) 2008-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include @@ -19,68 +19,57 @@ /* Specification. */ #include +/* A function definition is only needed if HAVE_RAWMEMCHR is not defined. */ +#if !HAVE_RAWMEMCHR + +# include +# include +# include + +# include "verify.h" + /* Find the first occurrence of C in S. */ void * rawmemchr (const void *s, int c_in) { - /* On 32-bit hardware, choosing longword to be a 32-bit unsigned - long instead of a 64-bit uintmax_t tends to give better - performance. On 64-bit hardware, unsigned long is generally 64 - bits already. Change this typedef to experiment with - performance. */ - typedef unsigned long int longword; + /* Change this typedef to experiment with performance. */ + typedef uintptr_t longword; + /* If you change the "uintptr_t", you should change UINTPTR_WIDTH to match. + This verifies that the type does not have padding bits. */ + verify (UINTPTR_WIDTH == UCHAR_WIDTH * sizeof (longword)); const unsigned char *char_ptr; - const longword *longword_ptr; - longword repeated_one; - longword repeated_c; - unsigned char c; - - c = (unsigned char) c_in; + unsigned char c = c_in; /* Handle the first few bytes by reading one byte at a time. Do this until CHAR_PTR is aligned on a longword boundary. */ for (char_ptr = (const unsigned char *) s; - (size_t) char_ptr % sizeof (longword) != 0; + (uintptr_t) char_ptr % alignof (longword) != 0; ++char_ptr) if (*char_ptr == c) return (void *) char_ptr; - longword_ptr = (const longword *) char_ptr; - - /* All these elucidatory comments refer to 4-byte longwords, - but the theory applies equally well to any size longwords. */ + longword const *longword_ptr = s = char_ptr; /* Compute auxiliary longword values: repeated_one is a value which has a 1 in every byte. repeated_c has c in every byte. */ - repeated_one = 0x01010101; - repeated_c = c | (c << 8); - repeated_c |= repeated_c << 16; - if (0xffffffffU < (longword) -1) - { - repeated_one |= repeated_one << 31 << 1; - repeated_c |= repeated_c << 31 << 1; - if (8 < sizeof (longword)) - { - size_t i; - - for (i = 64; i < sizeof (longword) * 8; i *= 2) - { - repeated_one |= repeated_one << i; - repeated_c |= repeated_c << i; - } - } - } + longword repeated_one = (longword) -1 / UCHAR_MAX; + longword repeated_c = repeated_one * c; + longword repeated_hibit = repeated_one * (UCHAR_MAX / 2 + 1); /* Instead of the traditional loop which tests each byte, we will - test a longword at a time. The tricky part is testing if *any of - the four* bytes in the longword in question are equal to NUL or + test a longword at a time. The tricky part is testing if any of + the bytes in the longword in question are equal to c. We first use an xor with repeated_c. This reduces the task - to testing whether *any of the four* bytes in longword1 is zero. + to testing whether any of the bytes in longword1 is zero. + + (The following comments assume 8-bit bytes, as POSIX requires; + the code's use of UCHAR_MAX should work even if bytes have more + than 8 bits.) We compute tmp = - ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7). + ((longword1 - repeated_one) & ~longword1) & (repeated_one * 0x80). That is, we perform the following operations: 1. Subtract repeated_one. 2. & ~longword1. @@ -114,23 +103,23 @@ rawmemchr (const void *s, int c_in) { longword longword1 = *longword_ptr ^ repeated_c; - if ((((longword1 - repeated_one) & ~longword1) - & (repeated_one << 7)) != 0) + if ((((longword1 - repeated_one) & ~longword1) & repeated_hibit) != 0) break; longword_ptr++; } - char_ptr = (const unsigned char *) longword_ptr; + char_ptr = s = longword_ptr; /* At this point, we know that one of the sizeof (longword) bytes - starting at char_ptr is == c. On little-endian machines, we + starting at char_ptr is == c. If we knew endianness, we could determine the first such byte without any further memory accesses, just by looking at the tmp result from the last loop - iteration. But this does not work on big-endian machines. - Choose code that works in both cases. */ + iteration. However, the following simple and portable code does + not attempt this potential optimization. */ - char_ptr = (unsigned char *) longword_ptr; while (*char_ptr != c) char_ptr++; return (void *) char_ptr; } + +#endif diff --git a/lib/rawmemchr.valgrind b/lib/rawmemchr.valgrind index 087d5e4178..d489c320c3 100644 --- a/lib/rawmemchr.valgrind +++ b/lib/rawmemchr.valgrind @@ -2,17 +2,17 @@ # Copyright (C) 2008-2021 Free Software Foundation, Inc. # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. +# This file is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of the +# License, or (at your option) any later version. # -# This program is distributed in the hope that it will be useful, +# This file 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. +# GNU Lesser General Public License for more details. # -# You should have received a copy of the GNU General Public License +# You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # This use is OK because it provides only a speedup. diff --git a/lib/readlink.c b/lib/readlink.c index c4b635ce71..ad4d51dc64 100644 --- a/lib/readlink.c +++ b/lib/readlink.c @@ -1,17 +1,17 @@ /* Read the contents of a symbolic link. Copyright (C) 2003-2007, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include @@ -29,8 +29,8 @@ such as DJGPP 2.03 and mingw32. */ ssize_t -readlink (char const *file, char *buf _GL_UNUSED, - size_t bufsize _GL_UNUSED) +readlink (char const *file, _GL_UNUSED char *buf, + _GL_UNUSED size_t bufsize) { struct stat statbuf; diff --git a/lib/realloc.c b/lib/realloc.c new file mode 100644 index 0000000000..af03f0c577 --- /dev/null +++ b/lib/realloc.c @@ -0,0 +1,63 @@ +/* realloc() function that is glibc compatible. + + Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2021 Free Software + Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* written by Jim Meyering and Bruno Haible */ + +#include + +#include + +#include + +#include "xalloc-oversized.h" + +/* Call the system's realloc below. This file does not define + _GL_USE_STDLIB_ALLOC because it needs Gnulib's malloc if present. */ +#undef realloc + +/* Change the size of an allocated block of memory P to N bytes, + with error checking. If P is NULL, use malloc. Otherwise if N is zero, + free P and return NULL. */ + +void * +rpl_realloc (void *p, size_t n) +{ + if (p == NULL) + return malloc (n); + + if (n == 0) + { + free (p); + return NULL; + } + + if (xalloc_oversized (n, 1)) + { + errno = ENOMEM; + return NULL; + } + + void *result = realloc (p, n); + +#if !HAVE_MALLOC_POSIX + if (result == NULL) + errno = ENOMEM; +#endif + + return result; +} diff --git a/lib/regcomp.c b/lib/regcomp.c index 0c31b0e14c..887e5b5068 100644 --- a/lib/regcomp.c +++ b/lib/regcomp.c @@ -4,16 +4,16 @@ Contributed by Isamu Hasegawa . The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ @@ -1695,12 +1695,14 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root) reg_errcode_t err; Idx i; re_node_set eclosure; - bool ok; bool incomplete = false; err = re_node_set_alloc (&eclosure, dfa->edests[node].nelem + 1); if (__glibc_unlikely (err != REG_NOERROR)) return err; + /* An epsilon closure includes itself. */ + eclosure.elems[eclosure.nelem++] = node; + /* This indicates that we are calculating this node now. We reference this value to avoid infinite loop. */ dfa->eclosures[node].nelem = -1; @@ -1753,10 +1755,6 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root) } } - /* An epsilon closure includes itself. */ - ok = re_node_set_insert (&eclosure, node); - if (__glibc_unlikely (! ok)) - return REG_ESPACE; if (incomplete && !root) dfa->eclosures[node].nelem = 0; else diff --git a/lib/regex.c b/lib/regex.c index f76a416b3b..d32863972c 100644 --- a/lib/regex.c +++ b/lib/regex.c @@ -4,16 +4,16 @@ Contributed by Isamu Hasegawa . The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ @@ -24,6 +24,7 @@ # if __GNUC_PREREQ (4, 6) # pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" +# pragma GCC diagnostic ignored "-Wvla" # endif # if __GNUC_PREREQ (4, 3) # pragma GCC diagnostic ignored "-Wold-style-definition" diff --git a/lib/regex.h b/lib/regex.h index d291e38793..adb69768ee 100644 --- a/lib/regex.h +++ b/lib/regex.h @@ -4,16 +4,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ @@ -522,6 +522,30 @@ typedef struct /* Declarations for routines. */ +#ifndef _REGEX_NELTS +# if (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ \ + && !defined __STDC_NO_VLA__) +# define _REGEX_NELTS(n) n +# else +# define _REGEX_NELTS(n) +# endif +#endif + +#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wvla" +#endif + +#ifndef _Attr_access_ +# ifdef __attr_access +# define _Attr_access_(arg) __attr_access (arg) +# elif defined __GNUC__ && 10 <= __GNUC__ +# define _Attr_access_(x) __attribute__ ((__access__ x)) +# else +# define _Attr_access_(x) +# endif +#endif + #ifdef __USE_GNU /* Sets the current default syntax to SYNTAX, and return the old syntax. You can also simply assign to the 're_syntax_options' variable. */ @@ -536,7 +560,8 @@ extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax); 'regcomp', with a malloc'ed value, or set to NULL before calling 'regfree'. */ extern const char *re_compile_pattern (const char *__pattern, size_t __length, - struct re_pattern_buffer *__buffer); + struct re_pattern_buffer *__buffer) + _Attr_access_ ((__read_only__, 1, 2)); /* Compile a fastmap for the compiled pattern in BUFFER; used to @@ -553,7 +578,8 @@ extern int re_compile_fastmap (struct re_pattern_buffer *__buffer); extern regoff_t re_search (struct re_pattern_buffer *__buffer, const char *__String, regoff_t __length, regoff_t __start, regoff_t __range, - struct re_registers *__regs); + struct re_registers *__regs) + _Attr_access_ ((__read_only__, 2, 3)); /* Like 're_search', but search in the concatenation of STRING1 and @@ -563,14 +589,17 @@ extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer, const char *__string2, regoff_t __length2, regoff_t __start, regoff_t __range, struct re_registers *__regs, - regoff_t __stop); + regoff_t __stop) + _Attr_access_ ((__read_only__, 2, 3)) + _Attr_access_ ((__read_only__, 4, 5)); /* Like 're_search', but return how many characters in STRING the regexp in BUFFER matched, starting at position START. */ extern regoff_t re_match (struct re_pattern_buffer *__buffer, const char *__String, regoff_t __length, - regoff_t __start, struct re_registers *__regs); + regoff_t __start, struct re_registers *__regs) + _Attr_access_ ((__read_only__, 2, 3)); /* Relates to 're_match' as 're_search_2' relates to 're_search'. */ @@ -578,7 +607,9 @@ extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer, const char *__string1, regoff_t __length1, const char *__string2, regoff_t __length2, regoff_t __start, struct re_registers *__regs, - regoff_t __stop); + regoff_t __stop) + _Attr_access_ ((__read_only__, 2, 3)) + _Attr_access_ ((__read_only__, 4, 5)); /* Set REGS to hold NUM_REGS registers, storing them in STARTS and @@ -647,14 +678,19 @@ extern int regcomp (regex_t *_Restrict_ __preg, extern int regexec (const regex_t *_Restrict_ __preg, const char *_Restrict_ __String, size_t __nmatch, - regmatch_t __pmatch[_Restrict_arr_], + regmatch_t __pmatch[_Restrict_arr_ + _REGEX_NELTS (__nmatch)], int __eflags); extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg, - char *_Restrict_ __errbuf, size_t __errbuf_size); + char *_Restrict_ __errbuf, size_t __errbuf_size) + _Attr_access_ ((__write_only__, 3, 4)); extern void regfree (regex_t *__preg); +#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__) +# pragma GCC diagnostic pop +#endif #ifdef __cplusplus } diff --git a/lib/regex_internal.c b/lib/regex_internal.c index 73087c8610..aefcfa2f52 100644 --- a/lib/regex_internal.c +++ b/lib/regex_internal.c @@ -4,16 +4,16 @@ Contributed by Isamu Hasegawa . The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ @@ -1211,6 +1211,10 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src) if (__glibc_unlikely (dest->nelem == 0)) { + /* Although we already guaranteed above that dest->alloc != 0 and + therefore dest->elems != NULL, add a debug assertion to pacify + GCC 11.2.1's -fanalyzer. */ + DEBUG_ASSERT (dest->elems); dest->nelem = src->nelem; memcpy (dest->elems, src->elems, src->nelem * sizeof (Idx)); return REG_NOERROR; @@ -1286,7 +1290,10 @@ re_node_set_insert (re_node_set *set, Idx elem) if (__glibc_unlikely (set->nelem) == 0) { - /* We already guaranteed above that set->alloc != 0. */ + /* Although we already guaranteed above that set->alloc != 0 and + therefore set->elems != NULL, add a debug assertion to pacify + GCC 11.2 -fanalyzer. */ + DEBUG_ASSERT (set->elems); set->elems[0] = elem; ++set->nelem; return true; @@ -1314,6 +1321,7 @@ re_node_set_insert (re_node_set *set, Idx elem) { for (idx = set->nelem; set->elems[idx - 1] > elem; idx--) set->elems[idx] = set->elems[idx - 1]; + DEBUG_ASSERT (set->elems[idx - 1] < elem); } /* Insert the new element. */ diff --git a/lib/regex_internal.h b/lib/regex_internal.h index 4c634edcbf..1245e782ff 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -4,16 +4,16 @@ Contributed by Isamu Hasegawa . The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ @@ -32,7 +32,10 @@ #include #include -#include +#ifndef _LIBC +# include +#endif + #include #include @@ -50,14 +53,14 @@ # define lock_fini(lock) ((void) 0) # define lock_lock(lock) __libc_lock_lock (lock) # define lock_unlock(lock) __libc_lock_unlock (lock) -#elif defined GNULIB_LOCK && !defined USE_UNLOCKED_IO +#elif defined GNULIB_LOCK && !defined GNULIB_REGEX_SINGLE_THREAD # include "glthread/lock.h" # define lock_define(name) gl_lock_define (, name) # define lock_init(lock) glthread_lock_init (&(lock)) # define lock_fini(lock) glthread_lock_destroy (&(lock)) # define lock_lock(lock) glthread_lock_lock (&(lock)) # define lock_unlock(lock) glthread_lock_unlock (&(lock)) -#elif defined GNULIB_PTHREAD && !defined USE_UNLOCKED_IO +#elif defined GNULIB_PTHREAD && !defined GNULIB_REGEX_SINGLE_THREAD # include # define lock_define(name) pthread_mutex_t name; # define lock_init(lock) pthread_mutex_init (&(lock), 0) diff --git a/lib/regexec.c b/lib/regexec.c index 15dc57bd0e..83e9aaf8ca 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -4,16 +4,16 @@ Contributed by Isamu Hasegawa . The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ @@ -59,7 +59,7 @@ static void update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, Idx cur_idx, Idx nmatch); static reg_errcode_t push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node, Idx nregs, - regmatch_t *regs, + regmatch_t *regs, regmatch_t *prevregs, re_node_set *eps_via_nodes); static reg_errcode_t set_regs (const regex_t *preg, const re_match_context_t *mctx, @@ -186,11 +186,12 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len); REG_NOTBOL is set, then ^ does not match at the beginning of the string; if REG_NOTEOL is set, then $ does not match at the end. - We return 0 if we find a match and REG_NOMATCH if not. */ + Return 0 if a match is found, REG_NOMATCH if not, REG_BADPAT if + EFLAGS is invalid. */ int regexec (const regex_t *__restrict preg, const char *__restrict string, - size_t nmatch, regmatch_t pmatch[], int eflags) + size_t nmatch, regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags) { reg_errcode_t err; Idx start, length; @@ -234,7 +235,7 @@ int attribute_compat_text_section __compat_regexec (const regex_t *__restrict preg, const char *__restrict string, size_t nmatch, - regmatch_t pmatch[], int eflags) + regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags) { return regexec (preg, string, nmatch, pmatch, eflags & (REG_NOTBOL | REG_NOTEOL)); @@ -269,8 +270,8 @@ compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0); strings.) On success, re_match* functions return the length of the match, re_search* - return the position of the start of the match. Return value -1 means no - match was found and -2 indicates an internal error. */ + return the position of the start of the match. They return -1 on + match failure, -2 on error. */ regoff_t re_match (struct re_pattern_buffer *bufp, const char *string, Idx length, @@ -1206,27 +1207,30 @@ check_halt_state_context (const re_match_context_t *mctx, /* Compute the next node to which "NFA" transit from NODE("NFA" is a NFA corresponding to the DFA). Return the destination node, and update EPS_VIA_NODES; - return -1 in case of errors. */ + return -1 on match failure, -2 on error. */ static Idx proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, + regmatch_t *prevregs, Idx *pidx, Idx node, re_node_set *eps_via_nodes, struct re_fail_stack_t *fs) { const re_dfa_t *const dfa = mctx->dfa; - Idx i; - bool ok; if (IS_EPSILON_NODE (dfa->nodes[node].type)) { re_node_set *cur_nodes = &mctx->state_log[*pidx]->nodes; re_node_set *edests = &dfa->edests[node]; - Idx dest_node; - ok = re_node_set_insert (eps_via_nodes, node); - if (__glibc_unlikely (! ok)) - return -2; - /* Pick up a valid destination, or return -1 if none - is found. */ - for (dest_node = -1, i = 0; i < edests->nelem; ++i) + + if (! re_node_set_contains (eps_via_nodes, node)) + { + bool ok = re_node_set_insert (eps_via_nodes, node); + if (__glibc_unlikely (! ok)) + return -2; + } + + /* Pick a valid destination, or return -1 if none is found. */ + Idx dest_node = -1; + for (Idx i = 0; i < edests->nelem; i++) { Idx candidate = edests->elems[i]; if (!re_node_set_contains (cur_nodes, candidate)) @@ -1244,7 +1248,7 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, /* Otherwise, push the second epsilon-transition on the fail stack. */ else if (fs != NULL && push_fail_stack (fs, *pidx, candidate, nregs, regs, - eps_via_nodes)) + prevregs, eps_via_nodes)) return -2; /* We know we are going to exit. */ @@ -1288,7 +1292,7 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, if (naccepted == 0) { Idx dest_node; - ok = re_node_set_insert (eps_via_nodes, node); + bool ok = re_node_set_insert (eps_via_nodes, node); if (__glibc_unlikely (! ok)) return -2; dest_node = dfa->edests[node].elems[0]; @@ -1317,7 +1321,8 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, static reg_errcode_t __attribute_warn_unused_result__ push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node, - Idx nregs, regmatch_t *regs, re_node_set *eps_via_nodes) + Idx nregs, regmatch_t *regs, regmatch_t *prevregs, + re_node_set *eps_via_nodes) { reg_errcode_t err; Idx num = fs->num++; @@ -1333,25 +1338,30 @@ push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node, } fs->stack[num].idx = str_idx; fs->stack[num].node = dest_node; - fs->stack[num].regs = re_malloc (regmatch_t, nregs); + fs->stack[num].regs = re_malloc (regmatch_t, 2 * nregs); if (fs->stack[num].regs == NULL) return REG_ESPACE; memcpy (fs->stack[num].regs, regs, sizeof (regmatch_t) * nregs); + memcpy (fs->stack[num].regs + nregs, prevregs, sizeof (regmatch_t) * nregs); err = re_node_set_init_copy (&fs->stack[num].eps_via_nodes, eps_via_nodes); return err; } static Idx pop_fail_stack (struct re_fail_stack_t *fs, Idx *pidx, Idx nregs, - regmatch_t *regs, re_node_set *eps_via_nodes) + regmatch_t *regs, regmatch_t *prevregs, + re_node_set *eps_via_nodes) { + if (fs == NULL || fs->num == 0) + return -1; Idx num = --fs->num; - DEBUG_ASSERT (num >= 0); *pidx = fs->stack[num].idx; memcpy (regs, fs->stack[num].regs, sizeof (regmatch_t) * nregs); + memcpy (prevregs, fs->stack[num].regs + nregs, sizeof (regmatch_t) * nregs); re_node_set_free (eps_via_nodes); re_free (fs->stack[num].regs); *eps_via_nodes = fs->stack[num].eps_via_nodes; + DEBUG_ASSERT (0 <= fs->stack[num].node); return fs->stack[num].node; } @@ -1407,33 +1417,32 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, { update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch); - if (idx == pmatch[0].rm_eo && cur_node == mctx->last_node) + if ((idx == pmatch[0].rm_eo && cur_node == mctx->last_node) + || (fs && re_node_set_contains (&eps_via_nodes, cur_node))) { Idx reg_idx; + cur_node = -1; if (fs) { for (reg_idx = 0; reg_idx < nmatch; ++reg_idx) if (pmatch[reg_idx].rm_so > -1 && pmatch[reg_idx].rm_eo == -1) - break; - if (reg_idx == nmatch) - { - re_node_set_free (&eps_via_nodes); - regmatch_list_free (&prev_match); - return free_fail_stack_return (fs); - } - cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch, - &eps_via_nodes); + { + cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch, + prev_idx_match, &eps_via_nodes); + break; + } } - else + if (cur_node < 0) { re_node_set_free (&eps_via_nodes); regmatch_list_free (&prev_match); - return REG_NOERROR; + return free_fail_stack_return (fs); } } /* Proceed to next node. */ - cur_node = proceed_next_node (mctx, nmatch, pmatch, &idx, cur_node, + cur_node = proceed_next_node (mctx, nmatch, pmatch, prev_idx_match, + &idx, cur_node, &eps_via_nodes, fs); if (__glibc_unlikely (cur_node < 0)) @@ -1445,13 +1454,13 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, free_fail_stack_return (fs); return REG_ESPACE; } - if (fs) - cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch, - &eps_via_nodes); - else + cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch, + prev_idx_match, &eps_via_nodes); + if (cur_node < 0) { re_node_set_free (&eps_via_nodes); regmatch_list_free (&prev_match); + free_fail_stack_return (fs); return REG_NOMATCH; } } @@ -1495,10 +1504,10 @@ update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, } else if (type == OP_CLOSE_SUBEXP) { + /* We are at the last node of this sub expression. */ Idx reg_num = dfa->nodes[cur_node].opr.idx + 1; if (reg_num < nmatch) { - /* We are at the last node of this sub expression. */ if (pmatch[reg_num].rm_so < cur_idx) { pmatch[reg_num].rm_eo = cur_idx; @@ -2195,6 +2204,7 @@ sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx, /* Return the next state to which the current state STATE will transit by accepting the current input byte, and update STATE_LOG if necessary. + Return NULL on failure. If STATE can accept a multibyte char/collating element/back reference update the destination of STATE_LOG. */ @@ -2395,7 +2405,7 @@ check_subexp_matching_top (re_match_context_t *mctx, re_node_set *cur_nodes, #if 0 /* Return the next state to which the current state STATE will transit by - accepting the current input byte. */ + accepting the current input byte. Return NULL on failure. */ static re_dfastate_t * transit_state_sb (reg_errcode_t *err, re_match_context_t *mctx, @@ -2817,7 +2827,8 @@ find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes, /* Check whether the node TOP_NODE at TOP_STR can arrive to the node LAST_NODE at LAST_STR. We record the path onto PATH since it will be heavily reused. - Return REG_NOERROR if it can arrive, or REG_NOMATCH otherwise. */ + Return REG_NOERROR if it can arrive, REG_NOMATCH if it cannot, + REG_ESPACE if memory is exhausted. */ static reg_errcode_t __attribute_warn_unused_result__ @@ -3433,7 +3444,8 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) /* Group all nodes belonging to STATE into several destinations. Then for all destinations, set the nodes belonging to the destination to DESTS_NODE[i] and set the characters accepted by the destination - to DEST_CH[i]. This function return the number of destinations. */ + to DEST_CH[i]. Return the number of destinations if successful, + -1 on internal error. */ static Idx group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, @@ -4211,7 +4223,8 @@ match_ctx_add_subtop (re_match_context_t *mctx, Idx node, Idx str_idx) } /* Register the node NODE, whose type is OP_CLOSE_SUBEXP, and which matches - at STR_IDX, whose corresponding OP_OPEN_SUBEXP is SUB_TOP. */ + at STR_IDX, whose corresponding OP_OPEN_SUBEXP is SUB_TOP. + Return the new entry if successful, NULL if memory is exhausted. */ static re_sub_match_last_t * match_ctx_add_sublast (re_sub_match_top_t *subtop, Idx node, Idx str_idx) diff --git a/lib/root-uid.h b/lib/root-uid.h index cb74a49c1b..b367d5ab69 100644 --- a/lib/root-uid.h +++ b/lib/root-uid.h @@ -2,20 +2,20 @@ Copyright 2012-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ - Written by Paul Eggert. */ +/* Written by Paul Eggert. */ #ifndef ROOT_UID_H_ #define ROOT_UID_H_ diff --git a/lib/save-cwd.h b/lib/save-cwd.h index e1e69eceaf..3cefba58c0 100644 --- a/lib/save-cwd.h +++ b/lib/save-cwd.h @@ -1,7 +1,7 @@ /* Save and restore current working directory. - Copyright (C) 1995, 1997-1998, 2003, 2009-2021 Free Software - Foundation, Inc. + Copyright (C) 1995, 1997-1998, 2003, 2009-2021 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/scratch_buffer.h b/lib/scratch_buffer.h index 603b0d65d0..88735771d2 100644 --- a/lib/scratch_buffer.h +++ b/lib/scratch_buffer.h @@ -1,17 +1,17 @@ /* Variable-sized buffer with on-stack default allocation. Copyright (C) 2017-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert, 2017. */ @@ -19,12 +19,109 @@ #ifndef _GL_SCRATCH_BUFFER_H #define _GL_SCRATCH_BUFFER_H -#include +/* Scratch buffers with a default stack allocation and fallback to + heap allocation. It is expected that this function is used in this + way: + struct scratch_buffer tmpbuf; + scratch_buffer_init (&tmpbuf); + + while (!function_that_uses_buffer (tmpbuf.data, tmpbuf.length)) + if (!scratch_buffer_grow (&tmpbuf)) + return -1; + + scratch_buffer_free (&tmpbuf); + return 0; + + The allocation functions (scratch_buffer_grow, + scratch_buffer_grow_preserve, scratch_buffer_set_array_size) make + sure that the heap allocation, if any, is freed, so that the code + above does not have a memory leak. The buffer still remains in a + state that can be deallocated using scratch_buffer_free, so a loop + like this is valid as well: + + struct scratch_buffer tmpbuf; + scratch_buffer_init (&tmpbuf); + + while (!function_that_uses_buffer (tmpbuf.data, tmpbuf.length)) + if (!scratch_buffer_grow (&tmpbuf)) + break; + + scratch_buffer_free (&tmpbuf); + + scratch_buffer_grow and scratch_buffer_grow_preserve are guaranteed + to grow the buffer by at least 512 bytes. This means that when + using the scratch buffer as a backing store for a non-character + array whose element size, in bytes, is 512 or smaller, the scratch + buffer only has to grow once to make room for at least one more + element. +*/ + +/* Scratch buffer. Must be initialized with scratch_buffer_init + before its use. */ +struct scratch_buffer; + +/* Initializes *BUFFER so that BUFFER->data points to BUFFER->__space + and BUFFER->length reflects the available space. */ +#if 0 +extern void scratch_buffer_init (struct scratch_buffer *buffer); +#endif + +/* Deallocates *BUFFER (if it was heap-allocated). */ +#if 0 +extern void scratch_buffer_free (struct scratch_buffer *buffer); +#endif + +/* Grow *BUFFER by some arbitrary amount. The buffer contents is NOT + preserved. Return true on success, false on allocation failure (in + which case the old buffer is freed). On success, the new buffer is + larger than the previous size. On failure, *BUFFER is deallocated, + but remains in a free-able state, and errno is set. */ +#if 0 +extern bool scratch_buffer_grow (struct scratch_buffer *buffer); +#endif + +/* Like scratch_buffer_grow, but preserve the old buffer + contents on success, as a prefix of the new buffer. */ +#if 0 +extern bool scratch_buffer_grow_preserve (struct scratch_buffer *buffer); +#endif + +/* Grow *BUFFER so that it can store at least NELEM elements of SIZE + bytes. The buffer contents are NOT preserved. Both NELEM and SIZE + can be zero. Return true on success, false on allocation failure + (in which case the old buffer is freed, but *BUFFER remains in a + free-able state, and errno is set). It is unspecified whether this + function can reduce the array size. */ +#if 0 +extern bool scratch_buffer_set_array_size (struct scratch_buffer *buffer, + size_t nelem, size_t size); +#endif + +/* Return a copy of *BUFFER's first SIZE bytes as a heap-allocated block, + deallocating *BUFFER if it was heap-allocated. SIZE must be at + most *BUFFER's size. Return NULL (setting errno) on memory + exhaustion. */ +#if 0 +extern void *scratch_buffer_dupfree (struct scratch_buffer *buffer, + size_t size); +#endif + + +/* The implementation is imported from glibc. */ + +/* Avoid possible conflicts with symbols exported by the GNU libc. */ #define __libc_scratch_buffer_dupfree gl_scratch_buffer_dupfree #define __libc_scratch_buffer_grow gl_scratch_buffer_grow #define __libc_scratch_buffer_grow_preserve gl_scratch_buffer_grow_preserve #define __libc_scratch_buffer_set_array_size gl_scratch_buffer_set_array_size -#include + +#ifndef _GL_LIKELY +/* Rely on __builtin_expect, as provided by the module 'builtin-expect'. */ +# define _GL_LIKELY(cond) __builtin_expect ((cond), 1) +# define _GL_UNLIKELY(cond) __builtin_expect ((cond), 0) +#endif + +#include #endif /* _GL_SCRATCH_BUFFER_H */ diff --git a/lib/set-permissions.c b/lib/set-permissions.c index 607983cb93..5c837f1238 100644 --- a/lib/set-permissions.c +++ b/lib/set-permissions.c @@ -775,7 +775,7 @@ chmod_or_fchmod (const char *name, int desc, mode_t mode) int set_permissions (struct permission_context *ctx, const char *name, int desc) { - bool acls_set _GL_UNUSED = false; + _GL_UNUSED bool acls_set = false; bool early_chmod; bool must_chmod = false; int ret = 0; diff --git a/lib/sha1.c b/lib/sha1.c index 612d46de82..52b1020319 100644 --- a/lib/sha1.c +++ b/lib/sha1.c @@ -3,18 +3,18 @@ Copyright (C) 2000-2001, 2003-2006, 2008-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* Written by Scott G. Miller Credits: @@ -23,6 +23,7 @@ #include +/* Specification. */ #if HAVE_OPENSSL_SHA1 # define GL_OPENSSL_INLINE _GL_EXTERN_INLINE #endif @@ -30,13 +31,8 @@ #include #include -#include #include -#if USE_UNLOCKED_IO -# include "unlocked-io.h" -#endif - #include #ifdef WORDS_BIGENDIAN # define SWAP(n) (n) @@ -44,12 +40,8 @@ # define SWAP(n) bswap_32 (n) #endif -#define BLOCKSIZE 32768 -#if BLOCKSIZE % 64 != 0 -# error "invalid BLOCKSIZE" -#endif - #if ! HAVE_OPENSSL_SHA1 + /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. (RFC 1321, 3.1: Step 1) */ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; @@ -120,93 +112,7 @@ sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf) return sha1_read_ctx (ctx, resbuf); } -#endif - -#ifdef GL_COMPILE_CRYPTO_STREAM - -#include "af_alg.h" -/* Compute SHA1 message digest for bytes read from STREAM. The - resulting message digest number will be written into the 20 bytes - beginning at RESBLOCK. */ -int -sha1_stream (FILE *stream, void *resblock) -{ - switch (afalg_stream (stream, "sha1", resblock, SHA1_DIGEST_SIZE)) - { - case 0: return 0; - case -EIO: return 1; - } - - char *buffer = malloc (BLOCKSIZE + 72); - if (!buffer) - return 1; - - struct sha1_ctx ctx; - sha1_init_ctx (&ctx); - size_t sum; - - /* Iterate over full file contents. */ - while (1) - { - /* We read the file in blocks of BLOCKSIZE bytes. One call of the - computation function processes the whole buffer so that with the - next round of the loop another block can be read. */ - size_t n; - sum = 0; - - /* Read block. Take care for partial reads. */ - while (1) - { - /* Either process a partial fread() from this loop, - or the fread() in afalg_stream may have gotten EOF. - We need to avoid a subsequent fread() as EOF may - not be sticky. For details of such systems, see: - https://sourceware.org/bugzilla/show_bug.cgi?id=1190 */ - if (feof (stream)) - goto process_partial_block; - - n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); - - sum += n; - - if (sum == BLOCKSIZE) - break; - - if (n == 0) - { - /* Check for the error flag IFF N == 0, so that we don't - exit the loop after a partial read due to e.g., EAGAIN - or EWOULDBLOCK. */ - if (ferror (stream)) - { - free (buffer); - return 1; - } - goto process_partial_block; - } - } - - /* Process buffer with BLOCKSIZE bytes. Note that - BLOCKSIZE % 64 == 0 - */ - sha1_process_block (buffer, BLOCKSIZE, &ctx); - } - - process_partial_block:; - - /* Process any remaining bytes. */ - if (sum > 0) - sha1_process_bytes (buffer, sum, &ctx); - - /* Construct result in desired memory. */ - sha1_finish_ctx (&ctx, resblock); - free (buffer); - return 0; -} -#endif - -#if ! HAVE_OPENSSL_SHA1 /* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message @@ -444,6 +350,7 @@ sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx) e = ctx->E += e; } } + #endif /* diff --git a/lib/sha1.h b/lib/sha1.h index 94ccd18fda..e12a23cd4d 100644 --- a/lib/sha1.h +++ b/lib/sha1.h @@ -3,18 +3,18 @@ Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifndef SHA1_H # define SHA1_H 1 @@ -30,7 +30,7 @@ extern "C" { # endif -#define SHA1_DIGEST_SIZE 20 +# define SHA1_DIGEST_SIZE 20 # if HAVE_OPENSSL_SHA1 # define GL_OPENSSL_NAME 1 @@ -88,6 +88,7 @@ extern void *sha1_buffer (const char *buffer, size_t len, void *restrict resblock); # endif + /* Compute SHA1 message digest for bytes read from STREAM. STREAM is an open file stream. Regular files are handled more efficiently. The contents of STREAM from its current position to its end will be read. diff --git a/lib/sha256.c b/lib/sha256.c index 129d64b174..2b8687f1db 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -3,17 +3,17 @@ Copyright (C) 2005-2006, 2008-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by David Madore, considerably copypasting from @@ -22,6 +22,7 @@ #include +/* Specification. */ #if HAVE_OPENSSL_SHA256 # define GL_OPENSSL_INLINE _GL_EXTERN_INLINE #endif @@ -29,13 +30,8 @@ #include #include -#include #include -#if USE_UNLOCKED_IO -# include "unlocked-io.h" -#endif - #include #ifdef WORDS_BIGENDIAN # define SWAP(n) (n) @@ -43,12 +39,8 @@ # define SWAP(n) bswap_32 (n) #endif -#define BLOCKSIZE 32768 -#if BLOCKSIZE % 64 != 0 -# error "invalid BLOCKSIZE" -#endif - #if ! HAVE_OPENSSL_SHA256 + /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. */ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; @@ -167,110 +159,7 @@ sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf) sha256_conclude_ctx (ctx); return sha224_read_ctx (ctx, resbuf); } -#endif - -#ifdef GL_COMPILE_CRYPTO_STREAM - -#include "af_alg.h" - -/* Compute message digest for bytes read from STREAM using algorithm ALG. - Write the message digest into RESBLOCK, which contains HASHLEN bytes. - The initial and finishing operations are INIT_CTX and FINISH_CTX. - Return zero if and only if successful. */ -static int -shaxxx_stream (FILE *stream, char const *alg, void *resblock, - ssize_t hashlen, void (*init_ctx) (struct sha256_ctx *), - void *(*finish_ctx) (struct sha256_ctx *, void *)) -{ - switch (afalg_stream (stream, alg, resblock, hashlen)) - { - case 0: return 0; - case -EIO: return 1; - } - - char *buffer = malloc (BLOCKSIZE + 72); - if (!buffer) - return 1; - - struct sha256_ctx ctx; - init_ctx (&ctx); - size_t sum; - - /* Iterate over full file contents. */ - while (1) - { - /* We read the file in blocks of BLOCKSIZE bytes. One call of the - computation function processes the whole buffer so that with the - next round of the loop another block can be read. */ - size_t n; - sum = 0; - - /* Read block. Take care for partial reads. */ - while (1) - { - /* Either process a partial fread() from this loop, - or the fread() in afalg_stream may have gotten EOF. - We need to avoid a subsequent fread() as EOF may - not be sticky. For details of such systems, see: - https://sourceware.org/bugzilla/show_bug.cgi?id=1190 */ - if (feof (stream)) - goto process_partial_block; - - n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); - - sum += n; - - if (sum == BLOCKSIZE) - break; - - if (n == 0) - { - /* Check for the error flag IFF N == 0, so that we don't - exit the loop after a partial read due to e.g., EAGAIN - or EWOULDBLOCK. */ - if (ferror (stream)) - { - free (buffer); - return 1; - } - goto process_partial_block; - } - } - - /* Process buffer with BLOCKSIZE bytes. Note that - BLOCKSIZE % 64 == 0 - */ - sha256_process_block (buffer, BLOCKSIZE, &ctx); - } - - process_partial_block:; - - /* Process any remaining bytes. */ - if (sum > 0) - sha256_process_bytes (buffer, sum, &ctx); - - /* Construct result in desired memory. */ - finish_ctx (&ctx, resblock); - free (buffer); - return 0; -} -int -sha256_stream (FILE *stream, void *resblock) -{ - return shaxxx_stream (stream, "sha256", resblock, SHA256_DIGEST_SIZE, - sha256_init_ctx, sha256_finish_ctx); -} - -int -sha224_stream (FILE *stream, void *resblock) -{ - return shaxxx_stream (stream, "sha224", resblock, SHA224_DIGEST_SIZE, - sha224_init_ctx, sha224_finish_ctx); -} -#endif - -#if ! HAVE_OPENSSL_SHA256 /* Compute SHA256 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message @@ -533,6 +422,7 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx) h = ctx->state[7] += h; } } + #endif /* diff --git a/lib/sha256.h b/lib/sha256.h index b4bc082267..e09b3de807 100644 --- a/lib/sha256.h +++ b/lib/sha256.h @@ -2,17 +2,17 @@ library functions. Copyright (C) 2005-2006, 2008-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef SHA256_H @@ -93,6 +93,7 @@ extern void *sha224_buffer (const char *buffer, size_t len, void *restrict resblock); # endif + /* Compute SHA256 (SHA224) message digest for bytes read from STREAM. STREAM is an open file stream. Regular files are handled more efficiently. The contents of STREAM from its current position to its end will be read. diff --git a/lib/sha512.c b/lib/sha512.c index 4ac3fa3e42..2865d6e588 100644 --- a/lib/sha512.c +++ b/lib/sha512.c @@ -3,17 +3,17 @@ Copyright (C) 2005-2006, 2008-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by David Madore, considerably copypasting from @@ -22,6 +22,7 @@ #include +/* Specification. */ #if HAVE_OPENSSL_SHA512 # define GL_OPENSSL_INLINE _GL_EXTERN_INLINE #endif @@ -29,13 +30,8 @@ #include #include -#include #include -#if USE_UNLOCKED_IO -# include "unlocked-io.h" -#endif - #include #ifdef WORDS_BIGENDIAN # define SWAP(n) (n) @@ -43,12 +39,8 @@ # define SWAP(n) bswap_64 (n) #endif -#define BLOCKSIZE 32768 -#if BLOCKSIZE % 128 != 0 -# error "invalid BLOCKSIZE" -#endif - #if ! HAVE_OPENSSL_SHA512 + /* This array contains the bytes used to pad the buffer to the next 128-byte boundary. */ static const unsigned char fillbuf[128] = { 0x80, 0 /* , 0, 0, ... */ }; @@ -168,110 +160,7 @@ sha384_finish_ctx (struct sha512_ctx *ctx, void *resbuf) sha512_conclude_ctx (ctx); return sha384_read_ctx (ctx, resbuf); } -#endif - -#ifdef GL_COMPILE_CRYPTO_STREAM - -#include "af_alg.h" - -/* Compute message digest for bytes read from STREAM using algorithm ALG. - Write the message digest into RESBLOCK, which contains HASHLEN bytes. - The initial and finishing operations are INIT_CTX and FINISH_CTX. - Return zero if and only if successful. */ -static int -shaxxx_stream (FILE *stream, char const *alg, void *resblock, - ssize_t hashlen, void (*init_ctx) (struct sha512_ctx *), - void *(*finish_ctx) (struct sha512_ctx *, void *)) -{ - switch (afalg_stream (stream, alg, resblock, hashlen)) - { - case 0: return 0; - case -EIO: return 1; - } - - char *buffer = malloc (BLOCKSIZE + 72); - if (!buffer) - return 1; - - struct sha512_ctx ctx; - init_ctx (&ctx); - size_t sum; - - /* Iterate over full file contents. */ - while (1) - { - /* We read the file in blocks of BLOCKSIZE bytes. One call of the - computation function processes the whole buffer so that with the - next round of the loop another block can be read. */ - size_t n; - sum = 0; - - /* Read block. Take care for partial reads. */ - while (1) - { - /* Either process a partial fread() from this loop, - or the fread() in afalg_stream may have gotten EOF. - We need to avoid a subsequent fread() as EOF may - not be sticky. For details of such systems, see: - https://sourceware.org/bugzilla/show_bug.cgi?id=1190 */ - if (feof (stream)) - goto process_partial_block; - - n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); - - sum += n; - - if (sum == BLOCKSIZE) - break; - - if (n == 0) - { - /* Check for the error flag IFF N == 0, so that we don't - exit the loop after a partial read due to e.g., EAGAIN - or EWOULDBLOCK. */ - if (ferror (stream)) - { - free (buffer); - return 1; - } - goto process_partial_block; - } - } - - /* Process buffer with BLOCKSIZE bytes. Note that - BLOCKSIZE % 128 == 0 - */ - sha512_process_block (buffer, BLOCKSIZE, &ctx); - } - - process_partial_block:; - - /* Process any remaining bytes. */ - if (sum > 0) - sha512_process_bytes (buffer, sum, &ctx); - - /* Construct result in desired memory. */ - finish_ctx (&ctx, resblock); - free (buffer); - return 0; -} -int -sha512_stream (FILE *stream, void *resblock) -{ - return shaxxx_stream (stream, "sha512", resblock, SHA512_DIGEST_SIZE, - sha512_init_ctx, sha512_finish_ctx); -} - -int -sha384_stream (FILE *stream, void *resblock) -{ - return shaxxx_stream (stream, "sha384", resblock, SHA384_DIGEST_SIZE, - sha384_init_ctx, sha384_finish_ctx); -} -#endif - -#if ! HAVE_OPENSSL_SHA512 /* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message @@ -578,6 +467,7 @@ sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx) h = ctx->state[7] = u64plus (ctx->state[7], h); } } + #endif /* diff --git a/lib/sha512.h b/lib/sha512.h index 81b53034c7..e15afe996e 100644 --- a/lib/sha512.h +++ b/lib/sha512.h @@ -2,17 +2,17 @@ library functions. Copyright (C) 2005-2006, 2008-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef SHA512_H @@ -96,6 +96,7 @@ extern void *sha384_buffer (const char *buffer, size_t len, void *restrict resblock); # endif + /* Compute SHA512 (SHA384) message digest for bytes read from STREAM. STREAM is an open file stream. Regular files are handled more efficiently. The contents of STREAM from its current position to its end will be read. diff --git a/lib/sigdescr_np.c b/lib/sigdescr_np.c index 6c9bf283a8..bf6abe55c4 100644 --- a/lib/sigdescr_np.c +++ b/lib/sigdescr_np.c @@ -1,17 +1,17 @@ /* English descriptions of signals. Copyright (C) 2020-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Bruno Haible , 2020. */ @@ -189,7 +189,7 @@ sigdescr_np (int sig) return "Instruction emulation needed"; #endif /* Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix */ - #if defined SIGINFO + #if defined SIGINFO && SIGINFO != SIGPWR case SIGINFO: return "Information request"; #endif diff --git a/lib/signal.in.h b/lib/signal.in.h index ed01d672c9..275da8c817 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -2,17 +2,17 @@ Copyright (C) 2006-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #if __GNUC__ >= 3 diff --git a/lib/stat-time.c b/lib/stat-time.c index 81b83ddb4f..7b92792694 100644 --- a/lib/stat-time.c +++ b/lib/stat-time.c @@ -1,3 +1,21 @@ +/* stat-related time functions. + + Copyright (C) 2012-2021 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + #include + #define _GL_STAT_TIME_INLINE _GL_EXTERN_INLINE #include "stat-time.h" diff --git a/lib/stat-time.h b/lib/stat-time.h index 523ed21b08..6b2cc686ae 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h @@ -2,17 +2,17 @@ Copyright (C) 2005, 2007, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ @@ -102,7 +102,7 @@ get_stat_mtime_ns (struct stat const *st) /* Return the nanosecond component of *ST's birth time. */ _GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE -get_stat_birthtime_ns (struct stat const *st _GL_UNUSED) +get_stat_birthtime_ns (_GL_UNUSED struct stat const *st) { # if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC return STAT_TIMESPEC (st, st_birthtim).tv_nsec; @@ -158,7 +158,7 @@ get_stat_mtime (struct stat const *st) /* Return *ST's birth time, if available; otherwise return a value with tv_sec and tv_nsec both equal to -1. */ _GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE -get_stat_birthtime (struct stat const *st _GL_UNUSED) +get_stat_birthtime (_GL_UNUSED struct stat const *st) { struct timespec t; @@ -208,7 +208,7 @@ get_stat_birthtime (struct stat const *st _GL_UNUSED) errno to EOVERFLOW if normalization overflowed. This function is intended to be private to this .h file. */ _GL_STAT_TIME_INLINE int -stat_time_normalize (int result, struct stat *st _GL_UNUSED) +stat_time_normalize (int result, _GL_UNUSED struct stat *st) { #if defined __sun && defined STAT_TIMESPEC if (result == 0) diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h index eae9d13221..592d58e372 100644 --- a/lib/stdalign.in.h +++ b/lib/stdalign.in.h @@ -2,18 +2,18 @@ Copyright 2011-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* Written by Paul Eggert and Bruno Haible. */ @@ -104,12 +104,13 @@ #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 # if defined __cplusplus && 201103 <= __cplusplus # define _Alignas(a) alignas (a) -# elif ((defined __APPLE__ && defined __MACH__ \ - ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ - : __GNUC__ && !defined __ibmxl__) \ - || (4 <= __clang_major__) \ - || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ - || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__) +# elif (!defined __attribute__ \ + && ((defined __APPLE__ && defined __MACH__ \ + ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ + : __GNUC__ && !defined __ibmxl__) \ + || (4 <= __clang_major__) \ + || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ + || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)) # define _Alignas(a) __attribute__ ((__aligned__ (a))) # elif 1300 <= _MSC_VER # define _Alignas(a) __declspec (align (a)) diff --git a/lib/stddef.in.h b/lib/stddef.in.h index 0f506a5b18..42290d448d 100644 --- a/lib/stddef.in.h +++ b/lib/stddef.in.h @@ -2,18 +2,18 @@ Copyright (C) 2009-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* Written by Eric Blake. */ @@ -42,6 +42,13 @@ # define _GL_STDDEF_WINT_T # endif # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ + /* On TinyCC, make sure that the macros that indicate the special invocation + convention get undefined. */ +# undef __need_wchar_t +# undef __need_size_t +# undef __need_ptrdiff_t +# undef __need_NULL +# undef __need_wint_t # endif #else @@ -51,7 +58,7 @@ /* On AIX 7.2, with xlc in 64-bit mode, defines max_align_t to a type with alignment 4, but 'long' has alignment 8. */ -# if defined _AIX && defined _ARCH_PPC64 +# if defined _AIX && defined __LP64__ # if !GNULIB_defined_max_align_t # ifdef _MAX_ALIGN_T /* /usr/include/stddef.h has already defined max_align_t. Override it. */ @@ -109,7 +116,7 @@ typedef long max_align_t; && defined __cplusplus # include #else -# if ! (@HAVE_MAX_ALIGN_T@ || defined _GCC_MAX_ALIGN_T) +# if ! (@HAVE_MAX_ALIGN_T@ || (defined _GCC_MAX_ALIGN_T && !defined __clang__)) # if !GNULIB_defined_max_align_t /* On the x86, the maximum storage alignment of double, long, etc. is 4, but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8, diff --git a/lib/stdint.in.h b/lib/stdint.in.h index 7a8f27cef7..85c5418f14 100644 --- a/lib/stdint.in.h +++ b/lib/stdint.in.h @@ -2,18 +2,18 @@ Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. This file is part of gnulib. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* * ISO C 99 for platforms that lack it. @@ -85,7 +85,7 @@ /* Override WINT_MIN and WINT_MAX if gnulib's or overrides wint_t. */ -#if @GNULIB_OVERRIDES_WINT_T@ +#if @GNULIBHEADERS_OVERRIDE_WINT_T@ # undef WINT_MIN # undef WINT_MAX # define WINT_MIN 0x0U @@ -598,7 +598,7 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) /* wint_t limits */ /* If gnulib's or overrides wint_t, @WINT_T_SUFFIX@ is not accurate, therefore use the definitions from above. */ -# if !@GNULIB_OVERRIDES_WINT_T@ +# if !@GNULIBHEADERS_OVERRIDE_WINT_T@ # undef WINT_MIN # undef WINT_MAX # if @HAVE_SIGNED_WINT_T@ diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h index 2a5db74f28..3fa94b487e 100644 --- a/lib/stdio-impl.h +++ b/lib/stdio-impl.h @@ -1,17 +1,17 @@ /* Implementation details of FILE streams. Copyright (C) 2007-2008, 2010-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Many stdio implementations have the same logic and therefore can share diff --git a/lib/stdio.in.h b/lib/stdio.in.h index a930840505..0ca2c8e10c 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -2,18 +2,18 @@ Copyright (C) 2004, 2007-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -56,6 +56,52 @@ May also define off_t to a 64-bit type on native Windows. */ #include +/* Solaris 10 and NetBSD 7.0 declare renameat in , not in . */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && (defined __sun || defined __NetBSD__) \ + && ! defined __GLIBC__ +# include +#endif + +/* Android 4.3 declares renameat in , not in . */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ + && ! defined __GLIBC__ +# include +#endif + +/* MSVC declares 'perror' in , not in . We must include + it before we #define perror rpl_perror. */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \ + && (defined _WIN32 && ! defined __CYGWIN__) \ + && ! defined __GLIBC__ +# include +#endif + +/* MSVC declares 'remove' in , not in . We must include + it before we #define remove rpl_remove. */ +/* MSVC declares 'rename' in , not in . We must include + it before we #define rename rpl_rename. */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \ + && (defined _WIN32 && ! defined __CYGWIN__) \ + && ! defined __GLIBC__ +# include +#endif + + +/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers + that can be freed by passing them as the Ith argument to the + function F. */ +#ifndef _GL_ATTRIBUTE_DEALLOC +# if __GNUC__ >= 11 +# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) +# else +# define _GL_ATTRIBUTE_DEALLOC(f, i) +# endif +#endif + /* The __attribute__ feature is available in gcc versions 2.5 and later. The __-protected variants of the attributes 'format' and 'printf' are accepted by gcc versions 2.6.4 (effectively 2.7) and later. @@ -127,41 +173,6 @@ #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) -/* Solaris 10 and NetBSD 7.0 declare renameat in , not in . */ -/* But in any case avoid namespace pollution on glibc systems. */ -#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && (defined __sun || defined __NetBSD__) \ - && ! defined __GLIBC__ -# include -#endif - -/* Android 4.3 declares renameat in , not in . */ -/* But in any case avoid namespace pollution on glibc systems. */ -#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ - && ! defined __GLIBC__ -# include -#endif - -/* MSVC declares 'perror' in , not in . We must include - it before we #define perror rpl_perror. */ -/* But in any case avoid namespace pollution on glibc systems. */ -#if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \ - && (defined _WIN32 && ! defined __CYGWIN__) \ - && ! defined __GLIBC__ -# include -#endif - -/* MSVC declares 'remove' in , not in . We must include - it before we #define remove rpl_remove. */ -/* MSVC declares 'rename' in , not in . We must include - it before we #define rename rpl_rename. */ -/* But in any case avoid namespace pollution on glibc systems. */ -#if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \ - && (defined _WIN32 && ! defined __CYGWIN__) \ - && ! defined __GLIBC__ -# include -#endif - - /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ @@ -242,7 +253,7 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " _GL_CXXALIAS_MDA (fcloseall, int, (void)); # else # if @HAVE_DECL_FCLOSEALL@ -# if defined __FreeBSD__ +# if defined __FreeBSD__ || defined __DragonFly__ _GL_CXXALIAS_SYS (fcloseall, void, (void)); # else _GL_CXXALIAS_SYS (fcloseall, int, (void)); @@ -260,8 +271,9 @@ _GL_CXXALIASWARN (fcloseall); # undef fdopen # define fdopen rpl_fdopen # endif -_GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode) - _GL_ARG_NONNULL ((2))); +_GL_FUNCDECL_RPL (fdopen, FILE *, + (int fd, const char *mode) + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -270,28 +282,42 @@ _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); # endif _GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); # else +# if __GNUC__ >= 11 +/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ +_GL_FUNCDECL_SYS (fdopen, FILE *, + (int fd, const char *mode) + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); +# endif _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); # endif _GL_CXXALIASWARN (fdopen); -#elif defined GNULIB_POSIXCHECK -# undef fdopen +#else +# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen +/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ +_GL_FUNCDECL_SYS (fdopen, FILE *, + (int fd, const char *mode) + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); +# endif +# if defined GNULIB_POSIXCHECK +# undef fdopen /* Assume fdopen is always declared. */ _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " "use gnulib module fdopen for portability"); -#elif @GNULIB_MDA_FDOPEN@ +# elif @GNULIB_MDA_FDOPEN@ /* On native Windows, map 'fdopen' to '_fdopen', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between platforms by defining GNULIB_NAMESPACE::fdopen always. */ -# if defined _WIN32 && !defined __CYGWIN__ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef fdopen -# define fdopen _fdopen -# endif +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fdopen +# define fdopen _fdopen +# endif _GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); -# else +# else _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); -# endif +# endif _GL_CXXALIASWARN (fdopen); +# endif #endif #if @GNULIB_FFLUSH@ @@ -380,21 +406,35 @@ _GL_CXXALIASWARN (fileno); # endif _GL_FUNCDECL_RPL (fopen, FILE *, (const char *restrict filename, const char *restrict mode) - _GL_ARG_NONNULL ((1, 2))); + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); _GL_CXXALIAS_RPL (fopen, FILE *, (const char *restrict filename, const char *restrict mode)); # else +# if __GNUC__ >= 11 +/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ +_GL_FUNCDECL_SYS (fopen, FILE *, + (const char *restrict filename, const char *restrict mode) + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); +# endif _GL_CXXALIAS_SYS (fopen, FILE *, (const char *restrict filename, const char *restrict mode)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fopen); # endif -#elif defined GNULIB_POSIXCHECK -# undef fopen +#else +# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fopen +/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ +_GL_FUNCDECL_SYS (fopen, FILE *, + (const char *restrict filename, const char *restrict mode) + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); +# endif +# if defined GNULIB_POSIXCHECK +# undef fopen /* Assume fopen is always declared. */ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - " "use gnulib module fopen for portability"); +# endif #endif #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ @@ -1009,22 +1049,32 @@ _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " # undef popen # define popen rpl_popen # endif -_GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode) - _GL_ARG_NONNULL ((1, 2))); +_GL_FUNCDECL_RPL (popen, FILE *, + (const char *cmd, const char *mode) + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); # else -# if !@HAVE_POPEN@ -_GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode) - _GL_ARG_NONNULL ((1, 2))); +# if !@HAVE_POPEN@ || __GNUC__ >= 11 +_GL_FUNCDECL_SYS (popen, FILE *, + (const char *cmd, const char *mode) + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); # endif _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); # endif _GL_CXXALIASWARN (popen); -#elif defined GNULIB_POSIXCHECK -# undef popen -# if HAVE_RAW_DECL_POPEN +#else +# if @GNULIB_PCLOSE@ && __GNUC__ >= 11 && !defined popen +/* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */ +_GL_FUNCDECL_SYS (popen, FILE *, + (const char *cmd, const char *mode) + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); +# endif +# if defined GNULIB_POSIXCHECK +# undef popen +# if HAVE_RAW_DECL_POPEN _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " "use gnulib module popen or pipe for more portability"); +# endif # endif #endif @@ -1257,6 +1307,7 @@ _GL_CXXALIASWARN (scanf); # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define snprintf rpl_snprintf # endif +# define GNULIB_overrides_snprintf 1 _GL_FUNCDECL_RPL (snprintf, int, (char *restrict str, size_t size, const char *restrict format, ...) @@ -1302,6 +1353,7 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define sprintf rpl_sprintf # endif +# define GNULIB_overrides_sprintf 1 _GL_FUNCDECL_RPL (sprintf, int, (char *restrict str, const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) @@ -1344,19 +1396,32 @@ _GL_CXXALIASWARN (tempnam); # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define tmpfile rpl_tmpfile # endif -_GL_FUNCDECL_RPL (tmpfile, FILE *, (void)); +_GL_FUNCDECL_RPL (tmpfile, FILE *, (void) + _GL_ATTRIBUTE_DEALLOC (fclose, 1)); _GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); # else +# if __GNUC__ >= 11 +/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ +_GL_FUNCDECL_SYS (tmpfile, FILE *, (void) + _GL_ATTRIBUTE_DEALLOC (fclose, 1)); +# endif _GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (tmpfile); # endif -#elif defined GNULIB_POSIXCHECK -# undef tmpfile -# if HAVE_RAW_DECL_TMPFILE +#else +# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile +/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ +_GL_FUNCDECL_SYS (tmpfile, FILE *, (void) + _GL_ATTRIBUTE_DEALLOC (fclose, 1)); +# endif +# if defined GNULIB_POSIXCHECK +# undef tmpfile +# if HAVE_RAW_DECL_TMPFILE _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " "use gnulib module tmpfile for portability"); +# endif # endif #endif @@ -1369,6 +1434,7 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define asprintf rpl_asprintf # endif +# define GNULIB_overrides_asprintf _GL_FUNCDECL_RPL (asprintf, int, (char **result, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) @@ -1390,6 +1456,7 @@ _GL_CXXALIASWARN (asprintf); # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vasprintf rpl_vasprintf # endif +# define GNULIB_overrides_vasprintf 1 _GL_FUNCDECL_RPL (vasprintf, int, (char **result, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) @@ -1573,6 +1640,7 @@ _GL_CXXALIASWARN (vscanf); # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vsnprintf rpl_vsnprintf # endif +# define GNULIB_overrides_vsnprintf 1 _GL_FUNCDECL_RPL (vsnprintf, int, (char *restrict str, size_t size, const char *restrict format, va_list args) @@ -1609,6 +1677,7 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vsprintf rpl_vsprintf # endif +# define GNULIB_overrides_vsprintf 1 _GL_FUNCDECL_RPL (vsprintf, int, (char *restrict str, const char *restrict format, va_list args) diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 49fc44e14a..0855112d19 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -2,17 +2,17 @@ Copyright (C) 1995, 2001-2004, 2006-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #if __GNUC__ >= 3 @@ -99,6 +99,35 @@ struct random_data # include #endif +/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers + that can be freed by passing them as the Ith argument to the + function F. */ +#ifndef _GL_ATTRIBUTE_DEALLOC +# if __GNUC__ >= 11 +# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) +# else +# define _GL_ATTRIBUTE_DEALLOC(f, i) +# endif +#endif + +/* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that + can be freed via 'free'; it can be used only after declaring 'free'. */ +/* Applies to: functions. Cannot be used on inline functions. */ +#ifndef _GL_ATTRIBUTE_DEALLOC_FREE +# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1) +#endif + +/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly + allocated memory. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_MALLOC +# if __GNUC__ >= 3 || defined __clang__ +# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +# else +# define _GL_ATTRIBUTE_MALLOC +# endif +#endif + /* The __attribute__ feature is available in gcc versions 2.5 and later. The attribute __pure__ was added in gcc 2.96. */ #ifndef _GL_ATTRIBUTE_PURE @@ -149,6 +178,28 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " #endif +#if @GNULIB_FREE_POSIX@ +# if @REPLACE_FREE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef free +# define free rpl_free +# endif +_GL_FUNCDECL_RPL (free, void, (void *ptr)); +_GL_CXXALIAS_RPL (free, void, (void *ptr)); +# else +_GL_CXXALIAS_SYS (free, void, (void *ptr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (free); +# endif +#elif defined GNULIB_POSIXCHECK +# undef free +/* Assume free is always declared. */ +_GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - " + "use gnulib module free for portability"); +#endif + + /* Allocate memory with indefinite extent and specified alignment. */ #if @GNULIB_ALIGNED_ALLOC@ # if @REPLACE_ALIGNED_ALLOC@ @@ -156,21 +207,37 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " # undef aligned_alloc # define aligned_alloc rpl_aligned_alloc # endif -_GL_FUNCDECL_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); +_GL_FUNCDECL_RPL (aligned_alloc, void *, + (size_t alignment, size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); # else # if @HAVE_ALIGNED_ALLOC@ +# if __GNUC__ >= 11 +/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (aligned_alloc, void *, + (size_t alignment, size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); # endif # endif # if @HAVE_ALIGNED_ALLOC@ _GL_CXXALIASWARN (aligned_alloc); # endif -#elif defined GNULIB_POSIXCHECK -# undef aligned_alloc -# if HAVE_RAW_DECL_ALIGNED_ALLOC +#else +# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc +/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (aligned_alloc, void *, + (size_t alignment, size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +# if defined GNULIB_POSIXCHECK +# undef aligned_alloc +# if HAVE_RAW_DECL_ALIGNED_ALLOC _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - " "use gnulib module aligned_alloc for portability"); +# endif # endif #endif @@ -198,19 +265,35 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - " # undef calloc # define calloc rpl_calloc # endif -_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size)); +_GL_FUNCDECL_RPL (calloc, void *, + (size_t nmemb, size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); # else +# if __GNUC__ >= 11 +/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (calloc, void *, + (size_t nmemb, size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (calloc); # endif -#elif defined GNULIB_POSIXCHECK -# undef calloc +#else +# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc +/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (calloc, void *, + (size_t nmemb, size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +# if defined GNULIB_POSIXCHECK +# undef calloc /* Assume calloc is always declared. */ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " "use gnulib module calloc-posix for portability"); +# endif #endif #if @GNULIB_CANONICALIZE_FILE_NAME@ @@ -218,13 +301,17 @@ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define canonicalize_file_name rpl_canonicalize_file_name # endif -_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name) - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (canonicalize_file_name, char *, + (const char *name) + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); # else -# if !@HAVE_CANONICALIZE_FILE_NAME@ -_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name) - _GL_ARG_NONNULL ((1))); +# if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11 +_GL_FUNCDECL_SYS (canonicalize_file_name, char *, + (const char *name) + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); # endif @@ -233,12 +320,22 @@ _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@) # endif _GL_CXXALIASWARN (canonicalize_file_name); -#elif defined GNULIB_POSIXCHECK -# undef canonicalize_file_name -# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME +#else +# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name +/* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or + rpl_free. */ +_GL_FUNCDECL_SYS (canonicalize_file_name, char *, + (const char *name) + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +# if defined GNULIB_POSIXCHECK +# undef canonicalize_file_name +# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME _GL_WARN_ON_USE (canonicalize_file_name, "canonicalize_file_name is unportable - " "use gnulib module canonicalize-lgpl for portability"); +# endif # endif #endif @@ -288,27 +385,6 @@ _GL_CXXALIASWARN (fcvt); # endif #endif -#if @GNULIB_FREE_POSIX@ -# if @REPLACE_FREE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef free -# define free rpl_free -# endif -_GL_FUNCDECL_RPL (free, void, (void *ptr)); -_GL_CXXALIAS_RPL (free, void, (void *ptr)); -# else -_GL_CXXALIAS_SYS (free, void, (void *ptr)); -# endif -# if __GLIBC__ >= 2 -_GL_CXXALIASWARN (free); -# endif -#elif defined GNULIB_POSIXCHECK -# undef free -/* Assume free is always declared. */ -_GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - " - "use gnulib module free for portability"); -#endif - #if @GNULIB_MDA_GCVT@ /* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between @@ -404,19 +480,35 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - " # undef malloc # define malloc rpl_malloc # endif -_GL_FUNCDECL_RPL (malloc, void *, (size_t size)); +_GL_FUNCDECL_RPL (malloc, void *, + (size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); # else +# if __GNUC__ >= 11 +/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (malloc, void *, + (size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (malloc); # endif -#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC -# undef malloc +#else +# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc +/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (malloc, void *, + (size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC +# undef malloc /* Assume malloc is always declared. */ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " "use gnulib module malloc-posix for portability"); +# endif #endif /* Convert a multibyte character to a wide character. */ @@ -1015,29 +1107,53 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " # undef realloc # define realloc rpl_realloc # endif -_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)); +_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size) + _GL_ATTRIBUTE_DEALLOC_FREE); _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); # else +# if __GNUC__ >= 11 +/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size) + _GL_ATTRIBUTE_DEALLOC_FREE); +# endif _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (realloc); # endif -#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC -# undef realloc +#else +# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc +/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size) + _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC +# undef realloc /* Assume realloc is always declared. */ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " "use gnulib module realloc-posix for portability"); +# endif #endif #if @GNULIB_REALLOCARRAY@ -# if ! @HAVE_REALLOCARRAY@ +# if @REPLACE_REALLOCARRAY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef reallocarray +# define reallocarray rpl_reallocarray +# endif +_GL_FUNCDECL_RPL (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); +_GL_CXXALIAS_RPL (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); +# else +# if ! @HAVE_REALLOCARRAY@ _GL_FUNCDECL_SYS (reallocarray, void *, (void *ptr, size_t nmemb, size_t size)); -# endif +# endif _GL_CXXALIAS_SYS (reallocarray, void *, (void *ptr, size_t nmemb, size_t size)); +# endif _GL_CXXALIASWARN (reallocarray); #elif defined GNULIB_POSIXCHECK # undef reallocarray @@ -1202,6 +1318,47 @@ _GL_WARN_ON_USE (strtold, "strtold is unportable - " # endif #endif +#if @GNULIB_STRTOL@ +/* Parse a signed integer whose textual representation starts at STRING. + The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, + it may be decimal or octal (with prefix "0") or hexadecimal (with prefix + "0x"). + If ENDPTR is not NULL, the address of the first byte after the integer is + stored in *ENDPTR. + Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set + to ERANGE. */ +# if @REPLACE_STRTOL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strtol rpl_strtol +# endif +# define GNULIB_defined_strtol_function 1 +_GL_FUNCDECL_RPL (strtol, long, + (const char *restrict string, char **restrict endptr, + int base) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtol, long, + (const char *restrict string, char **restrict endptr, + int base)); +# else +# if !@HAVE_STRTOL@ +_GL_FUNCDECL_SYS (strtol, long, + (const char *restrict string, char **restrict endptr, + int base) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strtol, long, + (const char *restrict string, char **restrict endptr, + int base)); +# endif +_GL_CXXALIASWARN (strtol); +#elif defined GNULIB_POSIXCHECK +# undef strtol +# if HAVE_RAW_DECL_STRTOL +_GL_WARN_ON_USE (strtol, "strtol is unportable - " + "use gnulib module strtol for portability"); +# endif +#endif + #if @GNULIB_STRTOLL@ /* Parse a signed integer whose textual representation starts at STRING. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, @@ -1211,15 +1368,29 @@ _GL_WARN_ON_USE (strtold, "strtold is unportable - " stored in *ENDPTR. Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set to ERANGE. */ -# if !@HAVE_STRTOLL@ +# if @REPLACE_STRTOLL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strtoll rpl_strtoll +# endif +# define GNULIB_defined_strtoll_function 1 +_GL_FUNCDECL_RPL (strtoll, long long, + (const char *restrict string, char **restrict endptr, + int base) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtoll, long long, + (const char *restrict string, char **restrict endptr, + int base)); +# else +# if !@HAVE_STRTOLL@ _GL_FUNCDECL_SYS (strtoll, long long, (const char *restrict string, char **restrict endptr, int base) _GL_ARG_NONNULL ((1))); -# endif +# endif _GL_CXXALIAS_SYS (strtoll, long long, (const char *restrict string, char **restrict endptr, int base)); +# endif _GL_CXXALIASWARN (strtoll); #elif defined GNULIB_POSIXCHECK # undef strtoll @@ -1229,6 +1400,46 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - " # endif #endif +#if @GNULIB_STRTOUL@ +/* Parse an unsigned integer whose textual representation starts at STRING. + The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, + it may be decimal or octal (with prefix "0") or hexadecimal (with prefix + "0x"). + If ENDPTR is not NULL, the address of the first byte after the integer is + stored in *ENDPTR. + Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE. */ +# if @REPLACE_STRTOUL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strtoul rpl_strtoul +# endif +# define GNULIB_defined_strtoul_function 1 +_GL_FUNCDECL_RPL (strtoul, unsigned long, + (const char *restrict string, char **restrict endptr, + int base) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtoul, unsigned long, + (const char *restrict string, char **restrict endptr, + int base)); +# else +# if !@HAVE_STRTOUL@ +_GL_FUNCDECL_SYS (strtoul, unsigned long, + (const char *restrict string, char **restrict endptr, + int base) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strtoul, unsigned long, + (const char *restrict string, char **restrict endptr, + int base)); +# endif +_GL_CXXALIASWARN (strtoul); +#elif defined GNULIB_POSIXCHECK +# undef strtoul +# if HAVE_RAW_DECL_STRTOUL +_GL_WARN_ON_USE (strtoul, "strtoul is unportable - " + "use gnulib module strtoul for portability"); +# endif +#endif + #if @GNULIB_STRTOULL@ /* Parse an unsigned integer whose textual representation starts at STRING. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, @@ -1238,15 +1449,29 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - " stored in *ENDPTR. Upon overflow, the return value is ULLONG_MAX, and errno is set to ERANGE. */ -# if !@HAVE_STRTOULL@ +# if @REPLACE_STRTOULL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strtoull rpl_strtoull +# endif +# define GNULIB_defined_strtoull_function 1 +_GL_FUNCDECL_RPL (strtoull, unsigned long long, + (const char *restrict string, char **restrict endptr, + int base) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtoull, unsigned long long, + (const char *restrict string, char **restrict endptr, + int base)); +# else +# if !@HAVE_STRTOULL@ _GL_FUNCDECL_SYS (strtoull, unsigned long long, (const char *restrict string, char **restrict endptr, int base) _GL_ARG_NONNULL ((1))); -# endif +# endif _GL_CXXALIAS_SYS (strtoull, unsigned long long, (const char *restrict string, char **restrict endptr, int base)); +# endif _GL_CXXALIASWARN (strtoull); #elif defined GNULIB_POSIXCHECK # undef strtoull diff --git a/lib/stpcpy.c b/lib/stpcpy.c index a4165ba4bf..c312fe44ba 100644 --- a/lib/stpcpy.c +++ b/lib/stpcpy.c @@ -5,17 +5,17 @@ NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3 of the License, or any - later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include diff --git a/lib/str-two-way.h b/lib/str-two-way.h index 005a19fb51..fc2db03b7b 100644 --- a/lib/str-two-way.h +++ b/lib/str-two-way.h @@ -3,18 +3,18 @@ This file is part of the GNU C Library. Written by Eric Blake , 2008. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* Before including this file, you need to include and , and define: diff --git a/lib/strftime.h b/lib/strftime.h index 7284f67133..790a80ed8f 100644 --- a/lib/strftime.h +++ b/lib/strftime.h @@ -2,17 +2,17 @@ Copyright (C) 2002, 2004, 2008-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include diff --git a/lib/string.in.h b/lib/string.in.h index c76c1820b3..8d77ae3800 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -2,18 +2,18 @@ Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -52,16 +52,6 @@ # include #endif -/* The __attribute__ feature is available in gcc versions 2.5 and later. - The attribute __pure__ was added in gcc 2.96. */ -#ifndef _GL_ATTRIBUTE_PURE -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -# else -# define _GL_ATTRIBUTE_PURE /* empty */ -# endif -#endif - /* NetBSD 5.0 declares strsignal in , not in . */ /* But in any case avoid namespace pollution on glibc systems. */ #if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \ @@ -77,12 +67,31 @@ # include #endif +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The attribute __pure__ was added in gcc 2.96. */ +#ifndef _GL_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE /* empty */ +# endif +#endif + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ +/* Declare 'free' if needed for _GL_ATTRIBUTE_DEALLOC_FREE. */ +_GL_EXTERN_C void free (void *); +#if @GNULIB_FREE_POSIX@ +# if (@REPLACE_FREE@ && !defined free \ + && !(defined __cplusplus && defined GNULIB_NAMESPACE)) +# define free rpl_free +_GL_EXTERN_C void free (void *); +# endif +#endif /* Clear a block of memory. The compiler will not delete a call to this function, even if the block is dead after the call. */ @@ -418,7 +427,10 @@ _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " # undef strdup # define strdup rpl_strdup # endif -_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (strdup, char *, + (char const *__s) + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); _GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -431,35 +443,47 @@ _GL_CXXALIAS_MDA (strdup, char *, (char const *__s)); /* strdup exists as a function and as a macro. Get rid of the macro. */ # undef strdup # endif -# if !(@HAVE_DECL_STRDUP@ || defined strdup) -_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); +# if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup +_GL_FUNCDECL_SYS (strdup, char *, + (char const *__s) + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); # endif _GL_CXXALIASWARN (strdup); -#elif defined GNULIB_POSIXCHECK -# undef strdup -# if HAVE_RAW_DECL_STRDUP +#else +# if __GNUC__ >= 11 && !defined strdup +/* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */ +_GL_FUNCDECL_SYS (strdup, char *, + (char const *__s) + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +# if defined GNULIB_POSIXCHECK +# undef strdup +# if HAVE_RAW_DECL_STRDUP _GL_WARN_ON_USE (strdup, "strdup is unportable - " "use gnulib module strdup for portability"); -# endif -#elif @GNULIB_MDA_STRDUP@ +# endif +# elif @GNULIB_MDA_STRDUP@ /* On native Windows, map 'creat' to '_creat', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between - platforms by defining GNULIB_NAMESPACE::creat always. */ -# if defined _WIN32 && !defined __CYGWIN__ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef strdup -# define strdup _strdup -# endif + platforms by defining GNULIB_NAMESPACE::strdup always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strdup +# define strdup _strdup +# endif _GL_CXXALIAS_MDA (strdup, char *, (char const *__s)); -# else -# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup -# undef strdup -# endif +# else +# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup +# undef strdup +# endif _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); -# endif +# endif _GL_CXXALIASWARN (strdup); +# endif #endif /* Append no more than N characters from SRC onto DEST. */ diff --git a/lib/strnlen.c b/lib/strnlen.c index c27a0392c2..ded06ce23f 100644 --- a/lib/strnlen.c +++ b/lib/strnlen.c @@ -2,18 +2,18 @@ Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc. Written by Simon Josefsson. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #include diff --git a/lib/strtoimax.c b/lib/strtoimax.c index 37a25c31d4..bf8534a767 100644 --- a/lib/strtoimax.c +++ b/lib/strtoimax.c @@ -3,17 +3,17 @@ Copyright (C) 1999, 2001-2004, 2006, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ diff --git a/lib/strtol.c b/lib/strtol.c index 2f2159b623..c49321ba0c 100644 --- a/lib/strtol.c +++ b/lib/strtol.c @@ -6,17 +6,17 @@ NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3 of the License, or any - later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifdef _LIBC @@ -51,6 +51,7 @@ /* Determine the name. */ #ifdef USE_IN_EXTENDED_LOCALE_MODEL +# undef strtol # if UNSIGNED # ifdef USE_WIDE_CHAR # ifdef QUAD @@ -82,6 +83,7 @@ # endif #else # if UNSIGNED +# undef strtol # ifdef USE_WIDE_CHAR # ifdef QUAD # define strtol wcstoull @@ -97,6 +99,7 @@ # endif # else # ifdef USE_WIDE_CHAR +# undef strtol # ifdef QUAD # define strtol wcstoll # else @@ -104,6 +107,7 @@ # endif # else # ifdef QUAD +# undef strtol # define strtol strtoll # endif # endif @@ -131,6 +135,12 @@ #endif +#ifdef USE_NUMBER_GROUPING +# define GROUP_PARAM_PROTO , int group +#else +# define GROUP_PARAM_PROTO +#endif + /* We use this code also for the extended locale handling where the function gets as an additional argument the locale which has to be used. To access the values we have to redefine the _NL_CURRENT @@ -166,19 +176,23 @@ # define UCHAR_TYPE unsigned char # define STRING_TYPE char # ifdef USE_IN_EXTENDED_LOCALE_MODEL -# define ISSPACE(Ch) __isspace_l ((Ch), loc) -# define ISALPHA(Ch) __isalpha_l ((Ch), loc) -# define TOUPPER(Ch) __toupper_l ((Ch), loc) +# define ISSPACE(Ch) __isspace_l ((unsigned char) (Ch), loc) +# define ISALPHA(Ch) __isalpha_l ((unsigned char) (Ch), loc) +# define TOUPPER(Ch) __toupper_l ((unsigned char) (Ch), loc) # else -# define ISSPACE(Ch) isspace (Ch) -# define ISALPHA(Ch) isalpha (Ch) -# define TOUPPER(Ch) toupper (Ch) +# define ISSPACE(Ch) isspace ((unsigned char) (Ch)) +# define ISALPHA(Ch) isalpha ((unsigned char) (Ch)) +# define TOUPPER(Ch) toupper ((unsigned char) (Ch)) # endif #endif -#define INTERNAL(X) INTERNAL1(X) -#define INTERNAL1(X) __##X##_internal -#define WEAKNAME(X) WEAKNAME1(X) +#ifdef USE_NUMBER_GROUPING +# define INTERNAL(X) INTERNAL1(X) +# define INTERNAL1(X) __##X##_internal +# define WEAKNAME(X) WEAKNAME1(X) +#else +# define INTERNAL(X) X +#endif #ifdef USE_NUMBER_GROUPING /* This file defines a function to check for correct grouping. */ @@ -196,7 +210,7 @@ INT INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr, - int base, int group LOCALE_PARAM_PROTO) + int base GROUP_PARAM_PROTO LOCALE_PARAM_PROTO) { int negative; register unsigned LONG int cutoff; @@ -379,15 +393,16 @@ INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr, return 0L; } +#ifdef USE_NUMBER_GROUPING /* External user entry point. */ - INT -#ifdef weak_function +# ifdef weak_function weak_function -#endif +# endif strtol (const STRING_TYPE *nptr, STRING_TYPE **endptr, int base LOCALE_PARAM_PROTO) { return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM); } +#endif diff --git a/lib/strtoll.c b/lib/strtoll.c index 30daefc50f..8e6f93faeb 100644 --- a/lib/strtoll.c +++ b/lib/strtoll.c @@ -3,17 +3,17 @@ Inc. This file is part of the GNU C Library. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #define QUAD 1 diff --git a/lib/symlink.c b/lib/symlink.c index 2f6c0d484b..4bb0884aca 100644 --- a/lib/symlink.c +++ b/lib/symlink.c @@ -1,17 +1,17 @@ /* Stub for symlink(). Copyright (C) 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include @@ -47,8 +47,8 @@ rpl_symlink (char const *contents, char const *name) /* The system does not support symlinks. */ int -symlink (char const *contents _GL_UNUSED, - char const *name _GL_UNUSED) +symlink (_GL_UNUSED char const *contents, + _GL_UNUSED char const *name) { errno = ENOSYS; return -1; diff --git a/lib/sys_random.in.h b/lib/sys_random.in.h index 5b9280dda3..1abd6c544e 100644 --- a/lib/sys_random.in.h +++ b/lib/sys_random.in.h @@ -1,18 +1,18 @@ /* Substitute for . Copyright (C) 2020-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ # if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h index 1dacb21087..910bea5d12 100644 --- a/lib/sys_select.in.h +++ b/lib/sys_select.in.h @@ -1,18 +1,18 @@ /* Substitute for . Copyright (C) 2007-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ # if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -21,7 +21,7 @@ /* On OSF/1 and Solaris 2.6, and both include . - On Cygwin, includes . + On Cygwin and OpenBSD, includes . Simply delegate to the system's header in this case. */ #if (@HAVE_SYS_SELECT_H@ \ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H \ @@ -39,6 +39,7 @@ || (!defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \ && ((defined __osf__ && defined _SYS_TIME_H_ \ && defined _OSF_SOURCE) \ + || (defined __OpenBSD__ && defined _SYS_TIME_H_) \ || (defined __sun && defined _SYS_TIME_H \ && (! (defined _XOPEN_SOURCE \ || defined _POSIX_C_SOURCE) \ diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index 13d12943cd..babe3dba3e 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -1,18 +1,18 @@ /* Provide a more complete sys/stat.h header file. Copyright (C) 2005-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h index 90a67d1842..8035fbe7ec 100644 --- a/lib/sys_time.in.h +++ b/lib/sys_time.in.h @@ -2,18 +2,18 @@ Copyright (C) 2007-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* Written by Paul Eggert. */ diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h index 654e80335f..2079d72efc 100644 --- a/lib/sys_types.in.h +++ b/lib/sys_types.in.h @@ -2,18 +2,18 @@ Copyright (C) 2011-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ diff --git a/lib/tempname.c b/lib/tempname.c index e243483eaf..7675aa076d 100644 --- a/lib/tempname.c +++ b/lib/tempname.c @@ -2,16 +2,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ @@ -181,13 +181,13 @@ try_file (char *tmpl, void *flags) } static int -try_dir (char *tmpl, void *flags _GL_UNUSED) +try_dir (char *tmpl, _GL_UNUSED void *flags) { return __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR); } static int -try_nocreate (char *tmpl, void *flags _GL_UNUSED) +try_nocreate (char *tmpl, _GL_UNUSED void *flags) { struct_stat64 st; diff --git a/lib/tempname.h b/lib/tempname.h index a8681fc998..795bb49764 100644 --- a/lib/tempname.h +++ b/lib/tempname.h @@ -2,17 +2,17 @@ Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* header written by Eric Blake */ diff --git a/lib/time-internal.h b/lib/time-internal.h index 067ee729ed..6bbd0a727b 100644 --- a/lib/time-internal.h +++ b/lib/time-internal.h @@ -2,18 +2,18 @@ Copyright 2015-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* Written by Paul Eggert. */ diff --git a/lib/time.in.h b/lib/time.in.h index 1385980cdf..a73fe59cbb 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -2,18 +2,18 @@ Copyright (C) 2007-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -340,22 +340,60 @@ _GL_CXXALIASWARN (strftime); # endif # if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ +/* Functions that use a first-class time zone data type, instead of + relying on an implicit global time zone. + Inspired by NetBSD. */ + +/* Represents a time zone. + (timezone_t) NULL stands for UTC. */ typedef struct tm_zone *timezone_t; + +/* tzalloc (name) + Returns a time zone object for the given time zone NAME. This object + represents the time zone that other functions would use it the TZ + environment variable was set to NAME. + If NAME is NULL, the result represents the time zone that other functions + would use it the TZ environment variable was unset. + May return NULL if NAME is invalid (this is platform dependent) or + upon memory allocation failure. */ _GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); _GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); + +/* tzfree (tz) + Frees a time zone object. + The argument must have been returned by tzalloc(). */ _GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz)); _GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); + +/* localtime_rz (tz, &t, &result) + Converts an absolute time T to a broken-down time RESULT, assuming the + time zone TZ. + This function is like 'localtime_r', but relies on the argument TZ instead + of an implicit global time zone. */ _GL_FUNCDECL_SYS (localtime_rz, struct tm *, (timezone_t __tz, time_t const *restrict __timer, struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_SYS (localtime_rz, struct tm *, (timezone_t __tz, time_t const *restrict __timer, struct tm *restrict __result)); + +/* mktime_z (tz, &tm) + Normalizes the broken-down time TM and converts it to an absolute time, + assuming the time zone TZ. Returns the absolute time. + This function is like 'mktime', but relies on the argument TZ instead + of an implicit global time zone. */ _GL_FUNCDECL_SYS (mktime_z, time_t, - (timezone_t __tz, struct tm *restrict __result) + (timezone_t __tz, struct tm *restrict __tm) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_SYS (mktime_z, time_t, - (timezone_t __tz, struct tm *restrict __result)); + (timezone_t __tz, struct tm *restrict __tm)); + +/* Time zone abbreviation strings (returned by 'localtime_rz' or 'mktime_z' + in the 'tm_zone' member of 'struct tm') are valid as long as + - the 'struct tm' argument is not destroyed or overwritten, + and + - the 'timezone_t' argument is not freed through tzfree(). */ + # endif /* Convert TM to a time_t value, assuming UTC. */ diff --git a/lib/time_r.c b/lib/time_r.c index d908986870..88d3c1c76f 100644 --- a/lib/time_r.c +++ b/lib/time_r.c @@ -2,18 +2,18 @@ Copyright (C) 2003, 2006-2007, 2010-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* Written by Paul Eggert. */ diff --git a/lib/time_rz.c b/lib/time_rz.c index 3ac053c621..e7722447c0 100644 --- a/lib/time_rz.c +++ b/lib/time_rz.c @@ -2,18 +2,18 @@ Copyright 2015-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ /* Written by Paul Eggert. */ diff --git a/lib/timegm.c b/lib/timegm.c index e4127e71c0..7e723e1fb8 100644 --- a/lib/timegm.c +++ b/lib/timegm.c @@ -4,16 +4,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library 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. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ diff --git a/lib/timespec.c b/lib/timespec.c index 2b6098ed7b..957b5fbba4 100644 --- a/lib/timespec.c +++ b/lib/timespec.c @@ -1,3 +1,21 @@ +/* Inline functions for . + + Copyright (C) 2012-2021 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. + + This file 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + #include + #define _GL_TIMESPEC_INLINE _GL_EXTERN_INLINE #include "timespec.h" diff --git a/lib/timespec.h b/lib/timespec.h index 9a71e9ea89..94a5db751f 100644 --- a/lib/timespec.h +++ b/lib/timespec.h @@ -3,17 +3,17 @@ Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #if ! defined TIMESPEC_H diff --git a/lib/u64.c b/lib/u64.c index 1e3854ddcd..c905af626f 100644 --- a/lib/u64.c +++ b/lib/u64.c @@ -1,4 +1,22 @@ +/* uint64_t-like operations that work even on hosts lacking uint64_t + + Copyright (C) 2012-2021 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + #include + #define _GL_U64_INLINE _GL_EXTERN_INLINE #include "u64.h" typedef int dummy; diff --git a/lib/u64.h b/lib/u64.h index ad719c84f8..8d21ec17ed 100644 --- a/lib/u64.h +++ b/lib/u64.h @@ -2,17 +2,17 @@ Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ diff --git a/lib/unistd.c b/lib/unistd.c index 72bad1c052..0763456021 100644 --- a/lib/unistd.c +++ b/lib/unistd.c @@ -1,4 +1,22 @@ +/* Inline functions for . + + Copyright (C) 2012-2021 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + #include + #define _GL_UNISTD_INLINE _GL_EXTERN_INLINE #include "unistd.h" typedef int dummy; diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 5e9b47d981..73c882f97b 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -1,18 +1,18 @@ /* Substitute for and wrapper around . Copyright (C) 2003-2021 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifndef _@GUARD_PREFIX@_UNISTD_H @@ -1521,6 +1521,7 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - " # undef isatty # define isatty rpl_isatty # endif +# define GNULIB_defined_isatty 1 _GL_FUNCDECL_RPL (isatty, int, (int fd)); _GL_CXXALIAS_RPL (isatty, int, (int fd)); # elif defined _WIN32 && !defined __CYGWIN__ @@ -2027,15 +2028,23 @@ _GL_WARN_ON_USE (sleep, "sleep is unportable - " #if @GNULIB_MDA_SWAB@ /* On native Windows, map 'swab' to '_swab', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between - platforms by defining GNULIB_NAMESPACE::creat always. */ + platforms by defining GNULIB_NAMESPACE::swab always. */ # if defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef swab # define swab _swab # endif -_GL_CXXALIAS_MDA (swab, void, (char *from, char *to, int n)); +/* Need to cast, because in old mingw the arguments are + (const char *from, char *to, size_t n). */ +_GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n)); # else +# if defined __hpux /* HP-UX */ +_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n)); +# elif defined __sun && !defined _XPG4 /* Solaris */ +_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n)); +# else _GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n)); +# endif # endif _GL_CXXALIASWARN (swab); #endif diff --git a/lib/unlocked-io.h b/lib/unlocked-io.h index 86b91c19dd..ca184b31fb 100644 --- a/lib/unlocked-io.h +++ b/lib/unlocked-io.h @@ -33,91 +33,91 @@ # include -# if HAVE_DECL_CLEARERR_UNLOCKED +# if HAVE_DECL_CLEARERR_UNLOCKED || defined clearerr_unlocked # undef clearerr # define clearerr(x) clearerr_unlocked (x) # else # define clearerr_unlocked(x) clearerr (x) # endif -# if HAVE_DECL_FEOF_UNLOCKED +# if HAVE_DECL_FEOF_UNLOCKED || defined feof_unlocked # undef feof # define feof(x) feof_unlocked (x) # else # define feof_unlocked(x) feof (x) # endif -# if HAVE_DECL_FERROR_UNLOCKED +# if HAVE_DECL_FERROR_UNLOCKED || defined ferror_unlocked # undef ferror # define ferror(x) ferror_unlocked (x) # else # define ferror_unlocked(x) ferror (x) # endif -# if HAVE_DECL_FFLUSH_UNLOCKED +# if HAVE_DECL_FFLUSH_UNLOCKED || defined fflush_unlocked # undef fflush # define fflush(x) fflush_unlocked (x) # else # define fflush_unlocked(x) fflush (x) # endif -# if HAVE_DECL_FGETS_UNLOCKED +# if HAVE_DECL_FGETS_UNLOCKED || defined fgets_unlocked # undef fgets # define fgets(x,y,z) fgets_unlocked (x,y,z) # else # define fgets_unlocked(x,y,z) fgets (x,y,z) # endif -# if HAVE_DECL_FPUTC_UNLOCKED +# if HAVE_DECL_FPUTC_UNLOCKED || defined fputc_unlocked # undef fputc # define fputc(x,y) fputc_unlocked (x,y) # else # define fputc_unlocked(x,y) fputc (x,y) # endif -# if HAVE_DECL_FPUTS_UNLOCKED +# if HAVE_DECL_FPUTS_UNLOCKED || defined fputs_unlocked # undef fputs # define fputs(x,y) fputs_unlocked (x,y) # else # define fputs_unlocked(x,y) fputs (x,y) # endif -# if HAVE_DECL_FREAD_UNLOCKED +# if HAVE_DECL_FREAD_UNLOCKED || defined fread_unlocked # undef fread # define fread(w,x,y,z) fread_unlocked (w,x,y,z) # else # define fread_unlocked(w,x,y,z) fread (w,x,y,z) # endif -# if HAVE_DECL_FWRITE_UNLOCKED +# if HAVE_DECL_FWRITE_UNLOCKED || defined fwrite_unlocked # undef fwrite # define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z) # else # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) # endif -# if HAVE_DECL_GETC_UNLOCKED +# if HAVE_DECL_GETC_UNLOCKED || defined get_unlocked # undef getc # define getc(x) getc_unlocked (x) # else # define getc_unlocked(x) getc (x) # endif -# if HAVE_DECL_GETCHAR_UNLOCKED +# if HAVE_DECL_GETCHAR_UNLOCKED || defined getchar_unlocked # undef getchar # define getchar() getchar_unlocked () # else # define getchar_unlocked() getchar () # endif -# if HAVE_DECL_PUTC_UNLOCKED +# if HAVE_DECL_PUTC_UNLOCKED || defined putc_unlocked # undef putc # define putc(x,y) putc_unlocked (x,y) # else # define putc_unlocked(x,y) putc (x,y) # endif -# if HAVE_DECL_PUTCHAR_UNLOCKED +# if HAVE_DECL_PUTCHAR_UNLOCKED || defined putchar_unlocked # undef putchar # define putchar(x) putchar_unlocked (x) # else diff --git a/lib/utimens.c b/lib/utimens.c index 44d1ea003e..a34180050e 100644 --- a/lib/utimens.c +++ b/lib/utimens.c @@ -2,17 +2,17 @@ Copyright (C) 2003-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3 of the License, or any - later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ @@ -126,14 +126,14 @@ validate_timespec (struct timespec timespec[2]) return result + (utime_omit_count == 1); } -/* Normalize any UTIME_NOW or UTIME_OMIT values in *TS, using stat - buffer STATBUF to obtain the current timestamps of the file. If +/* Normalize any UTIME_NOW or UTIME_OMIT values in (*TS)[0] and (*TS)[1], + using STATBUF to obtain the current timestamps of the file. If both times are UTIME_NOW, set *TS to NULL (as this can avoid some permissions issues). If both times are UTIME_OMIT, return true (nothing further beyond the prior collection of STATBUF is necessary); otherwise return false. */ static bool -update_timespec (struct stat const *statbuf, struct timespec *ts[2]) +update_timespec (struct stat const *statbuf, struct timespec **ts) { struct timespec *timespec = *ts; if (timespec[0].tv_nsec == UTIME_OMIT diff --git a/lib/utimens.h b/lib/utimens.h index 295d3d71cc..d17953c052 100644 --- a/lib/utimens.h +++ b/lib/utimens.h @@ -2,17 +2,17 @@ Copyright 2012-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3 of the License, or any - later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert. */ diff --git a/lib/verify.h b/lib/verify.h index 65514c34b9..a8ca59b093 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -2,17 +2,17 @@ Copyright (C) 2005-2006, 2009-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ @@ -25,7 +25,7 @@ works as per C11. This is supported by GCC 4.6.0+ and by clang 4+. Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as - per C2X. This is supported by GCC 9.1+. + per C2x. This is supported by GCC 9.1+. Support compilers claiming conformance to the relevant standard, and also support GCC when not pedantic. If we were willing to slow @@ -202,7 +202,7 @@ template This macro requires three or more arguments but uses at most the first two, so that the _Static_assert macro optionally defined below supports - both the C11 two-argument syntax and the C2X one-argument syntax. + both the C11 two-argument syntax and the C2x one-argument syntax. Unfortunately, unlike C11, this implementation must appear as an ordinary declaration, and cannot appear inside struct { ... }. */ diff --git a/lib/warn-on-use.h b/lib/warn-on-use.h index 5d5b17f05b..612937abb0 100644 --- a/lib/warn-on-use.h +++ b/lib/warn-on-use.h @@ -2,16 +2,16 @@ Copyright (C) 2010-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, or + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ /* _GL_WARN_ON_USE (function, "literal string") issues a declaration diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h index 53daf59663..4184f33955 100644 --- a/lib/xalloc-oversized.h +++ b/lib/xalloc-oversized.h @@ -2,17 +2,17 @@ Copyright (C) 1990-2000, 2003-2004, 2006-2021 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef XALLOC_OVERSIZED_H_ @@ -21,34 +21,39 @@ #include #include -/* True if N * S would overflow in a size_t calculation, - or would generate a value larger than PTRDIFF_MAX. +/* True if N * S does not fit into both ptrdiff_t and size_t. + N and S should be nonnegative and free of side effects. This expands to a constant expression if N and S are both constants. - By gnulib convention, SIZE_MAX represents overflow in size + By gnulib convention, SIZE_MAX represents overflow in size_t calculations, so the conservative size_t-based dividend to use here is SIZE_MAX - 1. */ #define __xalloc_oversized(n, s) \ - ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) < (n)) + ((s) != 0 \ + && ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) \ + < (n))) -#if PTRDIFF_MAX < SIZE_MAX -typedef ptrdiff_t __xalloc_count_type; -#else -typedef size_t __xalloc_count_type; -#endif +/* Return 1 if and only if an array of N objects, each of size S, + cannot exist reliably because its total size in bytes would exceed + MIN (PTRDIFF_MAX, SIZE_MAX - 1). + + N and S should be nonnegative and free of side effects. -/* Return 1 if an array of N objects, each of size S, cannot exist - reliably due to size or ptrdiff_t arithmetic overflow. S must be - positive and N must be nonnegative. This is a macro, not a - function, so that it works correctly even when SIZE_MAX < N. */ + Warning: (xalloc_oversized (N, S) ? NULL : malloc (N * S)) can + misbehave if N and S are both narrower than ptrdiff_t and size_t, + and can be rewritten as (xalloc_oversized (N, S) ? NULL + : malloc (N * (size_t) S)). -#if 7 <= __GNUC__ && !defined __clang__ + This is a macro, not a function, so that it works even if an + argument exceeds MAX (PTRDIFF_MAX, SIZE_MAX). */ +#if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX # define xalloc_oversized(n, s) \ - __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1) -#elif 5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ + __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1) +#elif (5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ \ + && PTRDIFF_MAX < SIZE_MAX) # define xalloc_oversized(n, s) \ (__builtin_constant_p (n) && __builtin_constant_p (s) \ ? __xalloc_oversized (n, s) \ - : ({ __xalloc_count_type __xalloc_count; \ + : ({ ptrdiff_t __xalloc_count; \ __builtin_mul_overflow (n, s, &__xalloc_count); })) /* Other compilers use integer division; this may be slower but is diff --git a/m4/close-stream.m4 b/m4/close-stream.m4 deleted file mode 100644 index feeb4eae5d..0000000000 --- a/m4/close-stream.m4 +++ /dev/null @@ -1,11 +0,0 @@ -#serial 4 -dnl Copyright (C) 2006-2007, 2009-2021 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl Prerequisites of lib/close-stream.c. -AC_DEFUN([gl_CLOSE_STREAM], -[ - : -]) diff --git a/m4/dirent_h.m4 b/m4/dirent_h.m4 index 6d86142585..17e2a20c5d 100644 --- a/m4/dirent_h.m4 +++ b/m4/dirent_h.m4 @@ -1,4 +1,4 @@ -# dirent_h.m4 serial 16 +# dirent_h.m4 serial 19 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,10 +6,10 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Bruno Haible. -AC_DEFUN([gl_DIRENT_H], +AC_DEFUN_ONCE([gl_DIRENT_H], [ - dnl Use AC_REQUIRE here, so that the default behavior below is expanded - dnl once only, before all statements that occur in other macros. + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) dnl is always overridden, because of GNULIB_POSIXCHECK. @@ -27,26 +27,41 @@ AC_DEFUN([gl_DIRENT_H], ]], [alphasort closedir dirfd fdopendir opendir readdir rewinddir scandir]) ]) +# gl_DIRENT_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_DIRENT_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_DIRENT_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_DIRENT_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_DIRENT_H_MODULE_INDICATOR_DEFAULTS], [ + gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REWINDDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CLOSEDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DIRFD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPENDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALPHASORT]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_DIRENT_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) +]) + AC_DEFUN([gl_DIRENT_H_DEFAULTS], [ - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR - GNULIB_OPENDIR=0; AC_SUBST([GNULIB_OPENDIR]) - GNULIB_READDIR=0; AC_SUBST([GNULIB_READDIR]) - GNULIB_REWINDDIR=0; AC_SUBST([GNULIB_REWINDDIR]) - GNULIB_CLOSEDIR=0; AC_SUBST([GNULIB_CLOSEDIR]) - GNULIB_DIRFD=0; AC_SUBST([GNULIB_DIRFD]) - GNULIB_FDOPENDIR=0; AC_SUBST([GNULIB_FDOPENDIR]) - GNULIB_SCANDIR=0; AC_SUBST([GNULIB_SCANDIR]) - GNULIB_ALPHASORT=0; AC_SUBST([GNULIB_ALPHASORT]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_OPENDIR=1; AC_SUBST([HAVE_OPENDIR]) HAVE_READDIR=1; AC_SUBST([HAVE_READDIR]) diff --git a/m4/environ.m4 b/m4/environ.m4 index d971770860..ae5329108e 100644 --- a/m4/environ.m4 +++ b/m4/environ.m4 @@ -1,4 +1,4 @@ -# environ.m4 serial 7 +# environ.m4 serial 8 dnl Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -33,7 +33,8 @@ AC_DEFUN([gt_CHECK_VAR_DECL], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[$1 - extern struct { int foo; } $2;]], + typedef struct { int foo; } foo_t; + extern foo_t $2;]], [[$2.foo = 1;]])], [gt_cv_var=no], [gt_cv_var=yes])]) diff --git a/m4/explicit_bzero.m4 b/m4/explicit_bzero.m4 index d77ec5a3a5..8c86d69e05 100644 --- a/m4/explicit_bzero.m4 +++ b/m4/explicit_bzero.m4 @@ -5,7 +5,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_EXPLICIT_BZERO], [ - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) dnl Persuade glibc to declare explicit_bzero. AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4 index a2acf126c8..a4ac5ea532 100644 --- a/m4/extern-inline.m4 +++ b/m4/extern-inline.m4 @@ -17,7 +17,8 @@ AC_DEFUN([gl_EXTERN_INLINE], mishandles inline functions that call each other. E.g., for 'inline void f (void) { } inline void g (void) { f (); }', c99 incorrectly complains 'reference to static identifier "f" in extern inline function'. - This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. + This bug was observed with Oracle Developer Studio 12.6 + (Sun C 5.15 SunOS_sparc 2017/05/30). Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) on configurations that mistakenly use 'static inline' to implement @@ -83,8 +84,8 @@ AC_DEFUN([gl_EXTERN_INLINE], # define _GL_EXTERN_INLINE extern # define _GL_EXTERN_INLINE_IN_USE #else -# define _GL_INLINE static _GL_UNUSED -# define _GL_EXTERN_INLINE static _GL_UNUSED +# define _GL_INLINE _GL_UNUSED static +# define _GL_EXTERN_INLINE _GL_UNUSED static #endif /* In GCC 4.6 (inclusive) to 5.1 (exclusive), diff --git a/m4/fcntl_h.m4 b/m4/fcntl_h.m4 index e63a82f10a..aba44735d1 100644 --- a/m4/fcntl_h.m4 +++ b/m4/fcntl_h.m4 @@ -1,4 +1,4 @@ -# serial 17 +# serial 20 # Configure fcntl.h. dnl Copyright (C) 2006-2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Paul Eggert. -AC_DEFUN([gl_FCNTL_H], +AC_DEFUN_ONCE([gl_FCNTL_H], [ AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) AC_REQUIRE([gl_FCNTL_O_FLAGS]) @@ -26,25 +26,40 @@ AC_DEFUN([gl_FCNTL_H], ]], [fcntl openat]) ]) +# gl_FCNTL_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_FCNTL_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CREAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCNTL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) +]) + AC_DEFUN([gl_FCNTL_H_DEFAULTS], [ - GNULIB_CREAT=0; AC_SUBST([GNULIB_CREAT]) - GNULIB_FCNTL=0; AC_SUBST([GNULIB_FCNTL]) - GNULIB_NONBLOCKING=0; AC_SUBST([GNULIB_NONBLOCKING]) - GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) - GNULIB_OPENAT=0; AC_SUBST([GNULIB_OPENAT]) - dnl Support Microsoft deprecated alias function names by default. - GNULIB_MDA_CREAT=1; AC_SUBST([GNULIB_MDA_CREAT]) - GNULIB_MDA_OPEN=1; AC_SUBST([GNULIB_MDA_OPEN]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) diff --git a/m4/free.m4 b/m4/free.m4 index d671376b0b..a7923b9059 100644 --- a/m4/free.m4 +++ b/m4/free.m4 @@ -1,4 +1,4 @@ -# free.m4 serial 5 +# free.m4 serial 6 # Copyright (C) 2003-2005, 2009-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -40,7 +40,10 @@ AC_DEFUN([gl_FUNC_FREE], ]) case $gl_cv_func_free_preserves_errno in - *yes) ;; + *yes) + AC_DEFINE([HAVE_FREE_POSIX], [1], + [Define if the 'free' function is guaranteed to preserve errno.]) + ;; *) REPLACE_FREE=1 ;; esac ]) diff --git a/m4/gettimeofday.m4 b/m4/gettimeofday.m4 index 3c20081574..37c54404bb 100644 --- a/m4/gettimeofday.m4 +++ b/m4/gettimeofday.m4 @@ -1,4 +1,4 @@ -# serial 28 +# serial 29 # Copyright (C) 2001-2003, 2005, 2007, 2009-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -9,10 +9,10 @@ dnl From Jim Meyering. AC_DEFUN([gl_FUNC_GETTIMEOFDAY], [ - AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) + AC_REQUIRE([gl_SYS_TIME_H_DEFAULTS]) AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([gl_HEADER_SYS_TIME_H]) + AC_REQUIRE([gl_SYS_TIME_H]) AC_CHECK_FUNCS_ONCE([gettimeofday]) gl_gettimeofday_timezone=void diff --git a/m4/glibc21.m4 b/m4/glibc21.m4 deleted file mode 100644 index 74a781aa1c..0000000000 --- a/m4/glibc21.m4 +++ /dev/null @@ -1,34 +0,0 @@ -# glibc21.m4 serial 5 -dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2021 Free Software -dnl Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -# Test for the GNU C Library, version 2.1 or newer, or uClibc. -# From Bruno Haible. - -AC_DEFUN([gl_GLIBC21], - [ - AC_CACHE_CHECK([whether we are using the GNU C Library >= 2.1 or uClibc], - [ac_cv_gnu_library_2_1], - [AC_EGREP_CPP([Lucky], - [ -#include -#ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) - Lucky GNU user - #endif -#endif -#ifdef __UCLIBC__ - Lucky user -#endif - ], - [ac_cv_gnu_library_2_1=yes], - [ac_cv_gnu_library_2_1=no]) - ] - ) - AC_SUBST([GLIBC21]) - GLIBC21="$ac_cv_gnu_library_2_1" - ] -) diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index f2eff10de6..12b19dbcb4 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 63 +# gnulib-common.m4 serial 67 dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -85,12 +85,12 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0) # define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7) # define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6) +# define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) # ifdef _ICC # define _GL_ATTR_may_alias 0 # else # define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) # endif -# define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) # define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) # define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) # define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) @@ -103,26 +103,47 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) #endif +#ifdef __has_c_attribute +# define _GL_HAS_C_ATTRIBUTE(attr) __has_c_attribute (__##attr##__) +#else +# define _GL_HAS_C_ATTRIBUTE(attr) 0 +#endif + ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's _Alignas instead. [ +/* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function + is the size of the returned memory block. + _GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied + by the Nth argument of the function is the size of the returned memory block. + */ +/* Applies to: function, pointer to function, function types. */ #if _GL_HAS_ATTRIBUTE (alloc_size) # define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) #else # define _GL_ATTRIBUTE_ALLOC_SIZE(args) #endif +/* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the + function and report an error if it cannot do so. */ +/* Applies to: function. */ #if _GL_HAS_ATTRIBUTE (always_inline) # define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) #else # define _GL_ATTRIBUTE_ALWAYS_INLINE #endif +/* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show + in stack traces when debugging. The compiler should omit the function from + stack traces. */ +/* Applies to: function. */ #if _GL_HAS_ATTRIBUTE (artificial) # define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) #else # define _GL_ATTRIBUTE_ARTIFICIAL #endif +/* _GL_ATTRIBUTE_COLD declares that the function is rarely executed. */ +/* Applies to: functions. */ /* Avoid __attribute__ ((cold)) on MinGW; see thread starting at . Also, Oracle Studio 12.6 requires 'cold' not '__cold__'. */ @@ -136,13 +157,41 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTRIBUTE_COLD #endif +/* _GL_ATTRIBUTE_CONST declares that it is OK for a compiler to omit duplicate + calls to the function with the same arguments. + This attribute is safe for a function that neither depends on nor affects + observable state, and always returns exactly once - e.g., does not loop + forever, and does not call longjmp. + (This attribute is stricter than _GL_ATTRIBUTE_PURE.) */ +/* Applies to: functions. */ #if _GL_HAS_ATTRIBUTE (const) # define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) #else # define _GL_ATTRIBUTE_CONST #endif -#if 201710L < __STDC_VERSION__ +/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers + that can be freed by passing them as the Ith argument to the + function F. + _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that + can be freed via 'free'; it can be used only after declaring 'free'. */ +/* Applies to: functions. Cannot be used on inline functions. */ +#if _GL_GNUC_PREREQ (11, 0) +# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) +#else +# define _GL_ATTRIBUTE_DEALLOC(f, i) +#endif +#define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1) + +/* _GL_ATTRIBUTE_DEPRECATED: Declares that an entity is deprecated. + The compiler may warn if the entity is used. */ +/* Applies to: + - function, variable, + - struct, union, struct/union member, + - enumeration, enumeration item, + - typedef, + in C++ also: namespace, class, template specialization. */ +#if _GL_HAS_C_ATTRIBUTE (deprecated) # define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] #elif _GL_HAS_ATTRIBUTE (deprecated) # define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) @@ -150,6 +199,11 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTRIBUTE_DEPRECATED #endif +/* _GL_ATTRIBUTE_ERROR(msg) requests an error if a function is called and + the function call is not optimized away. + _GL_ATTRIBUTE_WARNING(msg) requests a warning if a function is called and + the function call is not optimized away. */ +/* Applies to: functions. */ #if _GL_HAS_ATTRIBUTE (error) # define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg))) # define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg))) @@ -161,14 +215,21 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTRIBUTE_WARNING(msg) #endif +/* _GL_ATTRIBUTE_EXTERNALLY_VISIBLE declares that the entity should remain + visible to debuggers etc., even with '-fwhole-program'. */ +/* Applies to: functions, variables. */ #if _GL_HAS_ATTRIBUTE (externally_visible) # define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible)) #else # define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE #endif -/* FALLTHROUGH is special, because it always expands to something. */ -#if 201710L < __STDC_VERSION__ +/* _GL_ATTRIBUTE_FALLTHROUGH declares that it is not a programming mistake if + the control flow falls through to the immediately following 'case' or + 'default' label. The compiler should not warn in this case. */ +/* Applies to: Empty statement (;), inside a 'switch' statement. */ +/* Always expands to something. */ +#if _GL_HAS_C_ATTRIBUTE (fallthrough) # define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] #elif _GL_HAS_ATTRIBUTE (fallthrough) # define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) @@ -176,18 +237,47 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0) #endif +/* _GL_ATTRIBUTE_FORMAT ((ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK)) + declares that the STRING-INDEXth function argument is a format string of + style ARCHETYPE, which is one of: + printf, gnu_printf + scanf, gnu_scanf, + strftime, gnu_strftime, + strfmon, + or the same thing prefixed and suffixed with '__'. + If FIRST-TO-CHECK is not 0, arguments starting at FIRST-TO_CHECK + are suitable for the format string. */ +/* Applies to: functions. */ #if _GL_HAS_ATTRIBUTE (format) # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) #else # define _GL_ATTRIBUTE_FORMAT(spec) #endif +/* _GL_ATTRIBUTE_LEAF declares that if the function is called from some other + compilation unit, it executes code from that unit only by return or by + exception handling. This declaration lets the compiler optimize that unit + more aggressively. */ +/* Applies to: functions. */ #if _GL_HAS_ATTRIBUTE (leaf) # define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__)) #else # define _GL_ATTRIBUTE_LEAF #endif +/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly + allocated memory. */ +/* Applies to: functions. */ +#if _GL_HAS_ATTRIBUTE (malloc) +# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +#else +# define _GL_ATTRIBUTE_MALLOC +#endif + +/* _GL_ATTRIBUTE_MAY_ALIAS declares that pointers to the type may point to the + same storage as pointers to other types. Thus this declaration disables + strict aliasing optimization. */ +/* Applies to: types. */ /* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */ #if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C # define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__)) @@ -195,24 +285,33 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTRIBUTE_MAY_ALIAS #endif -#if 201710L < __STDC_VERSION__ +/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if + the entity is not used. The compiler should not warn if the entity is not + used. */ +/* Applies to: + - function, variable, + - struct, union, struct/union member, + - enumeration, enumeration item, + - typedef, + in C++ also: class. */ +/* In C++ and C2x, this is spelled [[__maybe_unused__]]. + GCC's syntax is __attribute__ ((__unused__)). + clang supports both syntaxes. */ +#if _GL_HAS_C_ATTRIBUTE (maybe_unused) # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] -#elif _GL_HAS_ATTRIBUTE (unused) -# define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__)) #else -# define _GL_ATTRIBUTE_MAYBE_UNUSED +# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED #endif -/* Earlier spellings of this macro. */ +/* Alternative spelling of this macro, for convenience. */ #define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED +/* Earlier spellings of this macro. */ #define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED -#if _GL_HAS_ATTRIBUTE (malloc) -# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) -#else -# define _GL_ATTRIBUTE_MALLOC -#endif - -#if 201710L < __STDC_VERSION__ +/* _GL_ATTRIBUTE_NODISCARD declares that the caller of the function should not + discard the return value. The compiler may warn if the caller does not use + the return value, unless the caller uses something like ignore_value. */ +/* Applies to: function, enumeration, class. */ +#if _GL_HAS_C_ATTRIBUTE (nodiscard) # define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] #elif _GL_HAS_ATTRIBUTE (warn_unused_result) # define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__)) @@ -220,18 +319,30 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTRIBUTE_NODISCARD #endif +/* _GL_ATTRIBUTE_NOINLINE tells that the compiler should not inline the + function. */ +/* Applies to: functions. */ #if _GL_HAS_ATTRIBUTE (noinline) # define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__)) #else # define _GL_ATTRIBUTE_NOINLINE #endif +/* _GL_ATTRIBUTE_NONNULL ((N1, N2,...)) declares that the arguments N1, N2,... + must not be NULL. + _GL_ATTRIBUTE_NONNULL () declares that all pointer arguments must not be + null. */ +/* Applies to: functions. */ #if _GL_HAS_ATTRIBUTE (nonnull) # define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args)) #else # define _GL_ATTRIBUTE_NONNULL(args) #endif +/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is + not meant to be NUL-terminated. */ +/* Applies to: struct/union members and variables that are arrays of element + type '[[un]signed] char'. */ #if _GL_HAS_ATTRIBUTE (nonstring) # define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__)) #else @@ -240,41 +351,77 @@ AC_DEFUN([gl_COMMON_BODY], [ /* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */ +/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. + */ +/* Applies to: functions. */ #if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) #else # define _GL_ATTRIBUTE_NOTHROW #endif +/* _GL_ATTRIBUTE_PACKED declares: + For struct members: The member has the smallest possible alignment. + For struct, union, class: All members have the smallest possible alignment, + minimizing the memory required. */ +/* Applies to: struct members, struct, union, + in C++ also: class. */ #if _GL_HAS_ATTRIBUTE (packed) # define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) #else # define _GL_ATTRIBUTE_PACKED #endif +/* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate + calls to the function with the same arguments if observable state is not + changed between calls. + This attribute is safe for a function that does not affect + observable state, and always returns exactly once. + (This attribute is looser than _GL_ATTRIBUTE_CONST.) */ +/* Applies to: functions. */ #if _GL_HAS_ATTRIBUTE (pure) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) #else # define _GL_ATTRIBUTE_PURE #endif +/* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is + a non-NULL pointer. */ +/* Applies to: functions. */ #if _GL_HAS_ATTRIBUTE (returns_nonnull) # define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__)) #else # define _GL_ATTRIBUTE_RETURNS_NONNULL #endif +/* _GL_ATTRIBUTE_SENTINEL(pos) declares that the variadic function expects a + trailing NULL argument. + _GL_ATTRIBUTE_SENTINEL () - The last argument is NULL (requires C99). + _GL_ATTRIBUTE_SENTINEL ((N)) - The (N+1)st argument from the end is NULL. */ +/* Applies to: functions. */ #if _GL_HAS_ATTRIBUTE (sentinel) # define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos)) #else # define _GL_ATTRIBUTE_SENTINEL(pos) #endif +/* A helper macro. Don't use it directly. */ +#if _GL_HAS_ATTRIBUTE (unused) +# define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +#else +# define _GL_ATTRIBUTE_UNUSED +#endif + ]dnl There is no _GL_ATTRIBUTE_VISIBILITY; see m4/visibility.m4 instead. [ -/* To support C++ as well as C, use _GL_UNUSED_LABEL with trailing ';'. */ -#if !defined __cplusplus || _GL_GNUC_PREREQ (4, 5) -# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_MAYBE_UNUSED +/* _GL_UNUSED_LABEL; declares that it is not a programming mistake if the + immediately preceding label is not used. The compiler should not warn + if the label is not used. */ +/* Applies to: label (both in C and C++). */ +/* Note that g++ < 4.5 does not support the '__attribute__ ((__unused__)) ;' + syntax. But clang does. */ +#if !(defined __cplusplus && !_GL_GNUC_PREREQ (4, 5)) || defined __clang__ +# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED #else # define _GL_UNUSED_LABEL #endif @@ -357,6 +504,16 @@ AC_DEFUN([gl_COMMON_BODY], [ export LIBC_FATAL_STDERR_ ]) +# gl_MODULE_INDICATOR_INIT_VARIABLE([variablename]) +# gl_MODULE_INDICATOR_INIT_VARIABLE([variablename], [initialvalue]) +# initializes the shell variable that indicates the presence of the given module +# as a C preprocessor expression. +AC_DEFUN([gl_MODULE_INDICATOR_INIT_VARIABLE], +[ + GL_MODULE_INDICATOR_PREFIX[]_[$1]=m4_if([$2], , [0], [$2]) + AC_SUBST(GL_MODULE_INDICATOR_PREFIX[]_[$1]) +]) + # gl_MODULE_INDICATOR_CONDITION # expands to a C preprocessor expression that evaluates to 1 or 0, depending # whether a gnulib module that has been requested shall be considered present @@ -369,9 +526,9 @@ m4_define([gl_MODULE_INDICATOR_CONDITION], [1]) AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], [ gl_MODULE_INDICATOR_SET_VARIABLE_AUX( - [GNULIB_[]m4_translit([[$1]], - [abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])], + [GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]m4_translit([[$1]], + [abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])], [gl_MODULE_INDICATOR_CONDITION]) ]) @@ -656,6 +813,72 @@ AC_DEFUN([gl_CACHE_VAL_SILENT], ]) ]) +# gl_CC_ALLOW_WARNINGS +# sets and substitutes a variable GL_CFLAG_ALLOW_WARNINGS, to a $(CC) option +# that reverts a preceding '-Werror' option, if available. +# This is expected to be '-Wno-error' on gcc, clang (except clang/MSVC), xlclang +# and empty otherwise. +AC_DEFUN([gl_CC_ALLOW_WARNINGS], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_CACHE_CHECK([for C compiler option to allow warnings], + [gl_cv_cc_wallow], + [rm -f conftest* + echo 'int dummy;' > conftest.c + AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null + AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null + dnl Test the number of error output lines, because AIX xlc accepts the + dnl option '-Wno-error', just to produce a warning + dnl "Option -Wno-error was incorrectly specified. The option will be ignored." + dnl afterwards. + if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then + gl_cv_cc_wallow='-Wno-error' + else + gl_cv_cc_wallow=none + fi + rm -f conftest* + ]) + case "$gl_cv_cc_wallow" in + none) GL_CFLAG_ALLOW_WARNINGS='' ;; + *) GL_CFLAG_ALLOW_WARNINGS="$gl_cv_cc_wallow" ;; + esac + AC_SUBST([GL_CFLAG_ALLOW_WARNINGS]) +]) + +# gl_CXX_ALLOW_WARNINGS +# sets and substitutes a variable GL_CXXFLAG_ALLOW_WARNINGS, to a $(CC) option +# that reverts a preceding '-Werror' option, if available. +AC_DEFUN([gl_CXX_ALLOW_WARNINGS], +[ + dnl Requires AC_PROG_CXX or gl_PROG_ANSI_CXX. + if test -n "$CXX" && test "$CXX" != no; then + AC_CACHE_CHECK([for C++ compiler option to allow warnings], + [gl_cv_cxx_wallow], + [rm -f conftest* + echo 'int dummy;' > conftest.cc + AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null + AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null + dnl Test the number of error output lines, because AIX xlC accepts the + dnl option '-Wno-error', just to produce a warning + dnl "Option -Wno-error was incorrectly specified. The option will be ignored." + dnl afterwards. + if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then + gl_cv_cxx_wallow='-Wno-error' + else + gl_cv_cxx_wallow=none + fi + rm -f conftest* + ]) + case "$gl_cv_cxx_wallow" in + none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; + *) GL_CXXFLAG_ALLOW_WARNINGS="$gl_cv_cxx_wallow" ;; + esac + else + GL_CXXFLAG_ALLOW_WARNINGS='' + fi + AC_SUBST([GL_CXXFLAG_ALLOW_WARNINGS]) +]) + dnl Expands to some code for use in .c programs that, on native Windows, defines dnl the Microsoft deprecated alias function names to the underscore-prefixed dnl actual function names. With this macro, these function names are available diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 05e7faa993..dd5bde8d79 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -121,11 +121,13 @@ AC_DEFUN([gl_EARLY], # Code from module inttypes-incomplete: # Code from module largefile: AC_REQUIRE([AC_SYS_LARGEFILE]) + AC_REQUIRE([gl_YEAR2038_EARLY]) # Code from module lchmod: # Code from module libc-config: # Code from module libgmp: # Code from module limits-h: # Code from module lstat: + # Code from module malloc-posix: # Code from module manywarnings: # Code from module memmem-simple: # Code from module mempcpy: @@ -147,6 +149,8 @@ AC_DEFUN([gl_EARLY], # Code from module rawmemchr: # Code from module readlink: # Code from module readlinkat: + # Code from module realloc-gnu: + # Code from module realloc-posix: # Code from module regex: # Code from module root-uid: # Code from module scratch_buffer: @@ -189,6 +193,7 @@ AC_DEFUN([gl_EARLY], # Code from module u64: # Code from module unistd: # Code from module unlocked-io: + # Code from module unlocked-io-internal: # Code from module update-copyright: # Code from module utimens: # Code from module utimensat: @@ -213,6 +218,8 @@ AC_DEFUN([gl_INIT], m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) m4_pushdef([gl_LIBSOURCES_LIST], []) m4_pushdef([gl_LIBSOURCES_DIR], []) + m4_pushdef([GL_MACRO_PREFIX], [gl]) + m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL]) gl_COMMON gl_source_base='lib' gl_FUNC_ACL @@ -245,6 +252,7 @@ AC_DEFUN([gl_INIT], gl_SHA512 gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE gl_DIRENT_H + gl_DIRENT_H_REQUIRE_DEFAULTS gl_DOUBLE_SLASH_ROOT gl_FUNC_DUP2 if test $REPLACE_DUP2 = 1; then @@ -282,6 +290,7 @@ AC_DEFUN([gl_INIT], fi gl_FCNTL_MODULE_INDICATOR([fcntl]) gl_FCNTL_H + gl_FCNTL_H_REQUIRE_DEFAULTS gl_FUNC_FDOPENDIR if test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1; then AC_LIBOBJ([fdopendir]) @@ -337,10 +346,10 @@ AC_DEFUN([gl_INIT], if test $REPLACE_GETOPT = 1; then AC_LIBOBJ([getopt]) AC_LIBOBJ([getopt1]) - dnl Arrange for unistd.h to include getopt.h. - GNULIB_GL_UNISTD_H_GETOPT=1 + dnl Define the substituted variable GNULIB_UNISTD_H_GETOPT to 1. + gl_UNISTD_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1]) fi - AC_SUBST([GNULIB_GL_UNISTD_H_GETOPT]) gl_UNISTD_MODULE_INDICATOR([getopt-posix]) AC_REQUIRE([AC_CANONICAL_HOST]) gl_FUNC_GETRANDOM @@ -357,6 +366,7 @@ AC_DEFUN([gl_INIT], gl_SYS_TIME_MODULE_INDICATOR([gettimeofday]) gl_IEEE754_H gl_INTTYPES_INCOMPLETE + gl_INTTYPES_H_REQUIRE_DEFAULTS AC_REQUIRE([gl_LARGEFILE]) gl___INLINE gl_LIBGMP @@ -444,22 +454,50 @@ AC_DEFUN([gl_INIT], fi gl_STRING_MODULE_INDICATOR([sigdescr_np]) gl_SIGNAL_H + gl_SIGNAL_H_REQUIRE_DEFAULTS gl_TYPE_SOCKLEN_T gt_TYPE_SSIZE_T gl_STAT_TIME gl_STAT_BIRTHTIME gl_STDALIGN_H gl_STDDEF_H + gl_STDDEF_H_REQUIRE_DEFAULTS gl_STDINT_H gl_STDIO_H + gl_STDIO_H_REQUIRE_DEFAULTS + dnl No need to create extra modules for these functions. Everyone who uses + dnl likely needs them. + gl_STDIO_MODULE_INDICATOR([fscanf]) + gl_MODULE_INDICATOR([fscanf]) + gl_STDIO_MODULE_INDICATOR([scanf]) + gl_MODULE_INDICATOR([scanf]) + gl_STDIO_MODULE_INDICATOR([fgetc]) + gl_STDIO_MODULE_INDICATOR([getc]) + gl_STDIO_MODULE_INDICATOR([getchar]) + gl_STDIO_MODULE_INDICATOR([fgets]) + gl_STDIO_MODULE_INDICATOR([fread]) + dnl No need to create extra modules for these functions. Everyone who uses + dnl likely needs them. + gl_STDIO_MODULE_INDICATOR([fprintf]) + gl_STDIO_MODULE_INDICATOR([printf]) + gl_STDIO_MODULE_INDICATOR([vfprintf]) + gl_STDIO_MODULE_INDICATOR([vprintf]) + gl_STDIO_MODULE_INDICATOR([fputc]) + gl_STDIO_MODULE_INDICATOR([putc]) + gl_STDIO_MODULE_INDICATOR([putchar]) + gl_STDIO_MODULE_INDICATOR([fputs]) + gl_STDIO_MODULE_INDICATOR([puts]) + gl_STDIO_MODULE_INDICATOR([fwrite]) gl_STDLIB_H + gl_STDLIB_H_REQUIRE_DEFAULTS gl_FUNC_STPCPY if test $HAVE_STPCPY = 0; then AC_LIBOBJ([stpcpy]) gl_PREREQ_STPCPY fi gl_STRING_MODULE_INDICATOR([stpcpy]) - gl_HEADER_STRING_H + gl_STRING_H + gl_STRING_H_REQUIRE_DEFAULTS gl_FUNC_STRNLEN if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then AC_LIBOBJ([strnlen]) @@ -477,19 +515,25 @@ AC_DEFUN([gl_INIT], AC_LIBOBJ([symlink]) fi gl_UNISTD_MODULE_INDICATOR([symlink]) - gl_HEADER_SYS_RANDOM + gl_SYS_RANDOM_H + gl_SYS_RANDOM_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P - AC_REQUIRE([gl_HEADER_SYS_SELECT]) + gl_SYS_SELECT_H + gl_SYS_SELECT_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P - gl_HEADER_SYS_STAT_H + gl_SYS_STAT_H + gl_SYS_STAT_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P - gl_HEADER_SYS_TIME_H + gl_SYS_TIME_H + gl_SYS_TIME_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P gl_SYS_TYPES_H + gl_SYS_TYPES_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P gl_FUNC_GEN_TEMPNAME gl_MODULE_INDICATOR([tempname]) - gl_HEADER_TIME_H + gl_TIME_H + gl_TIME_H_REQUIRE_DEFAULTS gl_TIME_R if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then AC_LIBOBJ([time_r]) @@ -510,6 +554,17 @@ AC_DEFUN([gl_INIT], gl_TIMER_TIME gl_TIMESPEC gl_UNISTD_H + gl_UNISTD_H_REQUIRE_DEFAULTS + AC_DEFINE([GNULIB_STDIO_SINGLE_THREAD], [1], + [Define to 1 if you want the FILE stream functions getc, putc, etc. + to use unlocked I/O if available, throughout the package. + Unlocked I/O can improve performance, sometimes dramatically. + But unlocked I/O is safe only in single-threaded programs, + as well as in multithreaded programs for which you can guarantee that + every FILE stream, including stdin, stdout, stderr, is used only + in a single thread.]) + AC_DEFINE([USE_UNLOCKED_IO], [GNULIB_STDIO_SINGLE_THREAD], + [An alias of GNULIB_STDIO_SINGLE_THREAD.]) gl_FUNC_GLIBC_UNLOCKED_IO gl_FUNC_UTIMENSAT if test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1; then @@ -527,12 +582,14 @@ AC_DEFUN([gl_INIT], gl_gnulib_enabled_getgroups=false gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1=false - gl_gnulib_enabled_idx=false gl_gnulib_enabled_lchmod=false + gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866=false gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31=false gl_gnulib_enabled_open=false gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7=false gl_gnulib_enabled_rawmemchr=false + gl_gnulib_enabled_d3b2383720ee0e541357aa2aac598e2b=false + gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4=false gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=false gl_gnulib_enabled_scratch_buffer=false gl_gnulib_enabled_strtoll=false @@ -571,6 +628,7 @@ AC_DEFUN([gl_INIT], func_gl_gnulib_m4code_dynarray () { if ! $gl_gnulib_enabled_dynarray; then + AC_PROG_MKDIR_P gl_gnulib_enabled_dynarray=true fi } @@ -617,6 +675,9 @@ AC_DEFUN([gl_INIT], fi gl_UNISTD_MODULE_INDICATOR([getgroups]) gl_gnulib_enabled_getgroups=true + if test $HAVE_GETGROUPS = 0 || test $REPLACE_GETGROUPS = 1; then + func_gl_gnulib_m4code_ef455225c00f5049c808c2eda3e76866 + fi fi } func_gl_gnulib_m4code_be453cec5eecf5731a274f2de7f2db36 () @@ -641,16 +702,10 @@ AC_DEFUN([gl_INIT], func_gl_gnulib_m4code_getgroups fi if test $HAVE_GROUP_MEMBER = 0; then - func_gl_gnulib_m4code_682e609604ccaac6be382e4ee3a4eaec + func_gl_gnulib_m4code_d3b2383720ee0e541357aa2aac598e2b fi fi } - func_gl_gnulib_m4code_idx () - { - if ! $gl_gnulib_enabled_idx; then - gl_gnulib_enabled_idx=true - fi - } func_gl_gnulib_m4code_lchmod () { if ! $gl_gnulib_enabled_lchmod; then @@ -663,6 +718,20 @@ AC_DEFUN([gl_INIT], gl_gnulib_enabled_lchmod=true fi } + func_gl_gnulib_m4code_ef455225c00f5049c808c2eda3e76866 () + { + if ! $gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866; then + AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) + if test $REPLACE_MALLOC = 1; then + AC_LIBOBJ([malloc]) + fi + gl_STDLIB_MODULE_INDICATOR([malloc-posix]) + gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866=true + if test $REPLACE_MALLOC = 1; then + func_gl_gnulib_m4code_682e609604ccaac6be382e4ee3a4eaec + fi + fi + } func_gl_gnulib_m4code_5264294aa0a5557541b53c8c741f7f31 () { if ! $gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31; then @@ -707,6 +776,34 @@ AC_DEFUN([gl_INIT], gl_gnulib_enabled_rawmemchr=true fi } + func_gl_gnulib_m4code_d3b2383720ee0e541357aa2aac598e2b () + { + if ! $gl_gnulib_enabled_d3b2383720ee0e541357aa2aac598e2b; then + gl_FUNC_REALLOC_GNU + if test $REPLACE_REALLOC = 1; then + AC_LIBOBJ([realloc]) + fi + gl_gnulib_enabled_d3b2383720ee0e541357aa2aac598e2b=true + func_gl_gnulib_m4code_61bcaca76b3e6f9ae55d57a1c3193bc4 + fi + } + func_gl_gnulib_m4code_61bcaca76b3e6f9ae55d57a1c3193bc4 () + { + if ! $gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4; then + gl_FUNC_REALLOC_POSIX + if test $REPLACE_REALLOC = 1; then + AC_LIBOBJ([realloc]) + fi + gl_STDLIB_MODULE_INDICATOR([realloc-posix]) + gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4=true + if test $REPLACE_REALLOC = 1; then + func_gl_gnulib_m4code_ef455225c00f5049c808c2eda3e76866 + fi + if test $REPLACE_REALLOC = 1; then + func_gl_gnulib_m4code_682e609604ccaac6be382e4ee3a4eaec + fi + fi + } func_gl_gnulib_m4code_6099e9737f757db36c47fa9d9f02e88c () { if ! $gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c; then @@ -716,14 +813,17 @@ AC_DEFUN([gl_INIT], func_gl_gnulib_m4code_scratch_buffer () { if ! $gl_gnulib_enabled_scratch_buffer; then + AC_PROG_MKDIR_P gl_gnulib_enabled_scratch_buffer=true + func_gl_gnulib_m4code_ef455225c00f5049c808c2eda3e76866 + func_gl_gnulib_m4code_61bcaca76b3e6f9ae55d57a1c3193bc4 fi } func_gl_gnulib_m4code_strtoll () { if ! $gl_gnulib_enabled_strtoll; then gl_FUNC_STRTOLL - if test $HAVE_STRTOLL = 0; then + if test $HAVE_STRTOLL = 0 || test $REPLACE_STRTOLL = 1; then AC_LIBOBJ([strtoll]) gl_PREREQ_STRTOLL fi @@ -747,9 +847,6 @@ AC_DEFUN([gl_INIT], if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then func_gl_gnulib_m4code_925677f0343de64b89a9f0c790b4104c fi - if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then - func_gl_gnulib_m4code_idx - fi if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then func_gl_gnulib_m4code_rawmemchr fi @@ -813,9 +910,6 @@ AC_DEFUN([gl_INIT], if { test $HAVE_DECL_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; } && test $ac_cv_type_long_long_int = yes; then func_gl_gnulib_m4code_strtoll fi - if test $HAVE_TIMEZONE_T = 0; then - func_gl_gnulib_m4code_idx - fi if test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1; then func_gl_gnulib_m4code_5264294aa0a5557541b53c8c741f7f31 fi @@ -839,12 +933,14 @@ AC_DEFUN([gl_INIT], AM_CONDITIONAL([gl_GNULIB_ENABLED_getgroups], [$gl_gnulib_enabled_getgroups]) AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], [$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36]) AM_CONDITIONAL([gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1], [$gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_idx], [$gl_gnulib_enabled_idx]) AM_CONDITIONAL([gl_GNULIB_ENABLED_lchmod], [$gl_gnulib_enabled_lchmod]) + AM_CONDITIONAL([gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866], [$gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866]) AM_CONDITIONAL([gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31], [$gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31]) AM_CONDITIONAL([gl_GNULIB_ENABLED_open], [$gl_gnulib_enabled_open]) AM_CONDITIONAL([gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7], [$gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7]) AM_CONDITIONAL([gl_GNULIB_ENABLED_rawmemchr], [$gl_gnulib_enabled_rawmemchr]) + AM_CONDITIONAL([gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b], [$gl_gnulib_enabled_d3b2383720ee0e541357aa2aac598e2b]) + AM_CONDITIONAL([gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4], [$gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4]) AM_CONDITIONAL([gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c], [$gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c]) AM_CONDITIONAL([gl_GNULIB_ENABLED_scratch_buffer], [$gl_gnulib_enabled_scratch_buffer]) AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtoll]) @@ -862,6 +958,8 @@ AC_DEFUN([gl_INIT], m4_if(m4_sysval, [0], [], [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) ]) + m4_popdef([GL_MODULE_INDICATOR_PREFIX]) + m4_popdef([GL_MACRO_PREFIX]) m4_popdef([gl_LIBSOURCES_DIR]) m4_popdef([gl_LIBSOURCES_LIST]) m4_popdef([AC_LIBSOURCES]) @@ -888,6 +986,8 @@ AC_DEFUN([gl_INIT], m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES])) m4_pushdef([gltests_LIBSOURCES_LIST], []) m4_pushdef([gltests_LIBSOURCES_DIR], []) + m4_pushdef([GL_MACRO_PREFIX], [gltests]) + m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL]) gl_COMMON gl_source_base='tests' changequote(,)dnl @@ -909,6 +1009,8 @@ changequote([, ])dnl m4_if(m4_sysval, [0], [], [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) ]) + m4_popdef([GL_MODULE_INDICATOR_PREFIX]) + m4_popdef([GL_MACRO_PREFIX]) m4_popdef([gltests_LIBSOURCES_DIR]) m4_popdef([gltests_LIBSOURCES_LIST]) m4_popdef([AC_LIBSOURCES]) @@ -1092,6 +1194,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/libc-config.h lib/limits.in.h lib/lstat.c + lib/malloc.c lib/malloc/dynarray-skeleton.c lib/malloc/dynarray.h lib/malloc/dynarray_at_failure.c @@ -1130,6 +1233,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/rawmemchr.valgrind lib/readlink.c lib/readlinkat.c + lib/realloc.c lib/regcomp.c lib/regex.c lib/regex.h @@ -1250,6 +1354,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/libgmp.m4 m4/limits-h.m4 m4/lstat.m4 + m4/malloc.m4 m4/manywarnings-c++.m4 m4/manywarnings.m4 m4/mbstate_t.m4 @@ -1276,6 +1381,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/rawmemchr.m4 m4/readlink.m4 m4/readlinkat.m4 + m4/realloc.m4 m4/regex.m4 m4/sha1.m4 m4/sha256.m4 @@ -1322,5 +1428,6 @@ AC_DEFUN([gl_FILE_LIST], [ m4/warnings.m4 m4/wchar_t.m4 m4/wint_t.m4 + m4/year2038.m4 m4/zzgnulib.m4 ]) diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 index f56e94a888..64b1de5c42 100644 --- a/m4/inttypes.m4 +++ b/m4/inttypes.m4 @@ -1,4 +1,4 @@ -# inttypes.m4 serial 32 +# inttypes.m4 serial 35 dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Derek Price, Bruno Haible. dnl Test whether is supported or must be substituted. -AC_DEFUN([gl_INTTYPES_H], +AC_DEFUN_ONCE([gl_INTTYPES_H], [ AC_REQUIRE([gl_INTTYPES_INCOMPLETE]) gl_INTTYPES_PRI_SCN @@ -136,19 +136,34 @@ AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION], AC_SUBST([$1]) ]) +# gl_INTTYPES_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_INTTYPES_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_INTTYPES_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXABS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXDIV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOIMAX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUMAX]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) +]) + AC_DEFUN([gl_INTTYPES_H_DEFAULTS], [ - GNULIB_IMAXABS=0; AC_SUBST([GNULIB_IMAXABS]) - GNULIB_IMAXDIV=0; AC_SUBST([GNULIB_IMAXDIV]) - GNULIB_STRTOIMAX=0; AC_SUBST([GNULIB_STRTOIMAX]) - GNULIB_STRTOUMAX=0; AC_SUBST([GNULIB_STRTOUMAX]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_IMAXABS=1; AC_SUBST([HAVE_DECL_IMAXABS]) HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV]) diff --git a/m4/largefile.m4 b/m4/largefile.m4 index cadb16dc97..fbde5e6647 100644 --- a/m4/largefile.m4 +++ b/m4/largefile.m4 @@ -22,7 +22,8 @@ AC_DEFUN([gl_SET_LARGEFILE_SOURCE], esac ]) -# The following implementation works around a problem in autoconf <= 2.69; +# Work around a problem in Autoconf through at least 2.71 on glibc 2.34+ +# with _TIME_BITS. Also, work around a problem in autoconf <= 2.69: # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5, # or configures them incorrectly in some cases. m4_version_prereq([2.70], [], [ @@ -40,6 +41,7 @@ m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]];[]dnl ]) +])# m4_version_prereq 2.70 # _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, @@ -54,7 +56,8 @@ m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE], [AC_LANG_PROGRAM([$5], [$6])], [$3=no; break]) m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( - [AC_LANG_PROGRAM([#define $1 $2 + [AC_LANG_PROGRAM([#undef $1 +#define $1 $2 $5], [$6])], [$3=$2; break]) $3=unknown @@ -80,9 +83,8 @@ rm -rf conftest*[]dnl AC_DEFUN([AC_SYS_LARGEFILE], [AC_ARG_ENABLE(largefile, [ --disable-largefile omit support for large files]) -if test "$enable_largefile" != no; then - - AC_CACHE_CHECK([for special C compiler options needed for large files], +AS_IF([test "$enable_largefile" != no], + [AC_CACHE_CHECK([for special C compiler options needed for large files], ac_cv_sys_largefile_CC, [ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then @@ -107,15 +109,15 @@ if test "$enable_largefile" != no; then ac_cv_sys_file_offset_bits, [Number of bits in a file offset, on hosts where this is settable.], [_AC_SYS_LARGEFILE_TEST_INCLUDES]) - if test $ac_cv_sys_file_offset_bits = unknown; then - _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, - ac_cv_sys_large_files, - [Define for large files, on AIX-style hosts.], - [_AC_SYS_LARGEFILE_TEST_INCLUDES]) - fi -fi + AS_CASE([$ac_cv_sys_file_offset_bits], + [unknown], + [_AC_SYS_LARGEFILE_MACRO_VALUE([_LARGE_FILES], [1], + [ac_cv_sys_large_files], + [Define for large files, on AIX-style hosts.], + [_AC_SYS_LARGEFILE_TEST_INCLUDES])], + [64], + [gl_YEAR2038_BODY([])])]) ])# AC_SYS_LARGEFILE -])# m4_version_prereq 2.70 # Enable large files on systems where this is implemented by Gnulib, not by the # system headers. diff --git a/m4/limits-h.m4 b/m4/limits-h.m4 index 70dbb7dcfa..00c9fe9e50 100644 --- a/m4/limits-h.m4 +++ b/m4/limits-h.m4 @@ -11,7 +11,7 @@ AC_DEFUN_ONCE([gl_LIMITS_H], [ gl_CHECK_NEXT_HEADERS([limits.h]) - AC_CACHE_CHECK([whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc.], + AC_CACHE_CHECK([whether limits.h has WORD_BIT, BOOL_WIDTH etc.], [gl_cv_header_limits_width], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( @@ -22,6 +22,7 @@ AC_DEFUN_ONCE([gl_LIMITS_H], long long llm = LLONG_MAX; int wb = WORD_BIT; int ullw = ULLONG_WIDTH; + int bw = BOOL_WIDTH; ]])], [gl_cv_header_limits_width=yes], [gl_cv_header_limits_width=no])]) diff --git a/m4/malloc.m4 b/m4/malloc.m4 new file mode 100644 index 0000000000..972e808ab7 --- /dev/null +++ b/m4/malloc.m4 @@ -0,0 +1,174 @@ +# malloc.m4 serial 27 +dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# This is adapted with modifications from upstream Autoconf here: +# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n949 +AC_DEFUN([_AC_FUNC_MALLOC_IF], +[ + AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles + AC_CACHE_CHECK([whether malloc (0) returns nonnull], + [ac_cv_func_malloc_0_nonnull], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[void *p = malloc (0); + int result = !p; + free (p); + return result;]]) + ], + [ac_cv_func_malloc_0_nonnull=yes], + [ac_cv_func_malloc_0_nonnull=no], + [case "$host_os" in + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | gnu* | *-musl* | midnightbsd* \ + | hpux* | solaris* | cygwin* | mingw* | msys* ) + ac_cv_func_malloc_0_nonnull="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; + esac + ]) + ]) + AS_CASE([$ac_cv_func_malloc_0_nonnull], [*yes], [$1], [$2]) +])# _AC_FUNC_MALLOC_IF + +# gl_FUNC_MALLOC_GNU +# ------------------ +# Replace malloc if it is not compatible with GNU libc. +AC_DEFUN([gl_FUNC_MALLOC_GNU], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) + if test $REPLACE_MALLOC = 0; then + _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC=1]) + fi +]) + +# gl_FUNC_MALLOC_PTRDIFF +# ---------------------- +# Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX, +# and replace malloc otherwise. +AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) + test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC=1 +]) + +# Test whether malloc, realloc, calloc refuse to create objects +# larger than what can be expressed in ptrdiff_t. +# Set gl_cv_func_malloc_gnu to yes or no accordingly. +AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF], +[ + AC_CACHE_CHECK([whether malloc is ptrdiff_t safe], + [gl_cv_malloc_ptrdiff], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[/* 64-bit ptrdiff_t is so wide that no practical platform + can exceed it. */ + #define WIDE_PTRDIFF (PTRDIFF_MAX >> 31 >> 31 != 0) + + /* On rare machines where size_t fits in ptrdiff_t there + is no problem. */ + #define NARROW_SIZE (SIZE_MAX <= PTRDIFF_MAX) + + /* glibc 2.30 and later malloc refuses to exceed ptrdiff_t + bounds even on 32-bit platforms. We don't know which + non-glibc systems are safe. */ + #define KNOWN_SAFE (2 < __GLIBC__ + (30 <= __GLIBC_MINOR__)) + + #if WIDE_PTRDIFF || NARROW_SIZE || KNOWN_SAFE + return 0; + #else + #error "malloc might not be ptrdiff_t safe" + syntax error + #endif + ]])], + [gl_cv_malloc_ptrdiff=yes], + [gl_cv_malloc_ptrdiff=no]) + ]) +]) + +# gl_FUNC_MALLOC_POSIX +# -------------------- +# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it +# fails, and doesn't mess up with ptrdiff_t overflow), and replace +# malloc if it is not. +AC_DEFUN([gl_FUNC_MALLOC_POSIX], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF]) + AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) + if test "$gl_cv_func_malloc_posix" = yes; then + AC_DEFINE([HAVE_MALLOC_POSIX], [1], + [Define if malloc, realloc, and calloc set errno on allocation failure.]) + else + REPLACE_MALLOC=1 + fi +]) + +# Test whether malloc, realloc, calloc set errno to ENOMEM on failure. +# Set gl_cv_func_malloc_posix to yes or no accordingly. +AC_DEFUN([gl_CHECK_MALLOC_POSIX], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether malloc, realloc, calloc set errno on failure], + [gl_cv_func_malloc_posix], + [ + dnl It is too dangerous to try to allocate a large amount of memory: + dnl some systems go to their knees when you do that. So assume that + dnl all Unix implementations of the function set errno on failure, + dnl except on those platforms where we have seen 'test-malloc-gnu', + dnl 'test-realloc-gnu', 'test-calloc-gnu' fail. + case "$host_os" in + mingw*) + gl_cv_func_malloc_posix=no ;; + irix* | solaris*) + dnl On IRIX 6.5, the three functions return NULL with errno unset + dnl when the argument is larger than PTRDIFF_MAX. + dnl On Solaris 11.3, the three functions return NULL with errno set + dnl to EAGAIN, not ENOMEM, when the argument is larger than + dnl PTRDIFF_MAX. + dnl Here is a test program: +m4_divert_push([KILL]) +#include +#include +#include +#define ptrdiff_t long +#ifndef PTRDIFF_MAX +# define PTRDIFF_MAX ((ptrdiff_t) ((1UL << (8 * sizeof (ptrdiff_t) - 1)) - 1)) +#endif + +int main () +{ + void *p; + + fprintf (stderr, "PTRDIFF_MAX = %lu\n", (unsigned long) PTRDIFF_MAX); + + errno = 0; + p = malloc ((unsigned long) PTRDIFF_MAX + 1); + fprintf (stderr, "p=%p errno=%d\n", p, errno); + + errno = 0; + p = calloc (PTRDIFF_MAX / 2 + 1, 2); + fprintf (stderr, "p=%p errno=%d\n", p, errno); + + errno = 0; + p = realloc (NULL, (unsigned long) PTRDIFF_MAX + 1); + fprintf (stderr, "p=%p errno=%d\n", p, errno); + + return 0; +} +m4_divert_pop([KILL]) + gl_cv_func_malloc_posix=no ;; + *) + gl_cv_func_malloc_posix=yes ;; + esac + ]) +]) diff --git a/m4/malloca.m4 b/m4/malloca.m4 deleted file mode 100644 index 7ee33773d2..0000000000 --- a/m4/malloca.m4 +++ /dev/null @@ -1,14 +0,0 @@ -# malloca.m4 serial 2 -dnl Copyright (C) 2003-2004, 2006-2007, 2009-2021 Free Software -dnl Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_MALLOCA], -[ - dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables - dnl @ALLOCA@ and @LTALLOCA@. - dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. - AC_REQUIRE([gl_EEMALLOC]) -]) diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4 index 53ab153403..872ea58e62 100644 --- a/m4/manywarnings.m4 +++ b/m4/manywarnings.m4 @@ -1,4 +1,4 @@ -# manywarnings.m4 serial 21 +# manywarnings.m4 serial 23 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -195,15 +195,9 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)], gl_AS_VAR_APPEND([$1], [' -Wno-uninitialized']) fi - # Some warnings have too many false alarms in GCC 10.1. - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93695 - gl_AS_VAR_APPEND([$1], [' -Wno-analyzer-double-free']) - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94458 + # This warning have too many false alarms in GCC 11.2.1. + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101713 gl_AS_VAR_APPEND([$1], [' -Wno-analyzer-malloc-leak']) - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94851 - gl_AS_VAR_APPEND([$1], [' -Wno-analyzer-null-dereference']) - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95758 - gl_AS_VAR_APPEND([$1], [' -Wno-analyzer-use-after-free']) AC_LANG_POP([C]) ]) diff --git a/m4/memmem.m4 b/m4/memmem.m4 index e2a785f48d..6dac766128 100644 --- a/m4/memmem.m4 +++ b/m4/memmem.m4 @@ -1,4 +1,4 @@ -# memmem.m4 serial 27 +# memmem.m4 serial 29 dnl Copyright (C) 2002-2004, 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,7 +10,7 @@ AC_DEFUN([gl_FUNC_MEMMEM_SIMPLE], dnl Persuade glibc to declare memmem(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_CHECK_FUNCS([memmem]) if test $ac_cv_func_memmem = yes; then HAVE_MEMMEM=1 @@ -50,6 +50,7 @@ AC_DEFUN([gl_FUNC_MEMMEM_SIMPLE], dnl Assume that it works on all other platforms (even if not linear). AC_EGREP_CPP([Lucky user], [ +#include /* for __GNU_LIBRARY__ */ #ifdef __GNU_LIBRARY__ #include #if ((__GLIBC__ == 2 && ((__GLIBC_MINOR > 0 && __GLIBC_MINOR__ < 9) \ diff --git a/m4/mempcpy.m4 b/m4/mempcpy.m4 index c5ee2af8cc..f9d9ec8f30 100644 --- a/m4/mempcpy.m4 +++ b/m4/mempcpy.m4 @@ -1,4 +1,4 @@ -# mempcpy.m4 serial 11 +# mempcpy.m4 serial 12 dnl Copyright (C) 2003-2004, 2006-2007, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -13,7 +13,7 @@ AC_DEFUN([gl_FUNC_MEMPCPY], dnl The mempcpy() declaration in lib/string.in.h uses 'restrict'. AC_REQUIRE([AC_C_RESTRICT]) - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_CHECK_FUNCS([mempcpy]) if test $ac_cv_func_mempcpy = no; then HAVE_MEMPCPY=0 diff --git a/m4/memrchr.m4 b/m4/memrchr.m4 index d0c05896e5..40f61c5ac0 100644 --- a/m4/memrchr.m4 +++ b/m4/memrchr.m4 @@ -1,4 +1,4 @@ -# memrchr.m4 serial 10 +# memrchr.m4 serial 11 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -10,7 +10,7 @@ AC_DEFUN([gl_FUNC_MEMRCHR], dnl Persuade glibc to declare memrchr(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_CHECK_DECLS_ONCE([memrchr]) if test $ac_cv_have_decl_memrchr = no; then HAVE_DECL_MEMRCHR=0 diff --git a/m4/mktime.m4 b/m4/mktime.m4 index 245649e774..721189af56 100644 --- a/m4/mktime.m4 +++ b/m4/mktime.m4 @@ -1,4 +1,4 @@ -# serial 35 +# serial 36 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -255,7 +255,7 @@ main () dnl Main macro of module 'mktime'. AC_DEFUN([gl_FUNC_MKTIME], [ - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + AC_REQUIRE([gl_TIME_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) diff --git a/m4/pselect.m4 b/m4/pselect.m4 index 538fe7dc12..9de63baf99 100644 --- a/m4/pselect.m4 +++ b/m4/pselect.m4 @@ -1,4 +1,4 @@ -# pselect.m4 serial 9 +# pselect.m4 serial 10 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_PSELECT], [ - AC_REQUIRE([gl_HEADER_SYS_SELECT]) + AC_REQUIRE([gl_SYS_SELECT_H]) AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_FUNCS_ONCE([pselect]) diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4 index eb4c784965..ff7fa9610e 100644 --- a/m4/pthread_sigmask.m4 +++ b/m4/pthread_sigmask.m4 @@ -1,4 +1,4 @@ -# pthread_sigmask.m4 serial 19 +# pthread_sigmask.m4 serial 21 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -111,9 +111,9 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK], AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - dnl On FreeBSD 6.4, HP-UX 11.31, Solaris 9, in programs that are not linked - dnl with -lpthread, the pthread_sigmask() function always returns 0 and has - dnl no effect. + dnl On FreeBSD 13.0, MidnightBSD 1.1, HP-UX 11.31, Solaris 9, in programs + dnl that are not linked with -lpthread, the pthread_sigmask() function + dnl always returns 0 and has no effect. if test -z "$LIB_PTHREAD_SIGMASK"; then case " $LIBS " in *' -pthread '*) ;; @@ -138,7 +138,7 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK], [ changequote(,)dnl case "$host_os" in - freebsd* | hpux* | solaris | solaris2.[2-9]*) + freebsd* | midnightbsd* | hpux* | solaris | solaris2.[2-9]*) gl_cv_func_pthread_sigmask_in_libc_works="guessing no";; *) gl_cv_func_pthread_sigmask_in_libc_works="guessing yes";; diff --git a/m4/rawmemchr.m4 b/m4/rawmemchr.m4 index f92846543c..452fab18f1 100644 --- a/m4/rawmemchr.m4 +++ b/m4/rawmemchr.m4 @@ -1,4 +1,4 @@ -# rawmemchr.m4 serial 2 +# rawmemchr.m4 serial 3 dnl Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,7 +9,7 @@ AC_DEFUN([gl_FUNC_RAWMEMCHR], dnl Persuade glibc to declare rawmemchr(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_CHECK_FUNCS([rawmemchr]) if test $ac_cv_func_rawmemchr = no; then HAVE_RAWMEMCHR=0 diff --git a/m4/realloc.m4 b/m4/realloc.m4 new file mode 100644 index 0000000000..0abc4185ed --- /dev/null +++ b/m4/realloc.m4 @@ -0,0 +1,63 @@ +# realloc.m4 serial 24 +dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# This is adapted with modifications from upstream Autoconf here: +# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n1455 +AC_DEFUN([_AC_FUNC_REALLOC_IF], +[ + AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles + AC_CACHE_CHECK([whether realloc (0, 0) returns nonnull], + [ac_cv_func_realloc_0_nonnull], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[void *p = realloc (0, 0); + int result = !p; + free (p); + return result;]]) + ], + [ac_cv_func_realloc_0_nonnull=yes], + [ac_cv_func_realloc_0_nonnull=no], + [case "$host_os" in + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | gnu* | *-musl* | midnightbsd* \ + | hpux* | solaris* | cygwin* | mingw* | msys* ) + ac_cv_func_realloc_0_nonnull="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;; + esac + ]) + ]) + AS_CASE([$ac_cv_func_realloc_0_nonnull], [*yes], [$1], [$2]) +])# AC_FUNC_REALLOC + +# gl_FUNC_REALLOC_GNU +# ------------------- +# Replace realloc if it is not compatible with GNU libc. +AC_DEFUN([gl_FUNC_REALLOC_GNU], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_REALLOC_POSIX]) + if test $REPLACE_REALLOC = 0; then + _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC=1]) + fi +])# gl_FUNC_REALLOC_GNU + +# gl_FUNC_REALLOC_POSIX +# --------------------- +# Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it +# fails, and doesn't mess up with ptrdiff_t overflow), +# and replace realloc if it is not. +AC_DEFUN([gl_FUNC_REALLOC_POSIX], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) + if test $REPLACE_MALLOC = 1; then + REPLACE_REALLOC=1 + fi +]) diff --git a/m4/regex.m4 b/m4/regex.m4 index 850c572228..1c7e562f6c 100644 --- a/m4/regex.m4 +++ b/m4/regex.m4 @@ -1,4 +1,4 @@ -# serial 71 +# serial 73 # Copyright (C) 1996-2001, 2003-2021 Free Software Foundation, Inc. # @@ -246,7 +246,7 @@ AC_DEFUN([gl_REGEX], & ~RE_CONTEXT_INVALID_DUP & ~RE_NO_EMPTY_RANGES); memset (®ex, 0, sizeof regex); - s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, ®ex); + s = re_compile_pattern ("[[:alnum:]_-]\\\\+\$", 16, ®ex); if (s) result |= 32; else @@ -264,14 +264,50 @@ AC_DEFUN([gl_REGEX], back reference. */ re_set_syntax (RE_SYNTAX_POSIX_EGREP); memset (®ex, 0, sizeof regex); - s = re_compile_pattern ("0|()0|\\1|0", 10, ®ex); + s = re_compile_pattern ("0|()0|\\\\1|0", 10, ®ex); if (!s) - result |= 64; + { + memset (®s, 0, sizeof regs); + i = re_search (®ex, "x", 1, 0, 1, ®s); + if (i != -1) + result |= 64; + if (0 <= i) + { + free (regs.start); + free (regs.end); + } + regfree (®ex); + } else { if (strcmp (s, "Invalid back reference")) result |= 64; + } + + /* glibc bug 11053. */ + re_set_syntax (RE_SYNTAX_POSIX_BASIC); + memset (®ex, 0, sizeof regex); + static char const pat_sub2[] = "\\\\(a*\\\\)*a*\\\\1"; + s = re_compile_pattern (pat_sub2, sizeof pat_sub2 - 1, ®ex); + if (s) + result |= 64; + else + { + memset (®s, 0, sizeof regs); + static char const data[] = "a"; + int datalen = sizeof data - 1; + i = re_search (®ex, data, datalen, 0, datalen, ®s); + if (i != 0) + result |= 64; + else if (regs.num_regs < 2) + result |= 64; + else if (! (regs.start[0] == 0 && regs.end[0] == 1)) + result |= 64; + else if (! (regs.start[1] == 0 && regs.end[1] == 0)) + result |= 64; regfree (®ex); + free (regs.start); + free (regs.end); } #if 0 diff --git a/m4/sigdescr_np.m4 b/m4/sigdescr_np.m4 index f6fa63140c..17c22506cc 100644 --- a/m4/sigdescr_np.m4 +++ b/m4/sigdescr_np.m4 @@ -1,4 +1,4 @@ -# sigdescr_np.m4 serial 1 +# sigdescr_np.m4 serial 2 dnl Copyright (C) 2020-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,7 +9,7 @@ AC_DEFUN([gl_FUNC_SIGDESCR_NP], dnl Persuade glibc to declare sigdescr_np(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_CHECK_FUNCS([sigdescr_np]) if test $ac_cv_func_sigdescr_np = no; then HAVE_SIGDESCR_NP=0 diff --git a/m4/signal_h.m4 b/m4/signal_h.m4 index ff9f0251fd..8b938809b7 100644 --- a/m4/signal_h.m4 +++ b/m4/signal_h.m4 @@ -1,10 +1,10 @@ -# signal_h.m4 serial 19 +# signal_h.m4 serial 22 dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_SIGNAL_H], +AC_DEFUN_ONCE([gl_SIGNAL_H], [ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T]) @@ -52,22 +52,37 @@ AC_DEFUN([gl_CHECK_TYPE_SIGSET_T], fi ]) +# gl_SIGNAL_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_SIGNAL_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SIGNAL_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SIGNAL_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_SIGMASK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAISE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNAL_H_SIGPIPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGPROCMASK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGACTION]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SIGNAL_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) +]) + AC_DEFUN([gl_SIGNAL_H_DEFAULTS], [ - GNULIB_PTHREAD_SIGMASK=0; AC_SUBST([GNULIB_PTHREAD_SIGMASK]) - GNULIB_RAISE=0; AC_SUBST([GNULIB_RAISE]) - GNULIB_SIGNAL_H_SIGPIPE=0; AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE]) - GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK]) - GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING]) HAVE_PTHREAD_SIGMASK=1; AC_SUBST([HAVE_PTHREAD_SIGMASK]) diff --git a/m4/stdalign.m4 b/m4/stdalign.m4 index 8dcb634d55..e22d7f78c0 100644 --- a/m4/stdalign.m4 +++ b/m4/stdalign.m4 @@ -13,7 +13,8 @@ AC_DEFUN([gl_STDALIGN_H], [gl_cv_header_working_stdalign_h], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( - [[#include + [[#include + #include #include /* Test that alignof yields a result consistent with offsetof. @@ -32,6 +33,7 @@ AC_DEFUN([gl_STDALIGN_H], /* Test _Alignas only on platforms where gnulib can help. */ #if \ ((defined __cplusplus && 201103 <= __cplusplus) \ + || (__TINYC__ && defined __attribute__) \ || (defined __APPLE__ && defined __MACH__ \ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ : __GNUC__) \ diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4 index cd666c4a58..1303d2e06c 100644 --- a/m4/stddef_h.m4 +++ b/m4/stddef_h.m4 @@ -1,4 +1,4 @@ -# stddef_h.m4 serial 9 +# stddef_h.m4 serial 11 dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl A placeholder for , for platforms that have issues. -AC_DEFUN([gl_STDDEF_H], +AC_DEFUN_ONCE([gl_STDDEF_H], [ AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) AC_REQUIRE([gt_TYPE_WCHAR_T]) @@ -68,13 +68,28 @@ AC_DEFUN([gl_STDDEF_H], fi ]) +# gl_STDDEF_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_STDDEF_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_STDDEF_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_STDDEF_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS], [ + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) +]) + AC_DEFUN([gl_STDDEF_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. diff --git a/m4/stdint.m4 b/m4/stdint.m4 index a785b44ed1..2eb1652d8e 100644 --- a/m4/stdint.m4 +++ b/m4/stdint.m4 @@ -1,4 +1,4 @@ -# stdint.m4 serial 58 +# stdint.m4 serial 60 dnl Copyright (C) 2001-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -170,7 +170,7 @@ struct s { PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) ? 1 : -1; - /* Detect bug in FreeBSD 6.0 / ia64. */ + /* Detect bug in FreeBSD 6.0/ia64 and FreeBSD 13.0/arm64. */ int check_SIG_ATOMIC: SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) @@ -527,7 +527,7 @@ AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], dnl requirement that wint_t is "unchanged by default argument promotions". dnl In this case gnulib's and override wint_t. dnl Set the variable BITSIZEOF_WINT_T accordingly. - if test $GNULIB_OVERRIDES_WINT_T = 1; then + if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then BITSIZEOF_WINT_T=32 fi ]) diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index 4c3f24acca..e704383862 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -1,11 +1,12 @@ -# stdio_h.m4 serial 52 +# stdio_h.m4 serial 56 dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_STDIO_H], +AC_DEFUN_ONCE([gl_STDIO_H], [ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AH_VERBATIM([MINGW_ANSI_STDIO], [/* Use GNU style printf and scanf. */ #ifndef __USE_MINGW_ANSI_STDIO @@ -13,7 +14,6 @@ AC_DEFUN([gl_STDIO_H], #endif ]) AC_DEFINE([__USE_MINGW_ANSI_STDIO]) - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) gl_NEXT_HEADERS([stdio.h]) dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and @@ -40,17 +40,6 @@ AC_DEFUN([gl_STDIO_H], attribute "__gnu_printf__" instead of "__printf__"]) fi - dnl No need to create extra modules for these functions. Everyone who uses - dnl likely needs them. - GNULIB_FSCANF=1 - gl_MODULE_INDICATOR([fscanf]) - GNULIB_SCANF=1 - gl_MODULE_INDICATOR([scanf]) - GNULIB_FGETC=1 - GNULIB_GETC=1 - GNULIB_GETCHAR=1 - GNULIB_FGETS=1 - GNULIB_FREAD=1 dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c" dnl "expected source file, required through AC_LIBSOURCES, not found". It is dnl also an optimization, to avoid performing a configure check whose result @@ -64,18 +53,6 @@ AC_DEFUN([gl_STDIO_H], fi ]) - dnl No need to create extra modules for these functions. Everyone who uses - dnl likely needs them. - GNULIB_FPRINTF=1 - GNULIB_PRINTF=1 - GNULIB_VFPRINTF=1 - GNULIB_VPRINTF=1 - GNULIB_FPUTC=1 - GNULIB_PUTC=1 - GNULIB_PUTCHAR=1 - GNULIB_FPUTS=1 - GNULIB_PUTS=1 - GNULIB_FWRITE=1 dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c" dnl "expected source file, required through AC_LIBSOURCES, not found". It is dnl also an optimization, to avoid performing a configure check whose result @@ -116,77 +93,92 @@ AC_DEFUN([gl_STDIO_H], fi ]) +# gl_STDIO_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_STDIO_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_STDIO_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FOPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPURGE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREAD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREOPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSCANF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEKO]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTCHAR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMOVE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FILENO], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETW], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTW], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TEMPNAM], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) +]) + AC_DEFUN([gl_STDIO_H_DEFAULTS], [ - GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF]) - GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE]) - GNULIB_FDOPEN=0; AC_SUBST([GNULIB_FDOPEN]) - GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) - GNULIB_FGETC=0; AC_SUBST([GNULIB_FGETC]) - GNULIB_FGETS=0; AC_SUBST([GNULIB_FGETS]) - GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) - GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF]) - GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) - GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE]) - GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC]) - GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS]) - GNULIB_FREAD=0; AC_SUBST([GNULIB_FREAD]) - GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) - GNULIB_FSCANF=0; AC_SUBST([GNULIB_FSCANF]) - GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) - GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) - GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) - GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) - GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE]) - GNULIB_GETC=0; AC_SUBST([GNULIB_GETC]) - GNULIB_GETCHAR=0; AC_SUBST([GNULIB_GETCHAR]) - GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) - GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) - GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) - GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) - GNULIB_PCLOSE=0; AC_SUBST([GNULIB_PCLOSE]) - GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR]) - GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN]) - GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF]) - GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX]) - GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC]) - GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR]) - GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS]) - GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE]) - GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME]) - GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT]) - GNULIB_SCANF=0; AC_SUBST([GNULIB_SCANF]) - GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) - GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) - GNULIB_STDIO_H_NONBLOCKING=0; AC_SUBST([GNULIB_STDIO_H_NONBLOCKING]) - GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE]) - GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE]) - GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) - GNULIB_VFSCANF=0; AC_SUBST([GNULIB_VFSCANF]) - GNULIB_VSCANF=0; AC_SUBST([GNULIB_VSCANF]) - GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF]) - GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF]) - GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) - GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF]) - GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX]) - GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) - GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) - dnl Support Microsoft deprecated alias function names by default. - GNULIB_MDA_FCLOSEALL=1; AC_SUBST([GNULIB_MDA_FCLOSEALL]) - GNULIB_MDA_FDOPEN=1; AC_SUBST([GNULIB_MDA_FDOPEN]) - GNULIB_MDA_FILENO=1; AC_SUBST([GNULIB_MDA_FILENO]) - GNULIB_MDA_GETW=1; AC_SUBST([GNULIB_MDA_GETW]) - GNULIB_MDA_PUTW=1; AC_SUBST([GNULIB_MDA_PUTW]) - GNULIB_MDA_TEMPNAM=1; AC_SUBST([GNULIB_MDA_TEMPNAM]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_FCLOSEALL=1; AC_SUBST([HAVE_DECL_FCLOSEALL]) HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE]) diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index 5a02972e05..9c1d1c76c1 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,10 +1,10 @@ -# stdlib_h.m4 serial 55 +# stdlib_h.m4 serial 63 dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_STDLIB_H], +AC_DEFUN_ONCE([gl_STDLIB_H], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) gl_NEXT_HEADERS([stdlib.h]) @@ -28,7 +28,7 @@ AC_DEFUN([gl_STDLIB_H], posix_memalign posix_openpt ptsname ptsname_r qsort_r random random_r reallocarray realpath rpmatch secure_getenv setenv setstate setstate_r srandom srandom_r - strtod strtold strtoll strtoull unlockpt unsetenv]) + strtod strtol strtold strtoll strtoul strtoull unlockpt unsetenv]) AC_REQUIRE([AC_C_RESTRICT]) @@ -46,61 +46,78 @@ AC_DEFUN([gl_STDLIB_H], fi ]) +# gl_STDLIB_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_STDLIB_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMPS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMPS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_MEMALIGN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_OPENPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTENV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_QSORT_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOULL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYSTEM_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLOCKPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNSETENV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOMB]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ECVT], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCVT], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GCVT], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKTEMP], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTENV], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) +]) + AC_DEFUN([gl_STDLIB_H_DEFAULTS], [ - GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT]) - GNULIB_ALIGNED_ALLOC=0; AC_SUBST([GNULIB_ALIGNED_ALLOC]) - GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL]) - GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) - GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME]) - GNULIB_FREE_POSIX=0; AC_SUBST([GNULIB_FREE_POSIX]) - GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG]) - GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) - GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT]) - GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) - GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC]) - GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) - GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) - GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) - GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) - GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS]) - GNULIB_POSIX_MEMALIGN=0;AC_SUBST([GNULIB_POSIX_MEMALIGN]) - GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT]) - GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME]) - GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R]) - GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) - GNULIB_QSORT_R=0; AC_SUBST([GNULIB_QSORT_R]) - GNULIB_RANDOM=0; AC_SUBST([GNULIB_RANDOM]) - GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) - GNULIB_REALLOCARRAY=0; AC_SUBST([GNULIB_REALLOCARRAY]) - GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) - GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH]) - GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) - GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV]) - GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) - GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) - GNULIB_STRTOLD=0; AC_SUBST([GNULIB_STRTOLD]) - GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) - GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) - GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) - GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) - GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) - GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB]) - dnl Support Microsoft deprecated alias function names by default. - GNULIB_MDA_ECVT=1; AC_SUBST([GNULIB_MDA_ECVT]) - GNULIB_MDA_FCVT=1; AC_SUBST([GNULIB_MDA_FCVT]) - GNULIB_MDA_GCVT=1; AC_SUBST([GNULIB_MDA_GCVT]) - GNULIB_MDA_MKTEMP=1; AC_SUBST([GNULIB_MDA_MKTEMP]) - GNULIB_MDA_PUTENV=1; AC_SUBST([GNULIB_MDA_PUTENV]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) HAVE_ALIGNED_ALLOC=1; AC_SUBST([HAVE_ALIGNED_ALLOC]) @@ -137,8 +154,10 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE]) HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE]) HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) + HAVE_STRTOL=1; AC_SUBST([HAVE_STRTOL]) HAVE_STRTOLD=1; AC_SUBST([HAVE_STRTOLD]) HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) + HAVE_STRTOUL=1; AC_SUBST([HAVE_STRTOUL]) HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) @@ -160,11 +179,16 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) + REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY]) REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE]) REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) + REPLACE_STRTOL=0; AC_SUBST([REPLACE_STRTOL]) REPLACE_STRTOLD=0; AC_SUBST([REPLACE_STRTOLD]) + REPLACE_STRTOLL=0; AC_SUBST([REPLACE_STRTOLL]) + REPLACE_STRTOUL=0; AC_SUBST([REPLACE_STRTOUL]) + REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL]) REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) ]) diff --git a/m4/stpcpy.m4 b/m4/stpcpy.m4 index 28db4f45df..eb44f03adb 100644 --- a/m4/stpcpy.m4 +++ b/m4/stpcpy.m4 @@ -1,4 +1,4 @@ -# stpcpy.m4 serial 8 +# stpcpy.m4 serial 9 dnl Copyright (C) 2002, 2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -12,7 +12,7 @@ AC_DEFUN([gl_FUNC_STPCPY], dnl The stpcpy() declaration in lib/string.in.h uses 'restrict'. AC_REQUIRE([AC_C_RESTRICT]) - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_CHECK_FUNCS([stpcpy]) if test $ac_cv_func_stpcpy = no; then HAVE_STPCPY=0 diff --git a/m4/string_h.m4 b/m4/string_h.m4 index a4cc5b4378..e88ac9ca85 100644 --- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -5,20 +5,15 @@ # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 29 +# serial 34 # Written by Paul Eggert. -AC_DEFUN([gl_HEADER_STRING_H], +AC_DEFUN_ONCE([gl_STRING_H], [ - dnl Use AC_REQUIRE here, so that the default behavior below is expanded - dnl once only, before all statements that occur in other macros. - AC_REQUIRE([gl_HEADER_STRING_H_BODY]) -]) - -AC_DEFUN([gl_HEADER_STRING_H_BODY], -[ - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_STRING_H_DEFAULTS]) gl_NEXT_HEADERS([string.h]) dnl Check for declarations of anything we want to poison if the @@ -33,62 +28,79 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY], AC_REQUIRE([AC_C_RESTRICT]) ]) +# gl_STRING_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_STRING_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_STRING_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) -AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPLICIT_BZERO]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSLL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMMEM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMPCPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMRCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAWMEMCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPCPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSEP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSTR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASECMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNCASECMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPCASECMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASESTR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCSPN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPBRK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSIGNAL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRVERSCMP]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MEMCCPY], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_STRDUP], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS]) + dnl Make sure the shell variable for GNULIB_FREE_POSIX is initialized. + gl_STDLIB_H_REQUIRE_DEFAULTS + AC_REQUIRE([gl_STRING_H_DEFAULTS]) +]) + +AC_DEFUN([gl_STRING_H_DEFAULTS], [ - GNULIB_EXPLICIT_BZERO=0; AC_SUBST([GNULIB_EXPLICIT_BZERO]) - GNULIB_FFSL=0; AC_SUBST([GNULIB_FFSL]) - GNULIB_FFSLL=0; AC_SUBST([GNULIB_FFSLL]) - GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR]) - GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) - GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) - GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR]) - GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR]) - GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY]) - GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY]) - GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL]) - GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP]) - GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT]) - GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP]) - GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN]) - GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK]) - GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP]) - GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR]) - GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR]) - GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R]) - GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN]) - GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN]) - GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR]) - GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR]) - GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR]) - GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP]) - GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP]) - GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP]) - GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR]) - GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN]) - GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK]) - GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN]) - GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) - GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) - GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) - GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R]) - GNULIB_STRERRORNAME_NP=0; AC_SUBST([GNULIB_STRERRORNAME_NP]) - GNULIB_SIGABBREV_NP=0; AC_SUBST([GNULIB_SIGABBREV_NP]) - GNULIB_SIGDESCR_NP=0; AC_SUBST([GNULIB_SIGDESCR_NP]) - GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) - GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) - dnl Support Microsoft deprecated alias function names by default. - GNULIB_MDA_MEMCCPY=1; AC_SUBST([GNULIB_MDA_MEMCCPY]) - GNULIB_MDA_STRDUP=1; AC_SUBST([GNULIB_MDA_STRDUP]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO]) HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) diff --git a/m4/strnlen.m4 b/m4/strnlen.m4 index bb9a680fdc..1d4f10616e 100644 --- a/m4/strnlen.m4 +++ b/m4/strnlen.m4 @@ -1,4 +1,4 @@ -# strnlen.m4 serial 13 +# strnlen.m4 serial 14 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRNLEN], [ - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) dnl Persuade glibc to declare strnlen(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) diff --git a/m4/strtoll.m4 b/m4/strtoll.m4 index d2c9e5310d..14455dc3db 100644 --- a/m4/strtoll.m4 +++ b/m4/strtoll.m4 @@ -1,4 +1,4 @@ -# strtoll.m4 serial 8 +# strtoll.m4 serial 9 dnl Copyright (C) 2002, 2004, 2006, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,8 +7,40 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRTOLL], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS([strtoll]) - if test $ac_cv_func_strtoll = no; then + if test $ac_cv_func_strtoll = yes; then + AC_CACHE_CHECK([whether strtoll works], + [gl_cv_func_strtoll_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[int result = 0; + char *term; + /* This test fails on Minix and native Windows. */ + { + const char input[] = "0x"; + (void) strtoll (input, &term, 16); + if (term != input + 1) + result |= 1; + } + return result; + ]]) + ], + [gl_cv_func_strtoll_works=yes], + [gl_cv_func_strtoll_works=no], + [case "$host_os" in + # Guess no on native Windows. + mingw*) gl_cv_func_strtoll_works="guessing no" ;; + *) gl_cv_func_strtoll_works="$gl_cross_guess_normal" ;; + esac + ]) + ]) + case "$gl_cv_func_strtoll_works" in + *yes) ;; + *) REPLACE_STRTOLL=1 ;; + esac + else HAVE_STRTOLL=0 fi ]) diff --git a/m4/sys_random_h.m4 b/m4/sys_random_h.m4 index 45e0469ba0..37bc31606b 100644 --- a/m4/sys_random_h.m4 +++ b/m4/sys_random_h.m4 @@ -1,10 +1,10 @@ -# sys_random_h.m4 serial 5 +# sys_random_h.m4 serial 8 dnl Copyright (C) 2020-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_HEADER_SYS_RANDOM], +AC_DEFUN_ONCE([gl_SYS_RANDOM_H], [ AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS]) dnl is always overridden, because of GNULIB_POSIXCHECK. @@ -35,18 +35,33 @@ AC_DEFUN([gl_HEADER_SYS_RANDOM], [getrandom]) ]) +# gl_SYS_RANDOM_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SYS_RANDOM_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_SYS_RANDOM_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_RANDOM_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_RANDOM_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETRANDOM]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_RANDOM_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS]) +]) + AC_DEFUN([gl_SYS_RANDOM_H_DEFAULTS], [ - GNULIB_GETRANDOM=0; AC_SUBST([GNULIB_GETRANDOM]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_GETRANDOM=1; AC_SUBST([HAVE_GETRANDOM]) REPLACE_GETRANDOM=0; AC_SUBST([REPLACE_GETRANDOM]) diff --git a/m4/sys_select_h.m4 b/m4/sys_select_h.m4 index 4b33d312e5..2e7d140dee 100644 --- a/m4/sys_select_h.m4 +++ b/m4/sys_select_h.m4 @@ -1,13 +1,13 @@ -# sys_select_h.m4 serial 20 +# sys_select_h.m4 serial 23 dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_HEADER_SYS_SELECT], +AC_DEFUN_ONCE([gl_SYS_SELECT_H], [ - AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS]) + AC_REQUIRE([AC_C_RESTRICT]) AC_CACHE_CHECK([whether is self-contained], [gl_cv_header_sys_select_h_selfcontained], [ @@ -75,19 +75,34 @@ AC_DEFUN([gl_HEADER_SYS_SELECT], ]], [pselect select]) ]) +# gl_SYS_SELECT_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_SYS_SELECT_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_SELECT_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_SELECT_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PSELECT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SELECT]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_SELECT_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS]) +]) + AC_DEFUN([gl_SYS_SELECT_H_DEFAULTS], [ - GNULIB_PSELECT=0; AC_SUBST([GNULIB_PSELECT]) - GNULIB_SELECT=0; AC_SUBST([GNULIB_SELECT]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_PSELECT=1; AC_SUBST([HAVE_PSELECT]) REPLACE_PSELECT=0; AC_SUBST([REPLACE_PSELECT]) diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4 index 503cb9668b..5676a0d217 100644 --- a/m4/sys_socket_h.m4 +++ b/m4/sys_socket_h.m4 @@ -1,4 +1,4 @@ -# sys_socket_h.m4 serial 25 +# sys_socket_h.m4 serial 28 dnl Copyright (C) 2005-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Simon Josefsson. -AC_DEFUN([gl_HEADER_SYS_SOCKET], +AC_DEFUN_ONCE([gl_SYS_SOCKET_H], [ AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) @@ -156,32 +156,47 @@ AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP], AC_SUBST([HAVE_WS2TCPIP_H]) ]) +# gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_SYS_SOCKET_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_SOCKET_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SOCKET]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CONNECT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BIND]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPEERNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKOPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LISTEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SEND]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECVFROM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SENDTO]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETSOCKOPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SHUTDOWN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT4]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) +]) + AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], [ - GNULIB_SOCKET=0; AC_SUBST([GNULIB_SOCKET]) - GNULIB_CONNECT=0; AC_SUBST([GNULIB_CONNECT]) - GNULIB_ACCEPT=0; AC_SUBST([GNULIB_ACCEPT]) - GNULIB_BIND=0; AC_SUBST([GNULIB_BIND]) - GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME]) - GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME]) - GNULIB_GETSOCKOPT=0; AC_SUBST([GNULIB_GETSOCKOPT]) - GNULIB_LISTEN=0; AC_SUBST([GNULIB_LISTEN]) - GNULIB_RECV=0; AC_SUBST([GNULIB_RECV]) - GNULIB_SEND=0; AC_SUBST([GNULIB_SEND]) - GNULIB_RECVFROM=0; AC_SUBST([GNULIB_RECVFROM]) - GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) - GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) - GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) - GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4]) HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4 index 23cbdd28eb..ac91d425bb 100644 --- a/m4/sys_stat_h.m4 +++ b/m4/sys_stat_h.m4 @@ -1,4 +1,4 @@ -# sys_stat_h.m4 serial 38 -*- Autoconf -*- +# sys_stat_h.m4 serial 41 -*- Autoconf -*- dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Eric Blake. dnl Provide a GNU-like . -AC_DEFUN([gl_HEADER_SYS_STAT_H], +AC_DEFUN_ONCE([gl_SYS_STAT_H], [ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) @@ -52,38 +52,53 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H], AC_REQUIRE([AC_C_RESTRICT]) ]) +# gl_SYS_STAT_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_SYS_STAT_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_STAT_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS], [ + gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHMODAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTATAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FUTIMENS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUMASK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHMOD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSTAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIRAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFO]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFOAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNOD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNODAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UTIMENSAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OVERRIDES_STRUCT_STAT]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHMOD], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKDIR], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UMASK], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) +]) + AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], [ - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR - GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT]) - GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT]) - GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT]) - GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS]) - GNULIB_GETUMASK=0; AC_SUBST([GNULIB_GETUMASK]) - GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD]) - GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT]) - GNULIB_MKDIR=0; AC_SUBST([GNULIB_MKDIR]) - GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT]) - GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO]) - GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT]) - GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD]) - GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT]) - GNULIB_STAT=0; AC_SUBST([GNULIB_STAT]) - GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT]) - GNULIB_OVERRIDES_STRUCT_STAT=0; AC_SUBST([GNULIB_OVERRIDES_STRUCT_STAT]) - dnl Support Microsoft deprecated alias function names by default. - GNULIB_MDA_CHMOD=1; AC_SUBST([GNULIB_MDA_CHMOD]) - GNULIB_MDA_MKDIR=1; AC_SUBST([GNULIB_MDA_MKDIR]) - GNULIB_MDA_UMASK=1; AC_SUBST([GNULIB_MDA_UMASK]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) diff --git a/m4/sys_time_h.m4 b/m4/sys_time_h.m4 index 64f133d513..c425a9639a 100644 --- a/m4/sys_time_h.m4 +++ b/m4/sys_time_h.m4 @@ -1,5 +1,5 @@ # Configure a replacement for . -# serial 9 +# serial 12 # Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -8,18 +8,13 @@ # Written by Paul Eggert and Martin Lambers. -AC_DEFUN([gl_HEADER_SYS_TIME_H], +AC_DEFUN_ONCE([gl_SYS_TIME_H], [ dnl Use AC_REQUIRE here, so that the REPLACE_GETTIMEOFDAY=0 statement dnl below is expanded once only, before all REPLACE_GETTIMEOFDAY=1 dnl statements that occur in other macros. - AC_REQUIRE([gl_HEADER_SYS_TIME_H_BODY]) -]) - -AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], -[ + AC_REQUIRE([gl_SYS_TIME_H_DEFAULTS]) AC_REQUIRE([AC_C_RESTRICT]) - AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) AC_CHECK_HEADERS_ONCE([sys/time.h]) gl_CHECK_NEXT_HEADERS([sys/time.h]) @@ -89,18 +84,33 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], ]], [gettimeofday]) ]) +# gl_SYS_TIME_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SYS_TIME_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_SYS_TIME_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) -AC_DEFUN([gl_HEADER_SYS_TIME_H_DEFAULTS], +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_TIME_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TIME_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETTIMEOFDAY]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TIME_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_TIME_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SYS_TIME_H_DEFAULTS], [ - GNULIB_GETTIMEOFDAY=0; AC_SUBST([GNULIB_GETTIMEOFDAY]) dnl Assume POSIX behavior unless another module says otherwise. HAVE_GETTIMEOFDAY=1; AC_SUBST([HAVE_GETTIMEOFDAY]) HAVE_STRUCT_TIMEVAL=1; AC_SUBST([HAVE_STRUCT_TIMEVAL]) diff --git a/m4/sys_types_h.m4 b/m4/sys_types_h.m4 index 2172c836d9..6dd6fee10c 100644 --- a/m4/sys_types_h.m4 +++ b/m4/sys_types_h.m4 @@ -1,4 +1,4 @@ -# sys_types_h.m4 serial 11 +# sys_types_h.m4 serial 13 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,10 +6,11 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_SYS_TYPES_H], [ + AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) + dnl Use sane struct stat types in OpenVMS 8.2 and later. AC_DEFINE([_USE_STD_STAT], 1, [For standard stat data types on VMS.]) - AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) gl_NEXT_HEADERS([sys/types.h]) dnl Ensure the type pid_t gets defined. @@ -30,6 +31,17 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H], AC_SUBST([WINDOWS_STAT_INODES]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_TYPES_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS], [ + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) +]) + AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], [ ]) diff --git a/m4/time_h.m4 b/m4/time_h.m4 index b6a1aa3bc0..b57474b48b 100644 --- a/m4/time_h.m4 +++ b/m4/time_h.m4 @@ -2,7 +2,7 @@ # Copyright (C) 2000-2001, 2003-2007, 2009-2021 Free Software Foundation, Inc. -# serial 15 +# serial 18 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -10,16 +10,11 @@ # Written by Paul Eggert and Jim Meyering. -AC_DEFUN([gl_HEADER_TIME_H], +AC_DEFUN_ONCE([gl_TIME_H], [ - dnl Use AC_REQUIRE here, so that the default behavior below is expanded - dnl once only, before all statements that occur in other macros. - AC_REQUIRE([gl_HEADER_TIME_H_BODY]) -]) - -AC_DEFUN([gl_HEADER_TIME_H_BODY], -[ - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_TIME_H_DEFAULTS]) gl_NEXT_HEADERS([time.h]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) @@ -111,30 +106,45 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], AC_SUBST([UNISTD_H_DEFINES_STRUCT_TIMESPEC]) ]) +# gl_TIME_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_TIME_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_TIME_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) -AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS], +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NANOSLEEP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRFTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMEGM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GET]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_TIME_H_DEFAULTS]) +]) + +AC_DEFUN([gl_TIME_H_DEFAULTS], [ - GNULIB_CTIME=0; AC_SUBST([GNULIB_CTIME]) - GNULIB_MKTIME=0; AC_SUBST([GNULIB_MKTIME]) - GNULIB_LOCALTIME=0; AC_SUBST([GNULIB_LOCALTIME]) - GNULIB_NANOSLEEP=0; AC_SUBST([GNULIB_NANOSLEEP]) - GNULIB_STRFTIME=0; AC_SUBST([GNULIB_STRFTIME]) - GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME]) - GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM]) - GNULIB_TIMESPEC_GET=0; AC_SUBST([GNULIB_TIMESPEC_GET]) - GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R]) - GNULIB_TIME_RZ=0; AC_SUBST([GNULIB_TIME_RZ]) - GNULIB_TZSET=0; AC_SUBST([GNULIB_TZSET]) - dnl Support Microsoft deprecated alias function names by default. - GNULIB_MDA_TZSET=1; AC_SUBST([GNULIB_MDA_TZSET]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R]) HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP]) diff --git a/m4/time_r.m4 b/m4/time_r.m4 index 713e93ac26..2d49b64f12 100644 --- a/m4/time_r.m4 +++ b/m4/time_r.m4 @@ -12,7 +12,7 @@ AC_DEFUN([gl_TIME_R], dnl Persuade glibc and Solaris to declare localtime_r. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + AC_REQUIRE([gl_TIME_H_DEFAULTS]) AC_REQUIRE([AC_C_RESTRICT]) dnl Some systems don't declare localtime_r() and gmtime_r() if _REENTRANT is diff --git a/m4/time_rz.m4 b/m4/time_rz.m4 index 34ef0bab4b..c5e85dc625 100644 --- a/m4/time_rz.m4 +++ b/m4/time_rz.m4 @@ -10,7 +10,7 @@ dnl Written by Paul Eggert. AC_DEFUN([gl_TIME_RZ], [ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + AC_REQUIRE([gl_TIME_H_DEFAULTS]) AC_REQUIRE([AC_STRUCT_TIMEZONE]) # On Mac OS X 10.6, localtime loops forever with some time_t values. diff --git a/m4/timegm.m4 b/m4/timegm.m4 index 098c857e7f..58123beb0c 100644 --- a/m4/timegm.m4 +++ b/m4/timegm.m4 @@ -1,4 +1,4 @@ -# timegm.m4 serial 12 +# timegm.m4 serial 13 dnl Copyright (C) 2003, 2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_TIMEGM], [ - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + AC_REQUIRE([gl_TIME_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) REPLACE_TIMEGM=0 AC_CHECK_FUNCS_ONCE([timegm]) diff --git a/m4/timer_time.m4 b/m4/timer_time.m4 index f0e5785e9a..003e36e9d1 100644 --- a/m4/timer_time.m4 +++ b/m4/timer_time.m4 @@ -1,4 +1,4 @@ -# timer_time.m4 serial 4 +# timer_time.m4 serial 5 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -18,9 +18,13 @@ AC_DEFUN([gl_TIMER_TIME], dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/. m4_ifdef([gl_][PTHREADLIB], [AC_REQUIRE([gl_][PTHREADLIB])]) + AC_CHECK_DECL([timer_settime], [], [], + [[#include + ]]) LIB_TIMER_TIME= AC_SUBST([LIB_TIMER_TIME]) - gl_saved_libs=$LIBS + AS_IF([test "$ac_cv_have_decl_timer_settime" = yes], [ + gl_saved_libs=$LIBS AC_SEARCH_LIBS([timer_settime], [rt posix4], [test "$ac_cv_search_timer_settime" = "none required" || LIB_TIMER_TIME=$ac_cv_search_timer_settime]) @@ -40,5 +44,6 @@ AC_DEFUN([gl_TIMER_TIME], ], [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBPMULTITHREAD"])]) AC_CHECK_FUNCS([timer_settime]) - LIBS=$gl_saved_libs + LIBS=$gl_saved_libs + ]) ]) diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index 0f26fb908d..0ce4ea4511 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 85 +# unistd_h.m4 serial 89 dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,10 +6,10 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Simon Josefsson, Bruno Haible. -AC_DEFUN([gl_UNISTD_H], +AC_DEFUN_ONCE([gl_UNISTD_H], [ - dnl Use AC_REQUIRE here, so that the default behavior below is expanded - dnl once only, before all statements that occur in other macros. + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) gl_CHECK_NEXT_HEADERS([unistd.h]) @@ -59,100 +59,116 @@ AC_DEFUN([gl_UNISTD_H], fi ]) +# gl_UNISTD_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_UNISTD_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_UNISTD_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCESS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHOWN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CLOSE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPY_FILE_RANGE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP2]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP3]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ENVIRON]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EUIDACCESS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FACCESSAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHOWNAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDATASYNC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSYNC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTRUNCATE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCWD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDOMAINNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDTABLESIZE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETENTROPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETGROUPS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETHOSTNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETOPT_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAGESIZE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPASS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUSERSHELL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GROUP_MEMBER]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISATTY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHOWN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINKAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSEEK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE2]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PREAD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PWRITE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READ]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINKAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RMDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETHOSTNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SLEEP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINKAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCATE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TTYNAME_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_NONBLOCKING]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_SIGPIPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINKAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_USLEEP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WRITE]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ACCESS], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHDIR], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CLOSE], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP2], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECL], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLE], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLP], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECV], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVE], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVP], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVPE], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETCWD], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETPID], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ISATTY], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_LSEEK], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_READ], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_RMDIR], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_SWAB], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UNLINK], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WRITE], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) +]) + AC_DEFUN([gl_UNISTD_H_DEFAULTS], [ - GNULIB_ACCESS=0; AC_SUBST([GNULIB_ACCESS]) - GNULIB_CHDIR=0; AC_SUBST([GNULIB_CHDIR]) - GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) - GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) - GNULIB_COPY_FILE_RANGE=0; AC_SUBST([GNULIB_COPY_FILE_RANGE]) - GNULIB_DUP=0; AC_SUBST([GNULIB_DUP]) - GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) - GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) - GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) - GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) - GNULIB_EXECL=0; AC_SUBST([GNULIB_EXECL]) - GNULIB_EXECLE=0; AC_SUBST([GNULIB_EXECLE]) - GNULIB_EXECLP=0; AC_SUBST([GNULIB_EXECLP]) - GNULIB_EXECV=0; AC_SUBST([GNULIB_EXECV]) - GNULIB_EXECVE=0; AC_SUBST([GNULIB_EXECVE]) - GNULIB_EXECVP=0; AC_SUBST([GNULIB_EXECVP]) - GNULIB_EXECVPE=0; AC_SUBST([GNULIB_EXECVPE]) - GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) - GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) - GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) - GNULIB_FDATASYNC=0; AC_SUBST([GNULIB_FDATASYNC]) - GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) - GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) - GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) - GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) - GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) - GNULIB_GETENTROPY=0; AC_SUBST([GNULIB_GETENTROPY]) - GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS]) - GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) - GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN]) - GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) - GNULIB_GETOPT_POSIX=0; AC_SUBST([GNULIB_GETOPT_POSIX]) - GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) - GNULIB_GETPASS=0; AC_SUBST([GNULIB_GETPASS]) - GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) - GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER]) - GNULIB_ISATTY=0; AC_SUBST([GNULIB_ISATTY]) - GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) - GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) - GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) - GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) - GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE]) - GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) - GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) - GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE]) - GNULIB_READ=0; AC_SUBST([GNULIB_READ]) - GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) - GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT]) - GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR]) - GNULIB_SETHOSTNAME=0; AC_SUBST([GNULIB_SETHOSTNAME]) - GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) - GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) - GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) - GNULIB_TRUNCATE=0; AC_SUBST([GNULIB_TRUNCATE]) - GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) - GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING]) - GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) - GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK]) - GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) - GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP]) - GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) - dnl Support Microsoft deprecated alias function names by default. - GNULIB_MDA_ACCESS=1; AC_SUBST([GNULIB_MDA_ACCESS]) - GNULIB_MDA_CHDIR=1; AC_SUBST([GNULIB_MDA_CHDIR]) - GNULIB_MDA_CLOSE=1; AC_SUBST([GNULIB_MDA_CLOSE]) - GNULIB_MDA_DUP=1; AC_SUBST([GNULIB_MDA_DUP]) - GNULIB_MDA_DUP2=1; AC_SUBST([GNULIB_MDA_DUP2]) - GNULIB_MDA_EXECL=1; AC_SUBST([GNULIB_MDA_EXECL]) - GNULIB_MDA_EXECLE=1; AC_SUBST([GNULIB_MDA_EXECLE]) - GNULIB_MDA_EXECLP=1; AC_SUBST([GNULIB_MDA_EXECLP]) - GNULIB_MDA_EXECV=1; AC_SUBST([GNULIB_MDA_EXECV]) - GNULIB_MDA_EXECVE=1; AC_SUBST([GNULIB_MDA_EXECVE]) - GNULIB_MDA_EXECVP=1; AC_SUBST([GNULIB_MDA_EXECVP]) - GNULIB_MDA_EXECVPE=1; AC_SUBST([GNULIB_MDA_EXECVPE]) - GNULIB_MDA_GETCWD=1; AC_SUBST([GNULIB_MDA_GETCWD]) - GNULIB_MDA_GETPID=1; AC_SUBST([GNULIB_MDA_GETPID]) - GNULIB_MDA_ISATTY=1; AC_SUBST([GNULIB_MDA_ISATTY]) - GNULIB_MDA_LSEEK=1; AC_SUBST([GNULIB_MDA_LSEEK]) - GNULIB_MDA_READ=1; AC_SUBST([GNULIB_MDA_READ]) - GNULIB_MDA_RMDIR=1; AC_SUBST([GNULIB_MDA_RMDIR]) - GNULIB_MDA_SWAB=1; AC_SUBST([GNULIB_MDA_SWAB]) - GNULIB_MDA_UNLINK=1; AC_SUBST([GNULIB_MDA_UNLINK]) - GNULIB_MDA_WRITE=1; AC_SUBST([GNULIB_MDA_WRITE]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) HAVE_COPY_FILE_RANGE=1; AC_SUBST([HAVE_COPY_FILE_RANGE]) diff --git a/m4/unlocked-io.m4 b/m4/unlocked-io.m4 index a2dc8a144a..b689020ff4 100644 --- a/m4/unlocked-io.m4 +++ b/m4/unlocked-io.m4 @@ -1,4 +1,4 @@ -# unlocked-io.m4 serial 15 +# unlocked-io.m4 serial 16 # Copyright (C) 1998-2006, 2009-2021 Free Software Foundation, Inc. # @@ -16,11 +16,6 @@ dnl on Solaris 2.6). AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO], [ - AC_DEFINE([USE_UNLOCKED_IO], [1], - [Define to 1 if you want getc etc. to use unlocked I/O if available. - Unlocked I/O can improve performance in unithreaded apps, - but it is not safe for multithreaded apps.]) - dnl Persuade glibc and Solaris to declare dnl fgets_unlocked(), fputs_unlocked() etc. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) diff --git a/m4/year2038.m4 b/m4/year2038.m4 new file mode 100644 index 0000000000..da0f8d7303 --- /dev/null +++ b/m4/year2038.m4 @@ -0,0 +1,124 @@ +# year2038.m4 serial 7 +dnl Copyright (C) 2017-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Attempt to ensure that 'time_t' can go past the year 2038 and that +dnl the functions 'time', 'stat', etc. work with post-2038 timestamps. + +AC_DEFUN([gl_YEAR2038_EARLY], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1], + [For 64-bit time_t on 32-bit mingw.]) + ;; + esac +]) + +# gl_YEAR2038_TEST_INCLUDES +# ------------------------- +AC_DEFUN([gl_YEAR2038_TEST_INCLUDES], +[[ + #include + /* Check that time_t can represent 2**32 - 1 correctly. */ + #define LARGE_TIME_T \\ + ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30))) + int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535 + && LARGE_TIME_T % 65537 == 0) + ? 1 : -1]; +]]) + +# gl_YEAR2038_BODY(REQUIRE-YEAR2038-SAFE) +----------------------------------------- +AC_DEFUN([gl_YEAR2038_BODY], +[ + AC_ARG_ENABLE([year2038], + [ --disable-year2038 omit support for timestamps past the year 2038]) + AS_IF([test "$enable_year2038" != no], + [ + dnl On many systems, time_t is already a 64-bit type. + dnl On those systems where time_t is still 32-bit, it requires kernel + dnl and libc support to make it 64-bit. For glibc 2.34 and later on Linux, + dnl defining _TIME_BITS=64 and _FILE_OFFSET_BITS=64 is needed on x86 and ARM. + dnl + dnl On native Windows, the system include files define types __time32_t + dnl and __time64_t. By default, time_t is an alias of + dnl - __time32_t on 32-bit mingw, + dnl - __time64_t on 64-bit mingw and on MSVC (since MSVC 8). + dnl But when compiling with -D__MINGW_USE_VC2005_COMPAT, time_t is an + dnl alias of __time64_t. + dnl And when compiling with -D_USE_32BIT_TIME_T, time_t is an alias of + dnl __time32_t. + AC_CACHE_CHECK([for time_t past the year 2038], [gl_cv_type_time_t_y2038], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([gl_YEAR2038_TEST_INCLUDES])], + [gl_cv_type_time_t_y2038=yes], [gl_cv_type_time_t_y2038=no]) + ]) + if test "$gl_cv_type_time_t_y2038" = no; then + AC_CACHE_CHECK([for 64-bit time_t with _TIME_BITS=64], + [gl_cv_type_time_t_bits_macro], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([[#define _TIME_BITS 64 + #define _FILE_OFFSET_BITS 64 + ]gl_YEAR2038_TEST_INCLUDES])], + [gl_cv_type_time_t_bits_macro=yes], + [gl_cv_type_time_t_bits_macro=no]) + ]) + if test "$gl_cv_type_time_t_bits_macro" = yes; then + AC_DEFINE([_TIME_BITS], [64], + [Number of bits in a timestamp, on hosts where this is settable.]) + dnl AC_SYS_LARGFILE also defines this; it's OK if we do too. + AC_DEFINE([_FILE_OFFSET_BITS], [64], + [Number of bits in a file offset, on hosts where this is settable.]) + gl_cv_type_time_t_y2038=yes + fi + fi + if test $gl_cv_type_time_t_y2038 = no; then + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef _USE_32BIT_TIME_T + int ok; + #else + error fail + #endif + ]])], + [AC_MSG_FAILURE( + [The 'time_t' type stops working after January 2038. + Remove _USE_32BIT_TIME_T from the compiler flags.])], + [# If not cross-compiling and $1 says we should check, + # and 'touch' works with a large timestamp, then evidently wider time_t + # is desired and supported, so fail and ask the builder to fix the + # problem. Otherwise, just warn the builder. + m4_ifval([$1], + [if test $cross_compiling = no \ + && TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null; then + case `TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null` in + *'Feb 7 2106'* | *'Feb 7 17:10'*) + AC_MSG_FAILURE( + [The 'time_t' type stops working after January 2038, + and your system appears to support a wider 'time_t'. + Try configuring with 'CC="${CC} -m64"'. + To build with a 32-bit time_t anyway (not recommended), + configure with '--disable-year2038'.]);; + esac + rm -f conftest.time + fi]) + if test "$gl_warned_about_y2038" != yes; then + AC_MSG_WARN( + [The 'time_t' type stops working after January 2038, + and this package needs a wider 'time_t' type + if there is any way to access timestamps after that. + Configure with 'CC="${CC} -m64"' perhaps?]) + gl_warned_about_y2038=yes + fi + ]) + fi]) +]) + +AC_DEFUN([gl_YEAR2038], +[ + gl_YEAR2038_BODY([require-year2038-safe]) +]) diff --git a/oldXMenu/AddPane.c b/oldXMenu/AddPane.c index b14b3e82e4..8616de804f 100644 --- a/oldXMenu/AddPane.c +++ b/oldXMenu/AddPane.c @@ -30,8 +30,8 @@ without express or implied warranty. * */ -#include #include "XMenuInt.h" +#include int XMenuAddPane(Display *display, register XMenu *menu, register char const *label, int active) diff --git a/oldXMenu/AddSel.c b/oldXMenu/AddSel.c index 9596caed0e..d81c54b870 100644 --- a/oldXMenu/AddSel.c +++ b/oldXMenu/AddSel.c @@ -31,8 +31,8 @@ without express or implied warranty. * */ -#include #include "XMenuInt.h" +#include int XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char const *help) diff --git a/src/xmenu.c b/src/xmenu.c index 709e455dd0..ea2cbab203 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -1605,11 +1605,11 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, prev_wv->next = wv; else if (!save_wv) { - /* This call to 'abort' pacifies gcc 11.2.1 when Emacs + /* This emacs_abort call pacifies gcc 11.2.1 when Emacs is configured with --enable-gcc-warnings. FIXME: If save_wv can be null, do something better; otherwise, explain why save_wv cannot be null. */ - abort (); + emacs_abort (); } else save_wv->contents = wv; commit 63cb65dccecb1146cdad7134e4b62ea3e1433880 Author: Andrea Corallo Date: Mon Oct 4 22:47:30 2021 +0200 * Fix mh tests for native comp builds (bug#50975) * test/lisp/mh-e/mh-utils-tests.el (mh-ensure-native-trampolines): New function. (mh-test-utils-setup-with-mocks) (mh-test-utils-setup-with-variant): Use it. diff --git a/test/lisp/mh-e/mh-utils-tests.el b/test/lisp/mh-e/mh-utils-tests.el index 68152ce3b6..82afbab647 100644 --- a/test/lisp/mh-e/mh-utils-tests.el +++ b/test/lisp/mh-e/mh-utils-tests.el @@ -107,6 +107,15 @@ install an MH variant and test it interactively." (if temp-home-dir (delete-directory temp-home-dir t)) (setenv "MH" original-mh-envvar)))) +(defun mh-ensure-native-trampolines () + "Build head of time the trampolines we'll need. +As `call-process'' and `file-directory-p' will be redefined, the +native compiler will invoke `call-process' to compile the +respective trampolines. To avoid interferences with the +`call-process' mocking we build these AOT." + (when (featurep 'native-compile) + (mapc #'comp-subr-trampoline-install '(call-process file-directory-p)))) + (defun mh-test-utils-setup-with-mocks () "Set dynamically bound variables so that MH programs are mocked out. The tests use this method if no configured MH variant is found." @@ -116,6 +125,7 @@ The tests use this method if no configured MH variant is found." (mh-populate-sub-folders-cache "+rela-folder/bar") (mh-populate-sub-folders-cache "+rela-folder/foo") (mh-populate-sub-folders-cache "+rela-folder/food") + (mh-ensure-native-trampolines) (fset 'call-process #'mh-test-utils-mock-call-process) (fset 'file-directory-p #'mh-test-utils-mock-file-directory-p)) @@ -205,6 +215,7 @@ The tests use this method if a configured MH variant is found." (make-directory (expand-file-name "foo" abso-folder) t) (make-directory (expand-file-name "food" abso-folder) t) (setq mh-test-abs-folder abso-folder) + (mh-ensure-native-trampolines) (fset 'call-process #'mh-test-utils-log-call-process) (fset 'file-directory-p #'mh-test-utils-log-file-directory-p) temp-home-dir)) commit e606cc6f4023a3b20179ed51e339941be7c36bd2 Author: Andrea Corallo Date: Mon Oct 4 21:15:02 2021 +0200 * Fix `batch-native-compile' not to spawn a subprocess * lisp/emacs-lisp/comp.el (comp-running-batch-compilation): New var. (comp-final): Use it. (batch-native-compile): Bind `comp-running-batch-compilation' it. diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 94753ec3d9..63d4a74b54 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -3653,6 +3653,9 @@ Prepare every function for final compilation and drive the C back-end." (defvar comp-async-compilation nil "Non-nil while executing an asynchronous native compilation.") +(defvar comp-running-batch-compilation nil + "Non-nil when compilation is driven by any `batch-*-compile' function.") + (defun comp-final (_) "Final pass driving the C back-end for code emission." (maphash #'comp-compute-function-type (comp-ctxt-funcs-h comp-ctxt)) @@ -3661,7 +3664,7 @@ Prepare every function for final compilation and drive the C back-end." ;; unless during bootstrap or async compilation (bug#45056). GCC ;; leaks memory but also interfere with the ability of Emacs to ;; detect when a sub-process completes (TODO understand why). - (if (or byte+native-compile comp-async-compilation) + (if (or comp-running-batch-compilation comp-async-compilation) (comp-final1) ;; Call comp-final1 in a child process. (let* ((output (comp-ctxt-output comp-ctxt)) @@ -4202,9 +4205,10 @@ as part of building the source tarball, in which case the .eln file will be placed under the native-lisp/ directory (actually, in the last directory in `native-comp-eln-load-path')." (comp-ensure-native-compiler) - (let ((native-compile-target-directory - (if for-tarball - (car (last native-comp-eln-load-path))))) + (let ((comp-running-batch-compilation t) + (native-compile-target-directory + (if for-tarball + (car (last native-comp-eln-load-path))))) (cl-loop for file in command-line-args-left if (or (null byte+native-compile) (cl-notany (lambda (re) (string-match re file)) commit 19444fb093b680c632797dbcade7c14f87d44966 Author: Lars Ingebrigtsen Date: Mon Oct 4 21:02:23 2021 +0200 Fix syntax error in define-keymap doc string * lisp/subr.el (define-keymap): Fix syntax error in (fn. diff --git a/lisp/subr.el b/lisp/subr.el index c3dbe8df80..e4819c4b2b 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6491,7 +6491,7 @@ KEY/DEFINITION pairs are as KEY and DEF in `define-key'. KEY can also be the special symbol `:menu', in which case DEFINITION should be a MENU form as accepted by `easy-menu-define'. -\n(fn [&key FULL PARENT SUPPRESS NAME PREFIX KEYMAP] [KEY DEFINITION] ...)" +\(fn (&key FULL PARENT SUPPRESS NAME PREFIX KEYMAP) &rest [KEY DEFINITION]...)" ;; Handle keywords. (let ((options nil)) (while (and definitions commit 894dfe70da2dbeb218e8a0a58ee5e860f0fe9e4e Author: Ken Brown Date: Mon Oct 4 14:47:57 2021 -0400 Fix native-compilation build from tarball on Cygwin * src/Makefile.in (../native-lisp) [CYGWIN]: Rebase the *.eln files after they are all created, to avoid fork problems later in the build. (Bug#50666) diff --git a/src/Makefile.in b/src/Makefile.in index 759572f85e..b8d0e7b54c 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -806,6 +806,9 @@ elnlisp := $(addprefix ${lispsource}/,${elnlisp}) $(lisp:.elc=.eln) ../native-lisp: | $(pdmp) if test ! -d $@; then \ mkdir $@ && $(MAKE) $(AM_V_NO_PD) $(elnlisp); \ + if test $(SYSTEM_TYPE) = cygwin; then \ + find $@ -name '*.eln' | rebase -v -O -T -; \ + fi; \ LC_ALL=C $(RUN_TEMACS) -batch $(BUILD_DETAILS) -l loadup --temacs=pdump \ --bin-dest $(BIN_DESTDIR) --eln-dest $(ELN_DESTDIR) \ && cp -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT) \ commit 882a59408e64c4826904ff800b9da122280693fc Author: Robert Pluim Date: Mon Oct 4 18:47:04 2021 +0200 Fix problem with 'vertical-motion' and emoji * src/font.c (font_range): Pass correct position to font_for_char (Bug#51012). diff --git a/src/font.c b/src/font.c index 82a1dffc01..83f0f8296a 100644 --- a/src/font.c +++ b/src/font.c @@ -3918,7 +3918,7 @@ font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit, val = XCAR (val); else if (VECTORP (val)) val = AREF (val, 0); - font_object = font_for_char (face, XFIXNAT (val), pos - 1, string); + font_object = font_for_char (face, XFIXNAT (val), pos, string); } } commit 2ce5e0805824212e4c92398203a669a9d1841786 Author: Robert Pluim Date: Mon Oct 4 19:11:15 2021 +0200 Remove U+FE0F from script-representative-chars * lisp/international/fontset.el (script-representative-chars): Remove U+FE0F / VS-16 from the 'emoji' entry. It could cause us to skip fonts that don't have a glyph for it, even though we don't actually need one. diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index f0ead8a274..fcd22e09d2 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -281,7 +281,7 @@ (ottoman-siyaq-number #x1ed01) (mahjong-tile #x1F000) (domino-tile #x1F030) - (emoji #x1F300 #x1F600 #xFE0F))) + (emoji #x1F300 #x1F600))) (defvar otf-script-alist) commit 9750e7820284fc85dabcfa17254914a1adc3b002 Author: Robert Pluim Date: Mon Oct 4 18:47:04 2021 +0200 Fix problem with 'vertical-motion' and emoji * src/font.c (font_range): Pass correct position to font_for_char (Bug#51012). diff --git a/src/font.c b/src/font.c index 82a1dffc01..83f0f8296a 100644 --- a/src/font.c +++ b/src/font.c @@ -3918,7 +3918,7 @@ font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit, val = XCAR (val); else if (VECTORP (val)) val = AREF (val, 0); - font_object = font_for_char (face, XFIXNAT (val), pos - 1, string); + font_object = font_for_char (face, XFIXNAT (val), pos, string); } } commit 13f459b3ac620a264b461d224158aafe9887433d Author: Eli Zaretskii Date: Mon Oct 4 19:29:34 2021 +0300 ; Describe PROBLEMS with Unicode display on some TTYs * etc/TODO: Describe problems with Unicode display on some text terminals. (Bug#50865) (Bug#50983) diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 72696e36fc..f3c0c4b34c 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -1942,6 +1942,71 @@ To avoid it, set xterm-extra-capabilities to a value other than 'check' (the default). See that variable's documentation (in term/xterm.el) for more details. +** Incorrect or corrupted display of some Unicode characters + +*** Linux console problems with double-width characters + +The Linux console declares UTF-8 encoding, but supports only a limited +number of Unicode characters, and can cause Emacs produce corrupted or +garbled display with some unusual characters and sequences. Emacs 28 +and later by default disables 'auto-composition-mode' on this console, +for that reason, but this might not be enough. One known problem with +this console is that zero-width and double-width characters are +displayed incorrectly (as a single-column characters), and that causes +the cursor to be out of sync with the actual display. + +One way of working around this is to use the display-table feature to +display the problematic characters as some other, less problematic +ones. Here's an example of setting up the standard display table to +show the U+01F64F PERSON WITH FOLDED HANDS character as a diamond with +a special face: + + (or standard-display-table + (setq standard-display-table (make-display-table))) + (aset standard-display-table + #x1f64f (vector (make-glyph-code #xFFFD 'escape-glyph))) + +Similar setup can be done with any other problematic character. If +the console cannot even display the U+FFFD REPLACEMENT CHARACTER, you +can use some ASCII character instead, like '?'; it will stand out due +to the 'escape-glyph' face. The disadvantage of this method is that +all such characters will look the same on display, and the only way of +knowing what is the real codepoint in the buffer is to go to the +character and type "C-u C-x =". + +*** Messed-up display on the Kitty text terminal + +This terminal has its own peculiar ideas about display of unusual +characters. For example, it hides the U+00AD SOFT HYPHEN characters +on display, which messes up Emacs cursor addressing, since Emacs +doesn't know these characters are effectively treated as zero-width +characters. + +One way of working around such "hidden" characters is to tell Emacs to +display them as zero-width: + + (aset glyphless-char-display #xAD 'zero-width) + +Another possibility is to use display-table to display SOFT HYPHEN as +a regular ASCII dash character '-': + + (or standard-display-table + (setq standard-display-table (make-display-table))) + (aset standard-display-table + #xAD (vector (make-glyph-code ?- 'escape-glyph))) + +Kitty also differs from many other character terminals in how it +handles character compositions. As one example, Emoji sequences that +begin with a non-Emoji character and end in U+FE0F VARIATION SELECTOR +16 should be composed into an Emoji glyph; Kitty assumes that all such +Emoji glyphs have 2-column width, whereas Emacs and many other text +terminals display them as 1-column glyphs. Again, this causes cursor +addressing to get out of sync and eventually messes up the display. + +One possible workaround for problems caused by character composition +is to turn off 'auto-composition-mode' on Kitty terminals. + + * Runtime problems specific to individual Unix variants ** GNU/Linux commit 0f2df365592636aaa6bcd72fc662774eb35c69d1 Author: Mattias Engdegård Date: Mon Oct 4 18:11:40 2021 +0200 Run ERT tests with `lexical-binding` bound to `t` * lisp/emacs-lisp/ert.el (ert-deftest, ert--run-test-internal): Use t rather than the ambient file value for `lexical-binding` to avoid bad lexbind coverage by mistake. diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index f2b20fd74e..607f15d254 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -219,11 +219,7 @@ it has to be wrapped in `(eval (quote ...))'. `(:expected-result-type ,expected-result)) ,@(when tags-supplied-p `(:tags ,tags)) - :body (lambda () - ;; Use the value of `lexical-binding' in - ;; the source file when evaluating the body. - (let ((lexical-binding ,lexical-binding)) - ,@body)))) + :body (lambda () ,@body))) ',name)))) (defvar ert--find-test-regexp @@ -780,7 +776,8 @@ This mainly sets up debugger-related bindings." ;; handle ert errors. Once that's done, remove ;; `ert--should-signal-hook'. See Bug#24402 and Bug#11218 for ;; details. - (let ((debugger (lambda (&rest args) + (let ((lexical-binding t) + (debugger (lambda (&rest args) (ert--run-test-debugger test-execution-info args))) (debug-on-error t) commit 7a98a620798072ce6c6bf0d84c396969388a6d3f Author: Michael Albinus Date: Mon Oct 4 18:01:06 2021 +0200 * test/README: Mention :nativecomp tag. diff --git a/test/README b/test/README index 97611cf864..a0961249cf 100644 --- a/test/README +++ b/test/README @@ -22,6 +22,10 @@ following tags are recognized: to run on a regular basis by users. Instead, it runs on demand only, or during regression tests. +* :nativecomp + The test runs only if Emacs is configured with Lisp native compiler + support. + * :unstable The test is under development. It shall run on demand only. commit 10e3bc610b48c18ba5b4a2859a9621a2ee96be48 Merge: ab1a8a8315 95a0227ff7 Author: Glenn Morris Date: Mon Oct 4 08:13:12 2021 -0700 Merge from origin/emacs-28 95a0227ff7 (origin/emacs-28) Avoid exiting when outputting error mess... b7ae0232be ; * src/Makefile.in (../native-lisp): More tweaks of the r... 6e79f8a444 Remove implemented emoji items 00bcba5125 project.el NEWS tagging 704a39f508 thing-at-mouse NEWS tagging 3a9d5f04fb Mention ffap-file-name-with-spaces in the ffap doc strin # Conflicts: # etc/NEWS commit ab1a8a83153b40d9664b17784340e6564bf15558 Merge: e0fdb68f8c ef6c43b896 Author: Glenn Morris Date: Mon Oct 4 08:13:11 2021 -0700 ; Merge from origin/emacs-28 The following commit was skipped: ef6c43b896 Revert "Make info-look search harder for the Python info f... commit e0fdb68f8ccb1c870bfb8c3cd2bf786a0bb312b6 Merge: f0e6b47ef0 3b8dda6c90 Author: Glenn Morris Date: Mon Oct 4 08:13:11 2021 -0700 Merge from origin/emacs-28 3b8dda6c90 Add safety check in x_menu_show e1fb731393 Tweak x_connection_closed when I/O error 595e506c82 * lisp/erc/erc.el (erc-user-mode): Set "+i" by default. d00f3d4c05 Port unused decls to C2x 317eb2d5b5 Improve structure of TODO c0793cd9de Don't use some obsolete names in documentation 87153cc915 Tweak x_hide_tip for consistency 7e871dcd27 Remove encode_terminal_code UNINITs 2a00634880 Port pdumper.c maybe_unused to C2x 6d9b3c0eaa Port systhreads.h to C2x fd274d7d24 Pacify -Wanalyzer-null-argument in lisp_malloc cc3fc94f09 Pacify gcc 11.2.1 -Wanalyzer-null-argument d3a832a61a Simplify hack-read-symbol-shorthands again (bug#50946) 4831426158 Fix recipe for 'native-lisp' directory 0bb42ef803 ; * lisp/time-stamp.el (time-stamp-format): Doc string. 732c70a0d9 Simplify socket symlink-attack checking fc32a3bd95 ; * doc/lispref/files.texi (Reading from Files): Fix wording. 3cc77aa976 Clarify (elisp) insert-file-contents with BEG or END not o... 5deeb0947d * src/Makefile.in: Simplify conditionals. 121a5abeae Move context-menu selection items Defun/List/Symbol to pro... 0c341e6e84 * lisp/tab-bar.el (tab-bar-detach-tab): Handle frame selec... 931a7276c0 * lisp/tab-line.el (tab-line-format): Add face-modified to... 3863919a00 Fix unmounting in Tramp 7a6d34cd1f * etc/themes/light-blue-theme.el: Add "Maintainer: emacs-d... c1b1e1f545 Define HAVE_NATIVE_COMP in src/Makefile.in 137fa2d716 Rename elisp-shorthands to read-symbol-shorthands e6fbc45b7b Font-lock shorthands in elisp-mode for quick visual recogn... 17e6f3bee5 ; Fix last change in tramp-sshfs.el 3dae1e33d1 Suppress superfluous error messages in Tramp b228ec9fab Fix reading the tail of a file in shorthands.el 7fb2789509 Fix substitution of pretty quotes in code in easy-mmode b47d7ce1b8 Fix agent directory deletion b1a8a66fb0 ; * etc/TODO: Fix previous commit; delete the right thing. 6c01a21365 Clarify the purpose of internal--format-docstring-line 55dadbc57e * lisp/net/dictionary.el (context-menu-dictionary): Move m... bb209cd5ab Update to Org 9.5-30-g10dc9d 4341e79a5f Remove bogus ":safe t" custom properties b6f6b593c6 Fix 'apropos-compact-layout' 62d6cecfcd Remove bogus ":safe nil" custom properties f9111d8784 The safe-local-variable property is a function (bug#50944) 3dc094abee ; Some minor tweaks to TODO a5b4356d37 Revert "; * etc/TODO: Move elpa.gnu.org items to the end." 7bc0cee115 Revert "* etc/TODO: Rearrange to start with "Simple tasks"." 3489471417 Fix selection of fonts for Arabic on Posix platforms 13e5943386 ; Fix a typo in a doc string bd60fca2fa Fix ox-koma-letter compilation warnings 340e527bed Preload paren.el a9052248da Improve documentation of 'shift-select-mode' d505971894 ; Standardize some license headers 9307889d68 Simplify shorthand injection (bug#50946) 5c77cc9584 ; * admin/release-branch.txt: Tweak previous. # Conflicts: # etc/NEWS # test/lisp/subr-tests.el commit f0e6b47ef0a5ee15568e0b3992352d00d1055f46 Author: Eli Zaretskii Date: Mon Oct 4 18:07:46 2021 +0300 Revert "Fix problem with outputting error messages while dumping Emacs" This reverts commit 1428962590e216163f079ff838f39667383aec56. A better fix was committed to the emacs-28 branch and will be merged to master. diff --git a/src/print.c b/src/print.c index 7f0bc3f364..d4301fd7b6 100644 --- a/src/print.c +++ b/src/print.c @@ -941,13 +941,7 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context, else { Lisp_Object error_conditions = Fget (errname, Qerror_conditions); - /* Calling `substitute-command-keys' while bootstrapping will make - Emacs exit, so don't do that. */ - if (will_bootstrap_p () || will_dump_p ()) - errmsg = Fget (errname, Qerror_message); - else - errmsg = call1 (Qsubstitute_command_keys, - Fget (errname, Qerror_message)); + errmsg = call1 (Qsubstitute_command_keys, Fget (errname, Qerror_message)); file_error = Fmemq (Qfile_error, error_conditions); } commit 95a0227ff74e4863203a8c2050727e57f8172861 Author: Gregory Heytings Date: Mon Oct 4 14:13:46 2021 +0000 Avoid exiting when outputting error messages during loadup * src/print.c (print_error_message): Don't call 'substitute-command-keys' when it isn't fboundp. diff --git a/src/print.c b/src/print.c index d4301fd7b6..9f684bbeb5 100644 --- a/src/print.c +++ b/src/print.c @@ -941,7 +941,11 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context, else { Lisp_Object error_conditions = Fget (errname, Qerror_conditions); - errmsg = call1 (Qsubstitute_command_keys, Fget (errname, Qerror_message)); + errmsg = Fget (errname, Qerror_message); + /* During loadup 'substitute-command-keys' might not be available. */ + if (!NILP (Ffboundp (Qsubstitute_command_keys))) + errmsg = call1 (Qsubstitute_command_keys, errmsg); + file_error = Fmemq (Qfile_error, error_conditions); } commit 7b409dfe9671ec12377d1bd3c02e5306badd22b5 Author: Lars Ingebrigtsen Date: Mon Oct 4 16:37:30 2021 +0200 Remove :copy from define-keymap * doc/lispref/keymaps.texi (Changing Key Bindings): Update documentation. * lisp/subr.el (define-keymap): (define-keymap--define): Remove :copy from the signature. * lisp/net/eww.el (eww-link-keymap): Use :parent. diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index 1ca4857450..adee7ce58e 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi @@ -1442,10 +1442,6 @@ If non-@code{nil}, the keymap will be suppressed with @code{suppress-keymap} (@pxref{Changing Key Bindings}). If @code{nodigits}, treat digits like other chars. -@item :copy -If non-@code{nil}, copy this keymap and use it as the basis -(@pxref{Creating Keymaps}). - @item :name If non-@code{nil}, this should be a string to use as the menu for the keymap if you use it as a menu with @code{x-popup-menu} (@pxref{Pop-Up diff --git a/lisp/net/eww.el b/lisp/net/eww.el index e5716d3ffd..afcf2ce8b4 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -271,10 +271,10 @@ See also `eww-form-checkbox-selected-symbol'." "text/html, text/plain, text/sgml, text/css, application/xhtml+xml, */*;q=0.01" "Value used for the HTTP 'Accept' header.") -(defvar-keymap eww-link-keymap (:copy shr-map) +(defvar-keymap eww-link-keymap (:parent shr-map) "\r" #'eww-follow-link) -(defvar-keymap eww-image-link-keymap (:copy shr-map) +(defvar-keymap eww-image-link-keymap (:parent shr-map) "\r" #'eww-follow-link) (defun eww-suggested-uris nil diff --git a/lisp/subr.el b/lisp/subr.el index 18b0851b1d..6473c5ac11 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6478,9 +6478,6 @@ pairs. Available keywords are: :keymap If non-nil, instead of creating a new keymap, the given keymap will be destructively modified instead. -:copy If non-nil, copy this keymap and use it as the basis - (see `copy-keymap'). - :name If non-nil, this should be a string to use as the menu for the keymap in case you use it as a menu with `x-popup-menu'. @@ -6492,7 +6489,7 @@ KEY/DEFINITION pairs are as KEY and DEF in `define-key'. KEY can also be the special symbol `:menu', in which case DEFINITION should be a MENU form as accepted by `easy-menu-define'. -\n(fn [&key FULL PARENT SUPPRESS NAME PREFIX KEYMAP COPY] [KEY DEFINITION] ...)" +\n(fn [&key FULL PARENT SUPPRESS NAME PREFIX KEYMAP] [KEY DEFINITION] ...)" ;; Handle keywords. (let ((options nil)) (while (and definitions @@ -6505,7 +6502,7 @@ should be a MENU form as accepted by `easy-menu-define'. (define-keymap--define (nreverse options) definitions))) (defun define-keymap--define (options definitions) - (let (full suppress parent name prefix copy keymap) + (let (full suppress parent name prefix keymap) (while options (let ((keyword (pop options)) (value (pop options))) @@ -6513,7 +6510,6 @@ should be a MENU form as accepted by `easy-menu-define'. (:full (setq full value)) (:keymap (setq keymap value)) (:parent (setq parent value)) - (:copy (setq copy value)) (:suppress (setq suppress value)) (:name (setq name value)) (:prefix (setq prefix value))))) @@ -6522,16 +6518,12 @@ should be a MENU form as accepted by `easy-menu-define'. (or full parent suppress keymap)) (error "A prefix keymap can't be defined with :full/:parent/:suppress/:keymap keywords")) - (when (and full copy) - (error "Invalid combination: :full/:copy")) - - (when (and keymap (or full copy)) - (error "Invalid combination: :keymap with :full/:copy")) + (when (and keymap full) + (error "Invalid combination: :keymap with :full")) (let ((keymap (cond (keymap keymap) (prefix (define-prefix-command prefix nil name)) - (copy (copy-keymap copy)) (full (make-keymap name)) (t (make-sparse-keymap name))))) (when suppress commit 3f14418b1152e8455b0fcd28f496187dec9b4257 Author: Lars Ingebrigtsen Date: Mon Oct 4 16:19:40 2021 +0200 Fix gnus-group-mode-map breakage from previous patch * lisp/gnus/gnus-group.el (:keymap): Restore gnus-group-list-map key strokes to the correct location. diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 7c879741cf..2a4c84c94b 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -718,46 +718,46 @@ simple manner." "l" #'gnus-group-list-level "c" #'gnus-group-list-cached "?" #'gnus-group-list-dormant - "!" #'gnus-group-list-ticked) - - "/" (define-keymap :prefix 'gnus-group-list-limit-map - "k" #'gnus-group-list-limit - "z" #'gnus-group-list-limit - "s" #'gnus-group-list-limit - "u" #'gnus-group-list-limit - "A" #'gnus-group-list-limit - "m" #'gnus-group-list-limit - "M" #'gnus-group-list-limit - "l" #'gnus-group-list-limit - "c" #'gnus-group-list-limit - "?" #'gnus-group-list-limit - "!" #'gnus-group-list-limit) - - "f" (define-keymap :prefix 'gnus-group-list-flush-map - "k" #'gnus-group-list-flush - "z" #'gnus-group-list-flush - "s" #'gnus-group-list-flush - "u" #'gnus-group-list-flush - "A" #'gnus-group-list-flush - "m" #'gnus-group-list-flush - "M" #'gnus-group-list-flush - "l" #'gnus-group-list-flush - "c" #'gnus-group-list-flush - "?" #'gnus-group-list-flush - "!" #'gnus-group-list-flush) - - "p" (define-keymap :prefix 'gnus-group-list-plus-map - "k" #'gnus-group-list-plus - "z" #'gnus-group-list-plus - "s" #'gnus-group-list-plus - "u" #'gnus-group-list-plus - "A" #'gnus-group-list-plus - "m" #'gnus-group-list-plus - "M" #'gnus-group-list-plus - "l" #'gnus-group-list-plus - "c" #'gnus-group-list-plus - "?" #'gnus-group-list-plus - "!" #'gnus-group-list-plus) + "!" #'gnus-group-list-ticked + + "/" (define-keymap :prefix 'gnus-group-list-limit-map + "k" #'gnus-group-list-limit + "z" #'gnus-group-list-limit + "s" #'gnus-group-list-limit + "u" #'gnus-group-list-limit + "A" #'gnus-group-list-limit + "m" #'gnus-group-list-limit + "M" #'gnus-group-list-limit + "l" #'gnus-group-list-limit + "c" #'gnus-group-list-limit + "?" #'gnus-group-list-limit + "!" #'gnus-group-list-limit) + + "f" (define-keymap :prefix 'gnus-group-list-flush-map + "k" #'gnus-group-list-flush + "z" #'gnus-group-list-flush + "s" #'gnus-group-list-flush + "u" #'gnus-group-list-flush + "A" #'gnus-group-list-flush + "m" #'gnus-group-list-flush + "M" #'gnus-group-list-flush + "l" #'gnus-group-list-flush + "c" #'gnus-group-list-flush + "?" #'gnus-group-list-flush + "!" #'gnus-group-list-flush) + + "p" (define-keymap :prefix 'gnus-group-list-plus-map + "k" #'gnus-group-list-plus + "z" #'gnus-group-list-plus + "s" #'gnus-group-list-plus + "u" #'gnus-group-list-plus + "A" #'gnus-group-list-plus + "m" #'gnus-group-list-plus + "M" #'gnus-group-list-plus + "l" #'gnus-group-list-plus + "c" #'gnus-group-list-plus + "?" #'gnus-group-list-plus + "!" #'gnus-group-list-plus)) "W" (define-keymap :prefix 'gnus-group-score-map "f" #'gnus-score-flush-cache commit b7ae0232bed40fd643cfeffbf12110de9e8dbc15 Author: Eli Zaretskii Date: Mon Oct 4 16:54:37 2021 +0300 ; * src/Makefile.in (../native-lisp): More tweaks of the recipe. diff --git a/src/Makefile.in b/src/Makefile.in index 25c7865d4a..759572f85e 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -807,8 +807,9 @@ elnlisp := $(addprefix ${lispsource}/,${elnlisp}) $(lisp:.elc=.eln) if test ! -d $@; then \ mkdir $@ && $(MAKE) $(AM_V_NO_PD) $(elnlisp); \ LC_ALL=C $(RUN_TEMACS) -batch $(BUILD_DETAILS) -l loadup --temacs=pdump \ - --bin-dest $(BIN_DESTDIR) --eln-dest $(ELN_DESTDIR); \ - cp -f $@ $(bootstrap_pdmp); \ + --bin-dest $(BIN_DESTDIR) --eln-dest $(ELN_DESTDIR) \ + && cp -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT) \ + && cp -f $(pdmp) $(bootstrap_pdmp); \ fi endif commit 43c2cb0a13343fe366452eea50eb4b36eee3c403 Author: Lars Ingebrigtsen Date: Mon Oct 4 13:23:18 2021 +0200 Document with-memoization * doc/misc/cl.texi (Modify Macros): Document with-memoization. diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index a6c3c32c0e..1e5d40b037 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -1245,6 +1245,12 @@ blocks for other macros like @code{cl-incf}, and @code{cl-pushnew}. The @code{cl-letf} and @code{cl-letf*} macros are used in the processing of symbol macros; @pxref{Macro Bindings}. +@defmac with-memoization @var{place} @var{code}@dots{} +This macro provides a simple way to do memoization. @var{code} is +evaluated and then stashed in @var{place}. If @var{place}'s value is +non-@code{nil}, return that value instead of evaluating @var{code}. +@end defmac + @node Variable Bindings @section Variable Bindings diff --git a/etc/NEWS b/etc/NEWS index 7b4a29e1b6..ef8d95af0b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -78,6 +78,8 @@ The new ':doc-spec-function' element can be used to compute the mode (instead of at load time). ** subr-x + ++++ *** New macro 'with-memoization' provides a very primitive form of memoization commit 8b4a6a722a3982024fc87b26dbc7ef7e2043f6e1 Author: Lars Ingebrigtsen Date: Mon Oct 4 13:15:41 2021 +0200 Add new command 'ensure-empty-lines'. * doc/lispref/text.texi (Commands for Insertion): Document it. * lisp/emacs-lisp/subr-x.el (ensure-empty-lines): New command. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 41b3138a0d..1e062be2c6 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -599,6 +599,19 @@ This command indents to the left margin if that is not zero. The value returned is @code{nil}. @end deffn +@deffn Command ensure-empty-lines &optional number-of-empty-lines +This command can be used to ensure that you have a specific number of +empty lines before point. (An ``empty line'' is here defined as a +line with no characters on it---a line with space characters isn't an +empty line.) It defaults to ensuring that there's a single empty line +before point. + +If point isn't at the beginning of a line, a newline character is +inserted first. If there's more empty lines before point than +specified, the number of empty lines is reduced. Otherwise it's +increased to the specified number. +@end deffn + @defvar overwrite-mode This variable controls whether overwrite mode is in effect. The value should be @code{overwrite-mode-textual}, @code{overwrite-mode-binary}, diff --git a/etc/NEWS b/etc/NEWS index b039310afa..7b4a29e1b6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -56,6 +56,11 @@ This change also affects 'cl-macrolet', 'cl-flet*' and This can be set to nil to inhibit translating upper case keys to lower case keys. ++++ +** New command 'ensure-empty-lines'. +This command increases (or decreases) the number of empty lines before +point. + * Changes in Specialized Modes and Packages in Emacs 29.1 diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 91ebbf9fb9..ecd3ca831e 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -412,6 +412,32 @@ and return the value found in PLACE instead." ,(funcall setter val) ,val))))) +;;;###autoload +(defun ensure-empty-lines (&optional lines) + "Ensure that there's LINES number of empty lines before point. +If LINES is nil or missing, a this ensures that there's a single +empty line before point. + +Interactively, this command uses the numerical prefix for LINES. + +If there's already more empty lines before point than LINES, the +number of blank lines will be reduced. + +If point is not at the beginning of a line, a newline character +is inserted before adjusting the number of empty lines." + (interactive "p") + (unless (bolp) + (insert "\n")) + (let ((lines (or lines 1)) + (start (save-excursion + (if (re-search-backward "[^\n]" nil t) + (+ (point) 2) + (point-min))))) + (cond + ((> (- (point) start) lines) + (delete-region (point) (- (point) (- (point) start lines)))) + ((< (- (point) start) lines) + (insert (make-string (- lines (- (point) start)) ?\n)))))) (provide 'subr-x) diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el index 1d19496ba4..f9cfea888c 100644 --- a/test/lisp/emacs-lisp/subr-x-tests.el +++ b/test/lisp/emacs-lisp/subr-x-tests.el @@ -638,5 +638,43 @@ (should (equal (string-chop-newline "foo\nbar\n") "foo\nbar")) (should (equal (string-chop-newline "foo\nbar") "foo\nbar"))) +(ert-deftest subr-ensure-empty-lines () + (should + (equal + (with-temp-buffer + (insert "foo") + (goto-char (point-min)) + (ensure-empty-lines 2) + (buffer-string)) + "\n\nfoo")) + (should + (equal + (with-temp-buffer + (insert "foo") + (ensure-empty-lines 2) + (buffer-string)) + "foo\n\n\n")) + (should + (equal + (with-temp-buffer + (insert "foo\n") + (ensure-empty-lines 2) + (buffer-string)) + "foo\n\n\n")) + (should + (equal + (with-temp-buffer + (insert "foo\n\n\n\n\n") + (ensure-empty-lines 2) + (buffer-string)) + "foo\n\n\n")) + (should + (equal + (with-temp-buffer + (insert "foo\n\n\n") + (ensure-empty-lines 0) + (buffer-string)) + "foo\n"))) + (provide 'subr-x-tests) ;;; subr-x-tests.el ends here commit 909f2a4b926ccc1b86d60341e44ca83c4d24fa0f Author: Michael Albinus Date: Mon Oct 4 13:19:38 2021 +0200 * test/infra/gitlab-ci.yml (test-native-comp-speed0): Fix thinko. diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index 5be59b8dcc..8c4cf3f2ca 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -295,7 +295,7 @@ test-native-comp-speed0: extends: [.job-template, .test-template, .native-comp-template] variables: target: emacs-native-comp-speed0 - make_params: "-C test native-comp.log" + make_params: "-C test comp-tests.log" test-all-inotify: # This tests also file monitor libraries inotify and inotifywatch. commit 6e79f8a444055139b9263cf60e4895b080b59a84 Author: Robert Pluim Date: Mon Oct 4 13:17:28 2021 +0200 Remove implemented emoji items * etc/TODO: Remove implemented emoji items. diff --git a/etc/TODO b/etc/TODO index 540d8a7ff5..ffc5ef304b 100644 --- a/etc/TODO +++ b/etc/TODO @@ -370,34 +370,6 @@ Emacs is capable of displaying Emoji and some of the Emoji sequences, provided that its fontsets are configured with a suitable font. To make this easier out of the box, the following should be done: -*** Populate composition-function-table with Emoji rules -The Unicode Character Database (UCD) includes several data files that -define the valid Emoji sequences. These files should be imported into -the Emacs tree, and should be converted by some script at Emacs build -time to Lisp code that populates composition-function-table with the -corresponding composition rules. - -*** Augment the default fontsets with Emoji-capable fonts -The default fontsets set up by fontest.el should include known free -fonts that provide good support for displaying Emoji sequences. In -addition, the rule that the default face's font is used for symbol and -punctuation characters, disregarding the fontsets, should be modified -to exempt Emoji from this rule (since Emoji characters belong to the -'symbol' script in Emacs), so that use-default-font-for-symbols would -not have to be tweaked to have Emoji display by default with a capable -font. (This has now been implemented, but only one font is currently -considered, please augment the list). - -*** Consider changing the default display of Variation Selectors -Emacs by default displays the Variation Selector (VS) codepoints not -composed with base characters as hex codes in a box. The Unicode FAQ -says that if variation sequences cannot be supported, the VS -characters should not be shown, leaving just the base character of the -sequence visible. This could be handled via glyphless-char-display, -by changing the entries for VS codepoints to 'zero-width'. Or we -could display them as a thin 1-pixel space, as we do with format -control characters, by using 'thin-space' there. - *** Special face for displaying text presentation of Emoji Emoji-capable fonts support Emoji sequences with the U+FE0F VARIATION SELECTOR-16 (VS16) for emoji-style display, but usually don't support commit 00bcba5125248eb77cd6f502e113a0c730270d01 Author: Lars Ingebrigtsen Date: Mon Oct 4 12:59:31 2021 +0200 project.el NEWS tagging diff --git a/etc/NEWS b/etc/NEWS index 214c58c56c..7e6143d932 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2424,8 +2424,10 @@ Those are 'shr-h1', 'shr-h2', 'shr-h3', 'shr-h4', 'shr-h5', 'shr-h6'. ** Project +--- *** New user option 'project-vc-merge-submodules'. +--- *** Project commands now have their own history. Previously used project directories are now suggested by all commands that prompt for a project directory. commit 704a39f50890bd5a996d7784016d5390e4bd39fb Author: Lars Ingebrigtsen Date: Mon Oct 4 12:57:06 2021 +0200 thing-at-mouse NEWS tagging diff --git a/etc/NEWS b/etc/NEWS index cff306e244..214c58c56c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2652,7 +2652,9 @@ This allows mode-specific alterations to how 'thing-at-point' works. 'symbol-at-point') will narrow to the current field (if any) before trying to identify the thing at point. +--- *** New function 'thing-at-mouse'. +This is like 'thing-at-point', but uses the mouse event position instead. ** image-dired commit 069749bed7ab1587f0cfbadb5924c80d7ee49ac9 Author: Lars Ingebrigtsen Date: Mon Oct 4 12:33:53 2021 +0200 Add new user option 'translate-upper-case-key-bindings' * doc/lispref/commands.texi (Key Sequence Input): Document it. * lisp/cus-start.el (standard): defcustom it. * src/keyboard.c (read_key_sequence): Use it. (syms_of_keyboard): New variable 'translate-upper-case-key-bindings'. diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index 3425880fec..8ad9df2522 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -2617,10 +2617,14 @@ returns the key sequence as a vector, never as a string. @cindex upper case key sequence @cindex downcasing in @code{lookup-key} @cindex shift-translation +@vindex translate-upper-case-key-bindings If an input character is upper-case (or has the shift modifier) and has no key binding, but its lower-case equivalent has one, then -@code{read-key-sequence} converts the character to lower case. Note -that @code{lookup-key} does not perform case conversion in this way. +@code{read-key-sequence} converts the character to lower case. (This +behaviour can be disabled by setting the +@code{translate-upper-case-key-bindings} user option to @code{nil}.) +Note that @code{lookup-key} does not perform case conversion in this +way. @vindex this-command-keys-shift-translated When reading input results in such a @dfn{shift-translation}, Emacs diff --git a/etc/NEWS b/etc/NEWS index 7deff1fa63..b039310afa 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -51,6 +51,11 @@ These forms now indent like this: This change also affects 'cl-macrolet', 'cl-flet*' and 'cl-symbol-macrolet'. ++++ +** New user option 'translate-upper-case-key-bindings'. +This can be set to nil to inhibit translating upper case keys to lower +case keys. + * Changes in Specialized Modes and Packages in Emacs 29.1 diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 1a3e5682bb..a46107a678 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -386,7 +386,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of (const :tag "When sent SIGUSR1" sigusr1) (const :tag "When sent SIGUSR2" sigusr2)) "24.1") - + (translate-upper-case-key-bindings keyboard boolean "29.1") ;; This is not good news because it will use the wrong ;; version-specific directories when you upgrade. We need ;; customization of the front of the list, maintaining the diff --git a/src/keyboard.c b/src/keyboard.c index bc6f97586d..4f3232dc46 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -10168,7 +10168,8 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt, use the corresponding lower-case letter instead. */ if (NILP (current_binding) && /* indec.start >= t && fkey.start >= t && */ keytran.start >= t - && FIXNUMP (key)) + && FIXNUMP (key) + && translate_upper_case_key_bindings) { Lisp_Object new_key; EMACS_INT k = XFIXNUM (key); @@ -10220,12 +10221,14 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt, int modifiers = CONSP (breakdown) ? (XFIXNUM (XCAR (XCDR (breakdown)))) : 0; - if (modifiers & shift_modifier - /* Treat uppercase keys as shifted. */ - || (FIXNUMP (key) - && (KEY_TO_CHAR (key) - < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->header.size) - && uppercasep (KEY_TO_CHAR (key)))) + if (translate_upper_case_key_bindings + && (modifiers & shift_modifier + /* Treat uppercase keys as shifted. */ + || (FIXNUMP (key) + && (KEY_TO_CHAR (key) + < XCHAR_TABLE (BVAR (current_buffer, + downcase_table))->header.size) + && uppercasep (KEY_TO_CHAR (key))))) { Lisp_Object new_key = (modifiers & shift_modifier @@ -12495,6 +12498,16 @@ If nil, Emacs crashes immediately in response to fatal signals. */); Vwhile_no_input_ignore_events, doc: /* Ignored events from while-no-input. */); + DEFVAR_BOOL ("translate-upper-case-key-bindings", + translate_upper_case_key_bindings, + doc: /* If non-nil, interpret upper case keys as lower case (when applicable). +Emacs allows binding both upper and lower case key sequences to +commands. However, if there is a lower case key sequence bound to a +command, and the user enters an upper case key sequence that is not +bound to a command, Emacs will use the lower case binding. Setting +this variable to nil inhibits this behaviour. */); + translate_upper_case_key_bindings = true; + pdumper_do_now_and_after_load (syms_of_keyboard_for_pdumper); } commit 39d9b96a606d1c605c329a6c7d1dab6afbd3b824 Author: Lars Ingebrigtsen Date: Mon Oct 4 11:56:23 2021 +0200 Remove MozRepl stuff from js.el * lisp/progmodes/js.el: Remove all the mozrepl stuff from js.el (bug#40771). diff --git a/etc/NEWS b/etc/NEWS index f7e52f6784..7deff1fa63 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -82,6 +82,11 @@ Emacs buffers, like indentation and the like. The new ert function * Incompatible Lisp Changes in Emacs 29.1 +--- +** MozRepl has been removed from js.el. +MozRepl was removed from Firefox in 2017, so this code doesn't work +with recent versions of Firefox. + * Lisp Changes in Emacs 29.1 diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 845ca8609d..f6603f86d5 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -33,7 +33,7 @@ ;; The main features of this JavaScript mode are syntactic ;; highlighting (enabled with `font-lock-mode' or ;; `global-font-lock-mode'), automatic indentation and filling of -;; comments, C preprocessor fontification, and MozRepl integration. +;; comments, and C preprocessor fontification. ;; ;; General Remarks: ;; @@ -51,7 +51,6 @@ (require 'cc-fonts)) (require 'newcomment) (require 'imenu) -(require 'moz nil t) (require 'json) (require 'prog-mode) @@ -59,12 +58,9 @@ (require 'cl-lib) (require 'ido)) -(defvar inferior-moz-buffer) -(defvar moz-repl-name) (defvar ido-cur-list) (defvar electric-layout-rules) (declare-function ido-mode "ido" (&optional arg)) -(declare-function inferior-moz-process "ext:mozrepl" ()) ;;; Constants @@ -485,25 +481,22 @@ seldom use, either globally or on a per-buffer basis." (list 'const x)) js--available-frameworks))) -(defcustom js-js-switch-tabs - (and (memq system-type '(darwin)) t) +(defvar js-js-switch-tabs (and (memq system-type '(darwin)) t) "Whether `js-mode' should display tabs while selecting them. This is useful only if the windowing system has a good mechanism -for preventing Firefox from stealing the keyboard focus." - :type 'boolean) +for preventing Firefox from stealing the keyboard focus.") +(make-obsolete-variable 'js-js-switch-tabs "MozRepl no longer exists" "28.1") -(defcustom js-js-tmpdir - (locate-user-emacs-file "js/js") +(defvar js-js-tmpdir (locate-user-emacs-file "js/js") "Temporary directory used by `js-mode' to communicate with Mozilla. -This directory must be readable and writable by both Mozilla and Emacs." - :type 'directory - :version "28.1") +This directory must be readable and writable by both Mozilla and Emacs.") +(make-obsolete-variable 'js-js-tmpdir "MozRepl no longer exists" "28.1") -(defcustom js-js-timeout 5 +(defvar js-js-timeout 5 "Reply timeout for executing commands in Mozilla via `js-mode'. The value is given in seconds. Increase this value if you are -getting timeout messages." - :type 'integer) +getting timeout messages.") +(make-obsolete-variable 'js-js-timeout "MozRepl no longer exists" "28.1") (defcustom js-indent-first-init nil "Non-nil means specially indent the first variable declaration's initializer. @@ -671,18 +664,7 @@ This variable is like `sgml-attribute-offset'." (defvar js-mode-map (let ((keymap (make-sparse-keymap))) - (define-key keymap [(control ?c) (meta ?:)] #'js-eval) - (define-key keymap [(control ?c) (control ?j)] #'js-set-js-context) - (define-key keymap [(control meta ?x)] #'js-eval-defun) (define-key keymap [(meta ?.)] #'js-find-symbol) - (easy-menu-define nil keymap "JavaScript Menu" - '("JavaScript" - ["Select New Mozilla Context..." js-set-js-context - (fboundp #'inferior-moz-process)] - ["Evaluate Expression in Mozilla Context..." js-eval - (fboundp #'inferior-moz-process)] - ["Send Current Function to Mozilla..." js-eval-defun - (fboundp #'inferior-moz-process)])) keymap) "Keymap for `js-mode'.") @@ -3336,1106 +3318,6 @@ current buffer. Pushes a mark onto the tag ring just like (push-mark) (goto-char marker))) -;;; MozRepl integration - -(define-error 'js-moz-bad-rpc "Mozilla RPC Error") ;; '(timeout error)) -(define-error 'js-js-error "JavaScript Error") ;; '(js-error error)) - -(defun js--wait-for-matching-output - (process regexp timeout &optional start) - "Wait TIMEOUT seconds for PROCESS to output a match for REGEXP. -On timeout, return nil. On success, return t with match data -set. If START is non-nil, look for output starting from START. -Otherwise, use the current value of `process-mark'." - (with-current-buffer (process-buffer process) - (cl-loop with start-pos = (or start - (marker-position (process-mark process))) - with end-time = (time-add nil timeout) - for time-left = (float-time (time-subtract end-time nil)) - do (goto-char (point-max)) - if (looking-back regexp start-pos) return t - while (> time-left 0) - do (accept-process-output process time-left nil t) - do (goto-char (process-mark process)) - finally do (signal - 'js-moz-bad-rpc - (list (format "Timed out waiting for output matching %S" regexp)))))) - -(cl-defstruct js--js-handle - ;; Integer, mirrors the value we see in JS - (id nil :read-only t) - - ;; Process to which this thing belongs - (process nil :read-only t)) - -(defun js--js-handle-expired-p (x) - (not (eq (js--js-handle-process x) - (inferior-moz-process)))) - -(defvar js--js-references nil - "Maps Elisp JavaScript proxy objects to their JavaScript IDs.") - -(defvar js--js-process nil - "The most recent MozRepl process object.") - -(defvar js--js-gc-idle-timer nil - "Idle timer for cleaning up JS object references.") - -(defvar js--js-last-gcs-done nil) - -(defconst js--moz-interactor - (replace-regexp-in-string - "[ \n]+" " " - ; */" Make Emacs happy -"(function(repl) { - repl.defineInteractor('js', { - onStart: function onStart(repl) { - if(!repl._jsObjects) { - repl._jsObjects = {}; - repl._jsLastID = 0; - repl._jsGC = this._jsGC; - } - this._input = ''; - }, - - _jsGC: function _jsGC(ids_in_use) { - var objects = this._jsObjects; - var keys = []; - var num_freed = 0; - - for(var pn in objects) { - keys.push(Number(pn)); - } - - keys.sort(function(x, y) x - y); - ids_in_use.sort(function(x, y) x - y); - var i = 0; - var j = 0; - - while(i < ids_in_use.length && j < keys.length) { - var id = ids_in_use[i++]; - while(j < keys.length && keys[j] !== id) { - var k_id = keys[j++]; - delete objects[k_id]; - ++num_freed; - } - ++j; - } - - while(j < keys.length) { - var k_id = keys[j++]; - delete objects[k_id]; - ++num_freed; - } - - return num_freed; - }, - - _mkArray: function _mkArray() { - var result = []; - for(var i = 0; i < arguments.length; ++i) { - result.push(arguments[i]); - } - return result; - }, - - _parsePropDescriptor: function _parsePropDescriptor(parts) { - if(typeof parts === 'string') { - parts = [ parts ]; - } - - var obj = parts[0]; - var start = 1; - - if(typeof obj === 'string') { - obj = window; - start = 0; - } else if(parts.length < 2) { - throw new Error('expected at least 2 arguments'); - } - - for(var i = start; i < parts.length - 1; ++i) { - obj = obj[parts[i]]; - } - - return [obj, parts[parts.length - 1]]; - }, - - _getProp: function _getProp(/*...*/) { - if(arguments.length === 0) { - throw new Error('no arguments supplied to getprop'); - } - - if(arguments.length === 1 && - (typeof arguments[0]) !== 'string') - { - return arguments[0]; - } - - var [obj, propname] = this._parsePropDescriptor(arguments); - return obj[propname]; - }, - - _putProp: function _putProp(properties, value) { - var [obj, propname] = this._parsePropDescriptor(properties); - obj[propname] = value; - }, - - _delProp: function _delProp(propname) { - var [obj, propname] = this._parsePropDescriptor(arguments); - delete obj[propname]; - }, - - _typeOf: function _typeOf(thing) { - return typeof thing; - }, - - _callNew: function(constructor) { - if(typeof constructor === 'string') - { - constructor = window[constructor]; - } else if(constructor.length === 1 && - typeof constructor[0] !== 'string') - { - constructor = constructor[0]; - } else { - var [obj,propname] = this._parsePropDescriptor(constructor); - constructor = obj[propname]; - } - - /* Hacky, but should be robust */ - var s = 'new constructor('; - for(var i = 1; i < arguments.length; ++i) { - if(i != 1) { - s += ','; - } - - s += 'arguments[' + i + ']'; - } - - s += ')'; - return eval(s); - }, - - _callEval: function(thisobj, js) { - return eval.call(thisobj, js); - }, - - getPrompt: function getPrompt(repl) { - return 'EVAL>' - }, - - _lookupObject: function _lookupObject(repl, id) { - if(typeof id === 'string') { - switch(id) { - case 'global': - return window; - case 'nil': - return null; - case 't': - return true; - case 'false': - return false; - case 'undefined': - return undefined; - case 'repl': - return repl; - case 'interactor': - return this; - case 'NaN': - return NaN; - case 'Infinity': - return Infinity; - case '-Infinity': - return -Infinity; - default: - throw new Error('No object with special id:' + id); - } - } - - var ret = repl._jsObjects[id]; - if(ret === undefined) { - throw new Error('No object with id:' + id + '(' + typeof id + ')'); - } - return ret; - }, - - _findOrAllocateObject: function _findOrAllocateObject(repl, value) { - if(typeof value !== 'object' && typeof value !== 'function') { - throw new Error('_findOrAllocateObject called on non-object(' - + typeof(value) + '): ' - + value) - } - - for(var id in repl._jsObjects) { - id = Number(id); - var obj = repl._jsObjects[id]; - if(obj === value) { - return id; - } - } - - var id = ++repl._jsLastID; - repl._jsObjects[id] = value; - return id; - }, - - _fixupList: function _fixupList(repl, list) { - for(var i = 0; i < list.length; ++i) { - if(list[i] instanceof Array) { - this._fixupList(repl, list[i]); - } else if(typeof list[i] === 'object') { - var obj = list[i]; - if(obj.funcall) { - var parts = obj.funcall; - this._fixupList(repl, parts); - var [thisobj, func] = this._parseFunc(parts[0]); - list[i] = func.apply(thisobj, parts.slice(1)); - } else if(obj.objid) { - list[i] = this._lookupObject(repl, obj.objid); - } else { - throw new Error('Unknown object type: ' + obj.toSource()); - } - } - } - }, - - _parseFunc: function(func) { - var thisobj = null; - - if(typeof func === 'string') { - func = window[func]; - } else if(func instanceof Array) { - if(func.length === 1 && typeof func[0] !== 'string') { - func = func[0]; - } else { - [thisobj, func] = this._parsePropDescriptor(func); - func = thisobj[func]; - } - } - - return [thisobj,func]; - }, - - _encodeReturn: function(value, array_as_mv) { - var ret; - - if(value === null) { - ret = ['special', 'null']; - } else if(value === true) { - ret = ['special', 'true']; - } else if(value === false) { - ret = ['special', 'false']; - } else if(value === undefined) { - ret = ['special', 'undefined']; - } else if(typeof value === 'number') { - if(isNaN(value)) { - ret = ['special', 'NaN']; - } else if(value === Infinity) { - ret = ['special', 'Infinity']; - } else if(value === -Infinity) { - ret = ['special', '-Infinity']; - } else { - ret = ['atom', value]; - } - } else if(typeof value === 'string') { - ret = ['atom', value]; - } else if(array_as_mv && value instanceof Array) { - ret = ['array', value.map(this._encodeReturn, this)]; - } else { - ret = ['objid', this._findOrAllocateObject(repl, value)]; - } - - return ret; - }, - - _handleInputLine: function _handleInputLine(repl, line) { - var ret; - var array_as_mv = false; - - try { - if(line[0] === '*') { - array_as_mv = true; - line = line.substring(1); - } - var parts = eval(line); - this._fixupList(repl, parts); - var [thisobj, func] = this._parseFunc(parts[0]); - ret = this._encodeReturn( - func.apply(thisobj, parts.slice(1)), - array_as_mv); - } catch(x) { - ret = ['error', x.toString() ]; - } - - var JSON = Components.classes['@mozilla.org/dom/json;1'].createInstance(Components.interfaces.nsIJSON); - repl.print(JSON.encode(ret)); - repl._prompt(); - }, - - handleInput: function handleInput(repl, chunk) { - this._input += chunk; - var match, line; - while(match = this._input.match(/.*\\n/)) { - line = match[0]; - - if(line === 'EXIT\\n') { - repl.popInteractor(); - repl._prompt(); - return; - } - - this._input = this._input.substring(line.length); - this._handleInputLine(repl, line); - } - } - }); -}) -") - - "String to set MozRepl up into a simple-minded evaluation mode.") - -(defun js--js-encode-value (x) - "Marshall the given value for JS. -Strings and numbers are JSON-encoded. Lists (including nil) are -made into JavaScript array literals and their contents encoded -with `js--js-encode-value'." - (cond ((or (stringp x) (numberp x)) (json-encode x)) - ((symbolp x) (format "{objid:%S}" (symbol-name x))) - ((js--js-handle-p x) - - (when (js--js-handle-expired-p x) - (error "Stale JS handle")) - - (format "{objid:%s}" (js--js-handle-id x))) - - ((sequencep x) - (if (eq (car-safe x) 'js--funcall) - (format "{funcall:[%s]}" - (mapconcat #'js--js-encode-value (cdr x) ",")) - (concat - "[" (mapconcat #'js--js-encode-value x ",") "]"))) - (t - (error "Unrecognized item: %S" x)))) - -(defconst js--js-prompt-regexp "\\(repl[0-9]*\\)> $") -(defconst js--js-repl-prompt-regexp "^EVAL>$") -(defvar js--js-repl-depth 0) - -(defun js--js-wait-for-eval-prompt () - (js--wait-for-matching-output - (inferior-moz-process) - js--js-repl-prompt-regexp js-js-timeout - - ;; start matching against the beginning of the line in - ;; order to catch a prompt that's only partially arrived - (save-excursion (forward-line 0) (point)))) - -;; Presumably "inferior-moz-process" loads comint. -(declare-function comint-send-string "comint" (process string)) -(declare-function comint-send-input "comint" - (&optional no-newline artificial)) - -(defun js--js-enter-repl () - (inferior-moz-process) ; called for side-effect - (with-current-buffer inferior-moz-buffer - (goto-char (point-max)) - - ;; Do some initialization the first time we see a process - (unless (eq (inferior-moz-process) js--js-process) - (setq js--js-process (inferior-moz-process)) - (setq js--js-references (make-hash-table :test 'eq :weakness t)) - (setq js--js-repl-depth 0) - - ;; Send interactor definition - (comint-send-string js--js-process js--moz-interactor) - (comint-send-string js--js-process - (concat "(" moz-repl-name ")\n")) - (js--wait-for-matching-output - (inferior-moz-process) js--js-prompt-regexp - js-js-timeout)) - - ;; Sanity check - (when (looking-back js--js-prompt-regexp - (save-excursion (forward-line 0) (point))) - (setq js--js-repl-depth 0)) - - (if (> js--js-repl-depth 0) - ;; If js--js-repl-depth > 0, we *should* be seeing an - ;; EVAL> prompt. If we don't, give Mozilla a chance to catch - ;; up with us. - (js--js-wait-for-eval-prompt) - - ;; Otherwise, tell Mozilla to enter the interactor mode - (insert (match-string-no-properties 1) - ".pushInteractor('js')") - (comint-send-input nil t) - (js--wait-for-matching-output - (inferior-moz-process) js--js-repl-prompt-regexp - js-js-timeout)) - - (cl-incf js--js-repl-depth))) - -(defun js--js-leave-repl () - (cl-assert (> js--js-repl-depth 0)) - (when (= 0 (cl-decf js--js-repl-depth)) - (with-current-buffer inferior-moz-buffer - (goto-char (point-max)) - (js--js-wait-for-eval-prompt) - (insert "EXIT") - (comint-send-input nil t) - (js--wait-for-matching-output - (inferior-moz-process) js--js-prompt-regexp - js-js-timeout)))) - -(defsubst js--js-not (value) - (memq value '(nil null false undefined))) - -(defsubst js--js-true (value) - (not (js--js-not value))) - -(eval-and-compile - (defun js--optimize-arglist (arglist) - "Convert immediate js< and js! references to deferred ones." - (cl-loop for item in arglist - if (eq (car-safe item) 'js<) - collect (append (list 'list ''js--funcall - '(list 'interactor "_getProp")) - (js--optimize-arglist (cdr item))) - else if (eq (car-safe item) 'js>) - collect (append (list 'list ''js--funcall - '(list 'interactor "_putProp")) - - (if (atom (cadr item)) - (list (cadr item)) - (list - (append - (list 'list ''js--funcall - '(list 'interactor "_mkArray")) - (js--optimize-arglist (cadr item))))) - (js--optimize-arglist (cddr item))) - else if (eq (car-safe item) 'js!) - collect (pcase-let ((`(,_ ,function . ,body) item)) - (append (list 'list ''js--funcall - (if (consp function) - (cons 'list - (js--optimize-arglist function)) - function)) - (js--optimize-arglist body))) - else - collect item))) - -(defmacro js--js-get-service (class-name interface-name) - `(js! ("Components" "classes" ,class-name "getService") - (js< "Components" "interfaces" ,interface-name))) - -(defmacro js--js-create-instance (class-name interface-name) - `(js! ("Components" "classes" ,class-name "createInstance") - (js< "Components" "interfaces" ,interface-name))) - -(defmacro js--js-qi (object interface-name) - `(js! (,object "QueryInterface") - (js< "Components" "interfaces" ,interface-name))) - -(defmacro with-js (&rest forms) - "Run FORMS with the Mozilla repl set up for js commands. -Inside the lexical scope of `with-js', `js?', `js!', -`js-new', `js-eval', `js-list', `js<', `js>', `js-get-service', -`js-create-instance', and `js-qi' are defined." - (declare (indent 0) (debug t)) - `(progn - (js--js-enter-repl) - (unwind-protect - (cl-macrolet ((js? (&rest body) `(js--js-true ,@body)) - (js! (function &rest body) - `(js--js-funcall - ,(if (consp function) - (cons 'list - (js--optimize-arglist function)) - function) - ,@(js--optimize-arglist body))) - - (js-new (function &rest body) - `(js--js-new - ,(if (consp function) - (cons 'list - (js--optimize-arglist function)) - function) - ,@body)) - - (js-eval (thisobj js) - `(js--js-eval - ,@(js--optimize-arglist - (list thisobj js)))) - - (js-list (&rest args) - `(js--js-list - ,@(js--optimize-arglist args))) - - (js-get-service (&rest args) - `(js--js-get-service - ,@(js--optimize-arglist args))) - - (js-create-instance (&rest args) - `(js--js-create-instance - ,@(js--optimize-arglist args))) - - (js-qi (&rest args) - `(js--js-qi - ,@(js--optimize-arglist args))) - - (js< (&rest body) `(js--js-get - ,@(js--optimize-arglist body))) - (js> (props value) - `(js--js-funcall - '(interactor "_putProp") - ,(if (consp props) - (cons 'list - (js--optimize-arglist props)) - props) - ,@(js--optimize-arglist (list value)) - )) - (js-handle? (arg) `(js--js-handle-p ,arg))) - ,@forms) - (js--js-leave-repl)))) - -(defvar js--js-array-as-list nil - "Whether to listify any Array returned by a Mozilla function. -If nil, the whole Array is treated as a JS symbol.") - -(defun js--js-decode-retval (result) - (pcase (intern (cl-first result)) - ('atom (cl-second result)) - ('special (intern (cl-second result))) - ('array - (mapcar #'js--js-decode-retval (cl-second result))) - ('objid - (or (gethash (cl-second result) - js--js-references) - (puthash (cl-second result) - (make-js--js-handle - :id (cl-second result) - :process (inferior-moz-process)) - js--js-references))) - - ('error (signal 'js-js-error (list (cl-second result)))) - (x (error "Unmatched case in js--js-decode-retval: %S" x)))) - -(defvar comint-last-input-end) - -(defun js--js-funcall (function &rest arguments) - "Call the Mozilla function FUNCTION with arguments ARGUMENTS. -If function is a string, look it up as a property on the global -object and use the global object for `this'. -If FUNCTION is a list with one element, use that element as the -function with the global object for `this', except that if that -single element is a string, look it up on the global object. -If FUNCTION is a list with more than one argument, use the list -up to the last value as a property descriptor and the last -argument as a function." - - (with-js - (let ((argstr (js--js-encode-value - (cons function arguments)))) - - (with-current-buffer inferior-moz-buffer - ;; Actual funcall - (when js--js-array-as-list - (insert "*")) - (insert argstr) - (comint-send-input nil t) - (js--wait-for-matching-output - (inferior-moz-process) "EVAL>" - js-js-timeout) - (goto-char comint-last-input-end) - - ;; Read the result - (let* ((json-array-type 'list) - (result (prog1 (json-read) - (goto-char (point-max))))) - (js--js-decode-retval result)))))) - -(defun js--js-new (constructor &rest arguments) - "Call CONSTRUCTOR as a constructor, with arguments ARGUMENTS. -CONSTRUCTOR is a JS handle, a string, or a list of these things." - (apply #'js--js-funcall - '(interactor "_callNew") - constructor arguments)) - -(defun js--js-eval (thisobj js) - (js--js-funcall '(interactor "_callEval") thisobj js)) - -(defun js--js-list (&rest arguments) - "Return a Lisp array resulting from evaluating each of ARGUMENTS." - (let ((js--js-array-as-list t)) - (apply #'js--js-funcall '(interactor "_mkArray") - arguments))) - -(defun js--js-get (&rest props) - (apply #'js--js-funcall '(interactor "_getProp") props)) - -(defun js--js-put (props value) - (js--js-funcall '(interactor "_putProp") props value)) - -(defun js-gc (&optional force) - "Tell the repl about any objects we don't reference anymore. -With argument, run even if no intervening GC has happened." - (interactive) - - (when force - (setq js--js-last-gcs-done nil)) - - (let ((this-gcs-done gcs-done) keys num) - (when (and js--js-references - (boundp 'inferior-moz-buffer) - (buffer-live-p inferior-moz-buffer) - - ;; Don't bother running unless we've had an intervening - ;; garbage collection; without a gc, nothing is deleted - ;; from the weak hash table, so it's pointless telling - ;; MozRepl about that references we still hold - (not (eq js--js-last-gcs-done this-gcs-done)) - - ;; Are we looking at a normal prompt? Make sure not to - ;; interrupt the user if he's doing something - (with-current-buffer inferior-moz-buffer - (save-excursion - (goto-char (point-max)) - (looking-back js--js-prompt-regexp - (save-excursion (forward-line 0) (point)))))) - - (setq keys (cl-loop for x being the hash-keys - of js--js-references - collect x)) - (setq num (js--js-funcall '(repl "_jsGC") (or keys []))) - - (setq js--js-last-gcs-done this-gcs-done) - (when (called-interactively-p 'interactive) - (message "Cleaned %s entries" num)) - - num))) - -(run-with-idle-timer 30 t #'js-gc) - -(defun js-eval (js) - "Evaluate the JavaScript in JS and return JSON-decoded result." - (interactive "MJavaScript to evaluate: ") - (with-js - (let* ((content-window (js--js-content-window - (js--get-js-context))) - (result (js-eval content-window js))) - (when (called-interactively-p 'interactive) - (message "%s" (js! "String" result))) - result))) - -(defun js--get-tabs () - "Enumerate all JavaScript contexts available. -Each context is a list: - (TITLE URL BROWSER TAB TABBROWSER) for content documents - (TITLE URL WINDOW) for windows - -All tabs of a given window are grouped together. The most recent -window is first. Within each window, the tabs are returned -left-to-right." - (with-js - (let (windows) - - (cl-loop with window-mediator = (js! ("Components" "classes" - "@mozilla.org/appshell/window-mediator;1" - "getService") - (js< "Components" "interfaces" - "nsIWindowMediator")) - with enumerator = (js! (window-mediator "getEnumerator") nil) - - while (js? (js! (enumerator "hasMoreElements"))) - for window = (js! (enumerator "getNext")) - for window-info = (js-list window - (js< window "document" "title") - (js! (window "location" "toString")) - (js< window "closed") - (js< window "windowState")) - - unless (or (js? (cl-fourth window-info)) - (eq (cl-fifth window-info) 2)) - do (push window-info windows)) - - (cl-loop for (window title location) in windows - collect (list title location window) - - for gbrowser = (js< window "gBrowser") - if (js-handle? gbrowser) - nconc (cl-loop - for x below (js< gbrowser "browsers" "length") - collect (js-list (js< gbrowser - "browsers" - x - "contentDocument" - "title") - - (js! (gbrowser - "browsers" - x - "contentWindow" - "location" - "toString")) - (js< gbrowser - "browsers" - x) - - (js! (gbrowser - "tabContainer" - "childNodes" - "item") - x) - - gbrowser)))))) - -(defvar js-read-tab-history nil) - -(declare-function ido-chop "ido" (items elem)) - -(defun js--read-tab (prompt) - "Read a Mozilla tab with prompt PROMPT. -Return a cons of (TYPE . OBJECT). TYPE is either `window' or -`tab', and OBJECT is a JavaScript handle to a ChromeWindow or a -browser, respectively." - - ;; Prime IDO - (unless ido-mode - (ido-mode 1) - (ido-mode -1)) - - (with-js - (let ((tabs (js--get-tabs)) selected-tab-cname - selected-tab prev-hitab) - - ;; Disambiguate names - (setq tabs - (cl-loop with tab-names = (make-hash-table :test 'equal) - for tab in tabs - for cname = (format "%s (%s)" - (cl-second tab) (cl-first tab)) - for num = (cl-incf (gethash cname tab-names -1)) - if (> num 0) - do (setq cname (format "%s <%d>" cname num)) - collect (cons cname tab))) - - (cl-labels - ((find-tab-by-cname - (cname) - (cl-loop for tab in tabs - if (equal (car tab) cname) - return (cdr tab))) - - (mogrify-highlighting - (hitab unhitab) - - ;; Hack to reduce the number of - ;; round-trips to mozilla - (let (cmds) - (cond - ;; Highlighting tab - ((cl-fourth hitab) - (push '(js! ((cl-fourth hitab) "setAttribute") - "style" - "color: red; font-weight: bold") - cmds) - - ;; Highlight window proper - (push '(js! ((cl-third hitab) - "setAttribute") - "style" - "border: 8px solid red") - cmds) - - ;; Select tab, when appropriate - (when js-js-switch-tabs - (push - '(js> ((cl-fifth hitab) "selectedTab") (cl-fourth hitab)) - cmds))) - - ;; Highlighting whole window - ((cl-third hitab) - (push '(js! ((cl-third hitab) "document" - "documentElement" "setAttribute") - "style" - (concat "-moz-appearance: none;" - "border: 8px solid red;")) - cmds))) - - (cond - ;; Unhighlighting tab - ((cl-fourth unhitab) - (push '(js! ((cl-fourth unhitab) "setAttribute") "style" "") - cmds) - (push '(js! ((cl-third unhitab) "setAttribute") "style" "") - cmds)) - - ;; Unhighlighting window - ((cl-third unhitab) - (push '(js! ((cl-third unhitab) "document" - "documentElement" "setAttribute") - "style" "") - cmds))) - - (eval `(with-js - (js-list ,@(nreverse cmds))) - t))) - - (command-hook - () - (let* ((tab (find-tab-by-cname (car ido-matches)))) - (mogrify-highlighting tab prev-hitab) - (setq prev-hitab tab))) - - (setup-hook - () - ;; Fiddle with the match list a bit: if our first match - ;; is a tabbrowser window, rotate the match list until - ;; the active tab comes up - (let ((matched-tab (find-tab-by-cname (car ido-matches)))) - (when (and matched-tab - (null (cl-fourth matched-tab)) - (equal "navigator:browser" - (js! ((cl-third matched-tab) - "document" - "documentElement" - "getAttribute") - "windowtype"))) - - (cl-loop with tab-to-match = (js< (cl-third matched-tab) - "gBrowser" - "selectedTab") - - for match in ido-matches - for candidate-tab = (find-tab-by-cname match) - if (eq (cl-fourth candidate-tab) tab-to-match) - do (setq ido-cur-list - (ido-chop ido-cur-list match)) - and return t))) - - (add-hook 'post-command-hook #'command-hook t t))) - - - (unwind-protect - ;; FIXME: Don't impose IDO on the user. - (setq selected-tab-cname - (let ((ido-minibuffer-setup-hook - (cons #'setup-hook ido-minibuffer-setup-hook))) - (ido-completing-read - prompt - (mapcar #'car tabs) - nil t nil - 'js-read-tab-history))) - - (when prev-hitab - (mogrify-highlighting nil prev-hitab) - (setq prev-hitab nil))) - - (add-to-history 'js-read-tab-history selected-tab-cname) - - (setq selected-tab (cl-loop for tab in tabs - if (equal (car tab) selected-tab-cname) - return (cdr tab))) - - (cons (if (cl-fourth selected-tab) 'browser 'window) - (cl-third selected-tab)))))) - -(defun js--guess-eval-defun-info (pstate) - "Helper function for `js-eval-defun'. -Return a list (NAME . CLASSPARTS), where CLASSPARTS is a list of -strings making up the class name and NAME is the name of the -function part." - (cond ((and (= (length pstate) 3) - (eq (js--pitem-type (cl-first pstate)) 'function) - (= (length (js--pitem-name (cl-first pstate))) 1) - (consp (js--pitem-type (cl-second pstate)))) - - (append (js--pitem-name (cl-second pstate)) - (list (cl-first (js--pitem-name (cl-first pstate)))))) - - ((and (= (length pstate) 2) - (eq (js--pitem-type (cl-first pstate)) 'function)) - - (append - (butlast (js--pitem-name (cl-first pstate))) - (list (car (last (js--pitem-name (cl-first pstate))))))) - - (t (error "Function not a toplevel defun or class member")))) - -(defvar js--js-context nil - "The current JavaScript context. -This is a cons like the one returned from `js--read-tab'. -Change with `js-set-js-context'.") - -(defconst js--js-inserter - "(function(func_info,func) { - func_info.unshift('window'); - var obj = window; - for(var i = 1; i < func_info.length - 1; ++i) { - var next = obj[func_info[i]]; - if(typeof next !== 'object' && typeof next !== 'function') { - next = obj.prototype && obj.prototype[func_info[i]]; - if(typeof next !== 'object' && typeof next !== 'function') { - alert('Could not find ' + func_info.slice(0, i+1).join('.') + - ' or ' + func_info.slice(0, i+1).join('.') + '.prototype'); - return; - } - - func_info.splice(i+1, 0, 'prototype'); - ++i; - } - } - - obj[func_info[i]] = func; - alert('Successfully updated '+func_info.join('.')); - })") - -(defun js-set-js-context (context) - "Set the JavaScript context to CONTEXT. -When called interactively, prompt for CONTEXT." - (interactive (list (js--read-tab "JavaScript Context: "))) - (setq js--js-context context)) - -(defun js--get-js-context () - "Return a valid JavaScript context. -If one hasn't been set, or if it's stale, prompt for a new one." - (with-js - (when (or (null js--js-context) - (js--js-handle-expired-p (cdr js--js-context)) - (pcase (car js--js-context) - ('window (js? (js< (cdr js--js-context) "closed"))) - ('browser (not (js? (js< (cdr js--js-context) - "contentDocument")))) - (x (error "Unmatched case in js--get-js-context: %S" x)))) - (setq js--js-context (js--read-tab "JavaScript Context: "))) - js--js-context)) - -(defun js--js-content-window (context) - (with-js - (pcase (car context) - ('window (cdr context)) - ('browser (js< (cdr context) - "contentWindow" "wrappedJSObject")) - (x (error "Unmatched case in js--js-content-window: %S" x))))) - -(defun js--make-nsilocalfile (path) - (with-js - (let ((file (js-create-instance "@mozilla.org/file/local;1" - "nsILocalFile"))) - (js! (file "initWithPath") path) - file))) - -(defun js--js-add-resource-alias (alias path) - (with-js - (let* ((io-service (js-get-service "@mozilla.org/network/io-service;1" - "nsIIOService")) - (res-prot (js! (io-service "getProtocolHandler") "resource")) - (res-prot (js-qi res-prot "nsIResProtocolHandler")) - (path-file (js--make-nsilocalfile path)) - (path-uri (js! (io-service "newFileURI") path-file))) - (js! (res-prot "setSubstitution") alias path-uri)))) - -(cl-defun js-eval-defun () - "Update a Mozilla tab using the JavaScript defun at point." - (interactive) - - ;; This function works by generating a temporary file that contains - ;; the function we'd like to insert. We then use the elisp-js bridge - ;; to command mozilla to load this file by inserting a script tag - ;; into the document we set. This way, debuggers and such will have - ;; a way to find the source of the just-inserted function. - ;; - ;; We delete the temporary file if there's an error, but otherwise - ;; we add an unload event listener on the Mozilla side to delete the - ;; file. - - (save-excursion - (let (begin end pstate defun-info temp-name defun-body) - (js-end-of-defun) - (setq end (point)) - (js--ensure-cache) - (js-beginning-of-defun) - (re-search-forward "\\_") - (setq begin (match-beginning 0)) - (setq pstate (js--forward-pstate)) - - (when (or (null pstate) - (> (point) end)) - (error "Could not locate function definition")) - - (setq defun-info (js--guess-eval-defun-info pstate)) - - (let ((overlay (make-overlay begin end))) - (overlay-put overlay 'face 'highlight) - (unwind-protect - (unless (y-or-n-p (format "Send %s to Mozilla? " - (mapconcat #'identity defun-info "."))) - (message "") ; question message lingers until next command - (cl-return-from js-eval-defun)) - (delete-overlay overlay))) - - (setq defun-body (buffer-substring-no-properties begin end)) - - (make-directory js-js-tmpdir t) - - ;; (Re)register a Mozilla resource URL to point to the - ;; temporary directory - (js--js-add-resource-alias "js" js-js-tmpdir) - - (setq temp-name (make-temp-file (concat js-js-tmpdir - "/js-") - nil ".js")) - (unwind-protect - (with-js - (with-temp-buffer - (insert js--js-inserter) - (insert "(") - (let ((standard-output (current-buffer))) - (json--print-list defun-info)) - (insert ",\n") - (insert defun-body) - (insert "\n)") - (write-region (point-min) (point-max) temp-name - nil 1)) - - ;; Give Mozilla responsibility for deleting this file - (let* ((content-window (js--js-content-window - (js--get-js-context))) - (content-document (js< content-window "document")) - (head (if (js? (js< content-document "body")) - ;; Regular content - (js< (js! (content-document "getElementsByTagName") - "head") - 0) - ;; Chrome - (js< content-document "documentElement"))) - (elem (js! (content-document "createElementNS") - "http://www.w3.org/1999/xhtml" "script"))) - - (js! (elem "setAttribute") "type" "text/javascript") - (js! (elem "setAttribute") "src" - (format "resource://js/%s" - (file-name-nondirectory temp-name))) - - (js! (head "appendChild") elem) - - (js! (content-window "addEventListener") "unload" - (js! ((js-new - "Function" "file" - "return function() { file.remove(false) }")) - (js--make-nsilocalfile temp-name)) - 'false) - (setq temp-name nil) - - - - )) - - ;; temp-name is set to nil on success - (when temp-name - (delete-file temp-name)))))) - ;;; Syntax extensions (defvar js-syntactic-mode-name t commit 60e817e78dfc8eeea3fdd95f7706ebd33fc0c63f Author: Carlos Pita Date: Mon Oct 4 11:43:17 2021 +0200 Avoid a warning in python-eldoc-setup-code * lisp/progmodes/python.el (python-eldoc-setup-code): Avoid a deprecation warning about formatargspec (bug#50996). diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index c58ac6f637..43ee3c0c15 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -4671,7 +4671,10 @@ See `python-check-command' for the default." target = obj objtype = 'def' if target: - args = inspect.formatargspec(*argspec_function(target)) + if hasattr(inspect, 'signature'): + args = str(inspect.signature(target)) + else: + args = inspect.formatargspec(*argspec_function(target)) name = obj.__name__ doc = '{objtype} {name}{args}'.format( objtype=objtype, name=name, args=args commit 1428962590e216163f079ff838f39667383aec56 Author: Gregory Heytings Date: Mon Oct 4 11:18:07 2021 +0200 Fix problem with outputting error messages while dumping Emacs * src/print.c (print_error_message): Don't call substitute-command-keys while bootstrapping. diff --git a/src/print.c b/src/print.c index d4301fd7b6..7f0bc3f364 100644 --- a/src/print.c +++ b/src/print.c @@ -941,7 +941,13 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context, else { Lisp_Object error_conditions = Fget (errname, Qerror_conditions); - errmsg = call1 (Qsubstitute_command_keys, Fget (errname, Qerror_message)); + /* Calling `substitute-command-keys' while bootstrapping will make + Emacs exit, so don't do that. */ + if (will_bootstrap_p () || will_dump_p ()) + errmsg = Fget (errname, Qerror_message); + else + errmsg = call1 (Qsubstitute_command_keys, + Fget (errname, Qerror_message)); file_error = Fmemq (Qfile_error, error_conditions); } commit 3a9d5f04fb23cc89797f5d5102607c790440201e Author: Lars Ingebrigtsen Date: Mon Oct 4 11:09:38 2021 +0200 Mention ffap-file-name-with-spaces in the ffap doc strin * lisp/ffap.el (find-file-at-point): Mention ffap-file-name-with-spaces in the doc string. diff --git a/lisp/ffap.el b/lisp/ffap.el index db38016427..964daaaa15 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -1639,8 +1639,9 @@ If `ffap-url-regexp' is not nil, the FILENAME may also be an URL. With a prefix, this command behaves exactly like `ffap-file-finder'. If `ffap-require-prefix' is set, the prefix meaning is reversed. See also the variables `ffap-dired-wildcards', `ffap-newfile-prompt', -`ffap-url-unwrap-local', `ffap-url-unwrap-remote', and the functions -`ffap-file-at-point' and `ffap-url-at-point'." +`ffap-url-unwrap-local', `ffap-url-unwrap-remote', +`ffap-file-name-with-spaces', and the functions `ffap-file-at-point' +and `ffap-url-at-point'." (interactive) (if (and (called-interactively-p 'interactive) (if ffap-require-prefix (not current-prefix-arg) commit b421e086cad435977b76e940e7e0bfb8b7db2ac9 Author: Lars Ingebrigtsen Date: Mon Oct 4 10:53:39 2021 +0200 Allow computing :doc-spec info-look elements at run time * lisp/info-look.el (info-lookup--expand-info): New function. (:mode, info-lookup-add-help): Adjust doc string. (info-lookup-add-help*): Allow adding a dynamic expansion. (info-lookup): Expand. (:mode): Use a dynamic expansion for Python to postpone the lookup. (info-complete): Expand. diff --git a/etc/NEWS b/etc/NEWS index 4991a93251..f7e52f6784 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -61,6 +61,11 @@ This change also affects 'cl-macrolet', 'cl-flet*' and The new command 'image-dired-unmark-all-marks' has been added with a binding in the menu. +--- +*** info-look specs can now be expanded at run time instead of a load time. +The new ':doc-spec-function' element can be used to compute the +':doc-spec' element when the user asks for info on that particular +mode (instead of at load time). ** subr-x *** New macro 'with-memoization' provides a very primitive form of memoization diff --git a/lisp/info-look.el b/lisp/info-look.el index 7cc5462dd4..309f2e8d63 100644 --- a/lisp/info-look.el +++ b/lisp/info-look.el @@ -124,6 +124,14 @@ OTHER-MODES is a list of cross references to other help modes.") (defsubst info-lookup->mode-value (topic mode) (assoc mode (info-lookup->topic-value topic))) +(defun info-lookup--expand-info (info) + ;; We have a dynamic doc-spec function. + (when (and (null (nth 3 info)) + (nth 6 info)) + (setf (nth 3 info) (funcall (nth 6 info)) + (nth 6 info) nil)) + info) + (defsubst info-lookup->regexp (topic mode) (nth 1 (info-lookup->mode-value topic mode))) @@ -146,7 +154,11 @@ Function arguments are specified as keyword/argument pairs: (KEYWORD . ARGUMENT) KEYWORD is either `:topic', `:mode', `:regexp', `:ignore-case', - `:doc-spec', `:parse-rule', or `:other-modes'. + `:doc-spec', `:parse-rule', `:other-modes' or `:doc-spec-function'. + `:doc-spec-function' is used to compute a `:doc-spec', but instead of + doing so at load time, this is done when the user asks for info on + the mode in question. + ARGUMENT has a value as explained in the documentation of the variable `info-lookup-alist'. @@ -162,7 +174,8 @@ for more details." (defun info-lookup-add-help* (maybe &rest arg) (let (topic mode regexp ignore-case doc-spec - parse-rule other-modes keyword value) + parse-rule other-modes keyword value + doc-spec-function) (setq topic 'symbol mode major-mode regexp "\\w+") @@ -185,6 +198,8 @@ for more details." (setq ignore-case value)) ((eq keyword :doc-spec) (setq doc-spec value)) + ((eq keyword :doc-spec-function) + (setq doc-spec-function value)) ((eq keyword :parse-rule) (setq parse-rule value)) ((eq keyword :other-modes) @@ -192,7 +207,8 @@ for more details." (t (error "Unknown keyword \"%S\"" keyword)))) (or (and maybe (info-lookup->mode-value topic mode)) - (let* ((data (list regexp ignore-case doc-spec parse-rule other-modes)) + (let* ((data (list regexp ignore-case doc-spec parse-rule other-modes + doc-spec-function)) (topic-cell (or (assoc topic info-lookup-alist) (car (setq info-lookup-alist (cons (cons topic nil) @@ -345,8 +361,9 @@ If optional argument QUERY is non-nil, query for the help mode." (defun info-lookup (topic item mode) "Display the documentation of a help item." (or mode (setq mode (info-lookup-select-mode))) - (or (info-lookup->mode-value topic mode) - (error "No %s help available for `%s'" topic mode)) + (if-let ((info (info-lookup->mode-value topic mode))) + (info-lookup--expand-info info) + (error "No %s help available for `%s'" topic mode)) (let* ((completions (info-lookup->completions topic mode)) (ignore-case (info-lookup->ignore-case topic mode)) (entry (or (assoc (if ignore-case (downcase item) item) completions) @@ -725,6 +742,8 @@ Return nil if there is nothing appropriate in the buffer near point." (defun info-complete (topic mode) "Try to complete a help item." (barf-if-buffer-read-only) + (when-let ((info (info-lookup->mode-value topic mode))) + (info-lookup--expand-info info)) (let ((data (info-lookup-completions-at-point topic mode))) (if (null data) (error "No %s completion available for `%s' at point" topic mode) @@ -907,11 +926,14 @@ Return nil if there is nothing appropriate in the buffer near point." :mode 'python-mode ;; Debian includes Python info files, but they're version-named ;; instead of having a symlink. - :doc-spec `((,(cl-loop for version from 20 downto 7 - for name = (format "python3.%d" version) - if (Info-find-file name t) - return (format "(%s)Index" name) - finally return "(python)Index")))) + :doc-spec-function (lambda () + (list + (list + (cl-loop for version from 20 downto 7 + for name = (format "python3.%d" version) + if (Info-find-file name t) + return (format "(%s)Index" name) + finally return "(python)Index"))))) (info-lookup-maybe-add-help :mode 'cperl-mode commit ef6c43b896bb50ca76e1c79ac6185d95169520f4 Author: Lars Ingebrigtsen Date: Mon Oct 4 10:23:18 2021 +0200 Revert "Make info-look search harder for the Python info file" This reverts commit 711eb40b9b9e2aabd0e23ec264e8e8f913329d33. This leads to loading info-look being excessively slow if the info path is long. It'll be reimplemented in Emacs 29. diff --git a/lisp/info-look.el b/lisp/info-look.el index 7cc5462dd4..cc6a806f56 100644 --- a/lisp/info-look.el +++ b/lisp/info-look.el @@ -43,7 +43,6 @@ (require 'info) (eval-when-compile (require 'subr-x)) -(eval-when-compile (require 'cl-lib)) (defgroup info-lookup nil "Major mode sensitive help agent." @@ -905,13 +904,9 @@ Return nil if there is nothing appropriate in the buffer near point." (info-lookup-maybe-add-help :mode 'python-mode - ;; Debian includes Python info files, but they're version-named - ;; instead of having a symlink. - :doc-spec `((,(cl-loop for version from 20 downto 7 - for name = (format "python3.%d" version) - if (Info-find-file name t) - return (format "(%s)Index" name) - finally return "(python)Index")))) + :doc-spec `((,(if (Info-find-file "python3.9" t) + "(python3.9)Index" + "(python)Index")))) (info-lookup-maybe-add-help :mode 'cperl-mode commit 84192b6716f4ee66787ea319bcdb37211eb5add2 Author: Lars Ingebrigtsen Date: Mon Oct 4 10:17:03 2021 +0200 Update NEWS for 'define-keymap' diff --git a/etc/NEWS b/etc/NEWS index 20ed20308e..4991a93251 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -85,6 +85,14 @@ Emacs buffers, like indentation and the like. The new ert function Using 'make-obsolete' on a theme is now supported. This will make 'load-theme' issue a warning when loading the theme. ++++ +** New function 'define-keymap'. +This function allows defining a number of keystrokes with one form. + ++++ +** New macro 'defvar-keymap'. +This macro allows defining keymap variables more conveniently. + * Changes in Emacs 29.1 on Non-Free Operating Systems commit 859190f03e87601324d394178d90e6dea5cd4002 Author: Lars Ingebrigtsen Date: Mon Oct 4 10:15:04 2021 +0200 Convert some keymaps to defvar-keymap * lisp/simple.el (special-mode-map): * lisp/net/shr.el (shr-map): * lisp/net/eww.el (eww-link-keymap): (eww-mode-map): (eww-submit-map): (eww-bookmark-mode-map): (eww-history-mode-map): (eww-buffers-mode-map): * lisp/gnus/message.el (message-mode-map): Use defvar-keymap. * lisp/gnus/gnus-eform.el (gnus-edit-form-mode-map): * lisp/gnus/gnus-dired.el (gnus-dired-mode-map): * lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-mode-map): Use defvar-keymap. * lisp/gnus/gnus-group.el (gnus-group-mode-map): Use define-keymap. * lisp/gnus/gnus-html.el (gnus-html-image-map): Use defvar-keymap. * lisp/gnus/gnus.el: Autoload gnus-score-edit-all-score. diff --git a/lisp/gnus/gnus-bookmark.el b/lisp/gnus/gnus-bookmark.el index 83e482f14c..a6b1a0762b 100644 --- a/lisp/gnus/gnus-bookmark.el +++ b/lisp/gnus/gnus-bookmark.el @@ -418,32 +418,28 @@ That is, all information but the name." (defvar gnus-bookmark-bmenu-bookmark-column nil) (defvar gnus-bookmark-bmenu-hidden-bookmarks ()) -(defvar gnus-bookmark-bmenu-mode-map nil) - -(if gnus-bookmark-bmenu-mode-map - nil - (setq gnus-bookmark-bmenu-mode-map (make-keymap)) - (suppress-keymap gnus-bookmark-bmenu-mode-map t) - (define-key gnus-bookmark-bmenu-mode-map "q" 'quit-window) - (define-key gnus-bookmark-bmenu-mode-map "\C-m" 'gnus-bookmark-bmenu-select) - (define-key gnus-bookmark-bmenu-mode-map "v" 'gnus-bookmark-bmenu-select) - (define-key gnus-bookmark-bmenu-mode-map "d" 'gnus-bookmark-bmenu-delete) - (define-key gnus-bookmark-bmenu-mode-map "k" 'gnus-bookmark-bmenu-delete) - (define-key gnus-bookmark-bmenu-mode-map "\C-d" 'gnus-bookmark-bmenu-delete-backwards) - (define-key gnus-bookmark-bmenu-mode-map "x" 'gnus-bookmark-bmenu-execute-deletions) - (define-key gnus-bookmark-bmenu-mode-map " " 'next-line) - (define-key gnus-bookmark-bmenu-mode-map "n" 'next-line) - (define-key gnus-bookmark-bmenu-mode-map "p" 'previous-line) - (define-key gnus-bookmark-bmenu-mode-map "\177" 'gnus-bookmark-bmenu-backup-unmark) - (define-key gnus-bookmark-bmenu-mode-map "?" 'describe-mode) - (define-key gnus-bookmark-bmenu-mode-map "u" 'gnus-bookmark-bmenu-unmark) - (define-key gnus-bookmark-bmenu-mode-map "m" 'gnus-bookmark-bmenu-mark) - (define-key gnus-bookmark-bmenu-mode-map "l" 'gnus-bookmark-bmenu-load) - (define-key gnus-bookmark-bmenu-mode-map "s" 'gnus-bookmark-bmenu-save) - (define-key gnus-bookmark-bmenu-mode-map "t" 'gnus-bookmark-bmenu-toggle-infos) - (define-key gnus-bookmark-bmenu-mode-map "a" 'gnus-bookmark-bmenu-show-details) - (define-key gnus-bookmark-bmenu-mode-map [mouse-2] - 'gnus-bookmark-bmenu-select-by-mouse)) + +(defvar-keymap gnus-bookmark-bmenu-mode-map (:full t + :suppress 'nodigits) + "q" #'quit-window + "\C-m" #'gnus-bookmark-bmenu-select + "v" #'gnus-bookmark-bmenu-select + "d" #'gnus-bookmark-bmenu-delete + "k" #'gnus-bookmark-bmenu-delete + "\C-d" #'gnus-bookmark-bmenu-delete-backwards + "x" #'gnus-bookmark-bmenu-execute-deletions + " " #'next-line + "n" #'next-line + "p" #'previous-line + "\177" #'gnus-bookmark-bmenu-backup-unmark + "?" #'describe-mode + "u" #'gnus-bookmark-bmenu-unmark + "m" #'gnus-bookmark-bmenu-mark + "l" #'gnus-bookmark-bmenu-load + "s" #'gnus-bookmark-bmenu-save + "t" #'gnus-bookmark-bmenu-toggle-infos + "a" #'gnus-bookmark-bmenu-show-details + [mouse-2] #'gnus-bookmark-bmenu-select-by-mouse) ;; Bookmark Buffer Menu mode is suitable only for specially formatted ;; data. diff --git a/lisp/gnus/gnus-dired.el b/lisp/gnus/gnus-dired.el index e9eddae942..08a4289714 100644 --- a/lisp/gnus/gnus-dired.el +++ b/lisp/gnus/gnus-dired.el @@ -53,12 +53,10 @@ (autoload 'message-buffers "message") (autoload 'gnus-print-buffer "gnus-sum") -(defvar gnus-dired-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "\C-c\C-m\C-a" 'gnus-dired-attach) - (define-key map "\C-c\C-m\C-l" 'gnus-dired-find-file-mailcap) - (define-key map "\C-c\C-m\C-p" 'gnus-dired-print) - map)) +(defvar-keymap gnus-dired-mode-map () + "\C-c\C-m\C-a" #'gnus-dired-attach + "\C-c\C-m\C-l" #'gnus-dired-find-file-mailcap + "\C-c\C-m\C-p" #'gnus-dired-print) ;; FIXME: Make it customizable, change the default to `mail-user-agent' when ;; this file is renamed (e.g. to `dired-mime.el'). diff --git a/lisp/gnus/gnus-eform.el b/lisp/gnus/gnus-eform.el index 3fd8bf51de..922e25e277 100644 --- a/lisp/gnus/gnus-eform.el +++ b/lisp/gnus/gnus-eform.el @@ -48,13 +48,9 @@ (defvar gnus-edit-form-buffer "*Gnus edit form*") (defvar gnus-edit-form-done-function nil) -(defvar gnus-edit-form-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map emacs-lisp-mode-map) - (gnus-define-keys map - "\C-c\C-c" gnus-edit-form-done - "\C-c\C-k" gnus-edit-form-exit) - map)) +(defvar-keymap gnus-edit-form-mode-map (:parent emacs-lisp-mode-map) + "\C-c\C-c" #'gnus-edit-form-done + "\C-c\C-k" #'gnus-edit-form-exit) (defun gnus-edit-form-make-menu-bar () (unless (boundp 'gnus-edit-form-menu) diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index b1e486b062..7c879741cf 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -573,209 +573,209 @@ simple manner." ;;; Gnus group mode ;;; -(gnus-define-keys gnus-group-mode-map - " " gnus-group-read-group - "=" gnus-group-select-group - "\r" gnus-group-select-group - "\M-\r" gnus-group-quick-select-group - "\M- " gnus-group-visible-select-group - [(meta control return)] gnus-group-select-group-ephemerally - "j" gnus-group-jump-to-group - "n" gnus-group-next-unread-group - "p" gnus-group-prev-unread-group - "\177" gnus-group-prev-unread-group - [delete] gnus-group-prev-unread-group - "N" gnus-group-next-group - "P" gnus-group-prev-group - "\M-n" gnus-group-next-unread-group-same-level - "\M-p" gnus-group-prev-unread-group-same-level - "," gnus-group-best-unread-group - "." gnus-group-first-unread-group - "u" gnus-group-toggle-subscription-at-point - "U" gnus-group-toggle-subscription - "c" gnus-group-catchup-current - "C" gnus-group-catchup-current-all - "\M-c" gnus-group-clear-data - "l" gnus-group-list-groups - "L" gnus-group-list-all-groups - "m" gnus-group-mail - "i" gnus-group-news - "g" gnus-group-get-new-news - "\M-g" gnus-group-get-new-news-this-group - "R" gnus-group-restart - "r" gnus-group-read-init-file - "B" gnus-group-browse-foreign-server - "b" gnus-group-check-bogus-groups - "F" gnus-group-find-new-groups - "\C-c\C-d" gnus-group-describe-group - "\M-d" gnus-group-describe-all-groups - "\C-c\C-a" gnus-group-apropos - "\C-c\M-\C-a" gnus-group-description-apropos - "a" gnus-group-post-news - "\ek" gnus-group-edit-local-kill - "\eK" gnus-group-edit-global-kill - "\C-k" gnus-group-kill-group - "\C-y" gnus-group-yank-group - "\C-w" gnus-group-kill-region - "\C-x\C-t" gnus-group-transpose-groups - "\C-c\C-l" gnus-group-list-killed - "\C-c\C-x" gnus-group-expire-articles - "\C-c\M-\C-x" gnus-group-expire-all-groups - "V" gnus-version - "s" gnus-group-save-newsrc - "z" gnus-group-suspend - "q" gnus-group-exit - "Q" gnus-group-quit - "?" gnus-group-describe-briefly - "\C-c\C-i" gnus-info-find-node - "\M-e" gnus-group-edit-group-method - "^" gnus-group-enter-server-mode - [mouse-2] gnus-mouse-pick-group - [follow-link] mouse-face - "<" beginning-of-buffer - ">" end-of-buffer - "\C-c\C-b" gnus-bug - "\C-c\C-s" gnus-group-sort-groups - "t" gnus-topic-mode - "\C-c\M-g" gnus-activate-all-groups - "\M-&" gnus-group-universal-argument - "#" gnus-group-mark-group - "\M-#" gnus-group-unmark-group) - -(gnus-define-keys (gnus-group-cloud-map "~" gnus-group-mode-map) - "u" gnus-cloud-upload-all-data - "~" gnus-cloud-upload-all-data - "d" gnus-cloud-download-all-data - "\r" gnus-cloud-download-all-data) - -(gnus-define-keys (gnus-group-mark-map "M" gnus-group-mode-map) - "m" gnus-group-mark-group - "u" gnus-group-unmark-group - "w" gnus-group-mark-region - "b" gnus-group-mark-buffer - "r" gnus-group-mark-regexp - "U" gnus-group-unmark-all-groups) - -(gnus-define-keys (gnus-group-sieve-map "D" gnus-group-mode-map) - "u" gnus-sieve-update - "g" gnus-sieve-generate) - -(gnus-define-keys (gnus-group-group-map "G" gnus-group-mode-map) - "d" gnus-group-make-directory-group - "h" gnus-group-make-help-group - "u" gnus-group-make-useful-group - "l" gnus-group-nnimap-edit-acl - "m" gnus-group-make-group - "E" gnus-group-edit-group - "e" gnus-group-edit-group-method - "p" gnus-group-edit-group-parameters - "v" gnus-group-add-to-virtual - "V" gnus-group-make-empty-virtual - "D" gnus-group-enter-directory - "f" gnus-group-make-doc-group - "w" gnus-group-make-web-group - "G" gnus-group-read-ephemeral-search-group - "g" gnus-group-make-search-group - "M" gnus-group-read-ephemeral-group - "r" gnus-group-rename-group - "R" gnus-group-make-rss-group - "c" gnus-group-customize - "z" gnus-group-compact-group - "x" gnus-group-expunge-group - "\177" gnus-group-delete-group - [delete] gnus-group-delete-group) - -(gnus-define-keys (gnus-group-sort-map "S" gnus-group-group-map) - "s" gnus-group-sort-groups - "a" gnus-group-sort-groups-by-alphabet - "u" gnus-group-sort-groups-by-unread - "l" gnus-group-sort-groups-by-level - "v" gnus-group-sort-groups-by-score - "r" gnus-group-sort-groups-by-rank - "m" gnus-group-sort-groups-by-method - "n" gnus-group-sort-groups-by-real-name) - -(gnus-define-keys (gnus-group-sort-selected-map "P" gnus-group-group-map) - "s" gnus-group-sort-selected-groups - "a" gnus-group-sort-selected-groups-by-alphabet - "u" gnus-group-sort-selected-groups-by-unread - "l" gnus-group-sort-selected-groups-by-level - "v" gnus-group-sort-selected-groups-by-score - "r" gnus-group-sort-selected-groups-by-rank - "m" gnus-group-sort-selected-groups-by-method - "n" gnus-group-sort-selected-groups-by-real-name) - -(gnus-define-keys (gnus-group-list-map "A" gnus-group-mode-map) - "k" gnus-group-list-killed - "z" gnus-group-list-zombies - "s" gnus-group-list-groups - "u" gnus-group-list-all-groups - "A" gnus-group-list-active - "a" gnus-group-apropos - "d" gnus-group-description-apropos - "m" gnus-group-list-matching - "M" gnus-group-list-all-matching - "l" gnus-group-list-level - "c" gnus-group-list-cached - "?" gnus-group-list-dormant - "!" gnus-group-list-ticked) - -(gnus-define-keys (gnus-group-list-limit-map "/" gnus-group-list-map) - "k" gnus-group-list-limit - "z" gnus-group-list-limit - "s" gnus-group-list-limit - "u" gnus-group-list-limit - "A" gnus-group-list-limit - "m" gnus-group-list-limit - "M" gnus-group-list-limit - "l" gnus-group-list-limit - "c" gnus-group-list-limit - "?" gnus-group-list-limit - "!" gnus-group-list-limit) - -(gnus-define-keys (gnus-group-list-flush-map "f" gnus-group-list-map) - "k" gnus-group-list-flush - "z" gnus-group-list-flush - "s" gnus-group-list-flush - "u" gnus-group-list-flush - "A" gnus-group-list-flush - "m" gnus-group-list-flush - "M" gnus-group-list-flush - "l" gnus-group-list-flush - "c" gnus-group-list-flush - "?" gnus-group-list-flush - "!" gnus-group-list-flush) - -(gnus-define-keys (gnus-group-list-plus-map "p" gnus-group-list-map) - "k" gnus-group-list-plus - "z" gnus-group-list-plus - "s" gnus-group-list-plus - "u" gnus-group-list-plus - "A" gnus-group-list-plus - "m" gnus-group-list-plus - "M" gnus-group-list-plus - "l" gnus-group-list-plus - "c" gnus-group-list-plus - "?" gnus-group-list-plus - "!" gnus-group-list-plus) - -(gnus-define-keys (gnus-group-score-map "W" gnus-group-mode-map) - "f" gnus-score-flush-cache - "e" gnus-score-edit-all-score) - -(gnus-define-keys (gnus-group-help-map "H" gnus-group-mode-map) - "d" gnus-group-describe-group - "v" gnus-version) - -(gnus-define-keys (gnus-group-sub-map "S" gnus-group-mode-map) - "l" gnus-group-set-current-level - "t" gnus-group-toggle-subscription-at-point - "s" gnus-group-toggle-subscription - "k" gnus-group-kill-group - "y" gnus-group-yank-group - "w" gnus-group-kill-region - "\C-k" gnus-group-kill-level - "z" gnus-group-kill-all-zombies) +(define-keymap :keymap gnus-group-mode-map + " " #'gnus-group-read-group + "=" #'gnus-group-select-group + "\r" #'gnus-group-select-group + "\M-\r" #'gnus-group-quick-select-group + "\M- " #'gnus-group-visible-select-group + [(meta control return)] #'gnus-group-select-group-ephemerally + "j" #'gnus-group-jump-to-group + "n" #'gnus-group-next-unread-group + "p" #'gnus-group-prev-unread-group + "\177" #'gnus-group-prev-unread-group + [delete] #'gnus-group-prev-unread-group + "N" #'gnus-group-next-group + "P" #'gnus-group-prev-group + "\M-n" #'gnus-group-next-unread-group-same-level + "\M-p" #'gnus-group-prev-unread-group-same-level + "," #'gnus-group-best-unread-group + "." #'gnus-group-first-unread-group + "u" #'gnus-group-toggle-subscription-at-point + "U" #'gnus-group-toggle-subscription + "c" #'gnus-group-catchup-current + "C" #'gnus-group-catchup-current-all + "\M-c" #'gnus-group-clear-data + "l" #'gnus-group-list-groups + "L" #'gnus-group-list-all-groups + "m" #'gnus-group-mail + "i" #'gnus-group-news + "g" #'gnus-group-get-new-news + "\M-g" #'gnus-group-get-new-news-this-group + "R" #'gnus-group-restart + "r" #'gnus-group-read-init-file + "B" #'gnus-group-browse-foreign-server + "b" #'gnus-group-check-bogus-groups + "F" #'gnus-group-find-new-groups + "\C-c\C-d" #'gnus-group-describe-group + "\M-d" #'gnus-group-describe-all-groups + "\C-c\C-a" #'gnus-group-apropos + "\C-c\M-\C-a" #'gnus-group-description-apropos + "a" #'gnus-group-post-news + "\ek" #'gnus-group-edit-local-kill + "\eK" #'gnus-group-edit-global-kill + "\C-k" #'gnus-group-kill-group + "\C-y" #'gnus-group-yank-group + "\C-w" #'gnus-group-kill-region + "\C-x\C-t" #'gnus-group-transpose-groups + "\C-c\C-l" #'gnus-group-list-killed + "\C-c\C-x" #'gnus-group-expire-articles + "\C-c\M-\C-x" #'gnus-group-expire-all-groups + "V" #'gnus-version + "s" #'gnus-group-save-newsrc + "z" #'gnus-group-suspend + "q" #'gnus-group-exit + "Q" #'gnus-group-quit + "?" #'gnus-group-describe-briefly + "\C-c\C-i" #'gnus-info-find-node + "\M-e" #'gnus-group-edit-group-method + "^" #'gnus-group-enter-server-mode + [mouse-2] #'gnus-mouse-pick-group + [follow-link] 'mouse-face + "<" #'beginning-of-buffer + ">" #'end-of-buffer + "\C-c\C-b" #'gnus-bug + "\C-c\C-s" #'gnus-group-sort-groups + "t" #'gnus-topic-mode + "\C-c\M-g" #'gnus-activate-all-groups + "\M-&" #'gnus-group-universal-argument + "#" #'gnus-group-mark-group + "\M-#" #'gnus-group-unmark-group + + "~" (define-keymap :prefix 'gnus-group-cloud-map + "u" #'gnus-cloud-upload-all-data + "~" #'gnus-cloud-upload-all-data + "d" #'gnus-cloud-download-all-data + "\r" #'gnus-cloud-download-all-data) + + "M" (define-keymap :prefix 'gnus-group-mark-map + "m" #'gnus-group-mark-group + "u" #'gnus-group-unmark-group + "w" #'gnus-group-mark-region + "b" #'gnus-group-mark-buffer + "r" #'gnus-group-mark-regexp + "U" #'gnus-group-unmark-all-groups) + + "D" (define-keymap :prefix 'gnus-group-sieve-map + "u" #'gnus-sieve-update + "g" #'gnus-sieve-generate) + + "G" (define-keymap :prefix 'gnus-group-group-map + "d" #'gnus-group-make-directory-group + "h" #'gnus-group-make-help-group + "u" #'gnus-group-make-useful-group + "l" #'gnus-group-nnimap-edit-acl + "m" #'gnus-group-make-group + "E" #'gnus-group-edit-group + "e" #'gnus-group-edit-group-method + "p" #'gnus-group-edit-group-parameters + "v" #'gnus-group-add-to-virtual + "V" #'gnus-group-make-empty-virtual + "D" #'gnus-group-enter-directory + "f" #'gnus-group-make-doc-group + "w" #'gnus-group-make-web-group + "G" #'gnus-group-read-ephemeral-search-group + "g" #'gnus-group-make-search-group + "M" #'gnus-group-read-ephemeral-group + "r" #'gnus-group-rename-group + "R" #'gnus-group-make-rss-group + "c" #'gnus-group-customize + "z" #'gnus-group-compact-group + "x" #'gnus-group-expunge-group + "\177" #'gnus-group-delete-group + [delete] #'gnus-group-delete-group) + + "S" (define-keymap :prefix 'gnus-group-sort-map + "s" #'gnus-group-sort-groups + "a" #'gnus-group-sort-groups-by-alphabet + "u" #'gnus-group-sort-groups-by-unread + "l" #'gnus-group-sort-groups-by-level + "v" #'gnus-group-sort-groups-by-score + "r" #'gnus-group-sort-groups-by-rank + "m" #'gnus-group-sort-groups-by-method + "n" #'gnus-group-sort-groups-by-real-name) + + "P" (define-keymap :prefix 'gnus-group-sort-selected-map + "s" #'gnus-group-sort-selected-groups + "a" #'gnus-group-sort-selected-groups-by-alphabet + "u" #'gnus-group-sort-selected-groups-by-unread + "l" #'gnus-group-sort-selected-groups-by-level + "v" #'gnus-group-sort-selected-groups-by-score + "r" #'gnus-group-sort-selected-groups-by-rank + "m" #'gnus-group-sort-selected-groups-by-method + "n" #'gnus-group-sort-selected-groups-by-real-name) + + "A" (define-keymap :prefix 'gnus-group-list-map + "k" #'gnus-group-list-killed + "z" #'gnus-group-list-zombies + "s" #'gnus-group-list-groups + "u" #'gnus-group-list-all-groups + "A" #'gnus-group-list-active + "a" #'gnus-group-apropos + "d" #'gnus-group-description-apropos + "m" #'gnus-group-list-matching + "M" #'gnus-group-list-all-matching + "l" #'gnus-group-list-level + "c" #'gnus-group-list-cached + "?" #'gnus-group-list-dormant + "!" #'gnus-group-list-ticked) + + "/" (define-keymap :prefix 'gnus-group-list-limit-map + "k" #'gnus-group-list-limit + "z" #'gnus-group-list-limit + "s" #'gnus-group-list-limit + "u" #'gnus-group-list-limit + "A" #'gnus-group-list-limit + "m" #'gnus-group-list-limit + "M" #'gnus-group-list-limit + "l" #'gnus-group-list-limit + "c" #'gnus-group-list-limit + "?" #'gnus-group-list-limit + "!" #'gnus-group-list-limit) + + "f" (define-keymap :prefix 'gnus-group-list-flush-map + "k" #'gnus-group-list-flush + "z" #'gnus-group-list-flush + "s" #'gnus-group-list-flush + "u" #'gnus-group-list-flush + "A" #'gnus-group-list-flush + "m" #'gnus-group-list-flush + "M" #'gnus-group-list-flush + "l" #'gnus-group-list-flush + "c" #'gnus-group-list-flush + "?" #'gnus-group-list-flush + "!" #'gnus-group-list-flush) + + "p" (define-keymap :prefix 'gnus-group-list-plus-map + "k" #'gnus-group-list-plus + "z" #'gnus-group-list-plus + "s" #'gnus-group-list-plus + "u" #'gnus-group-list-plus + "A" #'gnus-group-list-plus + "m" #'gnus-group-list-plus + "M" #'gnus-group-list-plus + "l" #'gnus-group-list-plus + "c" #'gnus-group-list-plus + "?" #'gnus-group-list-plus + "!" #'gnus-group-list-plus) + + "W" (define-keymap :prefix 'gnus-group-score-map + "f" #'gnus-score-flush-cache + "e" #'gnus-score-edit-all-score) + + "H" (define-keymap :prefix 'gnus-group-help-map + "d" #'gnus-group-describe-group + "v" #'gnus-version) + + "S" (define-keymap :prefix 'gnus-group-sub-map + "l" #'gnus-group-set-current-level + "t" #'gnus-group-toggle-subscription-at-point + "s" #'gnus-group-toggle-subscription + "k" #'gnus-group-kill-group + "y" #'gnus-group-yank-group + "w" #'gnus-group-kill-region + "\C-k" #'gnus-group-kill-level + "z" #'gnus-group-kill-all-zombies)) (defun gnus-topic-mode-p () "Return non-nil in `gnus-topic-mode'." diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el index be62bfd81f..e9fa819d0b 100644 --- a/lisp/gnus/gnus-html.el +++ b/lisp/gnus/gnus-html.el @@ -71,21 +71,17 @@ fit these criteria." :group 'gnus-art :type 'float) -(defvar gnus-html-image-map - (let ((map (make-sparse-keymap))) - (define-key map "u" 'gnus-article-copy-string) - (define-key map "i" 'gnus-html-insert-image) - (define-key map "v" 'gnus-html-browse-url) - map)) - -(defvar gnus-html-displayed-image-map - (let ((map (make-sparse-keymap))) - (define-key map "a" 'gnus-html-show-alt-text) - (define-key map "i" 'gnus-html-browse-image) - (define-key map "\r" 'gnus-html-browse-url) - (define-key map "u" 'gnus-article-copy-string) - (define-key map [tab] 'button-forward) - map)) +(defvar-keymap gnus-html-image-map () + "u" #'gnus-article-copy-string + "i" #'gnus-html-insert-image + "v" #'gnus-html-browse-url) + +(defvar-keymap gnus-html-displayed-image-map () + "a" #'gnus-html-show-alt-text + "i" #'gnus-html-browse-image + "\r" #'gnus-html-browse-url + "u" #'gnus-article-copy-string + [tab] #'forward-button) (defun gnus-html-encode-url (url) "Encode URL." diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index f558360361..3c2e4ad972 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -2537,7 +2537,7 @@ are always t.") ;; Only used in gnus-util, which has an autoload. ("rmailsum" rmail-update-summary) ("gnus-xmas" gnus-xmas-splash) - ("score-mode" :interactive t gnus-score-mode) + ("score-mode" :interactive t gnus-score-mode gnus-score-edit-all-score) ("gnus-mh" gnus-summary-save-article-folder gnus-Folder-save-name gnus-folder-save-name) ("gnus-mh" :interactive (gnus-summary-mode) gnus-summary-save-in-folder) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index d460f9bd92..b08d8c26c9 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -2868,84 +2868,77 @@ Consider adding this function to `message-header-setup-hook'" ;;; Set up keymap. -(defvar message-mode-map nil) - -(unless message-mode-map - (setq message-mode-map (make-keymap)) - (set-keymap-parent message-mode-map text-mode-map) - (define-key message-mode-map "\C-c?" #'describe-mode) - - (define-key message-mode-map "\C-c\C-f\C-t" #'message-goto-to) - (define-key message-mode-map "\C-c\C-f\C-o" #'message-goto-from) - (define-key message-mode-map "\C-c\C-f\C-b" #'message-goto-bcc) - (define-key message-mode-map "\C-c\C-f\C-w" #'message-goto-fcc) - (define-key message-mode-map "\C-c\C-f\C-c" #'message-goto-cc) - (define-key message-mode-map "\C-c\C-f\C-s" #'message-goto-subject) - (define-key message-mode-map "\C-c\C-f\C-r" #'message-goto-reply-to) - (define-key message-mode-map "\C-c\C-f\C-n" #'message-goto-newsgroups) - (define-key message-mode-map "\C-c\C-f\C-d" #'message-goto-distribution) - (define-key message-mode-map "\C-c\C-f\C-f" #'message-goto-followup-to) - (define-key message-mode-map "\C-c\C-f\C-m" #'message-goto-mail-followup-to) - (define-key message-mode-map "\C-c\C-f\C-k" #'message-goto-keywords) - (define-key message-mode-map "\C-c\C-f\C-u" #'message-goto-summary) - (define-key message-mode-map "\C-c\C-f\C-i" - #'message-insert-or-toggle-importance) - (define-key message-mode-map "\C-c\C-f\C-a" - #'message-generate-unsubscribed-mail-followup-to) +(defvar-keymap message-mode-map (:full t :parent text-mode-map + :doc "Message Mode keymap.") + "\C-c?" #'describe-mode + + "\C-c\C-f\C-t" #'message-goto-to + "\C-c\C-f\C-o" #'message-goto-from + "\C-c\C-f\C-b" #'message-goto-bcc + "\C-c\C-f\C-w" #'message-goto-fcc + "\C-c\C-f\C-c" #'message-goto-cc + "\C-c\C-f\C-s" #'message-goto-subject + "\C-c\C-f\C-r" #'message-goto-reply-to + "\C-c\C-f\C-n" #'message-goto-newsgroups + "\C-c\C-f\C-d" #'message-goto-distribution + "\C-c\C-f\C-f" #'message-goto-followup-to + "\C-c\C-f\C-m" #'message-goto-mail-followup-to + "\C-c\C-f\C-k" #'message-goto-keywords + "\C-c\C-f\C-u" #'message-goto-summary + "\C-c\C-f\C-i" #'message-insert-or-toggle-importance + "\C-c\C-f\C-a" #'message-generate-unsubscribed-mail-followup-to ;; modify headers (and insert notes in body) - (define-key message-mode-map "\C-c\C-fs" #'message-change-subject) + "\C-c\C-fs" #'message-change-subject ;; - (define-key message-mode-map "\C-c\C-fx" #'message-cross-post-followup-to) + "\C-c\C-fx" #'message-cross-post-followup-to ;; prefix+message-cross-post-followup-to = same w/o cross-post - (define-key message-mode-map "\C-c\C-ft" #'message-reduce-to-to-cc) - (define-key message-mode-map "\C-c\C-fa" #'message-add-archive-header) + "\C-c\C-ft" #'message-reduce-to-to-cc + "\C-c\C-fa" #'message-add-archive-header ;; mark inserted text - (define-key message-mode-map "\C-c\M-m" #'message-mark-inserted-region) - (define-key message-mode-map "\C-c\M-f" #'message-mark-insert-file) - - (define-key message-mode-map "\C-c\C-b" #'message-goto-body) - (define-key message-mode-map "\C-c\C-i" #'message-goto-signature) - - (define-key message-mode-map "\C-c\C-t" #'message-insert-to) - (define-key message-mode-map "\C-c\C-fw" #'message-insert-wide-reply) - (define-key message-mode-map "\C-c\C-n" #'message-insert-newsgroups) - (define-key message-mode-map "\C-c\C-l" #'message-to-list-only) - (define-key message-mode-map "\C-c\C-f\C-e" #'message-insert-expires) - - (define-key message-mode-map "\C-c\C-u" #'message-insert-or-toggle-importance) - (define-key message-mode-map "\C-c\M-n" - #'message-insert-disposition-notification-to) - - (define-key message-mode-map "\C-c\C-y" #'message-yank-original) - (define-key message-mode-map "\C-c\M-\C-y" #'message-yank-buffer) - (define-key message-mode-map "\C-c\C-q" #'message-fill-yanked-message) - (define-key message-mode-map "\C-c\C-w" #'message-insert-signature) - (define-key message-mode-map "\C-c\M-h" #'message-insert-headers) - (define-key message-mode-map "\C-c\C-r" #'message-caesar-buffer-body) - (define-key message-mode-map "\C-c\C-o" #'message-sort-headers) - (define-key message-mode-map "\C-c\M-r" #'message-rename-buffer) - - (define-key message-mode-map "\C-c\C-c" #'message-send-and-exit) - (define-key message-mode-map "\C-c\C-s" #'message-send) - (define-key message-mode-map "\C-c\C-k" #'message-kill-buffer) - (define-key message-mode-map "\C-c\C-d" #'message-dont-send) - (define-key message-mode-map "\C-c\n" #'gnus-delay-article) - - (define-key message-mode-map "\C-c\M-k" #'message-kill-address) - (define-key message-mode-map "\C-c\C-e" #'message-elide-region) - (define-key message-mode-map "\C-c\C-v" #'message-delete-not-region) - (define-key message-mode-map "\C-c\C-z" #'message-kill-to-signature) - (define-key message-mode-map "\M-\r" #'message-newline-and-reformat) - (define-key message-mode-map [remap split-line] #'message-split-line) - - (define-key message-mode-map "\C-c\C-a" #'mml-attach-file) - (define-key message-mode-map "\C-c\C-p" #'message-insert-screenshot) - - (define-key message-mode-map "\C-a" #'message-beginning-of-line) - (define-key message-mode-map "\t" #'message-tab) - - (define-key message-mode-map "\M-n" #'message-display-abbrev)) + "\C-c\M-m" #'message-mark-inserted-region + "\C-c\M-f" #'message-mark-insert-file + + "\C-c\C-b" #'message-goto-body + "\C-c\C-i" #'message-goto-signature + + "\C-c\C-t" #'message-insert-to + "\C-c\C-fw" #'message-insert-wide-reply + "\C-c\C-n" #'message-insert-newsgroups + "\C-c\C-l" #'message-to-list-only + "\C-c\C-f\C-e" #'message-insert-expires + "\C-c\C-u" #'message-insert-or-toggle-importance + "\C-c\M-n" #'message-insert-disposition-notification-to + + "\C-c\C-y" #'message-yank-original + "\C-c\M-\C-y" #'message-yank-buffer + "\C-c\C-q" #'message-fill-yanked-message + "\C-c\C-w" #'message-insert-signature + "\C-c\M-h" #'message-insert-headers + "\C-c\C-r" #'message-caesar-buffer-body + "\C-c\C-o" #'message-sort-headers + "\C-c\M-r" #'message-rename-buffer + + "\C-c\C-c" #'message-send-and-exit + "\C-c\C-s" #'message-send + "\C-c\C-k" #'message-kill-buffer + "\C-c\C-d" #'message-dont-send + "\C-c\n" #'gnus-delay-article + + "\C-c\M-k" #'message-kill-address + "\C-c\C-e" #'message-elide-region + "\C-c\C-v" #'message-delete-not-region + "\C-c\C-z" #'message-kill-to-signature + "\M-\r" #'message-newline-and-reformat + [remap split-line] #'message-split-line + + "\C-c\C-a" #'mml-attach-file + "\C-c\C-p" #'message-insert-screenshot + + "\C-a" #'message-beginning-of-line + "\t" #'message-tab + + "\M-n" #'message-display-abbrev) (easy-menu-define message-mode-menu message-mode-map "Message Menu." diff --git a/lisp/net/eww.el b/lisp/net/eww.el index bb6583c2a9..e5716d3ffd 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -271,15 +271,11 @@ See also `eww-form-checkbox-selected-symbol'." "text/html, text/plain, text/sgml, text/css, application/xhtml+xml, */*;q=0.01" "Value used for the HTTP 'Accept' header.") -(defvar eww-link-keymap - (let ((map (copy-keymap shr-map))) - (define-key map "\r" 'eww-follow-link) - map)) +(defvar-keymap eww-link-keymap (:copy shr-map) + "\r" #'eww-follow-link) -(defvar eww-image-link-keymap - (let ((map (copy-keymap shr-image-map))) - (define-key map "\r" 'eww-follow-link) - map)) +(defvar-keymap eww-image-link-keymap (:copy shr-map) + "\r" #'eww-follow-link) (defun eww-suggested-uris nil "Return the list of URIs to suggest at the `eww' prompt. @@ -973,67 +969,64 @@ the like." (setq result highest)))) result)) -(defvar eww-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "g" 'eww-reload) ;FIXME: revert-buffer-function instead! - (define-key map "G" 'eww) - (define-key map [?\M-\r] 'eww-open-in-new-buffer) - (define-key map [?\t] 'shr-next-link) - (define-key map [?\M-\t] 'shr-previous-link) - (define-key map [backtab] 'shr-previous-link) - (define-key map [delete] 'scroll-down-command) - (define-key map "l" 'eww-back-url) - (define-key map "r" 'eww-forward-url) - (define-key map "n" 'eww-next-url) - (define-key map "p" 'eww-previous-url) - (define-key map "u" 'eww-up-url) - (define-key map "t" 'eww-top-url) - (define-key map "&" 'eww-browse-with-external-browser) - (define-key map "d" 'eww-download) - (define-key map "w" 'eww-copy-page-url) - (define-key map "C" 'url-cookie-list) - (define-key map "v" 'eww-view-source) - (define-key map "R" 'eww-readable) - (define-key map "H" 'eww-list-histories) - (define-key map "E" 'eww-set-character-encoding) - (define-key map "s" 'eww-switch-to-buffer) - (define-key map "S" 'eww-list-buffers) - (define-key map "F" 'eww-toggle-fonts) - (define-key map "D" 'eww-toggle-paragraph-direction) - (define-key map [(meta C)] 'eww-toggle-colors) - (define-key map [(meta I)] 'eww-toggle-images) - - (define-key map "b" 'eww-add-bookmark) - (define-key map "B" 'eww-list-bookmarks) - (define-key map [(meta n)] 'eww-next-bookmark) - (define-key map [(meta p)] 'eww-previous-bookmark) - - (easy-menu-define nil map "" - '("Eww" - ["Exit" quit-window t] - ["Close browser" quit-window t] - ["Reload" eww-reload t] - ["Follow URL in new buffer" eww-open-in-new-buffer] - ["Back to previous page" eww-back-url - :active (not (zerop (length eww-history)))] - ["Forward to next page" eww-forward-url - :active (not (zerop eww-history-position))] - ["Browse with external browser" eww-browse-with-external-browser t] - ["Download" eww-download t] - ["View page source" eww-view-source] - ["Copy page URL" eww-copy-page-url t] - ["List histories" eww-list-histories t] - ["Switch to buffer" eww-switch-to-buffer t] - ["List buffers" eww-list-buffers t] - ["Add bookmark" eww-add-bookmark t] - ["List bookmarks" eww-list-bookmarks t] - ["List cookies" url-cookie-list t] - ["Toggle fonts" eww-toggle-fonts t] - ["Toggle colors" eww-toggle-colors t] - ["Toggle images" eww-toggle-images t] - ["Character Encoding" eww-set-character-encoding] - ["Toggle Paragraph Direction" eww-toggle-paragraph-direction])) - map)) +(defvar-keymap eww-mode-map () + "g" #'eww-reload ;FIXME: revert-buffer-function instead! + "G" #'eww + [?\M-\r] #'eww-open-in-new-buffer + [?\t] #'shr-next-link + [?\M-\t] #'shr-previous-link + [backtab] #'shr-previous-link + [delete] #'scroll-down-command + "l" #'eww-back-url + "r" #'eww-forward-url + "n" #'eww-next-url + "p" #'eww-previous-url + "u" #'eww-up-url + "t" #'eww-top-url + "&" #'eww-browse-with-external-browser + "d" #'eww-download + "w" #'eww-copy-page-url + "C" #'url-cookie-list + "v" #'eww-view-source + "R" #'eww-readable + "H" #'eww-list-histories + "E" #'eww-set-character-encoding + "s" #'eww-switch-to-buffer + "S" #'eww-list-buffers + "F" #'eww-toggle-fonts + "D" #'eww-toggle-paragraph-direction + [(meta C)] #'eww-toggle-colors + [(meta I)] #'eww-toggle-images + + "b" #'eww-add-bookmark + "B" #'eww-list-bookmarks + [(meta n)] #'eww-next-bookmark + [(meta p)] #'eww-previous-bookmark + + :menu '("Eww" + ["Exit" quit-window t] + ["Close browser" quit-window t] + ["Reload" eww-reload t] + ["Follow URL in new buffer" eww-open-in-new-buffer] + ["Back to previous page" eww-back-url + :active (not (zerop (length eww-history)))] + ["Forward to next page" eww-forward-url + :active (not (zerop eww-history-position))] + ["Browse with external browser" eww-browse-with-external-browser t] + ["Download" eww-download t] + ["View page source" eww-view-source] + ["Copy page URL" eww-copy-page-url t] + ["List histories" eww-list-histories t] + ["Switch to buffer" eww-switch-to-buffer t] + ["List buffers" eww-list-buffers t] + ["Add bookmark" eww-add-bookmark t] + ["List bookmarks" eww-list-bookmarks t] + ["List cookies" url-cookie-list t] + ["Toggle fonts" eww-toggle-fonts t] + ["Toggle colors" eww-toggle-colors t] + ["Toggle images" eww-toggle-images t] + ["Character Encoding" eww-set-character-encoding] + ["Toggle Paragraph Direction" eww-toggle-paragraph-direction])) (defun eww-context-menu (menu click) "Populate MENU with eww commands at CLICK." @@ -1230,54 +1223,40 @@ just re-display the HTML already fetched." (defvar eww-form nil) -(defvar eww-submit-map - (let ((map (make-sparse-keymap))) - (define-key map "\r" 'eww-submit) - (define-key map [(control c) (control c)] 'eww-submit) - map)) - -(defvar eww-submit-file - (let ((map (make-sparse-keymap))) - (define-key map "\r" 'eww-select-file) - (define-key map [(control c) (control c)] 'eww-submit) - map)) - -(defvar eww-checkbox-map - (let ((map (make-sparse-keymap))) - (define-key map " " 'eww-toggle-checkbox) - (define-key map "\r" 'eww-toggle-checkbox) - (define-key map [(control c) (control c)] 'eww-submit) - map)) - -(defvar eww-text-map - (let ((map (make-keymap))) - (set-keymap-parent map text-mode-map) - (define-key map "\r" 'eww-submit) - (define-key map [(control a)] 'eww-beginning-of-text) - (define-key map [(control c) (control c)] 'eww-submit) - (define-key map [(control e)] 'eww-end-of-text) - (define-key map [?\t] 'shr-next-link) - (define-key map [?\M-\t] 'shr-previous-link) - (define-key map [backtab] 'shr-previous-link) - map)) - -(defvar eww-textarea-map - (let ((map (make-keymap))) - (set-keymap-parent map text-mode-map) - (define-key map "\r" 'forward-line) - (define-key map [(control c) (control c)] 'eww-submit) - (define-key map [?\t] 'shr-next-link) - (define-key map [?\M-\t] 'shr-previous-link) - (define-key map [backtab] 'shr-previous-link) - map)) - -(defvar eww-select-map - (let ((map (make-sparse-keymap))) - (define-key map "\r" 'eww-change-select) - (define-key map [follow-link] 'mouse-face) - (define-key map [mouse-2] 'eww-change-select) - (define-key map [(control c) (control c)] 'eww-submit) - map)) +(defvar-keymap eww-submit-map () + "\r" #'eww-submit + [(control c) (control c)] #'eww-submit) + +(defvar-keymap eww-submit-file () + "\r" #'eww-select-file + [(control c) (control c)] #'eww-submit) + +(defvar-keymap eww-checkbox-map () + " " #'eww-toggle-checkbox + "\r" #'eww-toggle-checkbox + [(control c) (control c)] #'eww-submit) + +(defvar-keymap eww-text-map (:full t :parent text-mode-map) + "\r" #'eww-submit + [(control a)] #'eww-beginning-of-text + [(control c) (control c)] #'eww-submit + [(control e)] #'eww-end-of-text + [?\t] #'shr-next-link + [?\M-\t] #'shr-previous-link + [backtab] #'shr-previous-link) + +(defvar-keymap eww-textarea-map (:full t :parent text-mode-map) + "\r" #'forward-line + [(control c) (control c)] #'eww-submit + [?\t] #'shr-next-link + [?\M-\t] #'shr-previous-link + [backtab] #'shr-previous-link) + +(defvar-keymap eww-select-map (:doc "Map for select buttons") + "\r" #'eww-change-select + [follow-link] 'mouse-face + [mouse-2] #'eww-change-select + [(control c) (control c)] #'eww-submit) (defun eww-beginning-of-text () "Move to the start of the input field." @@ -2100,23 +2079,18 @@ If ERROR-OUT, signal user-error if there are no bookmarks." 'eww-bookmark))) (eww-browse-url (plist-get bookmark :url)))) -(defvar eww-bookmark-mode-map - (let ((map (make-sparse-keymap))) - (define-key map [(control k)] 'eww-bookmark-kill) - (define-key map [(control y)] 'eww-bookmark-yank) - (define-key map "\r" 'eww-bookmark-browse) - - (easy-menu-define nil map - "Menu for `eww-bookmark-mode-map'." - '("Eww Bookmark" - ["Exit" quit-window t] - ["Browse" eww-bookmark-browse - :active (get-text-property (line-beginning-position) 'eww-bookmark)] - ["Kill" eww-bookmark-kill - :active (get-text-property (line-beginning-position) 'eww-bookmark)] - ["Yank" eww-bookmark-yank - :active eww-bookmark-kill-ring])) - map)) +(defvar-keymap eww-bookmark-mode-map () + [(control k)] #'eww-bookmark-kill + [(control y)] #'eww-bookmark-yank + "\r" #'eww-bookmark-browse + :menu '("Eww Bookmark" + ["Exit" quit-window t] + ["Browse" eww-bookmark-browse + :active (get-text-property (line-beginning-position) 'eww-bookmark)] + ["Kill" eww-bookmark-kill + :active (get-text-property (line-beginning-position) 'eww-bookmark)] + ["Yank" eww-bookmark-yank + :active eww-bookmark-kill-ring])) (define-derived-mode eww-bookmark-mode special-mode "eww bookmarks" "Mode for listing bookmarks. @@ -2181,19 +2155,15 @@ If ERROR-OUT, signal user-error if there are no bookmarks." (pop-to-buffer-same-window buffer))) (eww-restore-history history))) -(defvar eww-history-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "\r" 'eww-history-browse) - (define-key map "n" 'next-line) - (define-key map "p" 'previous-line) - - (easy-menu-define nil map - "Menu for `eww-history-mode-map'." - '("Eww History" - ["Exit" quit-window t] - ["Browse" eww-history-browse - :active (get-text-property (line-beginning-position) 'eww-history)])) - map)) +(defvar-keymap eww-history-mode-map () + "\r" #'eww-history-browse + "n" #'next-line + "p" #'previous-line + :menu '("Eww History" + ["Exit" quit-window t] + ["Browse" eww-history-browse + :active (get-text-property (line-beginning-position) + 'eww-history)])) (define-derived-mode eww-history-mode special-mode "eww history" "Mode for listing eww-histories. @@ -2304,22 +2274,18 @@ If ERROR-OUT, signal user-error if there are no bookmarks." (forward-line -1)) (eww-buffer-show)) -(defvar eww-buffers-mode-map - (let ((map (make-sparse-keymap))) - (define-key map [(control k)] 'eww-buffer-kill) - (define-key map "\r" 'eww-buffer-select) - (define-key map "n" 'eww-buffer-show-next) - (define-key map "p" 'eww-buffer-show-previous) - - (easy-menu-define nil map - "Menu for `eww-buffers-mode-map'." - '("Eww Buffers" - ["Exit" quit-window t] - ["Select" eww-buffer-select - :active (get-text-property (line-beginning-position) 'eww-buffer)] - ["Kill" eww-buffer-kill - :active (get-text-property (line-beginning-position) 'eww-buffer)])) - map)) +(defvar-keymap eww-buffers-mode-map () + [(control k)] #'eww-buffer-kill + "\r" #'eww-buffer-select + "n" #'eww-buffer-show-next + "p" #'eww-buffer-show-previous + :menu '("Eww Buffers" + ["Exit" quit-window t] + ["Select" eww-buffer-select + :active (get-text-property (line-beginning-position) 'eww-buffer)] + ["Kill" eww-buffer-kill + :active (get-text-property (line-beginning-position) + 'eww-buffer)])) (define-derived-mode eww-buffers-mode special-mode "eww buffers" "Mode for listing buffers. diff --git a/lisp/net/shr.el b/lisp/net/shr.el index a8e15c1e0a..8f11b140fb 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -247,23 +247,21 @@ and other things: (defvar shr-target-id nil "Target fragment identifier anchor.") -(defvar shr-map - (let ((map (make-sparse-keymap))) - (define-key map "a" #'shr-show-alt-text) - (define-key map "i" #'shr-browse-image) - (define-key map "z" #'shr-zoom-image) - (define-key map [?\t] #'shr-next-link) - (define-key map [?\M-\t] #'shr-previous-link) - (define-key map [follow-link] 'mouse-face) - (define-key map [mouse-2] #'shr-browse-url) - (define-key map [C-down-mouse-1] #'shr-mouse-browse-url-new-window) - (define-key map "I" #'shr-insert-image) - (define-key map "w" #'shr-maybe-probe-and-copy-url) - (define-key map "u" #'shr-maybe-probe-and-copy-url) - (define-key map "v" #'shr-browse-url) - (define-key map "O" #'shr-save-contents) - (define-key map "\r" #'shr-browse-url) - map)) +(defvar-keymap shr-map () + "a" #'shr-show-alt-text + "i" #'shr-browse-image + "z" #'shr-zoom-image + [?\t] #'shr-next-link + [?\M-\t] #'shr-previous-link + [follow-link] 'mouse-face + [mouse-2] #'shr-browse-url + [C-down-mouse-1] #'shr-mouse-browse-url-new-window + "I" #'shr-insert-image + "w" #'shr-maybe-probe-and-copy-url + "u" #'shr-maybe-probe-and-copy-url + "v" #'shr-browse-url + "O" #'shr-save-contents + "\r" #'shr-browse-url) (defvar shr-image-map (let ((map (copy-keymap shr-map))) diff --git a/lisp/simple.el b/lisp/simple.el index 3695415163..114c841c2c 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -529,19 +529,16 @@ Other major modes are defined by comparison with this one." ;; Special major modes to view specially formatted data rather than files. -(defvar special-mode-map - (let ((map (make-sparse-keymap))) - (suppress-keymap map) - (define-key map "q" 'quit-window) - (define-key map " " 'scroll-up-command) - (define-key map [?\S-\ ] 'scroll-down-command) - (define-key map "\C-?" 'scroll-down-command) - (define-key map "?" 'describe-mode) - (define-key map "h" 'describe-mode) - (define-key map ">" 'end-of-buffer) - (define-key map "<" 'beginning-of-buffer) - (define-key map "g" 'revert-buffer) - map)) +(defvar-keymap special-mode-map (:suppress t) + "q" #'quit-window + " " #'scroll-up-command + [?\S-\ ] #'scroll-down-command + "\C-?" #'scroll-down-command + "?" #'describe-mode + "h" #'describe-mode + ">" #'end-of-buffer + "<" #'beginning-of-buffer + "g" #'revert-buffer) (put 'special-mode 'mode-class 'special) (define-derived-mode special-mode nil "Special" commit 192f9357f25b5b714984e5f60df2eba9dcac4120 Author: Lars Ingebrigtsen Date: Mon Oct 4 10:12:11 2021 +0200 Add 'define-keymap' and 'defvar-keymap' * doc/lispref/keymaps.texi (Changing Key Bindings): Document define-keymap and defvar-keymap. * lisp/subr.el (define-keymap): New function. (define-keymap--define): New function. (defvar-keymap): New macro. * lisp/emacs-lisp/lisp-mode.el (lisp-indent--defvar-keymap): New function. (lisp-indent-function): Use it to indent defvar-keymap. diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index 4097c86f07..1ca4857450 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi @@ -1386,6 +1386,101 @@ changing an entry in @code{ctl-x-map}, and this has the effect of changing the bindings of both @kbd{C-p C-f} and @kbd{C-x C-f} in the default global map. +@defun define-keymap &key options... &rest pairs... +@code{define-key} is the general work horse for defining a key in a +keymap. When writing modes, however, you frequently have to bind a +large number of keys at once, and using @code{define-key} on them all +can be tedious and error-prone. Instead you can use +@code{define-keymap}, which creates a keymaps and binds a number of +keys. Here's a very basic example: + +@lisp +(define-keymap + "n" #'forward-line + "f" #'previous-line) +@end lisp + +This function creates a new sparse keymap, defines the two keystrokes +in @var{pairs}, and returns the new keymap. + +@var{pairs} is a list of alternating key bindings and key definitions, +as accepted by @code{define-key}. In addition the key can be the +special symbol @code{:menu}, in which case the definition should be a +menu definition as accepted by @code{easy-menu-define} (@pxref{Easy +Menu}). Here's a brief example: + +@lisp +(define-keymap :full t + "g" #'eww-reload + :menu '("Eww" + ["Exit" quit-window t] + ["Reload" eww-reload t])) +@end lisp + +A number of keywords can be used before the key/definition pairs to +changes features of the new keymap. If the keyword is missing, the +default value for the feature is @code{nil}. Here's a list of the +available keywords: + +@table @code +@item :full +If non-@code{nil}, create a chartable keymap (as from +@code{make-keymap}) instead of a sparse keymap (as from +@code{make-sparse-keymap} (@pxref{Creating Keymaps}). A sparse keymap +is the default. + +@item :parent +If non-@code{nil}, this should be a keymap to use as the parent +(@pxref{Inheritance and Keymaps}). + +@item :keymap +If non-@code{nil}, this should be a keymap. Instead of creating a new +keymap, this keymap is modified instead. + +@item :suppress +If non-@code{nil}, the keymap will be suppressed with +@code{suppress-keymap} (@pxref{Changing Key Bindings}). If +@code{nodigits}, treat digits like other chars. + +@item :copy +If non-@code{nil}, copy this keymap and use it as the basis +(@pxref{Creating Keymaps}). + +@item :name +If non-@code{nil}, this should be a string to use as the menu for the +keymap if you use it as a menu with @code{x-popup-menu} (@pxref{Pop-Up +Menus}). + +@item :prefix +If non-@code{nil}, this should be a symbol to be used as a prefix +command (@pxref{Prefix Keys}). If this is the case, this symbol is +returned by @code{define-keymap} instead of the map itself. +@end table + +@end defun + +@defmac defvar-keymap name options &rest defs +By far, the most common thing to do with a keymap is to bind it to a +variable. This is what virtually all modes do---a mode called +@code{foo} almost always has a variable called @code{foo-mode-map}. + +This macro defines @var{name} as a variable, and passes @var{options} +and @var{defs} to @code{define-keymap}, and uses the result as the +default value for the variable. + +@var{options} is like the keywords in @code{define-keymap}, but adds a +@code{:doc} keyword that says what the doc string for the @var{name} +variable should be. + +Here's an example: + +@lisp +(defvar-keymap eww-textarea-map (:parent text-mode-map) + "\r" #'forward-line + [?\t] #'shr-next-link) +@end lisp +@end defmac + The function @code{substitute-key-definition} scans a keymap for keys that have a certain binding and rebinds them with a different binding. Another feature which is cleaner and can often produce the diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 57196dfec4..a465d189b7 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1162,6 +1162,18 @@ STATE is the `parse-partial-sexp' state for current position." (goto-char (scan-lists (point) -1 0)) (point))))))))))) +(defun lisp-indent--defvar-keymap (state) + "Return the indent position in the options part of a `defvar-keymap' form." + (save-excursion + (let ((parens (ppss-open-parens state))) + (and (equal (nth 1 parens) (ppss-innermost-start state)) + (progn + (goto-char (nth 0 parens)) + (looking-at-p "(defvar-keymap")) + (progn + (goto-char (ppss-innermost-start state)) + (1+ (current-column))))))) + (defun lisp-indent-function (indent-point state) "This function is the normal value of the variable `lisp-indent-function'. The function `calculate-lisp-indent' calls this to determine @@ -1195,10 +1207,12 @@ Lisp function does not specify a special indentation." (if (and (elt state 2) (not (looking-at "\\sw\\|\\s_"))) ;; car of form doesn't seem to be a symbol - (if (lisp--local-defform-body-p state) - ;; We nevertheless check whether we are in flet-like form - ;; as we presume local function names could be non-symbols. - (lisp-indent-defform state indent-point) + (cond + ((lisp--local-defform-body-p state) + ;; We nevertheless check whether we are in flet-like form + ;; as we presume local function names could be non-symbols. + (lisp-indent-defform state indent-point)) + (t (if (not (> (save-excursion (forward-line 1) (point)) calculate-lisp-indent-last-sexp)) (progn (goto-char calculate-lisp-indent-last-sexp) @@ -1210,25 +1224,28 @@ Lisp function does not specify a special indentation." ;; thing on that line has to be complete sexp since we are ;; inside the innermost containing sexp. (backward-prefix-chars) - (current-column)) - (let ((function (buffer-substring (point) - (progn (forward-sexp 1) (point)))) - method) - (setq method (or (function-get (intern-soft function) - 'lisp-indent-function) - (get (intern-soft function) 'lisp-indent-hook))) - (cond ((or (eq method 'defun) - (and (null method) - (> (length function) 3) - (string-match "\\`def" function)) - ;; Check whether we are in flet-like form. - (lisp--local-defform-body-p state)) - (lisp-indent-defform state indent-point)) - ((integerp method) - (lisp-indent-specform method state - indent-point normal-indent)) - (method - (funcall method indent-point state))))))) + (current-column))) + ;; Indent `defvar-keymap' arguments. + (or (lisp-indent--defvar-keymap state) + ;; Other forms. + (let ((function (buffer-substring (point) + (progn (forward-sexp 1) (point)))) + method) + (setq method (or (function-get (intern-soft function) + 'lisp-indent-function) + (get (intern-soft function) 'lisp-indent-hook))) + (cond ((or (eq method 'defun) + (and (null method) + (> (length function) 3) + (string-match "\\`def" function)) + ;; Check whether we are in flet-like form. + (lisp--local-defform-body-p state)) + (lisp-indent-defform state indent-point)) + ((integerp method) + (lisp-indent-specform method state + indent-point normal-indent)) + (method + (funcall method indent-point state)))))))) (defcustom lisp-body-indent 2 "Number of columns to indent the second line of a `(def...)' form." diff --git a/lisp/subr.el b/lisp/subr.el index 1d2980802e..18b0851b1d 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6458,4 +6458,119 @@ not a list, return a one-element list containing OBJECT." object (list object))) +(defun define-keymap (&rest definitions) + "Create a new keymap and define KEY/DEFEFINITION pairs as key sequences. +The new keymap is returned. + +Options can be given as keywords before the KEY/DEFEFINITION +pairs. Available keywords are: + +:full If non-nil, create a chartable alist (see `make-keymap'). + If nil (i.e., the default), create a sparse keymap (see + `make-sparse-keymap'). + +:suppress If non-nil, the keymap will be suppressed (see `suppress-keymap'). + If `nodigits', treat digits like other chars. + +:parent If non-nil, this should be a keymap to use as the parent + (see `set-keymap-parent'). + +:keymap If non-nil, instead of creating a new keymap, the given keymap + will be destructively modified instead. + +:copy If non-nil, copy this keymap and use it as the basis + (see `copy-keymap'). + +:name If non-nil, this should be a string to use as the menu for + the keymap in case you use it as a menu with `x-popup-menu'. + +:prefix If non-nil, this should be a symbol to be used as a prefix + command (see `define-prefix-command'). If this is the case, + this symbol is returned instead of the map itself. + +KEY/DEFINITION pairs are as KEY and DEF in `define-key'. KEY can +also be the special symbol `:menu', in which case DEFINITION +should be a MENU form as accepted by `easy-menu-define'. + +\n(fn [&key FULL PARENT SUPPRESS NAME PREFIX KEYMAP COPY] [KEY DEFINITION] ...)" + ;; Handle keywords. + (let ((options nil)) + (while (and definitions + (keywordp (car definitions))) + (let ((keyword (pop definitions))) + (unless definitions + (error "Missing keyword value for %s" keyword)) + (push keyword options) + (push (pop definitions) options))) + (define-keymap--define (nreverse options) definitions))) + +(defun define-keymap--define (options definitions) + (let (full suppress parent name prefix copy keymap) + (while options + (let ((keyword (pop options)) + (value (pop options))) + (pcase keyword + (:full (setq full value)) + (:keymap (setq keymap value)) + (:parent (setq parent value)) + (:copy (setq copy value)) + (:suppress (setq suppress value)) + (:name (setq name value)) + (:prefix (setq prefix value))))) + + (when (and prefix + (or full parent suppress keymap)) + (error "A prefix keymap can't be defined with :full/:parent/:suppress/:keymap keywords")) + + (when (and full copy) + (error "Invalid combination: :full/:copy")) + + (when (and keymap (or full copy)) + (error "Invalid combination: :keymap with :full/:copy")) + + (let ((keymap (cond + (keymap keymap) + (prefix (define-prefix-command prefix nil name)) + (copy (copy-keymap copy)) + (full (make-keymap name)) + (t (make-sparse-keymap name))))) + (when suppress + (suppress-keymap keymap (eq suppress 'nodigits))) + (when parent + (set-keymap-parent keymap parent)) + + ;; Do the bindings. + (while definitions + (let ((key (pop definitions))) + (unless definitions + (error "Uneven number of key/definition pairs")) + (let ((def (pop definitions))) + (if (eq key :menu) + (easy-menu-define nil keymap "" def) + (define-key keymap key def))))) + keymap))) + +(defmacro defvar-keymap (name options &rest defs) + "Define NAME as a variable with a keymap definition. +See `define-keymap' for an explanation of OPTIONS. In addition, +the :doc keyword can be used in OPTIONS to add a doc string to NAME. + +DEFS is passed to `define-keymap' and should be a plist of +key/definition pairs." + (let ((opts nil) + doc) + (while options + (let ((keyword (pop options))) + (unless options + (error "Uneven number of options")) + (if (eq keyword :doc) + (setq doc (pop options)) + (push keyword opts) + (push (pop options) opts)))) + (unless (zerop (% (length defs) 2)) + (error "Uneven number of key definitions: %s" defs)) + `(defvar ,name + (define-keymap--define (list ,@(nreverse opts)) (list ,@defs)) + ,@(and doc (list doc))))) + ;;; subr.el ends here diff --git a/test/lisp/progmodes/elisp-mode-resources/elisp-indents.erts b/test/lisp/progmodes/elisp-mode-resources/elisp-indents.erts index 69d2598bb1..70642e230c 100644 --- a/test/lisp/progmodes/elisp-mode-resources/elisp-indents.erts +++ b/test/lisp/progmodes/elisp-mode-resources/elisp-indents.erts @@ -48,3 +48,11 @@ Name: defun-space (print (quote (thingy great stuff)))) =-=-= + +Name: defvar-keymap + +=-= +(defvar-keymap eww-link-keymap (:copy shr-map + :foo bar) + "\r" #'eww-follow-link) +=-=-= commit 3b8dda6c903e8e103a26ce812fc9400b301a09ae Author: Paul Eggert Date: Sun Oct 3 20:30:26 2021 -0700 Add safety check in x_menu_show * src/xmenu.c (x_menu_show): Explicitly check whether save_wv can be null here. Looks like it can be but I am not 100% sure, so play it safe and add a FIXME comment. diff --git a/src/xmenu.c b/src/xmenu.c index a6762236bc..709e455dd0 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -1603,6 +1603,14 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, STRINGP (help) ? help : Qnil); if (prev_wv) prev_wv->next = wv; + else if (!save_wv) + { + /* This call to 'abort' pacifies gcc 11.2.1 when Emacs + is configured with --enable-gcc-warnings. FIXME: If + save_wv can be null, do something better; otherwise, + explain why save_wv cannot be null. */ + abort (); + } else save_wv->contents = wv; if (!NILP (descrip)) commit e1fb731393f0f47a910836915c410989c8d06a8f Author: Paul Eggert Date: Sun Oct 3 20:11:57 2021 -0700 Tweak x_connection_closed when I/O error * src/xterm.c (x_connection_closed): Don’t dereference dpyinfo in the unlikely case where it is null and ioerror is true. This pacifies gcc 11.2.1 -Wanalyzer-null-dereference. diff --git a/src/xterm.c b/src/xterm.c index cf1e97a8b9..89885e0d88 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10133,8 +10133,9 @@ x_connection_closed (Display *dpy, const char *error_message, bool ioerror) frame on it. */ dpyinfo->reference_count++; dpyinfo->terminal->reference_count++; + if (ioerror) + dpyinfo->display = 0; } - if (ioerror) dpyinfo->display = 0; /* First delete frames whose mini-buffers are on frames that are on the dead display. */ commit 595e506c829156c72206c6db95b04c54bae1d025 Author: Stefan Kangas Date: Thu Sep 30 01:49:42 2021 +0200 * lisp/erc/erc.el (erc-user-mode): Set "+i" by default. diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index c4077d48ab..308812f0eb 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -188,10 +188,12 @@ parameters and authentication." It is not strictly necessary to provide this, since ERC will prompt you for it.") -(defcustom erc-user-mode nil +(defcustom erc-user-mode "+i" + ;; +i "Invisible". Hides user from global /who and /names. "Initial user modes to be set after a connection is established." :group 'erc - :type '(choice (const nil) string function)) + :type '(choice (const nil) string function) + :version "28.1") (defcustom erc-prompt-for-password t commit d00f3d4c05713254b3fec19601f6944442b956ff Author: Paul Eggert Date: Sun Oct 3 20:04:09 2021 -0700 Port unused decls to C2x * src/conf_post.h (ATTRIBUTE_UNUSED): Remove. All uses replaced by MAYBE_UNUSED, and moved to start as needed for C2x. diff --git a/src/conf_post.h b/src/conf_post.h index 8558dc466c..2c6fbb0dba 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -293,7 +293,6 @@ extern int emacs_setenv_TZ (char const *); ATTRIBUTE_FORMAT ((PRINTF_ARCHETYPE, string_index, first_to_check)) #define ARG_NONNULL ATTRIBUTE_NONNULL -#define ATTRIBUTE_UNUSED MAYBE_UNUSED /* Declare NAME to be a pointer to an object of type TYPE, initialized to the address ADDR, which may be of a different type. Accesses diff --git a/src/process.c b/src/process.c index 58347a154a..221d4c7f6c 100644 --- a/src/process.c +++ b/src/process.c @@ -4004,7 +4004,7 @@ usage: (make-network-process &rest ARGS) */) if (!NILP (host)) { - ptrdiff_t portstringlen ATTRIBUTE_UNUSED; + MAYBE_UNUSED ptrdiff_t portstringlen; /* SERVICE can either be a string or int. Convert to a C string for later use by getaddrinfo. */ diff --git a/src/unexcw.c b/src/unexcw.c index 7a80b05963..157e9f4560 100644 --- a/src/unexcw.c +++ b/src/unexcw.c @@ -48,7 +48,7 @@ static exe_header_t * read_exe_header (int fd, exe_header_t * exe_header_buffer) { int i; - int ret ATTRIBUTE_UNUSED; + MAYBE_UNUSED int ret; assert (fd >= 0); assert (exe_header_buffer != 0); @@ -111,7 +111,7 @@ fixup_executable (int fd) exe_header_t exe_header_buffer; exe_header_t *exe_header; int i; - int ret ATTRIBUTE_UNUSED; + MAYBE_UNUSED int ret; int found_data = 0; int found_bss = 0; @@ -269,7 +269,7 @@ unexec (const char *outfile, const char *infile) int fd_in; int fd_out; int ret; - int ret2 ATTRIBUTE_UNUSED; + MAYBE_UNUSED int ret2; infile = add_exe_suffix_if_necessary (infile, infile_buffer); outfile = add_exe_suffix_if_necessary (outfile, outfile_buffer); diff --git a/src/xterm.c b/src/xterm.c index ae3af598da..cf1e97a8b9 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -4049,7 +4049,7 @@ x_delete_glyphs (struct frame *f, int n) /* Like XClearArea, but check that WIDTH and HEIGHT are reasonable. If they are <= 0, this is probably an error. */ -static ATTRIBUTE_UNUSED void +MAYBE_UNUSED static void x_clear_area1 (Display *dpy, Window window, int x, int y, int width, int height, int exposures) { commit 317eb2d5b54e6c65a3bdcf2964d2b8d2232b4a13 Author: Stefan Kangas Date: Mon Oct 4 03:26:17 2021 +0200 Improve structure of TODO * etc/TODO: Various improvements to the document structure according to discussion with the maintainers. diff --git a/etc/TODO b/etc/TODO index 1efbd8d871..540d8a7ff5 100644 --- a/etc/TODO +++ b/etc/TODO @@ -29,95 +29,25 @@ are the ones we consider more important, but these also may be difficult to fix. Bugs with severity "minor" may be simpler, but this is not always true. -* Speed up Elisp execution - -** Speed up function calls -Change src/bytecode.c so that calls from byte-code functions to byte-code -functions don't go through Ffuncall/funcall_lambda/exec_byte_code but instead -stay within exec_byte_code. - -** Improve the byte-compiler to recognize immutable bindings -Recognize immutable (lexical) bindings and get rid of them if they're -used only once and/or they're bound to a constant expression. - -Such things aren't present in hand-written code, but macro expansion and -defsubst can often end up generating things like -(funcall (lambda (arg) (body)) actual) which then get optimized to -(let ((arg actual)) (body)) but should additionally get optimized further -when 'actual' is a constant/copyable expression. - -** Add an "indirect goto" byte-code -Such a byte-code can be used for local lambda expressions. -E.g. when you have code like - - (let ((foo (lambda (x) bar))) - (dosomething - (funcall foo toto) - (blabla (funcall foo titi)))) - -turn those 'funcalls' into jumps and their return into indirect jumps back. - -** Compile efficiently local recursive functions -Similar to the previous point, we should be able to handle something like - - (letrec ((loop () (blabla) (if (toto) (loop)))) - (loop)) - -which ideally should generate the same byte-code as - - (while (progn (blabla) (toto))) - -* Things that were planned for Emacs-24 - -** Concurrency -Including it as an "experimental" compile-time option sounds good. Of -course there might still be big questions around "which form of -concurrency" we'll want. - -** Spread Semantic - -** Improve the "code snippets" support -Consolidate skeleton.el, tempo.el, and expand.el (any other?) and then -advertise/use/improve it. - -** Improve VC -Yes, there's a lot of work to be done there :-( - -** Random things that cross my mind right now that I'd like to see -Some of them from my local hacks, but it's not obvious at all whether -they'll make it. - -*** Prog-mode could/should provide a better fill-paragraph default -That default should use syntax-tables to recognize string/comment -boundaries. - -*** Provide more completion-at-point-functions -Make existing in-buffer completion use completion-at-point. - -*** "Functional" function-key-map -It would make it easy to add (and remove) mappings like -"FOO-mouse-4 -> FOO-scroll-down", "FOO-tab -> ?\FOO-\t", -"uppercase -> lowercase", "[fringe KEY...] -> [KEY]", -"H-FOO -> M-FOO", "C-x C-y FOO -> H-FOO", ... - -* Things related to elpa.gnu.org. +* High Priority Items +** Things related to elpa.gnu.org. We need to figure out how to best include GNU ELPA packages in the Emacs tarball before doing any of the items below. -** Move idlwave to elpa.gnu.org +*** Move idlwave to elpa.gnu.org Need to sync up the Emacs and external versions. See -** Move Org mode to elpa.gnu.org +*** Move Org mode to elpa.gnu.org See -** Move verilog-mode to elpa.gnu.org +*** Move verilog-mode to elpa.gnu.org See -** Move vhdl-mode to elpa.gnu.org +*** Move vhdl-mode to elpa.gnu.org See * Simple tasks @@ -242,6 +172,44 @@ https://lists.gnu.org/r/emacs-devel/2008-08/msg00456.html * Important features +** Speed up Elisp execution + +*** Speed up function calls +Change src/bytecode.c so that calls from byte-code functions to byte-code +functions don't go through Ffuncall/funcall_lambda/exec_byte_code but instead +stay within exec_byte_code. + +*** Improve the byte-compiler to recognize immutable bindings +Recognize immutable (lexical) bindings and get rid of them if they're +used only once and/or they're bound to a constant expression. + +Such things aren't present in hand-written code, but macro expansion and +defsubst can often end up generating things like +(funcall (lambda (arg) (body)) actual) which then get optimized to +(let ((arg actual)) (body)) but should additionally get optimized further +when 'actual' is a constant/copyable expression. + +** Add an "indirect goto" byte-code +Such a byte-code can be used for local lambda expressions. +E.g. when you have code like + + (let ((foo (lambda (x) bar))) + (dosomething + (funcall foo toto) + (blabla (funcall foo titi)))) + +turn those 'funcalls' into jumps and their return into indirect jumps back. + +*** Compile efficiently local recursive functions +Similar to the previous point, we should be able to handle something like + + (letrec ((loop () (blabla) (if (toto) (loop)))) + (loop)) + +which ideally should generate the same byte-code as + + (while (progn (blabla) (toto))) + ** "Emacs as word processor" https://lists.gnu.org/r/emacs-devel/2013-11/msg00515.html rms writes: @@ -392,6 +360,11 @@ should invoke the 'shape' method. 'hbfont_shape' should be extended to pass to 'hb_shape_full' the required array of features, as mentioned in the above HarfBuzz discussion. +** Concurrency +Stefan Monnier writes: "Including it as an 'experimental' compile-time +option sounds good. Of course there might still be big questions +around 'which form of concurrency' we'll want." + ** Better support for displaying Emoji Emacs is capable of displaying Emoji and some of the Emoji sequences, provided that its fontsets are configured with a suitable font. To @@ -669,6 +642,13 @@ could also be a button that you could use to view the advice. ** Add a function to get the insertion-type of the markers in an overlay +** Improve VC +Yes, there's a lot of work to be done there :-( + +** Improve the "code snippets" support +Consolidate skeleton.el, tempo.el, and expand.el (any other?) and then +advertise/use/improve it. + ** ange-ftp *** Make ange-ftp understand sftp @@ -906,6 +886,25 @@ The idea is to add an "X" of some kind, that when clicked deletes the window associated with that modeline. https://lists.gnu.org/r/emacs-devel/2007-09/msg02416.html +** Random things that were planned for Emacs-24 + +Stefan Monnier writes: "Random things that cross my mind right now +that I'd like to see. Some of them from my local hacks, but it's not +obvious at all whether they'll make it." + +*** Prog-mode could/should provide a better fill-paragraph default +That default should use syntax-tables to recognize string/comment +boundaries. + +*** Provide more completion-at-point-functions +Make existing in-buffer completion use completion-at-point. + +*** "Functional" function-key-map +It would make it easy to add (and remove) mappings like +"FOO-mouse-4 -> FOO-scroll-down", "FOO-tab -> ?\FOO-\t", +"uppercase -> lowercase", "[fringe KEY...] -> [KEY]", +"H-FOO -> M-FOO", "C-x C-y FOO -> H-FOO", ... + * Things to be done for specific packages or features ** NeXTstep port commit c0793cd9dea407e244537f77361cfbe5077181db Author: Stefan Kangas Date: Mon Oct 4 01:08:03 2021 +0200 Don't use some obsolete names in documentation * admin/notes/bugtracker: Use non-obsolete name 'mail-dont-reply-to-names'. * admin/notes/multi-tty: Mention new variable name 'x-selection-value'. * doc/lispintro/emacs-lisp-intro.texi (Point and mark) (Point and mark, Design @value{COUNT-WORDS}): Avoid using obsolete name 'count-lines-region'. * doc/lispref/hooks.texi (Standard Hooks): Remove reference to obsolete abnormal hook 'completion-annotate-function'. * doc/misc/efaq.texi (SPC no longer completes file names): Remove reference to obsolete 'minibuffer-local-filename-must-match-map'; setting it has no effect. * doc/misc/gnus.texi (NNTP): Remove reference to obsolete variable 'nntp-authinfo-file'. * doc/misc/reftex.texi (Table of Contents, Creating Citations) (Options - Table of Contents, Options - Referencing Labels) (Options - Creating Citations, Options - Index Support) (Options - Index Support, Changes): Don't use obsolete names. * doc/misc/speedbar.texi (Minor Display Modes) (Major Display Modes): Make variable name suggestions more in line with existing non-obsolete variable. * lisp/textmodes/reftex-cite.el (reftex-select-bib-mode-map): * lisp/textmodes/reftex-ref.el (reftex-offer-label-menu): Don't use obsolete variable names. * lisp/progmodes/which-func.el (which-func-mode): Doc fix. diff --git a/admin/notes/bugtracker b/admin/notes/bugtracker index 9eb65e1f86..deb06f552c 100644 --- a/admin/notes/bugtracker +++ b/admin/notes/bugtracker @@ -84,7 +84,7 @@ generate a new report. The only time to send mail to the bug list address is to create a new report. Gnus users can add the following to message-dont-reply-to-names; -similarly with Rmail and rmail-dont-reply-to-names: +similarly with Rmail and mail-dont-reply-to-names: "\\(emacs-pretest-bug\\|bug-gnu-emacs\\|bug-\\(e\\|gnu\\)macs\\)@gnu\\.org\\|\ \\(submit\\|control\\|owner\\)@debbugs\\.gnu\\.org" diff --git a/admin/notes/multi-tty b/admin/notes/multi-tty index 1a337b9d79..fa4df820ae 100644 --- a/admin/notes/multi-tty +++ b/admin/notes/multi-tty @@ -474,7 +474,7 @@ THINGS TO DO definition. Exceptions found so far: x-select-text and - x-cut-buffer-or-selection-value. + x-selection-value (old name: x-cut-buffer-or-selection-value). ** Have a look at fatal_error_hook. diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 7c7005b348..9dbf854171 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -4201,7 +4201,7 @@ times. The part of the buffer between point and mark is called @dfn{the region}. Numerous commands work on the region, including -@code{center-region}, @code{count-lines-region}, @code{kill-region}, and +@code{center-region}, @code{count-words-region}, @code{kill-region}, and @code{print-region}. The @code{save-excursion} special form saves the location of point and @@ -4214,7 +4214,7 @@ evaluated. In Emacs, a function frequently moves point as part of its internal workings even though a user would not expect this. For example, -@code{count-lines-region} moves point. To prevent the user from being +@code{count-words-region} moves point. To prevent the user from being bothered by jumps that are both unexpected and (from the user's point of view) unnecessary, @code{save-excursion} is often used to keep point in the location expected by the user. The use of @@ -13473,8 +13473,7 @@ The template for an interactive function definition is, as always: What we need to do is fill in the slots. -The name of the function should be self-explanatory and similar to the -existing @code{count-lines-region} name. This makes the name easier +The name of the function should be self-explanatory and easy to remember. @code{count-words-region} is the obvious choice. Since that name is now used for the standard Emacs command to count words, we will name our implementation @code{@value{COUNT-WORDS}}. diff --git a/doc/lispref/hooks.texi b/doc/lispref/hooks.texi index 394928454b..feec8b24f4 100644 --- a/doc/lispref/hooks.texi +++ b/doc/lispref/hooks.texi @@ -262,7 +262,6 @@ after-set-visited-file-name-hook auto-coding-functions choose-completion-string-functions completing-read-function -completion-annotate-function completion-at-point-functions completion-list-insert-choice-function deactivate-current-input-method-function diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index f80ccc080a..18342e65b0 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -4136,9 +4136,6 @@ You can get the old behavior by binding @kbd{SPC} to @lisp (define-key minibuffer-local-filename-completion-map (kbd "SPC") 'minibuffer-complete-word) - -(define-key minibuffer-local-filename-must-match-map (kbd "SPC") - 'minibuffer-complete-word) @end lisp @c ------------------------------------------------------------ diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 9e433e11c8..0c065584c4 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -13875,11 +13875,9 @@ present in this hook. @item nntp-authinfo-function @vindex nntp-authinfo-function @findex nntp-send-authinfo -@vindex nntp-authinfo-file This function will be used to send @samp{AUTHINFO} to the @acronym{NNTP} server. The default function is @code{nntp-send-authinfo}, which looks -through your @file{~/.authinfo} (or whatever you've set the -@code{nntp-authinfo-file} variable to) for applicable entries. If none +through your @file{~/.authinfo} for applicable entries. If none are found, it will prompt you for a login name and a password. The format of the @file{~/.authinfo} file is (almost) the same as the @code{ftp} @file{~/.netrc} file, which is defined in the @code{ftp} diff --git a/doc/misc/reftex.texi b/doc/misc/reftex.texi index 8ca5fcca5b..8bde241e18 100644 --- a/doc/misc/reftex.texi +++ b/doc/misc/reftex.texi @@ -658,9 +658,9 @@ variable @code{reftex-auto-recenter-toc}. @end table -@vindex reftex-toc-map +@vindex reftex-toc-mode-map In order to define additional commands for the @file{*toc*} buffer, the -keymap @code{reftex-toc-map} may be used. +keymap @code{reftex-toc-mode-map} may be used. @findex reftex-toc-recenter @vindex reftex-auto-recenter-toc @@ -1021,9 +1021,9 @@ document and let you select a label from there (@pxref{LaTeX xr Package,,xr}). @end table -@vindex reftex-select-label-map +@vindex reftex-select-label-mode-map In order to define additional commands for the selection process, the -keymap @code{reftex-select-label-map} may be used. +keymap @code{reftex-select-label-mode-map} may be used. @node Builtin Label Environments @section Builtin Label Environments @@ -1871,9 +1871,9 @@ entries. @end table -@vindex reftex-select-bib-map +@vindex reftex-select-bib-mode-map In order to define additional commands for this selection process, the -keymap @code{reftex-select-bib-map} may be used. +keymap @code{reftex-select-bib-mode-map} may be used. Note that if you do not use Emacs to edit the @BibTeX{} database files, @RefTeX{} will ask if the related buffers should be updated once it @@ -3960,7 +3960,7 @@ Normal hook which is run when a @file{*toc*} buffer is created. @end deffn -@deffn Keymap reftex-toc-map +@deffn Keymap reftex-toc-mode-map The keymap which is active in the @file{*toc*} buffer. (@pxref{Table of Contents}). @end deffn @@ -4425,7 +4425,7 @@ Normal hook which is run when a selection buffer enters @code{reftex-select-label-mode}. @end deffn -@deffn Keymap reftex-select-label-map +@deffn Keymap reftex-select-label-mode-map The keymap which is active in the labels selection process (@pxref{Referencing Labels}). @end deffn @@ -4586,7 +4586,7 @@ Normal hook which is run when a selection buffer enters @code{reftex-select-bib-mode}. @end deffn -@deffn Keymap reftex-select-bib-map +@deffn Keymap reftex-select-bib-mode-map The keymap which is active in the citation-key selection process (@pxref{Creating Citations}). @end deffn @@ -4792,7 +4792,7 @@ into blocks. Sorting will then preserve blocks, so that lines are re-arranged only within blocks. @end defopt -@defopt reftex-index-phrases-map +@defopt reftex-index-phrases-mode-map Keymap for the Index Phrases buffer. @end defopt @@ -4824,7 +4824,7 @@ the document. This flag can be toggled from within the @file{*Index*} buffer with the @kbd{f} key. @end defopt -@deffn Keymap reftex-index-map +@deffn Keymap reftex-index-mode-map The keymap which is active in the @file{*Index*} buffer (@pxref{Index Support}). @end deffn @@ -5813,8 +5813,8 @@ buffer). @noindent @b{Version 3.12} @itemize @bullet @item -There are 3 new keymaps for customization: @code{reftex-toc-map}, -@code{reftex-select-label-map}, @code{reftex-select-bib-map}. +There are 3 new keymaps for customization: @code{reftex-toc-mode-map}, +@code{reftex-select-label-mode-map}, @code{reftex-select-bib-mode-map}. @item Refontification uses more standard font-lock stuff. @item diff --git a/doc/misc/speedbar.texi b/doc/misc/speedbar.texi index 9991917b3f..70d4b05416 100644 --- a/doc/misc/speedbar.texi +++ b/doc/misc/speedbar.texi @@ -896,7 +896,7 @@ augmented with speedbar. @enumerate @item -Create the keymap variable @code{@var{name}-speedbar-key-map}. +Create the keymap variable @code{@var{name}-speedbar-mode-map}. @item Create a function, named whatever you like, which assigns values into your @@ -904,7 +904,7 @@ keymap. Use this command to create the keymap before assigning bindings: @smallexample - (setq @var{name}-speedbar-key-map (speedbar-make-specialized-keymap)) + (setq @var{name}-speedbar-mode-map (speedbar-make-specialized-keymap)) @end smallexample This function creates a special keymap for use in speedbar. @@ -977,7 +977,7 @@ Next, register your extension like this; @example (speedbar-add-expansion-list '("MyExtension" MyExtension-speedbar-menu-items - MyExtension-speedbar-key-map + MyExtension-speedbar-mode-map MyExtension-speedbar-buttons)) @end example diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index 8946e2c3f4..176f599649 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -185,7 +185,8 @@ and you want to simplify them for the mode line (defvar-local which-func-mode nil "Non-nil means display current function name in mode line. -This makes a difference only if `which-function-mode' is non-nil.") +This makes a difference only if variable `which-function-mode' is +non-nil.") (add-hook 'after-change-major-mode-hook #'which-func-ff-hook t) diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el index 8a54b1a301..e1475934dd 100644 --- a/lisp/textmodes/reftex-cite.el +++ b/lisp/textmodes/reftex-cite.el @@ -814,7 +814,7 @@ in order to only add another reference in the same cite command." (interactive) (reftex-citation nil ?t)) -(defvar reftex-select-bib-map) +(defvar reftex-select-bib-mode-map) (defvar reftex--found-list) (defun reftex-offer-bib-menu () "Offer bib menu and return list of selected items." @@ -870,7 +870,7 @@ in order to only add another reference in the same cite command." (reftex-select-item reftex-citation-prompt reftex-citation-help - reftex-select-bib-map + reftex-select-bib-mode-map nil 'reftex-bibtex-selection-callback nil)) (setq key (car rtn) diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el index 9d5bc5a8f0..a5d83c34d6 100644 --- a/lisp/textmodes/reftex-ref.el +++ b/lisp/textmodes/reftex-ref.el @@ -533,7 +533,7 @@ When called with 2 \\[universal-argument] prefix args, disable magic word recogn (cons (cdr cell) (- (match-end 0) (match-end 1))) nil))) -(defvar reftex-select-label-map) +(defvar reftex-select-label-mode-map) (defun reftex-offer-label-menu (typekey) ;; Offer a menu with the appropriate labels. (let* ((buf (current-buffer)) @@ -605,7 +605,7 @@ When called with 2 \\[universal-argument] prefix args, disable magic word recogn (reftex-select-item reftex-select-label-prompt reftex-select-label-help - reftex-select-label-map + reftex-select-label-mode-map offset 'reftex-show-label-location follow)) (setq key (car rtn) commit 87153cc9151fe2398c243cf49eb27584c166c58a Author: Paul Eggert Date: Sun Oct 3 17:58:16 2021 -0700 Tweak x_hide_tip for consistency * src/xfns.c (x_hide_tip, Fx_show_tip): Be consistent about using !NILP (tip_frame) instead of FRAMEP (tip_frame). The two expressions are logically equivalent since tip_frame is either a frame or nil, !NILP is a bit faster, and making things consistent pacifies gcc 11.2.1 -Wanalyzer-null-dereference. diff --git a/src/xfns.c b/src/xfns.c index 0d0335c299..785ae3baca 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -6222,7 +6222,7 @@ Otherwise, the return value is a vector with the following fields: static void compute_tip_xy (struct frame *, Lisp_Object, Lisp_Object, Lisp_Object, int, int, int *, int *); -/* The frame of the currently visible tooltip. */ +/* The frame of the currently visible tooltip, or nil if none. */ static Lisp_Object tip_frame; /* The window-system window corresponding to the frame of the @@ -6710,7 +6710,7 @@ x_hide_tip (bool delete) if ((NILP (tip_last_frame) && NILP (tip_frame)) || (!x_gtk_use_system_tooltips && !delete - && FRAMEP (tip_frame) + && !NILP (tip_frame) && FRAME_LIVE_P (XFRAME (tip_frame)) && !FRAME_VISIBLE_P (XFRAME (tip_frame)))) /* Either there's no tooltip to hide or it's an already invisible @@ -6727,7 +6727,7 @@ x_hide_tip (bool delete) specbind (Qinhibit_quit, Qt); /* Try to hide the GTK+ system tip first. */ - if (FRAMEP (tip_last_frame)) + if (!NILP (tip_last_frame)) { struct frame *f = XFRAME (tip_last_frame); @@ -6745,7 +6745,7 @@ x_hide_tip (bool delete) tip_last_frame = Qnil; /* Now look whether there's an Emacs tip around. */ - if (FRAMEP (tip_frame)) + if (!NILP (tip_frame)) { struct frame *f = XFRAME (tip_frame); @@ -6775,7 +6775,7 @@ x_hide_tip (bool delete) #else /* not USE_GTK */ if (NILP (tip_frame) || (!delete - && FRAMEP (tip_frame) + && !NILP (tip_frame) && FRAME_LIVE_P (XFRAME (tip_frame)) && !FRAME_VISIBLE_P (XFRAME (tip_frame)))) return Qnil; @@ -6788,7 +6788,7 @@ x_hide_tip (bool delete) specbind (Qinhibit_redisplay, Qt); specbind (Qinhibit_quit, Qt); - if (FRAMEP (tip_frame)) + if (!NILP (tip_frame)) { struct frame *f = XFRAME (tip_frame); @@ -6931,7 +6931,7 @@ Text larger than the specified size is clipped. */) } #endif /* USE_GTK */ - if (FRAMEP (tip_frame) && FRAME_LIVE_P (XFRAME (tip_frame))) + if (!NILP (tip_frame) && FRAME_LIVE_P (XFRAME (tip_frame))) { if (FRAME_VISIBLE_P (XFRAME (tip_frame)) && EQ (frame, tip_last_frame) @@ -7016,7 +7016,7 @@ Text larger than the specified size is clipped. */) tip_last_string = string; tip_last_parms = parms; - if (!FRAMEP (tip_frame) || !FRAME_LIVE_P (XFRAME (tip_frame))) + if (NILP (tip_frame) || !FRAME_LIVE_P (XFRAME (tip_frame))) { /* Add default values to frame parameters. */ if (NILP (Fassq (Qname, parms))) commit 7e871dcd27bdb827573ca97e609632e178e76f64 Author: Paul Eggert Date: Sun Oct 3 17:52:04 2021 -0700 Remove encode_terminal_code UNINITs * src/term.c (encode_terminal_code): Clarify by removing a couple of UNINITs and testing the local variable ‘cmp’ instead of retesting src->u.cmp.automatic. This pacifies gcc 11.2.1 -Wanalyzer-null-dereference. diff --git a/src/term.c b/src/term.c index 7d9fe8cee3..0858f81685 100644 --- a/src/term.c +++ b/src/term.c @@ -549,13 +549,14 @@ encode_terminal_code (struct glyph *src, int src_len, { if (src->type == COMPOSITE_GLYPH) { - struct composition *cmp UNINIT; - Lisp_Object gstring UNINIT; + struct composition *cmp; + Lisp_Object gstring; int i; nbytes = buf - encode_terminal_src; if (src->u.cmp.automatic) { + cmp = NULL; gstring = composition_gstring_from_id (src->u.cmp.id); required = src->slice.cmp.to - src->slice.cmp.from + 1; } @@ -575,7 +576,7 @@ encode_terminal_code (struct glyph *src, int src_len, buf = encode_terminal_src + nbytes; } - if (src->u.cmp.automatic) + if (!cmp) for (i = src->slice.cmp.from; i <= src->slice.cmp.to; i++) { Lisp_Object g = LGSTRING_GLYPH (gstring, i); commit 2a00634880adb20071686906ebb183326f2060e0 Author: Paul Eggert Date: Sun Oct 3 17:45:20 2021 -0700 Port pdumper.c maybe_unused to C2x Port pdumper.c to C2x, and pacify gcc 11.2.1 -Wattributes -Wunused. * src/pdumper.c (dump_tailq_prepend): Omit ATTRIBUTE_UNUSED, since it’s always used. (dump_tailq_append): Remove; unused. diff --git a/src/pdumper.c b/src/pdumper.c index 2291fced5d..11c680d77b 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -799,7 +799,7 @@ dump_tailq_length (const struct dump_tailq *tailq) return tailq->length; } -static void ATTRIBUTE_UNUSED +static void dump_tailq_prepend (struct dump_tailq *tailq, Lisp_Object value) { Lisp_Object link = Fcons (value, tailq->head); @@ -809,24 +809,6 @@ dump_tailq_prepend (struct dump_tailq *tailq, Lisp_Object value) tailq->length += 1; } -static void ATTRIBUTE_UNUSED -dump_tailq_append (struct dump_tailq *tailq, Lisp_Object value) -{ - Lisp_Object link = Fcons (value, Qnil); - if (NILP (tailq->head)) - { - eassert (NILP (tailq->tail)); - tailq->head = tailq->tail = link; - } - else - { - eassert (!NILP (tailq->tail)); - XSETCDR (tailq->tail, link); - tailq->tail = link; - } - tailq->length += 1; -} - static bool dump_tailq_empty_p (struct dump_tailq *tailq) { commit 6d9b3c0eaab2d553b2fea127f2f2b9fa44f44450 Author: Paul Eggert Date: Sun Oct 3 17:22:30 2021 -0700 Port systhreads.h to C2x * src/systhread.h: Put NODISCARD at the start of extern declarations, not at the end. This is needed by C2x. This patch also pacifies gcc 11.2.1 -Wattributes. diff --git a/src/systhread.h b/src/systhread.h index 0f47d7c1a8..601505f4f8 100644 --- a/src/systhread.h +++ b/src/systhread.h @@ -101,14 +101,11 @@ extern void sys_cond_signal (sys_cond_t *); extern void sys_cond_broadcast (sys_cond_t *); extern void sys_cond_destroy (sys_cond_t *); -extern sys_thread_t sys_thread_self (void) - NODISCARD; -extern bool sys_thread_equal (sys_thread_t, sys_thread_t) - NODISCARD; - -extern bool sys_thread_create (sys_thread_t *, thread_creation_function *, - void *) - NODISCARD; +NODISCARD extern sys_thread_t sys_thread_self (void); +NODISCARD extern bool sys_thread_equal (sys_thread_t, sys_thread_t); + +NODISCARD extern bool sys_thread_create (sys_thread_t *, + thread_creation_function *, void *); extern void sys_thread_yield (void); extern void sys_thread_set_name (const char *); commit fd274d7d24ec35d64974b007cfe881c0e07edf9d Author: Paul Eggert Date: Sun Oct 3 16:37:13 2021 -0700 Pacify -Wanalyzer-null-argument in lisp_malloc * src/alloc.c (lisp_malloc): Document that NBYTES must be positive, and omit a needless runtime check. This pacifies a false alarm with gcc 11.2.1 -Wanalyzer-possible-null-dereference. diff --git a/src/alloc.c b/src/alloc.c index 0895a0f52a..0c04d5cde0 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -988,7 +988,8 @@ record_xmalloc (size_t size) /* Like malloc but used for allocating Lisp data. NBYTES is the number of bytes to allocate, TYPE describes the intended use of the - allocated memory block (for strings, for conses, ...). */ + allocated memory block (for strings, for conses, ...). + NBYTES must be positive. */ #if ! USE_LSB_TAG void *lisp_malloc_loser EXTERNALLY_VISIBLE; @@ -1030,7 +1031,7 @@ lisp_malloc (size_t nbytes, bool clearit, enum mem_type type) #endif MALLOC_UNBLOCK_INPUT; - if (!val && nbytes) + if (!val) memory_full (nbytes); MALLOC_PROBE (nbytes); return val; commit cc3fc94f09332e5cca28fea1f19a93c8d45fd0f8 Author: Paul Eggert Date: Sun Oct 3 16:31:50 2021 -0700 Pacify gcc 11.2.1 -Wanalyzer-null-argument * src/gtkutil.c (xg_item_label_same_p): Clarify boolean expression to pacify -Wanalyzer-null-argument with GCC 11.2.1 20210728 (Red Hat 11.2.1-1). diff --git a/src/gtkutil.c b/src/gtkutil.c index 313cfc82c2..e87845caf7 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -2932,8 +2932,9 @@ xg_item_label_same_p (GtkMenuItem *witem, const char *label) char *utf8_label = get_utf8_string (label); const char *old_label = witem ? xg_get_menu_item_label (witem) : 0; - bool is_same = (!old_label == !utf8_label - && (!old_label || strcmp (utf8_label, old_label) == 0)); + bool is_same = (old_label + ? utf8_label && strcmp (utf8_label, old_label) == 0 + : !utf8_label); if (utf8_label) g_free (utf8_label); commit d3a832a61ab5766b6ec879cee9ab75bbbc62034a Author: João Távora Date: Sun Oct 3 16:05:40 2021 +0100 Simplify hack-read-symbol-shorthands again (bug#50946) * lisp/loadup.el (load-source-file-function): Don't set twice. * lisp/shorthands.el (hack-read-symbol-shorthands): Simplify. (load-with-shorthands-and-code-conversion): Remove. * lisp/international/mule.el (load-with-code-conversion): Call hack-read-symbol-shorthands-function. Set up shorthands. (hack-read-symbol-shorthands-function): New variable. diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 2a855b5673..5022a17db5 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -294,6 +294,9 @@ attribute." (apply 'define-charset-internal name (mapcar 'cdr attrs)))) +(defvar hack-read-symbol-shorthands-function nil + "Holds function to compute `read-symbol-shorthands'.") + (defun load-with-code-conversion (fullname file &optional noerror nomessage) "Execute a file of Lisp code named FILE whose absolute name is FULLNAME. The file contents are decoded before evaluation if necessary. @@ -319,7 +322,8 @@ Return t if file exists." (let ((load-true-file-name fullname) (load-file-name fullname) (set-auto-coding-for-load t) - (inhibit-file-name-operation nil)) + (inhibit-file-name-operation nil) + shorthands) (with-current-buffer buffer ;; So that we don't get completely screwed if the ;; file is encoded in some complicated character set, @@ -328,6 +332,13 @@ Return t if file exists." ;; Don't let deactivate-mark remain set. (let (deactivate-mark) (insert-file-contents fullname)) + (setq shorthands + ;; We need this indirection because hacking local + ;; variables in too early seems to have cause + ;; recursive load loops (bug#50946). Thus it + ;; remains nil until it is save to do so. + (and hack-read-symbol-shorthands-function + (funcall hack-read-symbol-shorthands-function))) ;; If the loaded file was inserted with no-conversion or ;; raw-text coding system, make the buffer unibyte. ;; Otherwise, eval-buffer might try to interpret random @@ -338,11 +349,13 @@ Return t if file exists." (set-buffer-multibyte nil)) ;; Make `kill-buffer' quiet. (set-buffer-modified-p nil)) - ;; Have the original buffer current while we eval. - (eval-buffer buffer nil - ;; This is compatible with what `load' does. - (if dump-mode file fullname) - nil t)) + ;; Have the original buffer current while we eval, + ;; but consider shorthands of the eval'ed one. + (let ((read-symbol-shorthands shorthands)) + (eval-buffer buffer nil + ;; This is compatible with what `load' does. + (if dump-mode file fullname) + nil t))) (let (kill-buffer-hook kill-buffer-query-functions) (kill-buffer buffer))) (do-after-load-evaluation fullname) diff --git a/lisp/loadup.el b/lisp/loadup.el index 3fb6b81328..3a55d2c805 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -355,7 +355,6 @@ (load "paren") (load "shorthands") -(setq load-source-file-function #'load-with-shorthands-and-code-conversion) (load "emacs-lisp/eldoc") (load "cus-start") ;Late to reduce customize-rogue (needs loaddefs.el anyway) diff --git a/lisp/shorthands.el b/lisp/shorthands.el index c31ef3d216..e9f5880ab2 100644 --- a/lisp/shorthands.el +++ b/lisp/shorthands.el @@ -26,37 +26,18 @@ ;;; Code: (require 'files) +(require 'mule) (eval-when-compile (require 'cl-lib)) -(defun hack-read-symbol-shorthands (fullname) - "Return value of `read-symbol-shorthands' file-local variable in FULLNAME. -FULLNAME is the absolute file name of an Elisp .el file which -potentially specifies a file-local value for -`read-symbol-shorthands'. The Elisp code in FULLNAME isn't read -or evaluated in any way, except for extraction of the -buffer-local value of `read-symbol-shorthands'." - (let* ((size (nth 7 (file-attributes fullname))) - (from (max 0 (- size 3000))) - (to size)) - (with-temp-buffer - (while (and (< (buffer-size) 3000) (>= from 0)) - (insert-file-contents fullname nil from to) - (setq to from - from (cond - ((= from 0) -1) - (t (max 0 (- from 100)))))) - ;; FIXME: relies on the `hack-local-variables--find-variables' - ;; detail of files.el. That function should be exported, - ;; possibly be refactored into two parts, since we're only - ;; interested in basic "Local Variables" parsing. - (alist-get 'read-symbol-shorthands (hack-local-variables--find-variables))))) - -(defun load-with-shorthands-and-code-conversion (fullname file noerror nomessage) - "Like `load-with-code-conversion', but also consider Elisp shorthands. -This function uses shorthands defined in the file FULLNAME's local -value of `read-symbol-shorthands', when it processes that file's Elisp code." - (let ((read-symbol-shorthands (hack-read-symbol-shorthands fullname))) - (load-with-code-conversion fullname file noerror nomessage))) +(defun hack-read-symbol-shorthands () + "Compute `read-symbol-shorthands' from Local Variables section." + ;; FIXME: relies on the `hack-local-variables--find-variables' + ;; detail of files.el. That function should be exported, + ;; possibly be refactored into two parts, since we're only + ;; interested in basic "Local Variables" parsing. + (alist-get 'read-symbol-shorthands (hack-local-variables--find-variables))) + +(setq hack-read-symbol-shorthands-function #'hack-read-symbol-shorthands) ;; FIXME: move this all to progmodes/elisp-mode.el? OTOH it'd make commit 483142615864e990b2ec45e61681d7ab44096335 Author: Eli Zaretskii Date: Sun Oct 3 22:35:04 2021 +0300 Fix recipe for 'native-lisp' directory * src/Makefile.in (../native-lisp): If the directory native-lisp exists, do nothing. diff --git a/src/Makefile.in b/src/Makefile.in index c4e57ca63b..25c7865d4a 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -804,10 +804,12 @@ elnlisp := $(addprefix ${lispsource}/,${elnlisp}) $(lisp:.elc=.eln) THEFILE=$< $ Date: Sun Oct 3 12:22:23 2021 -0700 ; * lisp/time-stamp.el (time-stamp-format): Doc string. diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index e1ea922d04..178e490fb7 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -59,7 +59,7 @@ with %, as follows. %#p `am' or `pm' %P gives uppercase: `AM' or `PM' %02S seconds %w day number of week, Sunday is 0 -%02y 2-digit year: `03' %Y 4-digit year: `2003' +%02y 2-digit year %Y 4-digit year %Z time zone name: `EST' %#Z gives lowercase: `est' %5z time zone offset: `-0500' (since Emacs 27; see note below) commit 732c70a0d9d8db6a2fd77a52185f9a76743b05a9 Author: Paul Eggert Date: Sun Oct 3 11:42:20 2021 -0700 Simplify socket symlink-attack checking This is a minor bugfix cleanup (Bug#33847#161). * lib-src/emacsclient.c: Move "#include " to inside "#ifdef SOCKETS_IN_FILE_SYSTEM", which is more accurate and simpler than having a separate "#ifndef WINDOWSNT". (O_PATH): Likewise. diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 018e81e422..cff3cec2a7 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -80,9 +80,6 @@ char *w32_getenv (const char *); #include #include -#ifndef WINDOWSNT -# include -#endif #include #include #include @@ -94,10 +91,6 @@ char *w32_getenv (const char *); # pragma GCC diagnostic ignored "-Wformat-truncation=2" #endif -#if !defined O_PATH && !defined WINDOWSNT -# define O_PATH O_SEARCH -#endif - /* Name used to invoke this program. */ static char const *progname; @@ -1135,6 +1128,12 @@ process_grouping (void) #ifdef SOCKETS_IN_FILE_SYSTEM +# include + +# ifndef O_PATH +# define O_PATH O_SEARCH +# endif + /* A local socket address. The union avoids the need to cast. */ union local_sockaddr { commit fc32a3bd958797ad4392a97b66e52bff420ac399 Author: Eli Zaretskii Date: Sun Oct 3 21:30:34 2021 +0300 ; * doc/lispref/files.texi (Reading from Files): Fix wording. diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index e73f53b040..1e05153f3c 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -565,15 +565,15 @@ In this case, @var{visit} must be @code{nil}. For example, @noindent inserts the characters coded by the first 500 bytes of a file. -If @var{beg} or @var{end} fails to be at a character boundary, Emacs's -character code conversion will insert one or more raw-text characters -(@pxref{Coding System Basics}) into the buffer. If you want to read -part of a file this way, you are recommended to bind -@code{coding-system-for-read} to a suitable value around the call to -this function (@pxref{Specifying Coding Systems}), and to write Lisp -code which will check for raw-text characters at the boundaries, read -the rest of these characters from the file, and convert them back to -valid characters. +If @var{beg} or @var{end} happens to be in the middle of a character's +multibyte sequence, Emacs's character code conversion will insert one +or more eight-bit characters (a.k.a.@: ``raw bytes'') +(@pxref{Character Sets}) into the buffer. If you want to read part of +a file this way, we recommend to bind @code{coding-system-for-read} to +a suitable value around the call to this function (@pxref{Specifying +Coding Systems}), and to write Lisp code which will check for raw +bytes at the boundaries, read the entire sequence of these bytes, and +convert them back to valid characters. If the argument @var{replace} is non-@code{nil}, it means to replace the contents of the buffer (actually, just the accessible portion) with the @@ -588,8 +588,8 @@ with @code{insert-file-contents}, as long as @var{replace} and @defun insert-file-contents-literally filename &optional visit beg end replace This function works like @code{insert-file-contents} except that each -byte in the file is handled separately, being converted into a -raw-text character if needed. It does not run +byte in the file is handled separately, being converted into an +eight-bit character if needed. It does not run @code{after-insert-file-functions}, and does not do format decoding, character code conversion, automatic uncompression, and so on. @end defun commit 3cc77aa976f356f2496bd8471cf68b44d26c22a7 Author: Alan Mackenzie Date: Sun Oct 3 18:13:23 2021 +0000 Clarify (elisp) insert-file-contents with BEG or END not on character boundary * doc/lispref/files.texi (Reading from files): When the argument BEG or END to insert-file-contents are at a byte position not at a character boundary, clarify that raw bytes get inserted, and how to handle this awkwardness in Lisp. Also clarify that insert-file-contents-literally is intended to insert raw bytes into the buffer. Fix the outdated example that states it inserts 500 characters, when it actually inserts 500 bytes. diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 2dc808e694..e73f53b040 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -563,7 +563,17 @@ In this case, @var{visit} must be @code{nil}. For example, @end example @noindent -inserts the first 500 characters of a file. +inserts the characters coded by the first 500 bytes of a file. + +If @var{beg} or @var{end} fails to be at a character boundary, Emacs's +character code conversion will insert one or more raw-text characters +(@pxref{Coding System Basics}) into the buffer. If you want to read +part of a file this way, you are recommended to bind +@code{coding-system-for-read} to a suitable value around the call to +this function (@pxref{Specifying Coding Systems}), and to write Lisp +code which will check for raw-text characters at the boundaries, read +the rest of these characters from the file, and convert them back to +valid characters. If the argument @var{replace} is non-@code{nil}, it means to replace the contents of the buffer (actually, just the accessible portion) with the @@ -577,10 +587,11 @@ with @code{insert-file-contents}, as long as @var{replace} and @end defun @defun insert-file-contents-literally filename &optional visit beg end replace -This function works like @code{insert-file-contents} except that it -does not run @code{after-insert-file-functions}, and does not do -format decoding, character code conversion, automatic uncompression, -and so on. +This function works like @code{insert-file-contents} except that each +byte in the file is handled separately, being converted into a +raw-text character if needed. It does not run +@code{after-insert-file-functions}, and does not do format decoding, +character code conversion, automatic uncompression, and so on. @end defun If you want to pass a file name to another process so that another commit c6be44d9b3ec09195f6279e9a503175f8fd60e14 Author: Michael Albinus Date: Sun Oct 3 19:53:17 2021 +0200 * test/infra/gitlab-ci.yml (.native-comp-template): Revert change. diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index 3c6d836b58..5be59b8dcc 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -190,9 +190,18 @@ default: - test/lisp/filenotify-tests.el .native-comp-template: - only: - - web - - schedules + rules: + - if: '$CI_PIPELINE_SOURCE == "web"' + - if: '$CI_PIPELINE_SOURCE == "schedule"' + changes: + - "**/Makefile.in" + - .gitlab-ci.yml + - lisp/emacs-lisp/comp.el + - lisp/emacs-lisp/comp-cstr.el + - src/comp.{h,m} + - test/infra/* + - test/src/comp-resources/*.el + - test/src/comp-tests.el timeout: 8 hours stages: commit 5deeb0947d3663b78c2fb975d1252b85e12fce86 Author: Andreas Schwab Date: Sun Oct 3 19:36:53 2021 +0200 * src/Makefile.in: Simplify conditionals. diff --git a/src/Makefile.in b/src/Makefile.in index 46faeb6009..c4e57ca63b 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -450,14 +450,9 @@ FIRSTFILE_OBJ=@FIRSTFILE_OBJ@ ALLOBJS = $(FIRSTFILE_OBJ) $(VMLIMIT_OBJ) $(obj) $(otherobj) # Must be first, before dep inclusion! -ifeq ($(HAVE_NATIVE_COMP),yes) -ifeq ($(NATIVE_DISABLED),) -all: emacs$(EXEEXT) $(pdmp) $(OTHER_FILES) ../native-lisp -else -all: emacs$(EXEEXT) $(pdmp) $(OTHER_FILES) -endif -else all: emacs$(EXEEXT) $(pdmp) $(OTHER_FILES) +ifeq ($(HAVE_NATIVE_COMP):$(NATIVE_DISABLED),yes:) +all: ../native-lisp endif .PHONY: all @@ -785,8 +780,7 @@ tags: TAGS ../lisp/TAGS $(lwlibdir)/TAGS @$(MAKE) $(AM_V_NO_PD) -C ../lisp EMACS="$(bootstrap_exe)"\ THEFILE=$< $ Date: Sun Oct 3 19:40:14 2021 +0200 Improve native compilation on emba * test/infra/Dockerfile.emba (emacs-native-comp) (emacs-native-comp-speed1, emacs-native-comp-speed2): New stages. (emacs-native-comp-speed0): Adapt. * test/infra/gitlab-ci.yml (.build-template): Add 'needs: []'. (.native-comp-template): Use 'only:' instead of 'rules:'. (build-native-comp-speed0): Rename from 'build-native-bootstrap-speed0'. (build-native-comp-speed1, build-native-comp-speed2) (test-native-comp-speed0): New jobs. diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba index 71b4e76865..c129bc8be8 100644 --- a/test/infra/Dockerfile.emba +++ b/test/infra/Dockerfile.emba @@ -72,14 +72,14 @@ RUN ./autogen.sh autoconf RUN ./configure --with-ns RUN make bootstrap -FROM emacs-base as emacs-native-comp-speed0 +FROM emacs-base as emacs-native-comp RUN apt-get update && \ apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \ libgccjit-6-dev \ && rm -rf /var/lib/apt/lists/* -ARG make_bootstrap_params="" +FROM emacs-native-comp as emacs-native-comp-speed0 COPY . /checkout WORKDIR /checkout @@ -87,3 +87,19 @@ RUN ./autogen.sh autoconf RUN ./configure --with-native-compilation RUN make bootstrap -j2 \ NATIVE_FULL_AOT=1 BYTE_COMPILE_EXTRA_FLAGS='--eval "(setq comp-speed 0)"' + +FROM emacs-native-comp as emacs-native-comp-speed1 + +COPY . /checkout +WORKDIR /checkout +RUN ./autogen.sh autoconf +RUN ./configure --with-native-compilation +RUN make bootstrap -j2 BYTE_COMPILE_EXTRA_FLAGS='--eval "(setq comp-speed 1)"' + +FROM emacs-native-comp as emacs-native-comp-speed2 + +COPY . /checkout +WORKDIR /checkout +RUN ./autogen.sh autoconf +RUN ./configure --with-native-compilation +RUN make bootstrap -j2 diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index b233c0fbc5..3c6d836b58 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -116,6 +116,7 @@ default: - test -n "$(docker ps -aq -f name=${test_name})" && docker rm ${test_name} .build-template: + needs: [] rules: - if: '$CI_PIPELINE_SOURCE == "web"' when: always @@ -189,18 +190,9 @@ default: - test/lisp/filenotify-tests.el .native-comp-template: - rules: - - if: '$CI_PIPELINE_SOURCE == "web"' - - if: '$CI_PIPELINE_SOURCE == "schedule"' - changes: - - "**/Makefile.in" - - .gitlab-ci.yml - - lisp/emacs-lisp/comp.el - - lisp/emacs-lisp/comp-cstr.el - - src/comp.{h,m} - - test/infra/* - - test/src/comp-resources/*.el - - test/src/comp-tests.el + only: + - web + - schedules timeout: 8 hours stages: @@ -270,43 +262,31 @@ test-gnustep: target: emacs-gnustep make_params: install -build-native-bootstrap-speed0: +build-native-comp-speed0: stage: native-comp-images extends: [.job-template, .build-template, .native-comp-template] variables: target: emacs-native-comp-speed0 -# build-native-bootstrap-speed0: -# # Test a full native bootstrap -# # Run for now only speed 0 to limit memory usage and compilation time. -# stage: native-comp-images -# # Uncomment the following to run it only when scheduled. -# # only: -# # - schedules -# script: -# - DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y -qq -o=Dpkg::Use-Pty=0 libgccjit-6-dev -# - ./autogen.sh autoconf -# - ./configure --with-native-compilation -# - make bootstrap NATIVE_FULL_AOT=1 BYTE_COMPILE_EXTRA_FLAGS='--eval "(setq comp-speed 0)"' -j2 -# timeout: 8 hours +build-native-comp-speed1: + stage: native-comp-images + extends: [.job-template, .build-template, .native-comp-template] + variables: + target: emacs-native-comp-speed1 -# build-native-bootstrap-speed1: -# stage: native-comp-images -# script: -# - DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y -qq -o=Dpkg::Use-Pty=0 libgccjit-6-dev -# - ./autogen.sh autoconf -# - ./configure --with-native-compilation -# - make bootstrap BYTE_COMPILE_EXTRA_FLAGS='--eval "(setq comp-speed 1)"' -# timeout: 8 hours +build-native-comp-speed2: + stage: native-comp-images + extends: [.job-template, .build-template, .native-comp-template] + variables: + target: emacs-native-comp-speed2 -# build-native-bootstrap-speed2: -# stage: native-comp-images -# script: -# - DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y -qq -o=Dpkg::Use-Pty=0 libgccjit-6-dev -# - ./autogen.sh autoconf -# - ./configure --with-native-compilation -# - make bootstrap -# timeout: 8 hours +test-native-comp-speed0: + stage: native-comp + needs: [build-native-comp-speed0] + extends: [.job-template, .test-template, .native-comp-template] + variables: + target: emacs-native-comp-speed0 + make_params: "-C test native-comp.log" test-all-inotify: # This tests also file monitor libraries inotify and inotifywatch. commit 121a5abeaee85e7955786d838f07103ce074a63b Author: Juri Linkov Date: Sun Oct 3 20:35:49 2021 +0300 Move context-menu selection items Defun/List/Symbol to prog-mode (bug#9054) * lisp/mouse.el (context-menu-functions): Add context-menu-middle-separator to choices. (context-menu-region): Move Defun/List/Symbol selection items to prog-context-menu. * lisp/progmodes/prog-mode.el (prog-context-menu): Move Defun/List/Symbol selection items from context-menu-region. Include text-mode select menu only in strings and comments. * lisp/textmodes/text-mode.el (text-mode-menu): New function. (text-mode): Add text-mode-menu to context-menu-functions. diff --git a/lisp/mouse.el b/lisp/mouse.el index 5d4e05fa25..bb47d04a3a 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -290,6 +290,7 @@ and should return the same menu with changes such as added new menu items." :type '(repeat (choice (function-item context-menu-undo) (function-item context-menu-region) + (function-item context-menu-middle-separator) (function-item context-menu-toolbar) (function-item context-menu-global) (function-item context-menu-local) @@ -478,14 +479,6 @@ Some context functions add menu items below the separator." `(menu-item "All" ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'buffer)) :help "Mark the whole buffer for a subsequent cut/copy")) - (define-key-after submenu [mark-defun] - `(menu-item "Defun" - ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'defun)) - :help "Mark the defun at click for a subsequent cut/copy")) - (define-key-after submenu [mark-list] - `(menu-item "List" - ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'list)) - :help "Mark the list at click for a subsequent cut/copy")) (when (let* ((pos (posn-point (event-end click))) (char (when pos (char-after pos)))) (or (and char (eq (char-syntax char) ?\")) @@ -498,10 +491,6 @@ Some context functions add menu items below the separator." `(menu-item "Line" ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'line)) :help "Mark the line at click for a subsequent cut/copy")) - (define-key-after submenu [mark-symbol] - `(menu-item "Symbol" - ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'symbol)) - :help "Mark the symbol at click for a subsequent cut/copy")) (when (region-active-p) (define-key-after submenu [mark-none] `(menu-item "None" diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 6c09dcf881..4f15686dc8 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -68,6 +68,28 @@ `(menu-item "Find Definition" xref-find-definitions-at-mouse :help ,(format "Find definition of `%s'" identifier)) 'prog-separator))) + + (when (thing-at-mouse click 'symbol) + (define-key-after menu [select-region mark-symbol] + `(menu-item "Symbol" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'symbol)) + :help "Mark the symbol at click for a subsequent cut/copy") + 'mark-whole-buffer)) + (define-key-after menu [select-region mark-list] + `(menu-item "List" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'list)) + :help "Mark the list at click for a subsequent cut/copy") + 'mark-whole-buffer) + (define-key-after menu [select-region mark-defun] + `(menu-item "Defun" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'defun)) + :help "Mark the defun at click for a subsequent cut/copy") + 'mark-whole-buffer) + + ;; Include text-mode select menu only in strings and comments. + (when (nth 8 (save-excursion (syntax-ppss (posn-point (event-end click))))) + (text-mode-menu menu click)) + menu) (defvar prog-mode-map diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el index 74c6d412a6..3243bd31c4 100644 --- a/lisp/textmodes/text-mode.el +++ b/lisp/textmodes/text-mode.el @@ -95,6 +95,28 @@ inherit all the commands defined in this map.") :style toggle :selected (memq 'turn-on-auto-fill text-mode-hook)])) +(defun text-mode-menu (menu click) + "Populate MENU with text selection commands at CLICK." + + (when (thing-at-mouse click 'word) + (define-key-after menu [select-region mark-word] + `(menu-item "Word" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'word)) + :help "Mark the word at click for a subsequent cut/copy") + 'mark-whole-buffer)) + (define-key-after menu [select-region mark-sentence] + `(menu-item "Sentence" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'sentence)) + :help "Mark the sentence at click for a subsequent cut/copy") + 'mark-whole-buffer) + (define-key-after menu [select-region mark-paragraph] + `(menu-item "Paragraph" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'paragraph)) + :help "Mark the paragraph at click for a subsequent cut/copy") + 'mark-whole-buffer) + + menu) + (define-derived-mode text-mode nil "Text" "Major mode for editing text written for humans to read. @@ -104,7 +126,8 @@ You can thus get the full benefit of adaptive filling \\{text-mode-map} Turning on Text mode runs the normal hook `text-mode-hook'." (setq-local text-mode-variant t) - (setq-local require-final-newline mode-require-final-newline)) + (setq-local require-final-newline mode-require-final-newline) + (add-hook 'context-menu-functions 'text-mode-menu 10 t)) (define-derived-mode paragraph-indent-text-mode text-mode "Parindent" "Major mode for editing text, with leading spaces starting a paragraph. commit 0c341e6e84101251c0e40300519869f24415600d Author: Juri Linkov Date: Sun Oct 3 20:16:32 2021 +0300 * lisp/tab-bar.el (tab-bar-detach-tab): Handle frame selected by make-frame. (tab-bar-move-window-to-tab): New command. (tab-bar-new-tab-to): Handle the value 'window' of tab-bar-new-tab-choice. https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg02197.html diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 634328e223..68afb539fa 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1211,13 +1211,26 @@ Interactively, ARG selects the ARGth different frame to move to." "Detach tab number FROM-NUMBER to a new frame. Interactively or without argument, detach current tab." (interactive (list (1+ (tab-bar--current-tab-index)))) - (let* ((tab (nth (1- (or from-number 1)) (funcall tab-bar-tabs-function))) - (tab-name (alist-get 'name tab)) + (let* ((tabs (funcall tab-bar-tabs-function)) + (tab-index (1- (or from-number (1+ (tab-bar--current-tab-index tabs))))) + (tab-name (alist-get 'name (nth tab-index tabs))) + ;; On some window managers, `make-frame' selects the new frame, + ;; so previously selected frame is saved to `from-frame'. + (from-frame (selected-frame)) (new-frame (make-frame `((name . ,tab-name))))) - (tab-bar-move-tab-to-frame nil nil from-number new-frame nil) + (tab-bar-move-tab-to-frame nil from-frame from-number new-frame nil) (with-selected-frame new-frame (tab-bar-close-tab)))) +(defun tab-bar-move-window-to-tab () + "Detach the selected window to a new tab." + (interactive) + (let ((tab-bar-new-tab-choice 'window)) + (tab-bar-new-tab)) + (tab-bar-switch-to-recent-tab) + (delete-window) + (tab-bar-switch-to-recent-tab)) + (defcustom tab-bar-new-tab-to 'right "Defines where to create a new tab. @@ -1264,9 +1277,10 @@ After the tab is created, the hooks in (select-window (minibuffer-selected-window))) (let ((ignore-window-parameters t)) (delete-other-windows)) - ;; Create a new window to get rid of old window parameters - ;; (e.g. prev/next buffers) of old window. - (split-window) (delete-window) + (unless (eq tab-bar-new-tab-choice 'window) + ;; Create a new window to get rid of old window parameters + ;; (e.g. prev/next buffers) of old window. + (split-window) (delete-window)) (let ((buffer (if (functionp tab-bar-new-tab-choice) (funcall tab-bar-new-tab-choice) commit 931a7276c036c25b5cde8971a3b0cb65873156b2 Author: Juri Linkov Date: Sun Oct 3 20:13:29 2021 +0300 * lisp/tab-line.el (tab-line-format): Add face-modified to the cache key. When tab-line-tab-face-functions contains tab-line-tab-face-modified, add 'buffer-modified-p' status to the cache-key, so the cache will expire when the buffer modification status will change. https://lists.gnu.org/archive/html/emacs-devel/2021-10/msg00129.html diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 4a751b384e..890d1243e7 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -574,7 +574,10 @@ For use in `tab-line-tab-face-functions'." ;; handle tab-line scrolling (window-parameter nil 'tab-line-hscroll) ;; for setting face 'tab-line-tab-current' - (eq (selected-window) (old-selected-window)))) + (eq (selected-window) (old-selected-window)) + (and (memq 'tab-line-tab-face-modified + tab-line-tab-face-functions) + (buffer-file-name) (buffer-modified-p)))) (cache (window-parameter nil 'tab-line-cache))) ;; Enable auto-hscroll again after it was disabled on manual scrolling. ;; The moment to enable it is when the window-buffer was updated. commit 3863919a00e5f6c7cf9d4fe9e1b1a96fd5c18173 Author: Michael Albinus Date: Sun Oct 3 18:55:35 2021 +0200 Fix unmounting in Tramp * doc/misc/tramp.texi (FUSE setup): Add tramp-fuse-unmount-on-cleanup. * lisp/net/tramp.el (tramp-file-name-unify): New defun. (tramp-file-name-equal-p): * lisp/net/tramp-cache.el (tramp-get-connection-property) (tramp-set-connection-property, tramp-flush-connection-property) (tramp-flush-connection-properties): Use it. * lisp/net/tramp-fuse.el (tramp-fuse-get-fusermount): New defun. (tramp-fuse-mount-points): New defvar. (tramp-fuse-unmount): Use it. Delete VEC from `tramp-fuse-mount-points'. Delete mount point. (tramp-fuse-unmount-on-cleanup): New user option. (tramp-fuse-cleanup, tramp-fuse-cleanup-all): New defuns. (top): Adapt `tramp-fuse-unload-hook', `tramp-cleanup-connection-hook', `tramp-cleanup-all-connections-hook' and `kill-emacs-hook'. * lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection): * lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection): Add VEC to `tramp-fuse-mount-points'. * test/lisp/net/tramp-tests.el (tramp-fuse-unmount-on-cleanup): Declare. (tramp-test39-make-lock-file-name): Use it. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index e1bf2f2bae..95c744eef6 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2629,6 +2629,11 @@ Example: @end group @end lisp +@vindex tramp-fuse-unmount-on-cleanup +The user option @code{tramp-fuse-unmount-on-cleanup}, when set to +non-@code{nil}, controls, whether a mount point is unmounted on +connection cleanup or on Emacs exiting. + @anchor{Setup of rclone method} @subsection @option{rclone} setup diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 5a00915f4f..f1c656ec20 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -319,12 +319,7 @@ KEY identifies the connection, it is either a process or a used to cache connection properties of the local machine. If KEY is `tramp-cache-undefined', or if the value is not set for the connection, return DEFAULT." - ;; Unify key by removing localname and hop from `tramp-file-name' - ;; structure. Work with a copy in order to avoid side effects. - (when (tramp-file-name-p key) - (setq key (copy-tramp-file-name key)) - (setf (tramp-file-name-localname key) nil - (tramp-file-name-hop key) nil)) + (setq key (tramp-file-name-unify key)) (let* ((hash (tramp-get-hash-table key)) (cached (if (hash-table-p hash) (gethash property hash tramp-cache-undefined) @@ -350,12 +345,7 @@ used to cache connection properties of the local machine. If KEY is `tramp-cache-undefined', nothing is set. PROPERTY is set persistent when KEY is a `tramp-file-name' structure. Return VALUE." - ;; Unify key by removing localname and hop from `tramp-file-name' - ;; structure. Work with a copy in order to avoid side effects. - (when (tramp-file-name-p key) - (setq key (copy-tramp-file-name key)) - (setf (tramp-file-name-localname key) nil - (tramp-file-name-hop key) nil)) + (setq key (tramp-file-name-unify key)) (when-let ((hash (tramp-get-hash-table key))) (puthash property value hash)) (setq tramp-cache-data-changed @@ -379,12 +369,7 @@ KEY identifies the connection, it is either a process or a `tramp-file-name' structure. A special case is nil, which is used to cache connection properties of the local machine. PROPERTY is set persistent when KEY is a `tramp-file-name' structure." - ;; Unify key by removing localname and hop from `tramp-file-name' - ;; structure. Work with a copy in order to avoid side effects. - (when (tramp-file-name-p key) - (setq key (copy-tramp-file-name key)) - (setf (tramp-file-name-localname key) nil - (tramp-file-name-hop key) nil)) + (setq key (tramp-file-name-unify key)) (when-let ((hash (tramp-get-hash-table key))) (remhash property hash)) (setq tramp-cache-data-changed @@ -397,12 +382,7 @@ PROPERTY is set persistent when KEY is a `tramp-file-name' structure." KEY identifies the connection, it is either a process or a `tramp-file-name' structure. A special case is nil, which is used to cache connection properties of the local machine." - ;; Unify key by removing localname and hop from `tramp-file-name' - ;; structure. Work with a copy in order to avoid side effects. - (when (tramp-file-name-p key) - (setq key (copy-tramp-file-name key)) - (setf (tramp-file-name-localname key) nil - (tramp-file-name-hop key) nil)) + (setq key (tramp-file-name-unify key)) (tramp-message key 7 "%s %s" key (when-let ((hash (gethash key tramp-cache-data))) diff --git a/lisp/net/tramp-fuse.el b/lisp/net/tramp-fuse.el index 8c5afa7cf9..d2bac2d0ee 100644 --- a/lisp/net/tramp-fuse.el +++ b/lisp/net/tramp-fuse.el @@ -175,15 +175,30 @@ mount) (match-string 1 mount))))))) +(defun tramp-fuse-get-fusermount () + "Determine the local `fusermount' command." + ;; We use key nil for local connection properties. + (with-tramp-connection-property nil "fusermount" + (or (executable-find "fusermount3") + (executable-find "fusermount")))) + +(defvar tramp-fuse-mount-points nil + "List of fuse volume determined by a VEC.") + (defun tramp-fuse-unmount (vec) "Unmount fuse volume determined by VEC." - (let ((default-directory tramp-compat-temporary-file-directory) - (command (format "fusermount3 -u %s" (tramp-fuse-mount-point vec)))) + (let* ((default-directory tramp-compat-temporary-file-directory) + (mount-point (tramp-fuse-mount-point vec)) + (command (format "%s -u %s" (tramp-fuse-get-fusermount) mount-point))) (tramp-message vec 6 "%s\n%s" command (shell-command-to-string command)) (tramp-flush-connection-property (tramp-get-connection-process vec) "mounted") + (setq tramp-fuse-mount-points + (delete (tramp-file-name-unify vec) tramp-fuse-mount-points)) ;; Give the caches a chance to expire. - (sleep-for 1))) + (sleep-for 1) + (when (tramp-compat-directory-empty-p mount-point) + (delete-directory mount-point)))) (defun tramp-fuse-local-file-name (filename) "Return local mount name of FILENAME." @@ -205,6 +220,36 @@ (substring localname 1) localname) (tramp-fuse-mount-point v))))))) +(defcustom tramp-fuse-unmount-on-cleanup nil + "Whether fuse volumes shall be unmounted on cleanup." + :group 'tramp + :version "28.1" + :type 'boolean) + +(defun tramp-fuse-cleanup (vec) + "Cleanup fuse volume determined by VEC." + (and tramp-fuse-unmount-on-cleanup + (member (tramp-file-name-unify vec) tramp-fuse-mount-points) + (tramp-fuse-unmount vec))) + +(defun tramp-fuse-cleanup-all () + "Unmount all fuse volumes used by Tramp." + (and tramp-fuse-unmount-on-cleanup + (mapc #'tramp-fuse-unmount tramp-fuse-mount-points))) + +;; Add cleanup hooks. +(add-hook 'tramp-cleanup-connection-hook #'tramp-fuse-cleanup) +(add-hook 'tramp-cleanup-all-connections-hook #'tramp-fuse-cleanup-all) +(add-hook 'kill-emacs-hook #'tramp-fuse-cleanup-all) +(add-hook 'tramp-fuse-unload-hook + (lambda () + (remove-hook 'tramp-cleanup-connection-hook + #'tramp-fuse-cleanup) + (remove-hook 'tramp-cleanup-all-connections-hook + #'tramp-fuse-cleanup-all) + (remove-hook 'kill-emacs-hook + #'tramp-fuse-cleanup-all))) + (add-hook 'tramp-unload-hook (lambda () (unload-feature 'tramp-fuse 'force))) diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index 49e366c01c..812e06f3f1 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el @@ -386,6 +386,7 @@ connection if a previous connection has died for some reason." (tramp-cleanup-connection vec 'keep-debug 'keep-password)) ;; Mark it as connected. + (add-to-list 'tramp-fuse-mount-points (tramp-file-name-unify vec)) (tramp-set-connection-property (tramp-get-connection-process vec) "connected" t)))) diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el index 68230ee1ff..2be0485fbf 100644 --- a/lisp/net/tramp-sshfs.el +++ b/lisp/net/tramp-sshfs.el @@ -371,6 +371,7 @@ connection if a previous connection has died for some reason." vec 'file-error "Error mounting %s" (tramp-fuse-mount-spec vec)))) ;; Mark it as connected. + (add-to-list 'tramp-fuse-mount-points (tramp-file-name-unify vec)) (tramp-set-connection-property (tramp-get-connection-process vec) "connected" t))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index b69e143ff1..c0f1cb161e 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1450,16 +1450,24 @@ If nil, return `tramp-default-port'." (put #'tramp-file-name-port-or-default 'tramp-suppress-trace t) +(defun tramp-file-name-unify (vec) + "Unify VEC by removing localname and hop from `tramp-file-name' structure. +Objects returned by this function compare `equal' if they refer to the +same connection. Make a copy in order to avoid side effects." + (when (tramp-file-name-p vec) + (setq vec (copy-tramp-file-name vec)) + (setf (tramp-file-name-localname vec) nil + (tramp-file-name-hop vec) nil)) + vec) + +(put #'tramp-file-name-unify 'tramp-suppress-trace t) + ;; Comparison of file names is performed by `tramp-equal-remote'. (defun tramp-file-name-equal-p (vec1 vec2) "Check, whether VEC1 and VEC2 denote the same `tramp-file-name'." (and (tramp-file-name-p vec1) (tramp-file-name-p vec2) - (string-equal (tramp-file-name-method vec1) - (tramp-file-name-method vec2)) - (string-equal (tramp-file-name-user-domain vec1) - (tramp-file-name-user-domain vec2)) - (string-equal (tramp-file-name-host-port vec1) - (tramp-file-name-host-port vec2)))) + (equal (tramp-file-name-unify vec1) + (tramp-file-name-unify vec2)))) (defun tramp-get-method-parameter (vec param) "Return the method parameter PARAM. @@ -3846,7 +3854,7 @@ User is always nil." (delete-file (tramp-make-tramp-file-name v remote-copy 'nohop)))) ;; Result. - (cons (expand-file-name filename) (cdr result))))) + (cons filename (cdr result))))) (defun tramp-get-lock-file (file) "Read lockfile info of FILE. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 9a1c9d659b..ebedbaf45f 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -69,6 +69,7 @@ (defvar tramp-connection-properties) (defvar tramp-copy-size-limit) (defvar tramp-display-escape-sequence-regexp) +(defvar tramp-fuse-unmount-on-cleanup) (defvar tramp-inline-compress-start-size) (defvar tramp-persistency-file-name) (defvar tramp-remote-path) @@ -5884,10 +5885,7 @@ Use direct async.") tramp-allow-unsafe-temporary-files (inhibit-message t) ;; tramp-rclone.el and tramp-sshfs.el cache the mounted files. - (tramp-cleanup-connection-hook - (append - (and (tramp--test-fuse-p) '(tramp-fuse-unmount)) - tramp-cleanup-connection-hook)) + (tramp-fuse-unmount-on-cleanup t) auto-save-default noninteractive) commit 7a6d34cd1f1ea2eb053578521632420d6ff9c0db Author: Stefan Kangas Date: Sun Oct 3 18:33:32 2021 +0200 * etc/themes/light-blue-theme.el: Add "Maintainer: emacs-devel". diff --git a/etc/themes/light-blue-theme.el b/etc/themes/light-blue-theme.el index 62528856da..f49b37a15f 100644 --- a/etc/themes/light-blue-theme.el +++ b/etc/themes/light-blue-theme.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2011-2021 Free Software Foundation, Inc. ;; Author: Drew Adams +;; Maintainer: emacs-devel@gnu.org ;; This file is part of GNU Emacs. commit c1b1e1f5455260d457ca9024d253fb2157d0a48f Author: Eli Zaretskii Date: Sun Oct 3 19:05:49 2021 +0300 Define HAVE_NATIVE_COMP in src/Makefile.in * src/Makefile.in (HAVE_NATIVE_COMP): Define. Reported by Ken Brown . diff --git a/src/Makefile.in b/src/Makefile.in index 34335cfa96..46faeb6009 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -55,6 +55,8 @@ lwlibdir = ../lwlib # Configuration files for .o files to depend on. config_h = config.h $(srcdir)/conf_post.h +HAVE_NATIVE_COMP = @HAVE_NATIVE_COMP@ + ## ns-app if NS self contained app, else empty. OTHER_FILES = @OTHER_FILES@ commit 137fa2d71676044234ddf5a49c83585a0b9407b6 Author: João Távora Date: Sun Oct 3 12:14:41 2021 +0100 Rename elisp-shorthands to read-symbol-shorthands The new name fits better in the family of variables that affect the Lisp reader. Suggested-by: Po Lu * doc/lispref/symbols.texi (Shorthands): Mention read-symbol-shorthands * lisp/shorthands.el (hack-read-symbol-shorthands) (hack-read-symbol-shorthands) (shorthands-font-lock-shorthands): Use read-symbol-shorthands * lisp/progmodes/elisp-mode.el (elisp--completion-local-symbols) (elisp--completion-local-symbols) (elisp-shorthands): Use read-symbol-shorthands * src/lread.c: (syms_of_lread): Define Vread_symbol_shorthands (oblookup_considering_shorthand): Use Vread_symbol_shorthands. * test/lisp/progmodes/elisp-mode-tests.el (elisp-shorthand-read-buffer): (elisp-shorthand-read-from-string): Use read-symbol-shorthands * test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el Use new symbol name read-symbol-shorthands. diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi index 8ae2d1fc88..9c33e2c8ec 100644 --- a/doc/lispref/symbols.texi +++ b/doc/lispref/symbols.texi @@ -666,7 +666,7 @@ different things. However, this practice commonly originates very long symbols names, which are inconvenient to type and read after a while. Shorthands solve these issues in a clean way. -@defvar elisp-shorthands +@defvar read-symbol-shorthands This variable's value is an alist whose elements have the form @code{(@var{shorthand-prefix} . @var{longhand-prefix})}. Each element instructs the Lisp reader to read every symbol form which starts with @@ -704,7 +704,7 @@ alleviate that. (snu-split "\\(\r\n\\|[\n\r]\\)" s)) ;; Local Variables: -;; elisp-shorthands: (("snu-" . "some-nice-string-utils-")) +;; read-symbol-shorthands: (("snu-" . "some-nice-string-utils-")) ;; End: @end lisp @@ -719,19 +719,19 @@ waiting for ElDoc (@pxref{Lisp Doc, , Local Variables in Files, emacs, The GNU Emacs Manual}) to hint at the true full name of the symbol under point in the echo area. -Since @code{elisp-shorthands} is a file-local variable, it is possible -that multiple libraries depending on +Since @code{read-symbol-shorthands} is a file-local variable, it is +possible that multiple libraries depending on @file{some-nice-string-utils-lines.el} refer to the same symbols under @emph{different} shorthands, or not using shorthands at all. In the -next example, the @file{my-tricks.el} library refers to the -symbol @code{some-nice-string-utils-lines} using the -@code{sns-} prefix instead of @code{snu-}. +next example, the @file{my-tricks.el} library refers to the symbol +@code{some-nice-string-utils-lines} using the @code{sns-} prefix +instead of @code{snu-}. @example (defun t-reverse-lines (s) (string-join (reverse (sns-lines s)) "\n") ;; Local Variables: -;; elisp-shorthands: (("t-" . "my-tricks-") -;; ("sns-" . "some-nice-string-utils-")) +;; read-symbol-shorthands: (("t-" . "my-tricks-") +;; ("sns-" . "some-nice-string-utils-")) ;; End: @end example diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index acf7123225..c7474b25a7 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -548,7 +548,7 @@ in `completion-at-point-functions' (which see)." (lambda (s) (push s retval) (cl-loop - for (shorthand . longhand) in elisp-shorthands + for (shorthand . longhand) in read-symbol-shorthands for full-name = (symbol-name s) when (string-prefix-p longhand full-name) do (let ((sym (make-symbol @@ -559,17 +559,17 @@ in `completion-at-point-functions' (which see)." (push sym retval) retval)))) retval))) - (cond ((null elisp-shorthands) obarray) + (cond ((null read-symbol-shorthands) obarray) ((and obarray-cache - (gethash (cons (current-buffer) elisp-shorthands) + (gethash (cons (current-buffer) read-symbol-shorthands) obarray-cache))) (obarray-cache - (puthash (cons (current-buffer) elisp-shorthands) + (puthash (cons (current-buffer) read-symbol-shorthands) (obarray-plus-shorthands) obarray-cache)) (t (setq obarray-cache (make-hash-table :test #'equal)) - (puthash (cons (current-buffer) elisp-shorthands) + (puthash (cons (current-buffer) read-symbol-shorthands) (obarray-plus-shorthands) obarray-cache))))) @@ -2126,7 +2126,7 @@ Runs in a batch-mode Emacs. Interactively use variable (pp collected))) -(put 'elisp-shorthands 'safe-local-variable #'consp) +(put 'read-symbol-shorthands 'safe-local-variable #'consp) (provide 'elisp-mode) ;;; elisp-mode.el ends here diff --git a/lisp/shorthands.el b/lisp/shorthands.el index f657047777..c31ef3d216 100644 --- a/lisp/shorthands.el +++ b/lisp/shorthands.el @@ -28,13 +28,13 @@ (require 'files) (eval-when-compile (require 'cl-lib)) -(defun hack-elisp-shorthands (fullname) - "Return value of `elisp-shorthands' file-local variable in FULLNAME. +(defun hack-read-symbol-shorthands (fullname) + "Return value of `read-symbol-shorthands' file-local variable in FULLNAME. FULLNAME is the absolute file name of an Elisp .el file which -potentially specifies a file-local value for `elisp-shorthands'. -The Elisp code in FULLNAME isn't read or evaluated in any way, -except for extraction of the buffer-local value of -`elisp-shorthands'." +potentially specifies a file-local value for +`read-symbol-shorthands'. The Elisp code in FULLNAME isn't read +or evaluated in any way, except for extraction of the +buffer-local value of `read-symbol-shorthands'." (let* ((size (nth 7 (file-attributes fullname))) (from (max 0 (- size 3000))) (to size)) @@ -49,13 +49,13 @@ except for extraction of the buffer-local value of ;; detail of files.el. That function should be exported, ;; possibly be refactored into two parts, since we're only ;; interested in basic "Local Variables" parsing. - (alist-get 'elisp-shorthands (hack-local-variables--find-variables))))) + (alist-get 'read-symbol-shorthands (hack-local-variables--find-variables))))) (defun load-with-shorthands-and-code-conversion (fullname file noerror nomessage) "Like `load-with-code-conversion', but also consider Elisp shorthands. This function uses shorthands defined in the file FULLNAME's local -value of `elisp-shorthands', when it processes that file's Elisp code." - (let ((elisp-shorthands (hack-elisp-shorthands fullname))) +value of `read-symbol-shorthands', when it processes that file's Elisp code." + (let ((read-symbol-shorthands (hack-read-symbol-shorthands fullname))) (load-with-code-conversion fullname file noerror nomessage))) @@ -78,7 +78,7 @@ value of `elisp-shorthands', when it processes that file's Elisp code." finally (return (1- i)))) (defun shorthands-font-lock-shorthands (limit) - (when elisp-shorthands + (when read-symbol-shorthands (while (re-search-forward (eval-when-compile (concat "\\_<\\(" lisp-mode-symbol-regexp "\\)\\_>")) diff --git a/src/lread.c b/src/lread.c index af0a799459..07580d11d1 100644 --- a/src/lread.c +++ b/src/lread.c @@ -4626,29 +4626,29 @@ oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff return tem; } -/* Like 'oblookup', but considers 'Velisp_shorthands', potentially - recognizing that IN is shorthand for some other longhand name, - which is then then placed in OUT. In that case, memory is - malloc'ed for OUT (which the caller must free) while SIZE_OUT and - SIZE_BYTE_OUT respectively hold the character and byte sizes of the - transformed symbol name. If IN is not recognized shorthand for any - other symbol, OUT is set to point to NULL and 'oblookup' is - called. */ +/* Like 'oblookup', but considers 'Vread_symbol_shorthands', + potentially recognizing that IN is shorthand for some other + longhand name, which is then then placed in OUT. In that case, + memory is malloc'ed for OUT (which the caller must free) while + SIZE_OUT and SIZE_BYTE_OUT respectively hold the character and byte + sizes of the transformed symbol name. If IN is not recognized + shorthand for any other symbol, OUT is set to point to NULL and + 'oblookup' is called. */ Lisp_Object oblookup_considering_shorthand (Lisp_Object obarray, const char *in, ptrdiff_t size, ptrdiff_t size_byte, char **out, ptrdiff_t *size_out, ptrdiff_t *size_byte_out) { - Lisp_Object tail = Velisp_shorthands; + Lisp_Object tail = Vread_symbol_shorthands; /* First, assume no transformation will take place. */ *out = NULL; - /* Then, iterate each pair in Velisp_shorthands. */ + /* Then, iterate each pair in Vread_symbol_shorthands. */ FOR_EACH_TAIL_SAFE (tail) { Lisp_Object pair = XCAR (tail); - /* Be lenient to 'elisp-shorthands': if some element isn't a + /* Be lenient to 'read-symbol-shorthands': if some element isn't a cons, or some member of that cons isn't a string, just skip to the next element. */ if (!CONSP (pair)) @@ -5446,10 +5446,10 @@ that are loaded before your customizations are read! */); DEFSYM (Qchar_from_name, "char-from-name"); - DEFVAR_LISP ("elisp-shorthands", Velisp_shorthands, + DEFVAR_LISP ("read-symbol-shorthands", Vread_symbol_shorthands, doc: /* Alist of known symbol-name shorthands. This variable's value can only be set via file-local variables. See Info node `(elisp)Shorthands' for more details. */); - Velisp_shorthands = Qnil; + Vread_symbol_shorthands = Qnil; DEFSYM (Qobarray_cache, "obarray-cache"); } diff --git a/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el b/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el index 29ee36a315..14c8e845d1 100644 --- a/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el +++ b/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el @@ -1,17 +1,17 @@ (defun f-test () - (let ((elisp-shorthands '(("foo-" . "bar-")))) + (let ((read-symbol-shorthands '(("foo-" . "bar-")))) (with-temp-buffer (insert "(foo-bar)") (goto-char (point-min)) (read (current-buffer))))) (defun f-test2 () - (let ((elisp-shorthands '(("foo-" . "bar-")))) + (let ((read-symbol-shorthands '(("foo-" . "bar-")))) (read-from-string "(foo-bar)"))) (defun f-test3 () - (let ((elisp-shorthands '(("foo-" . "bar-")))) + (let ((read-symbol-shorthands '(("foo-" . "bar-")))) (intern "foo-bar"))) (defvar f-test-complete-me 42) @@ -34,5 +34,5 @@ ;; Local Variables: -;; elisp-shorthands: (("f-" . "elisp--foo-")) +;; read-symbol-shorthands: (("f-" . "elisp--foo-")) ;; End: diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index a3449c2b33..ad39cebfc8 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -1026,7 +1026,7 @@ evaluation of BODY." (shorthand-sname (format "s-%s" gsym)) (expected (intern (format "shorthand-longhand-%s" gsym)))) (cl-assert (not (intern-soft shorthand-sname))) - (should (equal (let ((elisp-shorthands + (should (equal (let ((read-symbol-shorthands '(("s-" . "shorthand-longhand-")))) (with-temp-buffer (insert shorthand-sname) @@ -1040,7 +1040,7 @@ evaluation of BODY." (shorthand-sname (format "s-%s" gsym)) (expected (intern (format "shorthand-longhand-%s" gsym)))) (cl-assert (not (intern-soft shorthand-sname))) - (should (equal (let ((elisp-shorthands + (should (equal (let ((read-symbol-shorthands '(("s-" . "shorthand-longhand-")))) (car (read-from-string shorthand-sname))) expected)) commit e6fbc45b7b49a27ab4db348385762bafc330bcf3 Author: João Távora Date: Sun Oct 3 11:56:16 2021 +0100 Font-lock shorthands in elisp-mode for quick visual recognition (bug#50959) Only the shorthanded prefix is font-locked. This allows the remainder of the font-lock logic to subsist (e.g. for macro-defining symbols). * lisp/shorthands.el (cl-lib): Require it when compiling. (elisp-shorthand-font-lock-face): New face. (shorthands--mismatch-from-end): New helper. (shorthands-font-lock-shorthands): New helper. * test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el: Add some dummy test code. diff --git a/lisp/shorthands.el b/lisp/shorthands.el index 6162efd609..f657047777 100644 --- a/lisp/shorthands.el +++ b/lisp/shorthands.el @@ -26,6 +26,7 @@ ;;; Code: (require 'files) +(eval-when-compile (require 'cl-lib)) (defun hack-elisp-shorthands (fullname) "Return value of `elisp-shorthands' file-local variable in FULLNAME. @@ -57,4 +58,42 @@ value of `elisp-shorthands', when it processes that file's Elisp code." (let ((elisp-shorthands (hack-elisp-shorthands fullname))) (load-with-code-conversion fullname file noerror nomessage))) + +;; FIXME: move this all to progmodes/elisp-mode.el? OTOH it'd make +;; more sense there, OTOH all the elisp font-lock stuff is actually in +;; lisp/emacs-lisp/lisp-mode.el, which isn't right either. So +;; shorthand font-locking logic is probably better here for now. + +(defface elisp-shorthand-font-lock-face + '((t :inherit font-lock-keyword-face :foreground "cyan")) + "Face for highlighting shorthands in Emacs Lisp." + :version "28.1" + :group 'font-lock-faces) + +(defun shorthands--mismatch-from-end (str1 str2) + (cl-loop with l1 = (length str1) with l2 = (length str2) + for i from 1 + for i1 = (- l1 i) for i2 = (- l2 i) + while (and (>= i1 0) (>= i2 0) (eq (aref str1 i1) (aref str2 i2))) + finally (return (1- i)))) + +(defun shorthands-font-lock-shorthands (limit) + (when elisp-shorthands + (while (re-search-forward + (eval-when-compile + (concat "\\_<\\(" lisp-mode-symbol-regexp "\\)\\_>")) + limit t) + (let* ((existing (get-text-property (match-beginning 1) 'face)) + (probe (and (not (memq existing '(font-lock-comment-face + font-lock-string-face))) + (intern-soft (match-string 1)))) + (sname (and probe (symbol-name probe))) + (mm (and sname (shorthands--mismatch-from-end + (match-string 1) sname)))) + (unless (or (null mm) (= mm (length sname))) + (add-face-text-property (match-beginning 1) (1+ (- (match-end 1) mm)) + 'elisp-shorthand-font-lock-face)))))) + +(font-lock-add-keywords 'emacs-lisp-mode '((shorthands-font-lock-shorthands)) t) + ;;; shorthands.el ends here diff --git a/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el b/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el index ec568093af..29ee36a315 100644 --- a/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el +++ b/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el @@ -16,8 +16,16 @@ (defvar f-test-complete-me 42) +(elisp--foo-test3) + (defun #_f-test4--- () 84) +(defmacro f-define-test-5 ()) + +;; should be font locked with both shorthand +;; highlighting _and_ macro highlighting. +(f-define-test-5) + (when nil (f-test3) (f-test2) commit 17e6f3bee5a30f463082fad19d58de453ec9f490 Author: Michael Albinus Date: Sun Oct 3 17:01:30 2021 +0200 ; Fix last change in tramp-sshfs.el diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el index 688e408bfb..68230ee1ff 100644 --- a/lisp/net/tramp-sshfs.el +++ b/lisp/net/tramp-sshfs.el @@ -222,12 +222,14 @@ arguments to pass to the OPERATION." (defun tramp-sshfs-handle-insert-file-contents (filename &optional visit beg end replace) "Like `insert-file-contents' for Tramp files." - (let* (signal-hook-function - (result - (insert-file-contents - (tramp-fuse-local-file-name filename) visit beg end replace))) - (when visit (setq buffer-file-name filename)) - (cons (expand-file-name filename) (cdr result)))) + (setq filename (expand-file-name filename)) + (let (signal-hook-function result) + (unwind-protect + (setq result + (insert-file-contents + (tramp-fuse-local-file-name filename) visit beg end replace)) + (when visit (setq buffer-file-name filename)) + (cons filename (cdr result))))) (defun tramp-sshfs-handle-process-file (program &optional infile destination display &rest args) commit 3dae1e33d19e2a7e0f879a38354944c9d567c9d3 Author: Michael Albinus Date: Sun Oct 3 14:27:26 2021 +0200 Suppress superfluous error messages in Tramp * lisp/net/tramp-sshfs.el (tramp-sshfs-handle-insert-file-contents): * lisp/net/tramp.el (tramp-handle-insert-file-contents) (tramp-handle-lock-file): Suppress superfluous error message. diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el index 0019ac014f..688e408bfb 100644 --- a/lisp/net/tramp-sshfs.el +++ b/lisp/net/tramp-sshfs.el @@ -222,9 +222,10 @@ arguments to pass to the OPERATION." (defun tramp-sshfs-handle-insert-file-contents (filename &optional visit beg end replace) "Like `insert-file-contents' for Tramp files." - (let ((result - (insert-file-contents - (tramp-fuse-local-file-name filename) visit beg end replace))) + (let* (signal-hook-function + (result + (insert-file-contents + (tramp-fuse-local-file-name filename) visit beg end replace))) (when visit (setq buffer-file-name filename)) (cons (expand-file-name filename) (cdr result)))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 62628363b7..b69e143ff1 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3743,7 +3743,8 @@ User is always nil." (with-parsed-tramp-file-name filename nil (unwind-protect (if (not (file-exists-p filename)) - (tramp-compat-file-missing v filename) + (let ((tramp-verbose (if visit 0 tramp-verbose))) + (tramp-compat-file-missing v filename)) (with-tramp-progress-reporter v 3 (format-message "Inserting `%s'" filename) @@ -3920,7 +3921,8 @@ Return nil when there is no lockfile." (tramp-error v 'file-error "Unsafe lock file name"))) ;; Do the lock. - (let (create-lockfiles signal-hook-function) + (let ((tramp-verbose 0) + create-lockfiles signal-hook-function) (condition-case nil (make-symbolic-link info lockname 'ok-if-already-exists) (error commit b228ec9fab8ea5e09da4d3c3f41d7859d88afb7d Author: Eli Zaretskii Date: Sun Oct 3 14:34:08 2021 +0300 Fix reading the tail of a file in shorthands.el * lisp/shorthands.el (hack-elisp-shorthands): Fix reading past 3000-character limit from EOF. (Bug#50946) diff --git a/lisp/shorthands.el b/lisp/shorthands.el index b8204d62a2..6162efd609 100644 --- a/lisp/shorthands.el +++ b/lisp/shorthands.el @@ -40,7 +40,10 @@ except for extraction of the buffer-local value of (with-temp-buffer (while (and (< (buffer-size) 3000) (>= from 0)) (insert-file-contents fullname nil from to) - (setq to from from (- from 100))) + (setq to from + from (cond + ((= from 0) -1) + (t (max 0 (- from 100)))))) ;; FIXME: relies on the `hack-local-variables--find-variables' ;; detail of files.el. That function should be exported, ;; possibly be refactored into two parts, since we're only commit 7fb27895090f8f9fe6cfa6311a77ec2c794adc84 Author: Lars Ingebrigtsen Date: Sun Oct 3 11:35:28 2021 +0200 Fix substitution of pretty quotes in code in easy-mmode * lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring): Adjust. (easy-mmode--mode-docstring): Avoid making quotes into pretty quotes in code (bug#50968). diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index d37bca24a0..f752861d80 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -93,7 +93,7 @@ Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. To check whether the minor mode is enabled in the current buffer, -evaluate `%S'. +evaluate `%s'. The mode's hook is called both when the mode is enabled and when it is disabled.") @@ -109,7 +109,9 @@ it is disabled.") (docs-fc (bound-and-true-p emacs-lisp-docstring-fill-column)) (fill-column (if (integerp docs-fc) docs-fc 65)) (argdoc (format easy-mmode--arg-docstring mode-pretty-name - getter)) + ;; Avoid having quotes turn into pretty quotes. + (string-replace "'" "\\\\='" + (format "%S" getter)))) (filled (if (fboundp 'fill-region) (with-temp-buffer (insert argdoc) commit b47d7ce1b87ee8bbbb04ce2b784af57ece17177f Author: Lars Ingebrigtsen Date: Sun Oct 3 11:28:27 2021 +0200 Fix agent directory deletion * lisp/gnus/gnus-agent.el (gnus-agent-expire-unagentized-dirs): Delete directories in a simpler way that actually works (bug#50986). diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index 19d0512004..6426d82546 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el @@ -3553,32 +3553,13 @@ articles in every agentized group? ")) (when (and to-remove (or gnus-expert-user (gnus-y-or-n-p - "gnus-agent-expire has identified local directories that are\ - not currently required by any agentized group. Do you wish to consider\ - deleting them?"))) - (while to-remove - (let ((dir (pop to-remove))) - (if (or gnus-expert-user + "gnus-agent-expire has identified local directories that are +not currently required by any agentized group. Do you wish to consider +deleting them?"))) + (dolist (dir to-remove) + (when (or gnus-expert-user (gnus-y-or-n-p (format "Delete %s? " dir))) - (let* (delete-recursive - files f - (delete-recursive - (lambda (f-or-d) - (ignore-errors - (if (file-directory-p f-or-d) - (condition-case nil - (delete-directory f-or-d) - (file-error - (setq files (directory-files f-or-d)) - (while files - (setq f (pop files)) - (or (member f '("." "..")) - (funcall delete-recursive - (nnheader-concat - f-or-d f)))) - (delete-directory f-or-d))) - (delete-file f-or-d)))))) - (funcall delete-recursive dir))))))))) + (delete-directory dir t))))))) ;;;###autoload (defun gnus-agent-batch () commit 72491495e7b4b574f04fd18902c61dca84dcbc1b Author: Lars Ingebrigtsen Date: Sun Oct 3 11:03:55 2021 +0200 Obsolete the light-blue theme * etc/themes/light-blue-theme.el (light-blue): Make theme obsolete since it's not maintained and seems to serve no particular use case (bug#47047). diff --git a/etc/themes/light-blue-theme.el b/etc/themes/light-blue-theme.el index 62528856da..8f4502a0cb 100644 --- a/etc/themes/light-blue-theme.el +++ b/etc/themes/light-blue-theme.el @@ -28,6 +28,8 @@ (deftheme light-blue "Face colors utilizing a light blue background.") +(make-obsolete 'light-blue nil "29.1") + (let ((class '((class color) (min-colors 89)))) (custom-theme-set-faces 'light-blue commit 344634d7cc5206027fda8e791beef8c43de8aedb Author: Lars Ingebrigtsen Date: Sun Oct 3 11:03:07 2021 +0200 Allow obsoleting themes * lisp/cus-theme.el (customize-themes): Don't list obsolete themes. * lisp/custom.el (load-theme): Issue a warning if the theme is obsolete (bug#47047). diff --git a/etc/NEWS b/etc/NEWS index 8c22230daf..20ed20308e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -80,6 +80,11 @@ Emacs buffers, like indentation and the like. The new ert function * Lisp Changes in Emacs 29.1 +--- +** Themes can now be made obsolete. +Using 'make-obsolete' on a theme is now supported. This will make +'load-theme' issue a warning when loading the theme. + * Changes in Emacs 29.1 on Non-Free Operating Systems diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el index 07881e9b74..f618e3341c 100644 --- a/lisp/cus-theme.el +++ b/lisp/cus-theme.el @@ -627,22 +627,24 @@ Theme files are named *-theme.el in `")) (let ((help-echo "mouse-2: Enable this theme for this session") widget) (dolist (theme (custom-available-themes)) - (setq widget (widget-create 'checkbox - :value (custom-theme-enabled-p theme) - :theme-name theme - :help-echo help-echo - :action #'custom-theme-checkbox-toggle)) - (push (cons theme widget) custom--listed-themes) - (widget-create-child-and-convert widget 'push-button - :button-face-get 'ignore - :mouse-face-get 'ignore - :value (format " %s" theme) - :action #'widget-parent-action - :help-echo help-echo) - (widget-insert " -- " - (propertize (custom-theme-summary theme) - 'face 'shadow) - ?\n))) + ;; Don't list obsolete themes. + (unless (get theme 'byte-obsolete-info) + (setq widget (widget-create 'checkbox + :value (custom-theme-enabled-p theme) + :theme-name theme + :help-echo help-echo + :action #'custom-theme-checkbox-toggle)) + (push (cons theme widget) custom--listed-themes) + (widget-create-child-and-convert widget 'push-button + :button-face-get 'ignore + :mouse-face-get 'ignore + :value (format " %s" theme) + :action #'widget-parent-action + :help-echo help-echo) + (widget-insert " -- " + (propertize (custom-theme-summary theme) + 'face 'shadow) + ?\n)))) (goto-char (point-min)) (widget-setup)) diff --git a/lisp/custom.el b/lisp/custom.el index 858b158051..0cd4318e63 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -1331,6 +1331,13 @@ Return t if THEME was successfully loaded, nil otherwise." t)))) (t (error "Unable to load theme `%s'" theme)))) + (when-let ((obs (get theme 'byte-obsolete-info))) + (display-warning 'initialization + (format "The `%s' theme is obsolete%s" + theme + (if (nth 2 obs) + (format " since Emacs %s" (nth 2 obs)) + "")))) ;; Optimization: if the theme changes the `default' face, put that ;; entry first. This avoids some `frame-set-background-mode' rigmarole ;; by assigning the new background immediately. commit b1a8a66fb0f28cba607831862fa673666a47bb2c Author: Stefan Kangas Date: Sun Oct 3 02:04:34 2021 +0200 ; * etc/TODO: Fix previous commit; delete the right thing. diff --git a/etc/TODO b/etc/TODO index da15ea1f77..1efbd8d871 100644 --- a/etc/TODO +++ b/etc/TODO @@ -74,10 +74,6 @@ Including it as an "experimental" compile-time option sounds good. Of course there might still be big questions around "which form of concurrency" we'll want. -** Better support for dynamic embedded graphics -I like this idea (my mpc.el code could use it for the volume widget), -though I wonder if the resulting efficiency will be sufficient. - ** Spread Semantic ** Improve the "code snippets" support @@ -396,6 +392,11 @@ should invoke the 'shape' method. 'hbfont_shape' should be extended to pass to 'hb_shape_full' the required array of features, as mentioned in the above HarfBuzz discussion. +** Better support for displaying Emoji +Emacs is capable of displaying Emoji and some of the Emoji sequences, +provided that its fontsets are configured with a suitable font. To +make this easier out of the box, the following should be done: + *** Populate composition-function-table with Emoji rules The Unicode Character Database (UCD) includes several data files that define the valid Emoji sequences. These files should be imported into commit 6c01a213656cc1d38c9ac0b127583910a9296365 Author: Stefan Kangas Date: Sat Oct 2 21:56:22 2021 +0200 Clarify the purpose of internal--format-docstring-line * test/lisp/subr-tests.el (subr-test-internal--format-docstring-line): * lisp/subr.el (internal--format-docstring-line): Make it more clear that this function is not intended for the first line of a docstring. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Add comment explaining why we use 'internal--format-docstring-line'. Problem pointed out by Stefan Monnier . diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 527720c6e8..1852471bcb 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -3087,6 +3087,14 @@ To see the documentation for a defined struct type, use ;; and pred-check, so changing it is not straightforward. (push `(,defsym ,accessor (cl-x) ,(concat + ;; NB. This will produce incorrect results + ;; in some cases, as our coding conventions + ;; says that the first line must be a full + ;; sentence. However, if we don't word wrap + ;; we will have byte-compiler warnings about + ;; overly long docstrings. So we can't have + ;; a perfect result here, and choose to avoid + ;; the byte-compiler warnings. (internal--format-docstring-line "Access slot \"%s\" of `%s' struct CL-X." slot name) (if doc (concat "\n" doc) "")) diff --git a/lisp/subr.el b/lisp/subr.el index 1d2980802e..a8fb52c909 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6437,7 +6437,9 @@ of fill.el (for example `fill-region')." (defun internal--format-docstring-line (string &rest objects) "Format a single line from a documentation string out of STRING and OBJECTS. Signal an error if STRING contains a newline. -This is intended for internal use only." +This is intended for internal use only. Avoid using this for the +first line of a docstring; the first line should be a complete +sentence (see Info node `(elisp) Documentation Tips')." (when (string-match "\n" string) (error "Unable to fill string containing newline: %S" string)) (internal--fill-string-single-line (apply #'format string objects))) diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index ed9a3d0149..0da1ae9687 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -769,15 +769,14 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350." (ert-deftest subr-test-internal--format-docstring-line () (should - (string= (let ((fill-column 60)) + (string= (let ((fill-column 70)) (internal--format-docstring-line - "Emacs is the advanced, extensible, customizable, \ -self-documenting editor. This manual describes how to edit with Emacs and \ -some of the ways to customize it; it corresponds to GNU Emacs version 28.1.")) - "Emacs is the advanced, extensible, customizable, -self-documenting editor. This manual describes how to edit -with Emacs and some of the ways to customize it; it -corresponds to GNU Emacs version 28.1."))) + "In addition to any hooks its parent mode might have run, this \ +mode runs the hook ‘foo-bar-baz-very-long-name-indeed-mode-hook’, as the final \ +or penultimate step during initialization.")) + "In addition to any hooks its parent mode might have run, this mode +runs the hook ‘foo-bar-baz-very-long-name-indeed-mode-hook’, as the +final or penultimate step during initialization."))) (ert-deftest test-ensure-list () (should (equal (ensure-list nil) nil)) commit 55dadbc57e5e89bd6aa67d26c5dc1a32a0a279fc Author: Juri Linkov Date: Sat Oct 2 22:22:41 2021 +0300 * lisp/net/dictionary.el (context-menu-dictionary): Move menu item down. Place the dictionary menu item after middle-separator (bug#50552). diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 86447c2c35..1d07989ef5 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -1382,10 +1382,12 @@ When you add this function to `context-menu-functions', the context menu will contain an item that searches the word at mouse click." (when (thing-at-mouse click 'word) - (define-key menu [dictionary-separator] menu-bar-separator) - (define-key menu [dictionary-search-word-at-mouse] + (define-key-after menu [dictionary-separator] menu-bar-separator + 'middle-separator) + (define-key-after menu [dictionary-search-word-at-mouse] '(menu-item "Dictionary Search" dictionary-search-word-at-mouse - :help "Search the word at mouse click in dictionary"))) + :help "Search the word at mouse click in dictionary") + 'dictionary-separator)) menu) (provide 'dictionary) commit bb209cd5ab819c72784de7278092705e59ff41d5 Author: Kyle Meyer Date: Sat Oct 2 14:27:55 2021 -0400 Update to Org 9.5-30-g10dc9d The plan is to cut the Org 9.5.1 release and include it in Emacs 28.1, but in the meantime regularly sync changes from Org's bugfix branch to emacs-28. This sync includes files from Org 9.5's new etc/csl/ directory that should have been synced in bf9ec3d91a (Update to Org 9.5, 2021-09-29). diff --git a/etc/org/csl/README b/etc/org/csl/README new file mode 100644 index 0000000000..a9212207cc --- /dev/null +++ b/etc/org/csl/README @@ -0,0 +1,10 @@ +These data files are used by Org's oc-csl.el library. + +LICENSE INFORMATION + +chicago-author-date.csl +locales-en-US.xml + + Both of these files are part of the Citation Style Language (CSL) + project () and are released under the + Creative Commons Attribution-ShareAlike 3.0 Unported license. diff --git a/etc/org/csl/chicago-author-date.csl b/etc/org/csl/chicago-author-date.csl new file mode 100644 index 0000000000..8c133354b3 --- /dev/null +++ b/etc/org/csl/chicago-author-date.csl @@ -0,0 +1,658 @@ + + diff --git a/etc/org/csl/locales-en-US.xml b/etc/org/csl/locales-en-US.xml new file mode 100644 index 0000000000..be78c5e81f --- /dev/null +++ b/etc/org/csl/locales-en-US.xml @@ -0,0 +1,357 @@ + + + + + Andrew Dunning + + + Sebastian Karcher + + + Rintze M. Zelle + + This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License + 2015-10-10T23:31:02+00:00 + + + + + + + + + + + + + + accessed + and + and others + anonymous + anon. + at + available at + by + circa + c. + cited + + edition + editions + + ed. + et al. + forthcoming + from + ibid. + in + in press + internet + interview + letter + no date + n.d. + online + presented at the + + reference + references + + + ref. + refs. + + retrieved + scale + version + + + AD + BC + + + + + + + + + + th + st + nd + rd + th + th + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + line + lines + + + note + notes + + + opus + opera + + + page + pages + + + page + pages + + + paragraph + paragraphs + + + part + parts + + + section + sections + + + sub verbo + sub verbis + + + verse + verses + + + volume + volumes + + + + + bk. + bks. + + + chap. + chaps. + + + col. + cols. + + + fig. + figs. + + + fol. + fols. + + + no. + nos. + + + l. + ll. + + + n. + nn. + + + op. + opp. + + + p. + pp. + + + p. + pp. + + + para. + paras. + + + pt. + pts. + + + sec. + secs. + + + s.v. + s.vv. + + + v. + vv. + + + vol. + vols. + + + + + + ¶¶ + + + § + §§ + + + + + director + directors + + + editor + editors + + + editor + editors + + + illustrator + illustrators + + + translator + translators + + + editor & translator + editors & translators + + + + + dir. + dirs. + + + ed. + eds. + + + ed. + eds. + + + ill. + ills. + + + tran. + trans. + + + ed. & tran. + eds. & trans. + + + + by + directed by + edited by + edited by + illustrated by + interview by + to + by + translated by + edited & translated by + + + dir. by + ed. by + ed. by + illus. by + trans. by + ed. & trans. by + + + January + February + March + April + May + June + July + August + September + October + November + December + + + Jan. + Feb. + Mar. + Apr. + May + Jun. + Jul. + Aug. + Sep. + Oct. + Nov. + Dec. + + + Spring + Summer + Autumn + Winter + + diff --git a/lisp/org/ob-gnuplot.el b/lisp/org/ob-gnuplot.el index 3c84e4da14..8c4a5957b9 100644 --- a/lisp/org/ob-gnuplot.el +++ b/lisp/org/ob-gnuplot.el @@ -290,7 +290,7 @@ Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE." (orgtbl-to-generic table (org-combine-plists - '(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field) + '(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field :raw t :backend ascii) params))))) data-file) diff --git a/lisp/org/ob-julia.el b/lisp/org/ob-julia.el index 434b414b61..4fae0d142b 100644 --- a/lisp/org/ob-julia.el +++ b/lisp/org/ob-julia.el @@ -90,18 +90,13 @@ This function is called by `org-babel-execute-src-block'." (graphics-file (and (member "graphics" (assq :result-params params)) (org-babel-graphical-output-file params))) (colnames-p (unless graphics-file (cdr (assq :colnames params)))) - ;; (rownames-p (unless graphics-file (cdr (assq :rownames params)))) (full-body (org-babel-expand-body:julia body params graphics-file)) (result (org-babel-julia-evaluate session full-body result-type result-params (or (equal "yes" colnames-p) (org-babel-pick-name - (cdr (assq :colname-names params)) colnames-p)) - ;; (or (equal "yes" rownames-p) - ;; (org-babel-pick-name - ;; (cdr (assq :rowname-names params)) rownames-p)) - ))) + (cdr (assq :colname-names params)) colnames-p))))) (if graphics-file nil result)))) (defun org-babel-normalize-newline (result) @@ -135,12 +130,7 @@ This function is called by `org-babel-execute-src-block'." "Return list of julia statements assigning the block's variables." (let ((vars (org-babel--get-vars params))) (mapcar - (lambda (pair) - (org-babel-julia-assign-elisp - (car pair) (cdr pair) - ;; (equal "yes" (cdr (assq :colnames params))) - ;; (equal "yes" (cdr (assq :rownames params))) - )) + (lambda (pair) (org-babel-julia-assign-elisp (car pair) (cdr pair))) (mapcar (lambda (i) (cons (car (nth i vars)) @@ -156,7 +146,7 @@ This function is called by `org-babel-execute-src-block'." (concat "\"" (mapconcat #'identity (split-string s "\"") "\"\"") "\"") (format "%S" s))) -(defun org-babel-julia-assign-elisp (name value) ;; colnames-p rownames-p +(defun org-babel-julia-assign-elisp (name value) "Construct julia code assigning the elisp VALUE to a variable named NAME." (if (listp value) (let* ((lengths (mapcar #'length (cl-remove-if-not #'sequencep value))) @@ -164,11 +154,7 @@ This function is called by `org-babel-execute-src-block'." (min (if lengths (apply #'min lengths) 0))) ;; Ensure VALUE has an orgtbl structure (depth of at least 2). (unless (listp (car value)) (setq value (list value))) - (let ((file (orgtbl-to-csv value '(:fmt org-babel-julia-quote-csv-field))) - ;; (header (if (or (eq (nth 1 value) 'hline) colnames-p) - ;; "TRUE" "FALSE")) - ;; (row-names (if rownames-p "1" "NULL")) - ) + (let ((file (orgtbl-to-csv value '(:fmt org-babel-julia-quote-csv-field)))) (if (= max min) (format "%s = begin using CSV @@ -188,7 +174,7 @@ end" (let ((session (or session "*Julia*")) (ess-ask-for-ess-directory (and (bound-and-true-p ess-ask-for-ess-directory) - (not (cdr (assq :dir params)))))) + (not (cdr (assq :dir params)))))) (if (org-babel-comint-buffer-livep session) session ;; FIXME: Depending on `display-buffer-alist', (julia) may end up @@ -209,14 +195,6 @@ end" (buffer-name)))) (current-buffer)))))) - ; (defun org-babel-julia-associate-session (session) - ; "Associate julia code buffer with a julia session. - ; Make SESSION be the inferior ESS process associated with the - ; current code buffer." - ; (setq ess-local-process-name - ; (process-name (get-buffer-process session))) - ; (ess-make-buffer-current)) - (defun org-babel-julia-graphical-output-file (params) "Name of file to which julia should send graphical output." (and (member "graphics" (cdr (assq :result-params params))) @@ -259,16 +237,16 @@ end" end") (defun org-babel-julia-evaluate - (session body result-type result-params column-names-p) ;; row-names-p + (session body result-type result-params column-names-p) "Evaluate julia code in BODY." (if session (org-babel-julia-evaluate-session - session body result-type result-params column-names-p) ;; row-names-p + session body result-type result-params column-names-p) (org-babel-julia-evaluate-external-process - body result-type result-params column-names-p))) ;; row-names-p + body result-type result-params column-names-p))) (defun org-babel-julia-evaluate-external-process - (body result-type result-params column-names-p) ;; row-names-p + (body result-type result-params column-names-p) "Evaluate BODY in external julia process. If RESULT-TYPE equals 'output then return standard output as a string. If RESULT-TYPE equals 'value then return the value of the @@ -292,7 +270,7 @@ last statement in BODY, as elisp." (output (org-babel-eval org-babel-julia-command body)))) (defun org-babel-julia-evaluate-session - (session body result-type result-params column-names-p) ;; row-names-p + (session body result-type result-params column-names-p) "Evaluate BODY in SESSION. If RESULT-TYPE equals 'output then return standard output as a string. If RESULT-TYPE equals 'value then return the value of the diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el index b847fbbc4f..3d13880759 100644 --- a/lisp/org/oc-csl.el +++ b/lisp/org/oc-csl.el @@ -186,15 +186,21 @@ Used only when `second-field-align' is activated by the used CSL style." ;;; Internal variables (defconst org-cite-csl--etc-dir - (let* ((oc-root (file-name-directory (locate-library "oc"))) - (oc-etc-dir-1 (expand-file-name "../etc/csl/" oc-root))) - ;; package.el and straight will put all of org-mode/lisp/ in org-mode/. - ;; This will cause .. to resolve to the directory above Org. - ;; To make life easier for people using package.el or straight, we can - ;; check to see if ../etc/csl exists, and if it doesn't try ./etc/csl. - (if (file-exists-p oc-etc-dir-1) oc-etc-dir-1 - (expand-file-name "etc/csl/" oc-root))) - "Directory \"etc/\" from repository.") + (let ((oc-root (file-name-directory (locate-library "oc")))) + (cond + ;; First check whether it looks like we're running from the main + ;; Org repository. + ((let ((csl-org (expand-file-name "../etc/csl/" oc-root))) + (and (file-directory-p csl-org) csl-org))) + ;; Next look for the directory alongside oc.el because package.el + ;; and straight will put all of org-mode/lisp/ in org-mode/. + ((let ((csl-pkg (expand-file-name "etc/csl/" oc-root))) + (and (file-directory-p csl-pkg) csl-pkg))) + ;; Finally fall back the location used by shared system installs + ;; and when running directly from Emacs repository. + (t + (expand-file-name "org/csl/" data-directory)))) + "Directory containing CSL-related data files.") (defconst org-cite-csl--fallback-locales-dir org-cite-csl--etc-dir "Fallback CSL locale files directory.") diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index a8fb79ea3c..0779c3a82c 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el @@ -326,17 +326,19 @@ it for output." ;;; Indentation -(defun org-do-remove-indentation (&optional n) +(defun org-do-remove-indentation (&optional n skip-fl) "Remove the maximum common indentation from the buffer. When optional argument N is a positive integer, remove exactly -that much characters from indentation, if possible. Return nil -if it fails." +that much characters from indentation, if possible. When +optional argument SKIP-FL is non-nil, skip the first +line. Return nil if it fails." (catch :exit (goto-char (point-min)) ;; Find maximum common indentation, if not specified. (let ((n (or n (let ((min-ind (point-max))) (save-excursion + (when skip-fl (forward-line)) (while (re-search-forward "^[ \t]*\\S-" nil t) (let ((ind (current-indentation))) (if (zerop ind) (throw :exit nil) @@ -344,6 +346,7 @@ if it fails." min-ind)))) (if (zerop n) (throw :exit nil) ;; Remove exactly N indentation, but give up if not possible. + (when skip-fl (forward-line)) (while (not (eobp)) (let ((ind (progn (skip-chars-forward " \t") (current-column)))) (cond ((eolp) (delete-region (line-beginning-position) (point))) diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index 91a3d415df..8d02cf4345 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el @@ -38,6 +38,7 @@ (require 'org-keys) (declare-function org-mode "org" ()) +(declare-function org--get-expected-indentation "org" (element contentsp)) (declare-function org-element-at-point "org-element" ()) (declare-function org-element-class "org-element" (datum &optional parent)) (declare-function org-element-context "org-element" (&optional element)) @@ -327,7 +328,8 @@ a cons cell (LINE . COLUMN) or symbol `end'. See also (if (>= pos end) 'end (org-with-wide-buffer (goto-char (max beg pos)) - (cons (count-lines beg (line-beginning-position)) + (cons (count-lines (save-excursion (goto-char beg) (line-beginning-position)) + (line-beginning-position)) ;; Column is relative to the end of line to avoid problems of ;; comma escaping or colons appended in front of the line. (- (point) (min end (line-end-position))))))) @@ -445,6 +447,7 @@ Assume point is in the corresponding edit buffer." org-src--content-indentation 0)))) (use-tabs? (and (> org-src--tab-width 0) t)) + (preserve-fl (eq org-src--source-type 'latex-fragment)) (source-tab-width org-src--tab-width) (contents (org-with-wide-buffer (let ((eol (line-end-position))) @@ -466,7 +469,8 @@ Assume point is in the corresponding edit buffer." ;; Add INDENTATION-OFFSET to every line in buffer, ;; unless indentation is meant to be preserved. (when (> indentation-offset 0) - (while (not (eobp)) + (when preserve-fl (forward-line)) + (while (not (eobp)) (skip-chars-forward " \t") (when (or (not (eolp)) ; not a blank line (and (eq (point) (marker-position marker)) ; current line @@ -518,7 +522,13 @@ Leave point in edit buffer." (source-tab-width (if indent-tabs-mode tab-width 0)) (type (org-element-type datum)) (block-ind (org-with-point-at (org-element-property :begin datum) - (current-indentation))) + (cond + ((save-excursion (skip-chars-backward " \t") (bolp)) + (current-indentation)) + ((org-element-property :parent datum) + (org--get-expected-indentation + (org-element-property :parent datum) nil)) + (t (current-indentation))))) (content-ind org-edit-src-content-indentation) (blank-line (save-excursion (beginning-of-line) (looking-at-p "^[[:space:]]*$"))) @@ -548,7 +558,8 @@ Leave point in edit buffer." (insert contents) (remove-text-properties (point-min) (point-max) '(display nil invisible nil intangible nil)) - (unless preserve-ind (org-do-remove-indentation)) + (let ((lf (eq type 'latex-fragment))) + (unless preserve-ind (org-do-remove-indentation (and lf block-ind) lf))) (set-buffer-modified-p nil) (setq buffer-file-name nil) ;; Initialize buffer. diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index ef363dc390..5bccbe497c 100644 --- a/lisp/org/org-version.el +++ b/lisp/org/org-version.el @@ -11,7 +11,7 @@ Inserted by installing Org mode or when a release is made." (defun org-git-version () "The Git version of Org mode. Inserted by installing Org or when a release is made." - (let ((org-git-version "release_9.5")) + (let ((org-git-version "release_9.5-30-g10dc9d")) org-git-version)) (provide 'org-version) diff --git a/lisp/org/org.el b/lisp/org/org.el index 723de64942..bc0ea24bee 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -5113,6 +5113,7 @@ stacked delimiters is N. Escaping delimiters is not possible." '(invisible t)) (add-text-properties (match-beginning 3) (match-end 3) '(invisible t))) + (goto-char (match-end 0)) (throw :exit t)))))))) (defun org-emphasize (&optional char) commit 4341e79a5fad3e5e668a3eeb1b688d1986011481 Author: Glenn Morris Date: Sat Oct 2 10:59:48 2021 -0700 Remove bogus ":safe t" custom properties * lisp/org/oc.el (org-cite-global-bibliography) (org-cite-note-rules, org-cite-punctuation-marks): * lisp/org/oc-csl.el (org-cite-csl-locales-dir) (org-cite-csl-styles-dir, org-cite-csl-no-citelinks-backends): * lisp/org/oc-natbib.el (org-cite-natbib-options): * lisp/org/org-keys.el (org-mouse-1-follows-link): Remove bogus ":safe t" properties that would largely need to be replaced by custom predicates. diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el index 1430779b98..b847fbbc4f 100644 --- a/lisp/org/oc-csl.el +++ b/lisp/org/oc-csl.el @@ -127,7 +127,9 @@ If nil then only the fallback en-US locale will be available." :type '(choice (directory :tag "Locales directory") (const :tag "Use en-US locale only" nil)) - :safe t) + ;; It's not obvious to me that arbitrary locations are safe. +;;; :safe #'string-or-null-p + ) (defcustom org-cite-csl-styles-dir nil "Directory of CSL style files. @@ -138,7 +140,9 @@ directory. This variable is ignored when style file is absolute." :type '(choice (directory :tag "Styles directory") (const :tag "Use absolute file names" nil)) - :safe t) + ;; It's not obvious to me that arbitrary locations are safe. +;;; :safe #'string-or-null-p + ) ;;;; Citelinks (defcustom org-cite-csl-link-cites t @@ -154,8 +158,7 @@ Cite linking for export back-ends derived from any of the back-ends listed here, is also disabled." :group 'org-cite :package-version '(Org . "9.5") - :type '(repeat symbol) - :safe t) + :type '(repeat symbol)) ;;;; Output-specific variables (defcustom org-cite-csl-html-hanging-indent "1.5em" diff --git a/lisp/org/oc-natbib.el b/lisp/org/oc-natbib.el index c012ff1db0..13cac9ed0b 100644 --- a/lisp/org/oc-natbib.el +++ b/lisp/org/oc-natbib.el @@ -71,8 +71,7 @@ If \"natbib\" package is already required in the document, e.g., through (const :tag "order as above, but numerical citations are compressed if possible" sort&compress) (const :tag "display full author list on first citation, abbreviate the others" longnamesfirst) (const :tag "redefine \\thebibliography to issue \\section* instead of \\chapter*" sectionbib) - (const :tag "keep all the authors' names in a citation on one line" nonamebreak)) - :safe t) + (const :tag "keep all the authors' names in a citation on one line" nonamebreak))) ;;; Internal functions diff --git a/lisp/org/oc.el b/lisp/org/oc.el index eb4079e6dd..bbf2195fbd 100644 --- a/lisp/org/oc.el +++ b/lisp/org/oc.el @@ -127,8 +127,7 @@ File names must be absolute." :package-version '(Org . "9.5") :type '(choice (const :tag "No global bibliography" nil) (repeat :tag "List of bibliography files" - (file :tag "Bibliography"))) - :safe t) + (file :tag "Bibliography")))) (defcustom org-cite-activate-processor 'basic "Processor used for activating citations, as a symbol." @@ -295,8 +294,7 @@ This roughly follows the Oxford Guide to Style recommendations." (const :tag "Citation next to punctuation" same)) (choice :tag "Order of citation and punctuation" (const :tag "Citation first" before) - (const :tag "Citation last" after)))) - :safe t) + (const :tag "Citation last" after))))) (defcustom org-cite-punctuation-marks '("." "," ";" ":" "!" "?") "List of strings that can be moved around when placing note numbers. @@ -306,8 +304,7 @@ allowed to shuffle punctuation marks specified in this list in order to place note numbers according to rules defined in `org-cite-note-rules'." :group 'org-cite :package-version '(Org . "9.5") - :type '(repeat string) - :safe t) + :type '(repeat string)) ;;; Citation processors diff --git a/lisp/org/org-keys.el b/lisp/org/org-keys.el index 8fa551ad41..a10db7e666 100644 --- a/lisp/org/org-keys.el +++ b/lisp/org/org-keys.el @@ -279,8 +279,7 @@ before org.el is loaded." :type '(choice (const :tag "A double click follows the link" double) (const :tag "Unconditionally follow the link with mouse-1" t) - (integer :tag "mouse-1 click does not follow the link if longer than N ms" 450)) - :safe t) + (integer :tag "mouse-1 click does not follow the link if longer than N ms" 450))) (defcustom org-tab-follows-link nil "Non-nil means on links TAB will follow the link. commit b6f6b593c6752fabf7cc7532f6a2fda5a5e8373e Author: Eli Zaretskii Date: Sat Oct 2 20:53:26 2021 +0300 Fix 'apropos-compact-layout' * lisp/textmodes/fill.el (fill-region-as-paragraph): Fix filling paragraphs that end at EOB without a newline. (Bug#50974) diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index 81d908c95e..decce88573 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -768,7 +768,7 @@ space does not end a sentence, so don't break a line there." (setq first nil linebeg (+ (point) (length actual-fill-prefix)))) (move-to-column (current-fill-column)) - (if (when (< (point) to) + (if (when (and (< (point) to) (< linebeg to)) ;; Find the position where we'll break the line. ;; Use an immediately following space, if any. ;; However, note that `move-to-column' may overshoot commit 62d6cecfcd1a67e15a436c5c2b975f327d9a8b50 Author: Glenn Morris Date: Sat Oct 2 10:46:29 2021 -0700 Remove bogus ":safe nil" custom properties * lisp/org/oc.el (org-cite-activate-processor) (org-cite-export-processors, org-cite-follow-processor) (org-cite-insert-processor): * lisp/org/ol.el (org-link-parameters, org-link-frame-setup) (org-link-shell-confirm-function) (org-link-shell-skip-confirm-regexp) (org-link-elisp-confirm-function) (org-link-elisp-skip-confirm-regexp): * lisp/org/org-num.el (org-num-format-function): Remove bogus ":safe nil" that do nothing but propagate a misunderstanding of the safe-local-variable property. diff --git a/lisp/org/oc.el b/lisp/org/oc.el index 5562753368..eb4079e6dd 100644 --- a/lisp/org/oc.el +++ b/lisp/org/oc.el @@ -135,8 +135,7 @@ File names must be absolute." :group 'org-cite :package-version '(Org . "9.5") :type '(choice (const :tag "Default fontification" nil) - (symbol :tag "Citation processor")) - :safe nil) + (symbol :tag "Citation processor"))) (defcustom org-cite-export-processors '((t basic)) "Processor used for exporting citations, as a triplet, or nil. @@ -200,24 +199,21 @@ back-end." (string :tag "Use specific bibliography style")) (choice (const :tag "Default citation style" nil) - (string :tag "Use specific citation style"))))) - :safe nil) + (string :tag "Use specific citation style")))))) (defcustom org-cite-follow-processor 'basic "Processor used for following citations, as a symbol." :group 'org-cite :package-version '(Org . "9.5") :type '(choice (const :tag "No following" nil) - (symbol :tag "Citation processor")) - :safe nil) + (symbol :tag "Citation processor"))) (defcustom org-cite-insert-processor 'basic "Processor used for inserting citations, as a symbol." :group 'org-cite :package-version '(Org . "9.5") :type '(choice (const :tag "No insertion" nil) - (symbol :tag "Citation processor")) - :safe nil) + (symbol :tag "Citation processor"))) (defcustom org-cite-adjust-note-numbers t "When non-nil, allow process to modify location of note numbers. diff --git a/lisp/org/ol.el b/lisp/org/ol.el index e4a5a278dd..aa1849715c 100644 --- a/lisp/org/ol.el +++ b/lisp/org/ol.el @@ -178,8 +178,7 @@ link. :group 'org-link :package-version '(Org . "9.1") :type '(alist :tag "Link display parameters" - :value-type plist) - :safe nil) + :value-type plist)) (defcustom org-link-descriptive t "Non-nil means Org displays descriptive links. @@ -335,8 +334,7 @@ another window." (cons (const wl) (choice (const wl) - (const wl-other-frame)))) - :safe nil) + (const wl-other-frame))))) (defcustom org-link-search-must-match-exact-headline 'query-to-create "Non-nil means internal fuzzy links can only match headlines. @@ -385,15 +383,13 @@ single keystroke rather than having to type \"yes\"." :type '(choice (const :tag "with yes-or-no (safer)" yes-or-no-p) (const :tag "with y-or-n (faster)" y-or-n-p) - (const :tag "no confirmation (dangerous)" nil)) - :safe nil) + (const :tag "no confirmation (dangerous)" nil))) (defcustom org-link-shell-skip-confirm-regexp "" "Regexp to skip confirmation for shell links." :group 'org-link-follow :version "24.1" - :type 'regexp - :safe nil) + :type 'regexp) (defcustom org-link-elisp-confirm-function 'yes-or-no-p "Non-nil means ask for confirmation before executing Emacs Lisp links. @@ -410,15 +406,13 @@ single keystroke rather than having to type \"yes\"." :type '(choice (const :tag "with yes-or-no (safer)" yes-or-no-p) (const :tag "with y-or-n (faster)" y-or-n-p) - (const :tag "no confirmation (dangerous)" nil)) - :safe nil) + (const :tag "no confirmation (dangerous)" nil))) (defcustom org-link-elisp-skip-confirm-regexp "" "A regexp to skip confirmation for Elisp links." :group 'org-link-follow :version "24.1" - :type 'regexp - :safe nil) + :type 'regexp) (defgroup org-link-store nil "Options concerning storing links in Org mode." diff --git a/lisp/org/org-num.el b/lisp/org/org-num.el index 408b86ff41..f00e6c463b 100644 --- a/lisp/org/org-num.el +++ b/lisp/org/org-num.el @@ -99,8 +99,7 @@ Any `face' text property on the returned string overrides `org-num-face'." :group 'org-appearance :package-version '(Org . "9.3") - :type 'function - :safe nil) + :type 'function) (defcustom org-num-max-level nil "Level below which headlines are not numbered. commit f9111d8784bf12263abbe127cdfcbe5f409c9b3b Author: Glenn Morris Date: Sat Oct 2 10:37:42 2021 -0700 The safe-local-variable property is a function (bug#50944) * lisp/org/oc-basic.el (org-cite-basic-sorting-field) (org-cite-basic-author-year-separator) (org-cite-basic-max-key-distance) (org-cite-basic-author-column-end) (org-cite-basic-column-separator) (org-cite-basic-mouse-over-key-face): * lisp/org/oc-biblatex.el (org-cite-biblatex-options): * lisp/org/oc-csl.el (org-cite-csl-link-cites) (org-cite-csl-html-hanging-indent) (org-cite-csl-html-label-width-per-char) (org-cite-csl-latex-hanging-indent): * lisp/org/oc.el (org-cite-adjust-note-numbers): * lisp/org/org-keys.el (org-return-follows-link): * lisp/org/org.el (org-fontify-todo-headline): * lisp/org/ox-html.el (org-html-equation-reference-format) (org-html-wrap-src-lines): * lisp/org/ox-latex.el (org-latex-reference-command) (org-latex-default-quote-environment): * lisp/textmodes/tildify.el (tildify-pattern) (tildify-space-string): Fix :safe property. diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el index bf0153d1d1..98242f3b84 100644 --- a/lisp/org/oc-basic.el +++ b/lisp/org/oc-basic.el @@ -89,42 +89,42 @@ :group 'org-cite :package-version '(Org . "9.5") :type 'symbol - :safe t) + :safe #'symbolp) (defcustom org-cite-basic-author-year-separator ", " "String used to separate cites in an author-year configuration." :group 'org-cite :package-version '(Org . "9.5") :type 'string - :safe t) + :safe #'stringp) (defcustom org-cite-basic-max-key-distance 2 "Maximum (Levenshtein) distance between a wrong key and its suggestions." :group 'org-cite :package-version '(Org . "9.5") :type 'integer - :safe t) + :safe #'integerp) (defcustom org-cite-basic-author-column-end 25 "Column where author field ends in completion table, as an integer." :group 'org-cite :package-version '(Org . "9.5") :type 'integer - :safe t) + :safe #'integerp) (defcustom org-cite-basic-column-separator " " "Column separator in completion table, as a string." :group 'org-cite :package-version '(Org . "9.5") :type 'string - :safe t) + :safe #'stringp) (defcustom org-cite-basic-mouse-over-key-face 'highlight "Face used when mouse is over a citation key." :group 'org-cite :package-version '(Org . "9.5") :type 'face - :safe t) + :safe #'facep) ;;; Internal variables diff --git a/lisp/org/oc-biblatex.el b/lisp/org/oc-biblatex.el index 224abaeeeb..f517e39139 100644 --- a/lisp/org/oc-biblatex.el +++ b/lisp/org/oc-biblatex.el @@ -80,7 +80,7 @@ If \"biblatex\" package is already required in the document, e.g., through :type '(choice (string :tag "Options (key=value,key2=value2...)") (const :tag "No option" nil)) - :safe t) + :safe #'string-or-null-p) ;;; Internal functions diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el index cf3538b870..1430779b98 100644 --- a/lisp/org/oc-csl.el +++ b/lisp/org/oc-csl.el @@ -146,7 +146,7 @@ directory. This variable is ignored when style file is absolute." :group 'org-cite :package-version '(Org . "9.5") :type 'boolean - :safe t) + :safe #'booleanp) (defcustom org-cite-csl-no-citelinks-backends '(ascii) "List of export back-ends for which cite linking is disabled. @@ -163,7 +163,7 @@ is also disabled." :group 'org-cite :package-version '(Org . "9.5") :type 'string - :safe t) + :safe #'stringp) (defcustom org-cite-csl-html-label-width-per-char "0.6em" "Character width in CSS units for calculating entry label widths. @@ -171,14 +171,14 @@ Used only when `second-field-align' is activated by the used CSL style." :group 'org-cite :package-version '(Org . "9.5") :type 'string - :safe t) + :safe #'stringp) (defcustom org-cite-csl-latex-hanging-indent "1.5em" "Size of hanging-indent for LaTeX output in valid LaTeX units." :group 'org-cite :package-version '(Org . "9.5") :type 'string - :safe t) + :safe #'stringp) ;;; Internal variables diff --git a/lisp/org/oc.el b/lisp/org/oc.el index bb2e04d400..5562753368 100644 --- a/lisp/org/oc.el +++ b/lisp/org/oc.el @@ -234,7 +234,7 @@ When nil, the note number is not moved." :package-version '(Org . "9.5") :type '(choice (const :tag "Automatic note number location" t) (const :tag "Place note numbers manually" nil)) - :safe t) + :safe #'booleanp) (defcustom org-cite-note-rules '(("en-us" inside outside after) diff --git a/lisp/org/org-keys.el b/lisp/org/org-keys.el index 2984a4f514..8fa551ad41 100644 --- a/lisp/org/org-keys.el +++ b/lisp/org/org-keys.el @@ -300,7 +300,7 @@ implementation is bad." In tables, the special behavior of RET has precedence." :group 'org-link-follow :type 'boolean - :safe t) + :safe #'booleanp) ;;; Functions diff --git a/lisp/org/org.el b/lisp/org/org.el index 2ec6566c0b..723de64942 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -3630,7 +3630,7 @@ When this is non-nil, the headline after the keyword is set to the :group 'org-appearance :package-version '(Org . "9.4") :type 'boolean - :safe t) + :safe #'booleanp) (defcustom org-fontify-done-headline t "Non-nil means change the face of a headline if it is marked DONE. diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el index 60bb77d818..a150b1fdb8 100644 --- a/lisp/org/ox-html.el +++ b/lisp/org/ox-html.el @@ -795,7 +795,7 @@ Most common values are: :group 'org-export-html :package-version '(Org . "9.4") :type 'string - :safe t) + :safe #'stringp) (defcustom org-html-with-latex org-export-with-latex "Non-nil means process LaTeX math snippets. @@ -903,7 +903,7 @@ numbers are enabled." :group 'org-export-html :package-version '(Org . "9.3") :type 'boolean - :safe t) + :safe #'booleanp) ;;;; Table diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el index 993c2c6431..3e3967033a 100644 --- a/lisp/org/ox-latex.el +++ b/lisp/org/ox-latex.el @@ -413,7 +413,7 @@ to \"\\autoref{%s}\" or \"\\cref{%s}\" for example." :group 'org-export-latex :type 'string :package-version '(Org . "9.5") - :safe t) + :safe #'stringp) ;;;; Preamble @@ -793,7 +793,7 @@ default we use here encompasses both." :group 'org-export-latex :package-version '(Org . "9.5") :type 'string - :safe t) + :safe #'stringp) (defcustom org-latex-default-table-mode 'table "Default mode for tables. diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el index 01e2ad72d8..2a4c8cff8f 100644 --- a/lisp/textmodes/tildify.el +++ b/lisp/textmodes/tildify.el @@ -67,7 +67,7 @@ matching the white space). The pattern is matched case-sensitive regardless of the value of `case-fold-search' setting." :version "25.1" :type 'regexp - :safe t) + :safe #'stringp) (defcustom tildify-pattern-alist () "Alist specifying where to insert hard spaces. @@ -112,7 +112,7 @@ If nil, current major mode has no way to represent a hard space." " ") (const :tag "No-break space (U+00A0)" "\u00A0") (string :tag "Custom string")) - :safe t) + :safe #'string-or-null-p) (defcustom tildify-string-alist () "Alist specifying what is a hard space in the current major mode. commit 3dc094abeea40474b42c1f7002810011539769dc Author: Stefan Kangas Date: Sat Oct 2 17:26:28 2021 +0200 ; Some minor tweaks to TODO * etc/TODO: Explain elpa.gnu.org items better. Delete fixed item about dynamic embedded graphics. (Bug#50937) diff --git a/etc/TODO b/etc/TODO index db327c02a7..da15ea1f77 100644 --- a/etc/TODO +++ b/etc/TODO @@ -69,12 +69,12 @@ which ideally should generate the same byte-code as * Things that were planned for Emacs-24 -** concurrency +** Concurrency Including it as an "experimental" compile-time option sounds good. Of course there might still be big questions around "which form of concurrency" we'll want. -** better support for dynamic embedded graphics +** Better support for dynamic embedded graphics I like this idea (my mpc.el code could use it for the volume widget), though I wonder if the resulting efficiency will be sufficient. @@ -106,6 +106,9 @@ It would make it easy to add (and remove) mappings like * Things related to elpa.gnu.org. +We need to figure out how to best include GNU ELPA packages in the +Emacs tarball before doing any of the items below. + ** Move idlwave to elpa.gnu.org Need to sync up the Emacs and external versions. See @@ -393,11 +396,6 @@ should invoke the 'shape' method. 'hbfont_shape' should be extended to pass to 'hb_shape_full' the required array of features, as mentioned in the above HarfBuzz discussion. -** Better support for displaying Emoji -Emacs is capable of displaying Emoji and some of the Emoji sequences, -provided that its fontsets are configured with a suitable font. To -make this easier out of the box, the following should be done: - *** Populate composition-function-table with Emoji rules The Unicode Character Database (UCD) includes several data files that define the valid Emoji sequences. These files should be imported into commit a5b4356d37dcdc4f229d2802494a6c0658f02576 Author: Stefan Kangas Date: Sat Oct 2 17:25:29 2021 +0200 Revert "; * etc/TODO: Move elpa.gnu.org items to the end." This reverts commit d73f0e96a7026808c01861f7525a2909279fc00d. These items are a priority for the project and should be before other, less prioritized items, according to a private discussion with project co-maintainer Eli Zaretskii . diff --git a/etc/TODO b/etc/TODO index 0465bf1512..db327c02a7 100644 --- a/etc/TODO +++ b/etc/TODO @@ -69,12 +69,12 @@ which ideally should generate the same byte-code as * Things that were planned for Emacs-24 -** Concurrency +** concurrency Including it as an "experimental" compile-time option sounds good. Of course there might still be big questions around "which form of concurrency" we'll want. -** Better support for dynamic embedded graphics +** better support for dynamic embedded graphics I like this idea (my mpc.el code could use it for the volume widget), though I wonder if the resulting efficiency will be sufficient. @@ -104,6 +104,23 @@ It would make it easy to add (and remove) mappings like "uppercase -> lowercase", "[fringe KEY...] -> [KEY]", "H-FOO -> M-FOO", "C-x C-y FOO -> H-FOO", ... +* Things related to elpa.gnu.org. + +** Move idlwave to elpa.gnu.org +Need to sync up the Emacs and external versions. +See + + +** Move Org mode to elpa.gnu.org +See + + +** Move verilog-mode to elpa.gnu.org +See + +** Move vhdl-mode to elpa.gnu.org +See + * Simple tasks These don't require much Emacs knowledge and are suitable for anyone from beginners to experts. @@ -1743,26 +1760,6 @@ Add a standard button-class named "link", and make all other link-like button classes inherit from it. Set the default face of the "link" button class to the standard "link" face. -* Things related to elpa.gnu.org. - -We need to figure out how to best include GNU ELPA packages in the -Emacs tarball before doing any of the items below. - -** Move idlwave to elpa.gnu.org -Need to sync up the Emacs and external versions. -See - - -** Move Org mode to elpa.gnu.org -See - - -** Move verilog-mode to elpa.gnu.org -See - -** Move vhdl-mode to elpa.gnu.org -See - * Wishlist items ** Maybe replace etags.c with a Lisp implementation. commit 7bc0cee115a7c9336469e9849728fc7499019692 Author: Stefan Kangas Date: Sat Oct 2 17:25:24 2021 +0200 Revert "* etc/TODO: Rearrange to start with "Simple tasks"." This reverts commit 879ef5b19ab1dd90284aef829ef306d56b4e5adb. Some of these items are a priority for the project and should be before other, less prioritized items, according to a private discussion with project co-maintainer Eli Zaretskii . diff --git a/etc/TODO b/etc/TODO index d9149a521f..0465bf1512 100644 --- a/etc/TODO +++ b/etc/TODO @@ -29,6 +29,81 @@ are the ones we consider more important, but these also may be difficult to fix. Bugs with severity "minor" may be simpler, but this is not always true. +* Speed up Elisp execution + +** Speed up function calls +Change src/bytecode.c so that calls from byte-code functions to byte-code +functions don't go through Ffuncall/funcall_lambda/exec_byte_code but instead +stay within exec_byte_code. + +** Improve the byte-compiler to recognize immutable bindings +Recognize immutable (lexical) bindings and get rid of them if they're +used only once and/or they're bound to a constant expression. + +Such things aren't present in hand-written code, but macro expansion and +defsubst can often end up generating things like +(funcall (lambda (arg) (body)) actual) which then get optimized to +(let ((arg actual)) (body)) but should additionally get optimized further +when 'actual' is a constant/copyable expression. + +** Add an "indirect goto" byte-code +Such a byte-code can be used for local lambda expressions. +E.g. when you have code like + + (let ((foo (lambda (x) bar))) + (dosomething + (funcall foo toto) + (blabla (funcall foo titi)))) + +turn those 'funcalls' into jumps and their return into indirect jumps back. + +** Compile efficiently local recursive functions +Similar to the previous point, we should be able to handle something like + + (letrec ((loop () (blabla) (if (toto) (loop)))) + (loop)) + +which ideally should generate the same byte-code as + + (while (progn (blabla) (toto))) + +* Things that were planned for Emacs-24 + +** Concurrency +Including it as an "experimental" compile-time option sounds good. Of +course there might still be big questions around "which form of +concurrency" we'll want. + +** Better support for dynamic embedded graphics +I like this idea (my mpc.el code could use it for the volume widget), +though I wonder if the resulting efficiency will be sufficient. + +** Spread Semantic + +** Improve the "code snippets" support +Consolidate skeleton.el, tempo.el, and expand.el (any other?) and then +advertise/use/improve it. + +** Improve VC +Yes, there's a lot of work to be done there :-( + +** Random things that cross my mind right now that I'd like to see +Some of them from my local hacks, but it's not obvious at all whether +they'll make it. + +*** Prog-mode could/should provide a better fill-paragraph default +That default should use syntax-tables to recognize string/comment +boundaries. + +*** Provide more completion-at-point-functions +Make existing in-buffer completion use completion-at-point. + +*** "Functional" function-key-map +It would make it easy to add (and remove) mappings like +"FOO-mouse-4 -> FOO-scroll-down", "FOO-tab -> ?\FOO-\t", +"uppercase -> lowercase", "[fringe KEY...] -> [KEY]", +"H-FOO -> M-FOO", "C-x C-y FOO -> H-FOO", ... + * Simple tasks These don't require much Emacs knowledge and are suitable for anyone from beginners to experts. @@ -151,44 +226,6 @@ https://lists.gnu.org/r/emacs-devel/2008-08/msg00456.html * Important features -** Speed up Elisp execution - -*** Speed up function calls -Change src/bytecode.c so that calls from byte-code functions to byte-code -functions don't go through Ffuncall/funcall_lambda/exec_byte_code but instead -stay within exec_byte_code. - -*** Improve the byte-compiler to recognize immutable bindings -Recognize immutable (lexical) bindings and get rid of them if they're -used only once and/or they're bound to a constant expression. - -Such things aren't present in hand-written code, but macro expansion and -defsubst can often end up generating things like -(funcall (lambda (arg) (body)) actual) which then get optimized to -(let ((arg actual)) (body)) but should additionally get optimized further -when 'actual' is a constant/copyable expression. - -*** Add an "indirect goto" byte-code -Such a byte-code can be used for local lambda expressions. -E.g. when you have code like - - (let ((foo (lambda (x) bar))) - (dosomething - (funcall foo toto) - (blabla (funcall foo titi)))) - -turn those 'funcalls' into jumps and their return into indirect jumps back. - -*** Compile efficiently local recursive functions -Similar to the previous point, we should be able to handle something like - - (letrec ((loop () (blabla) (if (toto) (loop)))) - (loop)) - -which ideally should generate the same byte-code as - - (while (progn (blabla) (toto))) - ** "Emacs as word processor" https://lists.gnu.org/r/emacs-devel/2013-11/msg00515.html rms writes: @@ -446,15 +483,6 @@ consistency checks that make sure the new code computes the same results as the old code. And once that works well, we can remove the old code and old fields. -** Better support for dynamic embedded graphics -I like this idea (my mpc.el code could use it for the volume widget), -though I wonder if the resulting efficiency will be sufficient. - -** Concurrency -Including it as an "experimental" compile-time option sounds good. Of -course there might still be big questions around "which form of -concurrency" we'll want. - ** FFI (foreign function interface) See eg https://lists.gnu.org/r/emacs-devel/2013-10/msg00246.html @@ -862,32 +890,6 @@ The idea is to add an "X" of some kind, that when clicked deletes the window associated with that modeline. https://lists.gnu.org/r/emacs-devel/2007-09/msg02416.html -** Improve the "code snippets" support -Consolidate skeleton.el, tempo.el, and expand.el (any other?) and then -advertise/use/improve it. - -** Improve VC -Yes, there's a lot of work to be done there :-( - -** Spread Semantic - -** Random things that crossed Stefan Monnier's mind for Emacs 24 -Stefan Monnier writes: "Some of them from my local hacks, but it's not -obvious at all whether they'll make it." - -*** Prog-mode could/should provide a better fill-paragraph default -That default should use syntax-tables to recognize string/comment -boundaries. - -*** Provide more completion-at-point-functions -Make existing in-buffer completion use completion-at-point. - -*** "Functional" function-key-map -It would make it easy to add (and remove) mappings like -"FOO-mouse-4 -> FOO-scroll-down", "FOO-tab -> ?\FOO-\t", -"uppercase -> lowercase", "[fringe KEY...] -> [KEY]", -"H-FOO -> M-FOO", "C-x C-y FOO -> H-FOO", ... - * Things to be done for specific packages or features ** NeXTstep port commit 34894714177d1bb0a382e7f68d716dfe3aa08376 Author: Eli Zaretskii Date: Sat Oct 2 17:38:55 2021 +0300 Fix selection of fonts for Arabic on Posix platforms * lisp/international/fontset.el (script-representative-chars): Add U+06C1 to representative-characters for Arabic. (Bug#50951) diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index 4ec641dca8..f0ead8a274 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -157,7 +157,9 @@ (armenian #x531) (hebrew #x5D0) (vai #xA500) - (arabic #x628) + ;; U+06C1 prevents us from using bad fonts, like DejaVu Sans, + ;; for Arabic text. + (arabic #x628 #x6C1) (syriac #x710) (thaana #x78C) (devanagari #x915) commit ea3e51732dbd6755c1eacb3ba3fa79b0cd13f806 Author: Stefan Kangas Date: Sat Oct 2 16:20:06 2021 +0200 Expand internal--format-docstring-line test * test/lisp/subr-tests.el (subr-test-internal--format-docstring-line): Check for error on newline. diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index ed9a3d0149..5c4e0b9de9 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -777,7 +777,8 @@ some of the ways to customize it; it corresponds to GNU Emacs version 28.1.")) "Emacs is the advanced, extensible, customizable, self-documenting editor. This manual describes how to edit with Emacs and some of the ways to customize it; it -corresponds to GNU Emacs version 28.1."))) +corresponds to GNU Emacs version 28.1.")) + (should-error (internal--format-docstring-line "foo\nbar"))) (ert-deftest test-ensure-list () (should (equal (ensure-list nil) nil)) commit 6d0ea5e307c0f029a180d5f4a04b1fb11242c30c Author: Stefan Kangas Date: Sat Oct 2 15:14:15 2021 +0200 Support 'strong-italic' facemenu face in html-mode * lisp/textmodes/sgml-mode.el (sgml-face-tag-alist) (sgml-mode-facemenu-add-face-function, html-face-tag-alist): Support 'strong-italic' facemenu face. diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 7ef8161ab5..22a90ca9cf 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -440,7 +440,8 @@ These have to be run via `sgml-syntax-propertize'")) ;; internal (defvar sgml-face-tag-alist () - "Alist of face and tag name for facemenu.") + "Alist of face and tag name for facemenu. +The tag name can be a string or a list of strings.") (defvar sgml-tag-face-alist () "Tag names and face or list of faces to fontify with when invisible. @@ -528,11 +529,13 @@ an optional alist of possible values." (comment-indent-new-line soft))) (defun sgml-mode-facemenu-add-face-function (face _end) - (let ((tag-face (cdr (assq face sgml-face-tag-alist)))) + "Add \"face\" tags with `facemenu-keymap' commands." + (let ((tag-face (ensure-list (cdr (assq face sgml-face-tag-alist))))) (cond (tag-face (setq tag-face (funcall skeleton-transformation-function tag-face)) - (setq facemenu-end-add-face (concat "")) - (concat "<" tag-face ">")) + (setq facemenu-end-add-face + (mapconcat (lambda (f) (concat "")) (reverse tag-face) "")) + (mapconcat (lambda (f) (concat "<" f ">")) tag-face "")) ((and (consp face) (consp (car face)) (null (cdr face)) @@ -1868,6 +1871,7 @@ This takes effect when first loading the library.") (defvar html-face-tag-alist '((bold . "strong") (italic . "em") + (bold-italic . ("strong" "em")) (underline . "u") (mode-line . "rev")) "Value of `sgml-face-tag-alist' for HTML mode.") commit 13e59433869ec3ee6b8fc5e652e237702e05bf2c Author: Eli Zaretskii Date: Sat Oct 2 15:57:51 2021 +0300 ; Fix a typo in a doc string * lisp/files.el (hack-local-variables--find-variables): Fix typo in the doc string. diff --git a/lisp/files.el b/lisp/files.el index 05875b48e3..19b88e6621 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3896,7 +3896,7 @@ inhibited." (hack-local-variables-apply)))))) (defun hack-local-variables--find-variables (&optional handle-mode) - "Return all local variables in the ucrrent buffer. + "Return all local variables in the current buffer. If HANDLE-MODE is nil, we gather all the specified local variables. If HANDLE-MODE is neither nil nor t, we do the same, except that any settings of `mode' are ignored. commit 89d9f466ddd8a919acf173e185c3ac3a5697ad41 Author: Alexandre Duret-Lutz Date: Sat Oct 2 10:55:44 2021 +0200 gnus-icalendar: Missing attendees are not REQ-PARTICIPANT * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event--get-attendee-names) (gnus-icalendar-event-from-ical): Do not default to REQ-PARTICIPANT if the user was not found as an attendee. * test/lisp/gnus/gnus-icalendar-tests.el (gnus-icalendary-weekly-byday): Remove the ROLE property to test that it correctly defaults to REQ-PARTICIPANT. The case where the user is not listed is covered by gnus-icalendar-parse already (bug#50749). diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el index a2ae2a9668..15da356e87 100644 --- a/lisp/gnus/gnus-icalendar.el +++ b/lisp/gnus/gnus-icalendar.el @@ -196,7 +196,9 @@ (cl-labels ((attendee-role (prop) ;; RFC5546: default ROLE is REQ-PARTICIPANT - (or (plist-get (cadr prop) 'ROLE) "REQ-PARTICIPANT")) + (and prop + (or (plist-get (cadr prop) 'ROLE) + "REQ-PARTICIPANT"))) (attendee-name (prop) (or (plist-get (cadr prop) 'CN) @@ -228,7 +230,9 @@ ical attendee-name-or-email))) (attendee-names (gnus-icalendar-event--get-attendee-names ical)) ;; RFC5546: default ROLE is REQ-PARTICIPANT - (role (or (plist-get (cadr attendee) 'ROLE) "REQ-PARTICIPANT")) + (role (and attendee + (or (plist-get (cadr attendee) 'ROLE) + "REQ-PARTICIPANT"))) (participation-type (pcase role ("REQ-PARTICIPANT" 'required) ("OPT-PARTICIPANT" 'optional) diff --git a/test/lisp/gnus/gnus-icalendar-tests.el b/test/lisp/gnus/gnus-icalendar-tests.el index 90c3a34a5c..1206a976f6 100644 --- a/test/lisp/gnus/gnus-icalendar-tests.el +++ b/test/lisp/gnus/gnus-icalendar-tests.el @@ -216,7 +216,7 @@ RRULE:FREQ=WEEKLY;BYDAY=FR,MO,TH,TU,WE DTSTAMP:20200915T120627Z ORGANIZER;CN=anon@anoncompany.com:mailto:anon@anoncompany.com UID:7b6g3m7iftuo90ei4ul00feqn_R20200915T120000@google.com -ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE +ATTENDEE;CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED;RSVP=TRUE ;CN=participant@anoncompany.com;X-NUM-GUESTS=0:mailto:participant@anoncompany.com CREATED:20200325T095723Z DESCRIPTION:Coffee talk commit bd60fca2faa03034e89df68a69255656df6512ba Author: Lars Ingebrigtsen Date: Sat Oct 2 10:37:48 2021 +0200 Fix ox-koma-letter compilation warnings * lisp/org/ox-koma-letter.el (org-koma-letter-export-block) (org-koma-letter-export-snippet): Fix warning about two unused parameter. diff --git a/lisp/org/ox-koma-letter.el b/lisp/org/ox-koma-letter.el index f6aa84aba5..6a895a6a24 100644 --- a/lisp/org/ox-koma-letter.el +++ b/lisp/org/ox-koma-letter.el @@ -594,7 +594,7 @@ such as the one tagged with PS." ;;;; Export Block -(defun org-koma-letter-export-block (export-block contents info) +(defun org-koma-letter-export-block (export-block _contents _info) "Transcode an EXPORT-BLOCK element into KOMA Scrlttr2 code. CONTENTS is nil. INFO is a plist used as a communication channel." @@ -604,7 +604,7 @@ channel." ;;;; Export Snippet -(defun org-koma-letter-export-snippet (export-snippet contents info) +(defun org-koma-letter-export-snippet (export-snippet _contents _info) "Transcode an EXPORT-SNIPPET object into KOMA Scrlttr2 code. CONTENTS is nil. INFO is a plist used as a communication channel." commit 340e527bed83ff0382446132c871088ad61d1745 Author: Eli Zaretskii Date: Sat Oct 2 11:06:18 2021 +0300 Preload paren.el * lisp/Makefile.in (COMPILE_FIRST): Add the dependencies of comp.el, so that they are natively-compiled in advance. * lisp/loadup.el ("paren"): Preload paren.el. (Bug#50934) diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 60d1d10e5b..3e764c5a78 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -91,8 +91,19 @@ COMPILE_FIRST = \ $(lisp)/emacs-lisp/byte-opt.elc \ $(lisp)/emacs-lisp/bytecomp.elc ifeq ($(HAVE_NATIVE_COMP),yes) -COMPILE_FIRST += $(lisp)/emacs-lisp/comp.elc -COMPILE_FIRST += $(lisp)/emacs-lisp/comp-cstr.elc +COMPILE_FIRST += \ + $(lisp)/emacs-lisp/comp.elc \ + $(lisp)/emacs-lisp/comp-cstr.elc \ + $(lisp)/emacs-lisp/cl-macs.elc \ + $(lisp)/emacs-lisp/rx.elc \ + $(lisp)/emacs-lisp/cl-seq.elc \ + $(lisp)/help-mode.elc \ + $(lisp)/emacs-lisp/cl-extra.elc \ + $(lisp)/emacs-lisp/gv.elc \ + $(lisp)/emacs-lisp/seq.elc \ + $(lisp)/emacs-lisp/cl-lib.elc \ + $(lisp)/emacs-lisp/warnings.elc \ + $(lisp)/emacs-lisp/subr-x.elc endif COMPILE_FIRST += $(lisp)/emacs-lisp/autoload.elc diff --git a/lisp/loadup.el b/lisp/loadup.el index af997441d2..3fb6b81328 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -352,6 +352,7 @@ (load "vc/ediff-hook") (load "uniquify") (load "electric") +(load "paren") (load "shorthands") (setq load-source-file-function #'load-with-shorthands-and-code-conversion) commit a9052248da4296415260ea7710ab044e3f59ba77 Author: Eli Zaretskii Date: Sat Oct 2 09:40:44 2021 +0300 Improve documentation of 'shift-select-mode' * doc/emacs/mark.texi (Shift Selection): Document the 'permanent' value of 'shift-select-mode'. Add index entry for that variable. (Bug#50954) * etc/NEWS: Update the entry for 'shift-select-mode'. diff --git a/doc/emacs/mark.texi b/doc/emacs/mark.texi index 20cb8ee2c6..2461cb0f6a 100644 --- a/doc/emacs/mark.texi +++ b/doc/emacs/mark.texi @@ -409,9 +409,14 @@ region by dragging the mouse, you can continue to extend the region using shifted cursor motion commands. In either case, any unshifted cursor motion command deactivates the mark. +@vindex shift-select-mode To turn off shift-selection, set @code{shift-select-mode} to @code{nil}. Doing so does not disable setting the mark via mouse -commands. +commands. If you set @code{shift-select-mode} to the value +@code{permanent}, cursor motion keys that were not shift-translated +will not deactivate the mark, so, for example, the region set by prior +commands can be extended by shift-selection, and unshifted cursor +motion keys will extend the region set by shift-selection. @node Disabled Transient Mark @section Disabling Transient Mark Mode diff --git a/etc/NEWS b/etc/NEWS index f8c045f014..cff306e244 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -989,11 +989,12 @@ further tweak whether to complete or indent. --- ** 'indent-tabs-mode' is now a global minor mode instead of just a variable. ---- ++++ ** New choice 'permanent' for 'shift-select-mode'. When the mark was activated by shifted motion keys, non-shifted motion keys don't deactivate the mark after customizing 'shift-select-mode' -to 'permanent'. +to 'permanent'. Similarly, the active mark will not be deactivated by +typing shifted motion keys. +++ ** The "Edit => Clear" menu item now obeys a rectangular region. commit 58f8c3affc92c77832e93d4d6f0ff3a0bc0a778b Author: Stefan Monnier Date: Fri Oct 1 23:53:20 2021 -0400 * lisp/emacs-lisp/cl-generic.el: Fix test/lisp/loadhist-tests Revert 2fcd34f202 which was redundant anyway since e165bf3d4 had fixed it in a better way anyway (a way which doesn't litter the `load-history`). diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index 10490f0638..2c292415cf 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -631,14 +631,13 @@ The set of acceptable TYPEs (also called \"specializers\") is defined (setq dispatch-idx 0)) (dotimes (i dispatch-idx) (push (make-symbol (format "arg%d" (- dispatch-idx i 1))) fixedargs)) - ;; FIXME: We should find a way to expand `with-memoize' once and forall - ;; so we don't need `subr-x' when we get here. - (require 'subr-x) ;; FIXME: For generic functions with a single method (or with 2 methods, ;; one of which always matches), using a tagcode + hash-table is ;; overkill: better just use a `cl-typep' test. (byte-compile `(lambda (generic dispatches-left methods) + ;; FIXME: We should find a way to expand `with-memoize' once + ;; and forall so we don't need `subr-x' when we get here. (eval-when-compile (require 'subr-x)) (let ((method-cache (make-hash-table :test #'eql))) (lambda (,@fixedargs &rest args) commit d505971894d83e04e8d206be1dcee1cee5e8bb93 Author: Glenn Morris Date: Fri Oct 1 18:07:45 2021 -0700 ; Standardize some license headers diff --git a/lisp/org/ob-julia.el b/lisp/org/ob-julia.el index 5ff6a7ca0a..434b414b61 100644 --- a/lisp/org/ob-julia.el +++ b/lisp/org/ob-julia.el @@ -6,20 +6,20 @@ ;; Keywords: literate programming, reproducible research, scientific computing ;; Homepage: https://github.com/phrb/ob-julia -;; This file is not part of GNU Emacs. +;; This file is part of GNU Emacs. -;; This program is free software; you can redistribute it and/or modify +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. -;; This program is distributed in the hope that it will be useful, +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el index 3b589908e0..bf0153d1d1 100644 --- a/lisp/org/oc-basic.el +++ b/lisp/org/oc-basic.el @@ -4,18 +4,20 @@ ;; Author: Nicolas Goaziou -;; This program is free software; you can redistribute it and/or modify +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. -;; This program is distributed in the hope that it will be useful, +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/org/oc-biblatex.el b/lisp/org/oc-biblatex.el index a27f9e9bf1..224abaeeeb 100644 --- a/lisp/org/oc-biblatex.el +++ b/lisp/org/oc-biblatex.el @@ -4,18 +4,20 @@ ;; Author: Nicolas Goaziou -;; This program is free software; you can redistribute it and/or modify +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. -;; This program is distributed in the hope that it will be useful, +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el index 5623efcc1b..cf3538b870 100644 --- a/lisp/org/oc-csl.el +++ b/lisp/org/oc-csl.el @@ -4,18 +4,20 @@ ;; Author: Nicolas Goaziou -;; This program is free software; you can redistribute it and/or modify +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. -;; This program is distributed in the hope that it will be useful, +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/org/oc-natbib.el b/lisp/org/oc-natbib.el index 7e2127bd8d..c012ff1db0 100644 --- a/lisp/org/oc-natbib.el +++ b/lisp/org/oc-natbib.el @@ -4,18 +4,20 @@ ;; Author: Nicolas Goaziou -;; This program is free software; you can redistribute it and/or modify +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. -;; This program is distributed in the hope that it will be useful, +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/org/oc.el b/lisp/org/oc.el index eb2b7a1695..bb2e04d400 100644 --- a/lisp/org/oc.el +++ b/lisp/org/oc.el @@ -4,18 +4,20 @@ ;; Author: Nicolas Goaziou -;; This program is free software; you can redistribute it and/or modify +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. -;; This program is distributed in the hope that it will be useful, +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/org/ol-doi.el b/lisp/org/ol-doi.el index dfde380209..d2d16b27d5 100644 --- a/lisp/org/ol-doi.el +++ b/lisp/org/ol-doi.el @@ -1,21 +1,23 @@ ;;; ol-doi.el --- DOI links support in Org -*- lexical-binding: t; -*- -;; Copyright (C) 2021 Free Software Foundation, Inc. +;; Copyright (C) 2021 Free Software Foundation, Inc. ;; Author: Nicolas Goaziou -;; This program is free software; you can redistribute it and/or modify +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. -;; This program is distributed in the hope that it will be useful, +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/org/ox-koma-letter.el b/lisp/org/ox-koma-letter.el index 96704dbb98..f6aa84aba5 100644 --- a/lisp/org/ox-koma-letter.el +++ b/lisp/org/ox-koma-letter.el @@ -11,12 +11,12 @@ ;; This file is part of GNU Emacs. -;; This program is free software: you can redistribute it and/or modify +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. -;; This program is distributed in the hope that it will be useful, +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. diff --git a/lisp/shorthands.el b/lisp/shorthands.el index c72c04ab41..b8204d62a2 100644 --- a/lisp/shorthands.el +++ b/lisp/shorthands.el @@ -5,18 +5,20 @@ ;; Author: João Távora ;; Keywords: lisp -;; This program is free software; you can redistribute it and/or modify +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. -;; This program is distributed in the hope that it will be useful, +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/textmodes/etc-authors-mode.el b/lisp/textmodes/etc-authors-mode.el index a591b2db97..8b5fefd3b7 100644 --- a/lisp/textmodes/etc-authors-mode.el +++ b/lisp/textmodes/etc-authors-mode.el @@ -5,18 +5,20 @@ ;; Author: Stefan Kangas ;; Keywords: internal -;; This program is free software; you can redistribute it and/or modify +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. -;; This program is distributed in the hope that it will be useful, +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: commit 9307889d68222bad1a7e449d3adddac40da788cc Author: João Távora Date: Sat Oct 2 00:49:48 2021 +0100 Simplify shorthand injection (bug#50946) * lisp/loadup.el: Load "shorthands" relatively late. Set load-source-file-function to load-with-shorthands-and-code-conversion * lisp/international/mule.el (hack-elisp-shorthands) (load-with-shorthands-and-code-conversion): Move to lisp/shorthands.el * lisp/shorthands.el: New file. diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 2298af42b2..2a855b5673 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -294,31 +294,6 @@ attribute." (apply 'define-charset-internal name (mapcar 'cdr attrs)))) -(defun hack-elisp-shorthands (fullname) - "Return value of the `elisp-shorthands' file-local variable in FULLNAME. -FULLNAME is the absolute file name of an Elisp .el file which -potentially specifies a file-local value for `elisp-shorthands'. -The Elisp code in FULLNAME isn't read or evaluated in any way, except -for extraction of the buffer-local value of `elisp-shorthands'." - (let ((size (nth 7 (file-attributes fullname)))) - (with-temp-buffer - (insert-file-contents fullname nil (max 0 (- size 3000)) size) - (goto-char (point-max)) - (let* ((found (search-backward-regexp "elisp-shorthands:[ \t]*" 0 t)) - (val (and found - (goto-char (match-end 0)) - (ignore-errors (read (current-buffer))))) - (probe val) - aux) - (catch 'done - (when (consp probe) - (while (setq aux (pop probe)) - (unless (and (consp aux) - (stringp (car aux)) - (stringp (cdr aux))) - (throw 'done nil))) - val)))))) - (defun load-with-code-conversion (fullname file &optional noerror nomessage) "Execute a file of Lisp code named FILE whose absolute name is FULLNAME. The file contents are decoded before evaluation if necessary. @@ -378,13 +353,6 @@ Return t if file exists." (message "Loading %s...done" file))) t))) -(defun load-with-shorthands-and-code-conversion (fullname file noerror nomessage) - "Like `load-with-code-conversion', but also consider Elisp shorthands. -This function uses shorthands defined in the file FULLNAME's local -value of `elisp-shorthands', when it processes that file's Elisp code." - (let ((elisp-shorthands (hack-elisp-shorthands fullname))) - (load-with-code-conversion fullname file noerror nomessage))) - (defun charset-info (charset) "Return a vector of information of CHARSET. This function is provided for backward compatibility. diff --git a/lisp/loadup.el b/lisp/loadup.el index 942057c838..af997441d2 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -151,7 +151,7 @@ ;; variable its advertised default value (it starts as nil, see ;; xdisp.c). (setq resize-mini-windows 'grow-only) -(setq load-source-file-function #'load-with-shorthands-and-code-conversion) +(setq load-source-file-function #'load-with-code-conversion) (load "files") ;; Load-time macro-expansion can only take effect after setting @@ -352,6 +352,10 @@ (load "vc/ediff-hook") (load "uniquify") (load "electric") + +(load "shorthands") +(setq load-source-file-function #'load-with-shorthands-and-code-conversion) + (load "emacs-lisp/eldoc") (load "cus-start") ;Late to reduce customize-rogue (needs loaddefs.el anyway) (if (not (eq system-type 'ms-dos)) diff --git a/lisp/shorthands.el b/lisp/shorthands.el new file mode 100644 index 0000000000..c72c04ab41 --- /dev/null +++ b/lisp/shorthands.el @@ -0,0 +1,55 @@ +;;; shorthands.el --- Read code considering Elisp shorthands -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; Author: João Távora +;; Keywords: lisp + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Basic helpers for loading files with Shorthands. + +;;; Code: +(require 'files) + +(defun hack-elisp-shorthands (fullname) + "Return value of `elisp-shorthands' file-local variable in FULLNAME. +FULLNAME is the absolute file name of an Elisp .el file which +potentially specifies a file-local value for `elisp-shorthands'. +The Elisp code in FULLNAME isn't read or evaluated in any way, +except for extraction of the buffer-local value of +`elisp-shorthands'." + (let* ((size (nth 7 (file-attributes fullname))) + (from (max 0 (- size 3000))) + (to size)) + (with-temp-buffer + (while (and (< (buffer-size) 3000) (>= from 0)) + (insert-file-contents fullname nil from to) + (setq to from from (- from 100))) + ;; FIXME: relies on the `hack-local-variables--find-variables' + ;; detail of files.el. That function should be exported, + ;; possibly be refactored into two parts, since we're only + ;; interested in basic "Local Variables" parsing. + (alist-get 'elisp-shorthands (hack-local-variables--find-variables))))) + +(defun load-with-shorthands-and-code-conversion (fullname file noerror nomessage) + "Like `load-with-code-conversion', but also consider Elisp shorthands. +This function uses shorthands defined in the file FULLNAME's local +value of `elisp-shorthands', when it processes that file's Elisp code." + (let ((elisp-shorthands (hack-elisp-shorthands fullname))) + (load-with-code-conversion fullname file noerror nomessage))) + +;;; shorthands.el ends here commit 2fcd34f20275a9311ea5dc1709e5e565412ddd97 Author: Stefan Monnier Date: Fri Oct 1 15:34:09 2021 -0400 * lisp/emacs-lisp/cl-generic.el (cl--generic-get-dispatcher): Fix regression diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index a2bcad2d3a..10490f0638 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -631,6 +631,9 @@ The set of acceptable TYPEs (also called \"specializers\") is defined (setq dispatch-idx 0)) (dotimes (i dispatch-idx) (push (make-symbol (format "arg%d" (- dispatch-idx i 1))) fixedargs)) + ;; FIXME: We should find a way to expand `with-memoize' once and forall + ;; so we don't need `subr-x' when we get here. + (require 'subr-x) ;; FIXME: For generic functions with a single method (or with 2 methods, ;; one of which always matches), using a tagcode + hash-table is ;; overkill: better just use a `cl-typep' test. commit e165bf3d495b9afc85904810505c0afefdf5cf7e Author: Tassilo Horn Date: Fri Oct 1 21:15:51 2021 +0200 ; If Invalid function: with-memoization error introduced in 3c972723 diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index 2051613064..a2bcad2d3a 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -636,6 +636,7 @@ The set of acceptable TYPEs (also called \"specializers\") is defined ;; overkill: better just use a `cl-typep' test. (byte-compile `(lambda (generic dispatches-left methods) + (eval-when-compile (require 'subr-x)) (let ((method-cache (make-hash-table :test #'eql))) (lambda (,@fixedargs &rest args) (let ,bindings commit 3c972723e44c9428ea990562033acfbd84ed29d9 Author: Stefan Monnier Date: Fri Oct 1 14:33:37 2021 -0400 * lisp/emacs-lisp/subr-x.el (with-memoization): New macro Extracted from `cl-generic.el`. * lisp/emacs-lisp/cl-generic.el (cl--generic-get-dispatcher) (cl--generic-build-combined-method, cl-generic-generalizers): Use it. (cl--generic-with-memoization): Delete. diff --git a/etc/NEWS b/etc/NEWS index 9acde7e9e3..8c22230daf 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -61,6 +61,10 @@ This change also affects 'cl-macrolet', 'cl-flet*' and The new command 'image-dired-unmark-all-marks' has been added with a binding in the menu. + +** subr-x +*** New macro 'with-memoization' provides a very primitive form of memoization + * New Modes and Packages in Emacs 29.1 diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index 4834fb13c6..2051613064 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -100,6 +100,7 @@ (eval-when-compile (require 'cl-lib)) (eval-when-compile (require 'cl-macs)) ;For cl--find-class. (eval-when-compile (require 'pcase)) +(eval-when-compile (require 'subr-x)) (cl-defstruct (cl--generic-generalizer (:constructor nil) @@ -589,19 +590,10 @@ The set of acceptable TYPEs (also called \"specializers\") is defined ;; e.g. for tracing/debug-on-entry. (defalias sym gfun))))) -(defmacro cl--generic-with-memoization (place &rest code) - (declare (indent 1) (debug t)) - (gv-letplace (getter setter) place - `(or ,getter - ,(macroexp-let2 nil val (macroexp-progn code) - `(progn - ,(funcall setter val) - ,val))))) - (defvar cl--generic-dispatchers (make-hash-table :test #'equal)) (defun cl--generic-get-dispatcher (dispatch) - (cl--generic-with-memoization + (with-memoization (gethash dispatch cl--generic-dispatchers) ;; (message "cl--generic-get-dispatcher (%S)" dispatch) (let* ((dispatch-arg (car dispatch)) @@ -647,7 +639,7 @@ The set of acceptable TYPEs (also called \"specializers\") is defined (let ((method-cache (make-hash-table :test #'eql))) (lambda (,@fixedargs &rest args) (let ,bindings - (apply (cl--generic-with-memoization + (apply (with-memoization (gethash ,tag-exp method-cache) (cl--generic-cache-miss generic ',dispatch-arg dispatches-left methods @@ -691,7 +683,7 @@ for all those different tags in the method-cache.") ;; Special case needed to fix a circularity during bootstrap. (cl--generic-standard-method-combination generic methods) (let ((f - (cl--generic-with-memoization + (with-memoization ;; FIXME: Since the fields of `generic' are modified, this ;; hash-table won't work right, because the hashes will change! ;; It's not terribly serious, but reduces the effectiveness of @@ -1143,7 +1135,7 @@ These match if the argument is a cons cell whose car is `eql' to VAL." ;; since we can't use the `head' specializer to implement itself. (if (not (eq (car-safe specializer) 'head)) (cl-call-next-method) - (cl--generic-with-memoization + (with-memoization (gethash (cadr specializer) cl--generic-head-used) specializer) (list cl--generic-head-generalizer))) diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 3de666682f..91ebbf9fb9 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -400,6 +400,18 @@ as the new values of the bound variables in the recursive invocation." (cl-labels ((,name ,fargs . ,body)) #',name) . ,aargs))) +(defmacro with-memoization (place &rest code) + "Return the value of CODE and stash it in PLACE. +If PLACE's value is non-nil, then don't bother evaluating CODE +and return the value found in PLACE instead." + (declare (indent 1) (debug (gv-place body))) + (gv-letplace (getter setter) place + `(or ,getter + ,(macroexp-let2 nil val (macroexp-progn code) + `(progn + ,(funcall setter val) + ,val))))) + (provide 'subr-x) commit 5c77cc958451b3bc9ddb6752be1d32f50cba3e41 Author: Glenn Morris Date: Fri Oct 1 09:31:40 2021 -0700 ; * admin/release-branch.txt: Tweak previous. diff --git a/admin/release-branch.txt b/admin/release-branch.txt index 3318d8de80..0c393a9ecc 100644 --- a/admin/release-branch.txt +++ b/admin/release-branch.txt @@ -3,7 +3,8 @@ Instructions for cutting the Emacs release branch 1. In the clone of the Emacs Git repository, switch to the 'master' branch, "git pull", and build it (using 'make bootstrap') to make sure it's not broken. Run 'make check-expensive' and ensure all - tests pass. + tests pass. (Alternatively, verify that the automated build + servers are showing success for the latest revision.) 2. Create the release branch and switch to it. Assuming that it is for releasing Emacs versions XY.1, XY.2, etc., the command is: commit 99884c2264715b3ff811320a859d644db08ea90e Merge: 8968bf8e12 626696c3c8 Author: Glenn Morris Date: Fri Oct 1 09:27:47 2021 -0700 Merge from origin/emacs-28 626696c3c8 (origin/emacs-28) * doc/lispref/control.texi (pcase Macro)... 2895cb8d49 ; * lisp/time-stamp.el: Fix wording in some documentation ... 1e79c9e9c0 ; * admin/release-branch.txt: Small edits. f1f57a541e Fix some custom types commit 626696c3c838e69f499604cd80efd58a8dfd54db Author: Glenn Morris Date: Fri Oct 1 09:27:09 2021 -0700 * doc/lispref/control.texi (pcase Macro): Fix cross-reference. diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index aacf66c5cf..30676f0fb1 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi @@ -557,7 +557,7 @@ Likewise, it makes no sense to bind keyword symbols @item (cl-type @var{type}) Matches if @var{expval} is of type @var{type}, which is a type -descriptor as accepted by @code{cl-typep} (@pxref{cl-typep,,,cl,Common +descriptor as accepted by @code{cl-typep} (@pxref{Type Predicates,,,cl,Common Lisp Extensions}). Examples: @lisp commit 2895cb8d4917e09856babdb66dfc51d154f4ba5e Author: Stephen Gildea Date: Fri Oct 1 08:54:10 2021 -0700 ; * lisp/time-stamp.el: Fix wording in some documentation strings. diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index 663773281b..e1ea922d04 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -138,7 +138,7 @@ Its format is that of the ZONE argument of the `format-time-string' function." ;;;###autoload (defun time-stamp-zone-type-p (zone) - "Return whether or not ZONE is of the correct type for a timezone rule. + "Return non-nil if ZONE is of the correct type for a timezone rule. Valid ZONE values are described in the documentation of `format-time-string'." (or (memq zone '(nil t wall)) (stringp zone) @@ -313,7 +313,7 @@ this line to a local variables list near the end of the file: If the file has no time-stamp template, this function does nothing. -You can set `time-stamp-pattern' in a files's local variables list +You can set `time-stamp-pattern' in a file's local variables list to customize the information in the time stamp and where it is written. The time stamp is updated only if `time-stamp-active' is non-nil." @@ -712,7 +712,7 @@ and all `time-stamp-format' compatibility." (defun time-stamp-do-number (format-char alt-form field-width time) "Handle compatible FORMAT-CHAR where only default width/padding will change. -ALT-FORM is whether `#' specified. FIELD-WIDTH is the string +ALT-FORM is whether `#' was specified. FIELD-WIDTH is the string width specification or \"\". TIME is the time to convert. This is an internal helper for `time-stamp-string-preprocess'." (let ((format-string (concat "%" (char-to-string format-char)))) commit 1e79c9e9c068d3128b907ca2bf71d37506aac753 Author: Glenn Morris Date: Fri Oct 1 08:46:09 2021 -0700 ; * admin/release-branch.txt: Small edits. diff --git a/admin/release-branch.txt b/admin/release-branch.txt index 2be0495c41..3318d8de80 100644 --- a/admin/release-branch.txt +++ b/admin/release-branch.txt @@ -1,9 +1,9 @@ Instructions for cutting the Emacs release branch 1. In the clone of the Emacs Git repository, switch to the 'master' - branch, "git pull", and build it to make sure it's not broken. - Consider deleting all the *.elc and *.o files, or running the - command "make extraclean", before building. + branch, "git pull", and build it (using 'make bootstrap') to make + sure it's not broken. Run 'make check-expensive' and ensure all + tests pass. 2. Create the release branch and switch to it. Assuming that it is for releasing Emacs versions XY.1, XY.2, etc., the command is: commit f1f57a541e4c74eec68a27c47c7416ed6c7d75dd Author: Glenn Morris Date: Fri Oct 1 08:33:32 2021 -0700 Fix some custom types * lisp/mpc.el (mpc-cover-image-re): * lisp/org/oc-csl.el (org-cite-csl-locales-dir) (org-cite-csl-styles-dir): * lisp/org/org-plot.el (org-plot/preset-plot-types): Fix :type. diff --git a/lisp/mpc.el b/lisp/mpc.el index 913146415e..c47d4336e5 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -964,7 +964,7 @@ If PLAYLIST is t or nil or missing, use the main playlist." (defcustom mpc-cover-image-re nil ; (rx (or ".jpg" ".jpeg" ".png") string-end) "If non-nil, it is a regexp that should match a valid cover image." - :type '(regexp) + :type '(choice (const nil) regexp) :version "28.1") (defun mpc-secs-to-time (secs) diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el index 50df12115a..5623efcc1b 100644 --- a/lisp/org/oc-csl.el +++ b/lisp/org/oc-csl.el @@ -123,7 +123,7 @@ If nil then only the fallback en-US locale will be available." :group 'org-cite :package-version '(Org . "9.5") :type '(choice - (dir :tag "Locales directory") + (directory :tag "Locales directory") (const :tag "Use en-US locale only" nil)) :safe t) @@ -134,7 +134,7 @@ directory. This variable is ignored when style file is absolute." :group 'org-cite :package-version '(Org . "9.5") :type '(choice - (dir :tag "Styles directory") + (directory :tag "Styles directory") (const :tag "Use absolute file names" nil)) :safe t) diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el index 63176fce15..4f14c7d4c3 100644 --- a/lisp/org/org-plot.el +++ b/lisp/org/org-plot.el @@ -392,7 +392,7 @@ be set. Accepts string, nil, or lambda function which returns string or nil. Defaults to nil." :group 'org-plot - :type '(alist :value-type (symbol group))) + :type 'alist) (defvar org--plot/radar-template "### spider plot/chart with gnuplot commit 8968bf8e12893f8c1ba3a268ea6ebc277274fcf7 Merge: 38ef6da38f 5ee5a90213 Author: Glenn Morris Date: Fri Oct 1 07:50:25 2021 -0700 Merge from origin/emacs-28 5ee5a90213 (origin/emacs-28) ; Fix oddities in etc/NEWS # Conflicts: # etc/NEWS commit 38ef6da38fce71cfe42a2705b34dacbad993f3c7 Merge: 823bc66e74 35e6b8d357 Author: Glenn Morris Date: Fri Oct 1 07:50:25 2021 -0700 ; Merge from origin/emacs-28 The following commit was skipped: 35e6b8d357 (emacs-28) ; Auto-commit of loaddefs files. commit 823bc66e7459eed71de498ff0a2544f2bb889d34 Merge: e50f5d51f5 ad0798a395 Author: Glenn Morris Date: Fri Oct 1 07:50:25 2021 -0700 Merge from origin/emacs-28 ad0798a395 * etc/TODO: Add interactive mode tagging. 879ef5b19a * etc/TODO: Rearrange to start with "Simple tasks". d73f0e96a7 ; * etc/TODO: Move elpa.gnu.org items to the end. 7cf1229706 ; * etc/TODO: Mention a relevant bug report. f733b909ff * etc/TODO: Remove outdated item. (Bug#50904) 94c247d659 ; Oops, fix up last commit 88378acbfc Rename arguments of ERC's '/whois' and simplify doc string 205eb7f801 ; s/class/type 86da812afb Migrate Xref off EIEIO 5c73dfcbcb * admin/release-branch.txt: New file. f060d1c9a4 * lisp/dired.el (dired-omit-mode): Declare, to avoid compi... # Conflicts: # etc/NEWS commit e50f5d51f5b44dbe4996ce2a5a2b42d6eb97adf4 Merge: 6d74e751ec 2750d97543 Author: Glenn Morris Date: Fri Oct 1 07:50:18 2021 -0700 ; Merge from origin/emacs-28 The following commit was skipped: 2750d97543 Cut the emacs-28 release branch commit 6d74e751ec5db7d0207218d3add9b75592edda4e Author: Michael Albinus Date: Fri Oct 1 16:45:54 2021 +0200 ; Fix oddities in etc/NEWS diff --git a/etc/NEWS b/etc/NEWS index 3892ba2c79..9acde7e9e3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1,6 +1,6 @@ GNU Emacs NEWS -- history of user-visible changes. -Copyright (C) 2019-2021 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. See the end of the file for license conditions. Please send Emacs bug reports to 'bug-gnu-emacs@gnu.org'. @@ -65,7 +65,7 @@ binding in the menu. * New Modes and Packages in Emacs 29.1 +++ -** New mode 'erts-mode' +** New mode 'erts-mode'. This mode is used to edit files geared towards testing actions in Emacs buffers, like indentation and the like. The new ert function 'ert-test-erts-file' is used to parse these files. commit 5ee5a90213f6a6cac31fc849af6bf152756292e3 Author: Michael Albinus Date: Fri Oct 1 16:42:52 2021 +0200 ; Fix oddities in etc/NEWS diff --git a/etc/NEWS b/etc/NEWS index 10a46571b7..f8c045f014 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -144,8 +144,8 @@ their treatment. Which codepoints are treated as emoji is derived from the Unicode specifications. Also, Emacs will now use "Noto Color Emoji" by default for that script. Use: -(set-fontset-font t 'emoji - '("My New Emoji Font" . "iso10646-1") nil 'prepend) + (set-fontset-font t 'emoji + '("My New Emoji Font" . "iso10646-1") nil 'prepend) to change the font used. @@ -153,7 +153,7 @@ to change the font used. ** Zero Width Joiner (ZWJ) and emoji sequences are now composed. Emacs can now compose (almost) all the Unicode-14 ZWJ and emoji sequences (if a suitable font is installed) so that they are displayed -as single glyphs instead of multiple ones. 'Noto Color Emoji' is one +as single glyphs instead of multiple ones. "Noto Color Emoji" is one such suitable font. +++ @@ -163,7 +163,7 @@ font is now used to check if composition can be performed, rather than the font of the first character of the string being composed. This allows e.g. -'Emoji codepoint' + VS-16 + 'Emoji codepoint' + VS-16 to be displayed using the emoji font even if 'Emoji codepoint' does not have emoji presentation by default. @@ -543,7 +543,7 @@ If your mouse or trackpad supports it, you can now scroll tabs when the mouse pointer is in the tab line by scrolling left or right. --- -*** New tab-line faces and options. +*** New tab-line faces and user options. The face 'tab-line-tab-special' is used for tabs whose buffers are special, i.e. buffers that don't visit a file. The face 'tab-line-tab-modified' is used to display modified, file-backed @@ -551,7 +551,7 @@ buffers. The face 'tab-line-tab-inactive-alternate' is used to display inactive tabs with an alternating background color, making them easier to distinguish, especially if the face 'tab-line-tab' is configured to not display with a box; this alternate face is only -applied when the option 'tab-line-tab-face-functions' is so +applied when the user option 'tab-line-tab-face-functions' is so configured. That option may also be used to customize tab-line faces in other ways. @@ -595,7 +595,7 @@ built without SVG support, the old icons will be used instead. ** Help --- -*** The order things are displayed in the *Help* buffer has been changed. +*** The order things are displayed in the "*Help*" buffer has been changed. The indented "administrative" block (containing the "probably introduced" and "other relevant functions" (and similar things) has been moved to after the doc string. @@ -1091,7 +1091,7 @@ It serves as a local counterpart for 'show-paren-mode', allowing you to toggle it separately in different buffers. To use it only in programming modes, for example, add the following to your init file: -(add-hook 'prog-mode-hook #'show-paren-local-mode) + (add-hook 'prog-mode-hook #'show-paren-local-mode) * Changes in Specialized Modes and Packages in Emacs 28.1 @@ -1237,8 +1237,8 @@ The commands are now bound to 'C-x C-j' and 'C-x 4 C-j' by default. To get the old behavior of 'dired-bind-jump' back and unbind the above keys, add the following to your init file: -(global-set-key "\C-x\C-j" nil) -(global-set-key "\C-x4\C-j" nil) + (global-set-key "\C-x\C-j" nil) + (global-set-key "\C-x4\C-j" nil) --- *** 'dired-query' now uses 'read-char-from-minibuffer'. @@ -1253,7 +1253,7 @@ invoked during I-search, move respectively to the first occurrence of the current search string in the buffer, the last one, the first one after the current window, and the last one before the current window. Additionally, users can change the meaning of other motion commands -during I-search by using their 'isearch-motion' property. The +during I-search by using their 'isearch-motion' property. The user option 'isearch-motion-changes-direction' controls whether the direction of the search changes after a motion command. @@ -1583,7 +1583,7 @@ Some modules have their own minor mode now to account for these changes. *** Support for bookmark.el. -The command `bookmark-set' (bound to `C-x r m') is now supported, and +The command 'bookmark-set' (bound to 'C-x r m') is now supported, and will create a bookmark that opens the current directory in Eshell. ** Archive mode @@ -2394,14 +2394,14 @@ information, see the related entry about 'shr-browse-url' above. --- *** Support for bookmark.el. -The command `bookmark-set' (bound to `C-x r m') is now supported, and +The command 'bookmark-set' (bound to 'C-x r m') is now supported, and will create a bookmark that opens the current URL in EWW. ** SHR --- *** The command 'shr-browse-url' now supports custom mailto handlers. -Clicking on or otherwise following a 'mailto:' link in a HTML buffer +Clicking on or otherwise following a 'mailto:' link in an HTML buffer rendered by SHR previously invoked the command 'browse-url-mailto'. This is still the case by default, but if you customize 'browse-url-mailto-function' or 'browse-url-handlers' to call some @@ -2441,8 +2441,7 @@ a project's root directory, respectively. +++ *** New command 'project-compile'. -This command runs compilation in the current project's root -directory. +This command runs compilation in the current project's root directory. +++ *** New command 'project-switch-project'. @@ -2466,7 +2465,7 @@ directory and optionally also its subdirectories, storing them in +++ *** New commands 'project-forget-project' and 'project-forget-projects-under'. -These command lets you interactively remove entries from the list of projects +These commands let you interactively remove entries from the list of projects in 'project-list-file'. +++ @@ -2505,7 +2504,7 @@ The new user option 'xref-auto-jump-to-first-xref' changes the behavior of Xref commands such as 'xref-find-references', 'xref-find-apropos', and 'project-find-regexp', which are expected to display many matches that the user would like to -visit. 'xref-auto-jump-to-first-xref' changes their behavior much in +visit. 'xref-auto-jump-to-first-xref' changes their behavior much in the same way as 'xref-auto-jump-to-first-definition' affects the "find-definitions" commands. @@ -2670,7 +2669,7 @@ images are marked. ** Flymake mode +++ -*** New command 'flymake-show-project-diagnostics' +*** New command 'flymake-show-project-diagnostics'. This lists all diagnostics for buffers in the currently active project. The listing is similar to the one obtained by 'flymake-show-buffer-diagnostics', but adds a column for the @@ -2948,10 +2947,10 @@ checkdoc will now check the format of 'yes-or-no-p'. This can be used to run checkdoc on files from a Dired buffer. --- -*** No longer checks for "A-" modifiers. +*** No longer checks for 'A-' modifiers. Checkdoc recommends usage of command substitutions ("\\[foo-command]") -in favor of writing keybindings like "C-c f". It now no longer warns -about the "A-" modifier as it is not used very much in practice, and +in favor of writing keybindings like 'C-c f'. It now no longer warns +about the 'A-' modifier as it is not used very much in practice, and this warning therefore mostly led to false positives. ** Enriched mode @@ -3010,7 +3009,7 @@ Face 'mh-folder-whitelisted' is renamed 'mh-folder-allowlisted'. The function now accepts a variable number of arguments. +++ -*** Deprecate 'defun-rcirc-command' in favour of 'rcirc-define-command'. +*** Deprecate 'rcirc-command' in favor of 'rcirc-define-command'. The new macro handles multiple and optional arguments. --- @@ -3533,7 +3532,7 @@ by mistake and were not useful to Lisp code. The former is now declared obsolete. +++ -** 'facemenu.el' is no longer preloaded. +** facemenu.el is no longer preloaded. To use functions/variables from the package, you now have to say '(require 'facemenu)' or similar. @@ -3698,9 +3697,9 @@ objects in files specified by that variable. It's unclear when this actually changed, but at some point (perhaps decades ago) these commands started using 'load-history' to determine where symbols had been defined (which is much faster). The doc strings of all the -affected function has been updated. 'find-function-source-path' was +affected function have been updated. 'find-function-source-path' was still being used by 'find-library' and related commands, so the -variable has been renamed to 'find-library-source-path', and +user option has been renamed to 'find-library-source-path', and 'find-function-source-path' is now an obsolete variable alias. --- commit decabae2df4669da6279b0fceefb8bddffdda079 Author: Lars Ingebrigtsen Date: Fri Oct 1 15:38:29 2021 +0200 Fix one-clause movement in erts-mode--goto-start-of-test * lisp/progmodes/erts-mode.el (erts-mode--goto-start-of-test): Fix so this works in one-clause tests. diff --git a/lisp/progmodes/erts-mode.el b/lisp/progmodes/erts-mode.el index 46b6a3a711..9d51c1f8f0 100644 --- a/lisp/progmodes/erts-mode.el +++ b/lisp/progmodes/erts-mode.el @@ -173,7 +173,8 @@ will be prompted for one." (erts-mode--goto-start-of-test) (condition-case arg (ert-test--erts-test - (list (cons 'dummy t) (cons 'code test-function)) + (list (cons 'dummy t) + (cons 'code (car (read-from-string test-function)))) (buffer-file-name)) (:success (message "Test successful")) (ert-test-failed (message "Test failure; result: \n%s" @@ -183,9 +184,17 @@ will be prompted for one." (if (not (erts-mode--in-test-p (point))) (re-search-forward "^=-=\n" nil t) (re-search-backward "^=-=\n" nil t) - (when (save-match-data (erts-mode--in-test-p (point))) - (re-search-backward "^=-=\n" nil t)) - (goto-char (match-end 0)))) + (let ((potential-start (match-end 0))) + ;; See if we're in a two-clause ("before" and "after") test or not. + (if-let ((start (and (save-excursion (re-search-backward "^=-=\n" nil t)) + (match-end 0)))) + (let ((end (save-excursion (re-search-backward "^=-=-=\n" nil t)))) + (if (or (not end) + (> start end)) + ;; We are, so go to the real start. + (goto-char start) + (goto-char potential-start))) + (goto-char potential-start))))) (provide 'erts-mode) commit d62beccbbf5fb3dc77374e545792ae991b60aa91 Author: Glenn Morris Date: Fri Oct 1 06:31:17 2021 -0700 ; Auto-commit of loaddefs files. diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index 0ab9552c60..47d251f3b5 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -48,7 +48,7 @@ Mutate the result." t nil) (autoload '5x5-crack "5x5" "\ Attempt to find a solution for 5x5. -5x5-crack takes the argument BREEDER which should be a function that takes +`5x5-crack' takes the argument BREEDER which should be a function that takes two parameters, the first will be a grid vector array that is the current solution and the second will be the best solution so far. The function should return a grid vector array that is the new solution. @@ -288,7 +288,7 @@ The syntax of `defadvice' is as follows: FUNCTION ::= Name of the function to be advised. CLASS ::= `before' | `around' | `after' | `activation' | `deactivation'. NAME ::= Non-nil symbol that names this piece of advice. -POSITION ::= `first' | `last' | NUMBER. Optional, defaults to `first', +POSITION ::= `first' | `last' | NUMBER. Optional, defaults to `first', see also `ad-add-advice'. ARGLIST ::= An optional argument list to be used for the advised function instead of the argument list of the original. The first one found in @@ -368,22 +368,24 @@ align them so that the opening parentheses would line up: Mary-Anne (123) 456-7890 Joe (123) 456-7890 -There is no predefined rule to handle this, but you could easily do it -using a REGEXP like \"(\". Interactively, all you would have to do is -to mark the region, call `align-regexp' and enter that regular expression. - -REGEXP must contain at least one parenthesized subexpression, typically -whitespace of the form \"\\\\(\\\\s-*\\\\)\". In normal interactive use, -this is automatically added to the start of your regular expression after -you enter it. You only need to supply the characters to be lined up, and -any preceding whitespace is replaced. - -If you specify a prefix argument (or use this function non-interactively), -you must enter the full regular expression, including the subexpression. -The function also then prompts for which subexpression parenthesis GROUP -\(default 1) within REGEXP to modify, the amount of SPACING (default -`align-default-spacing') to use, and whether or not to REPEAT the rule -throughout the line. +There is no predefined rule to handle this, but interactively, +all you would have to do is to mark the region, call `align-regexp' +and enter \"(\". + +REGEXP must contain at least one parenthesized subexpression, +typically whitespace of the form \"\\\\(\\\\s-*\\\\)\", but in +interactive use, this is automatically added to the start of your +regular expression after you enter it. Interactively, you only +need to supply the characters to be lined up, and any preceding +whitespace is replaced. + +Non-interactively (or if you specify a prefix argument), you must +enter the full regular expression, including the subexpression. +Interactively, the function also then prompts for which +subexpression parenthesis GROUP (default 1) within REGEXP to +modify, the amount of SPACING (default `align-default-spacing') +to use, and whether or not to REPEAT the rule throughout the +line. See `align-rules-list' for more information about these options. @@ -463,7 +465,7 @@ Control whether and how allout outline mode is automatically activated when files are visited with non-nil buffer-specific file variable `allout-layout'. -When allout-auto-activation is \"On\" (t), allout mode is +When `allout-auto-activation' is \"On\" (t), allout mode is activated in buffers with non-nil `allout-layout', and the specified layout is applied. @@ -1201,8 +1203,9 @@ NOT recognized as integers or real numbers. The array MUST reside at the top of the buffer. TABs are not respected, and may be converted into spaces at any time. -Setting the variable `array-respect-tabs' to non-nil will prevent TAB conversion, -but will cause many functions to give errors if they encounter one. +Setting the variable `array-respect-tabs' to non-nil will prevent +TAB conversion, but will cause many functions to give errors if +they encounter one. Upon entering array mode, you will be prompted for the values of several variables. Others will be calculated based on the values you @@ -1392,7 +1395,7 @@ Drawing with keys \\[artist-key-set-point] Does one of the following: For lines/rectangles/squares: sets the first/second endpoint - For poly-lines: sets a point (use C-u \\[artist-key-set-point] to set last point) + For poly-lines: sets a point (use \\[universal-argument] \\[artist-key-set-point] to set last point) When erase characters: toggles erasing When cutting/copying: Sets first/last endpoint of rect/square When pasting: Pastes @@ -1517,9 +1520,8 @@ Special commands: ;;; Generated autoloads from auth-source.el (defvar auth-source-cache-expiry 7200 "\ -How many seconds passwords are cached, or nil to disable -expiring. Overrides `password-cache-expiry' through a -let-binding.") +How many seconds passwords are cached, or nil to disable expiring. +Overrides `password-cache-expiry' through a let-binding.") (custom-autoload 'auth-source-cache-expiry "auth-source" t) @@ -1967,7 +1969,6 @@ Output stream used is value of `standard-output'." nil nil) (autoload 'bat-mode "bat-mode" "\ Major mode for editing DOS/Windows batch files. - Start a new script from `bat-template'. Read help pages for DOS commands with `bat-cmd-help'. Navigate between sections using `imenu'. Run script using `bat-run' and `bat-run-args'. @@ -2385,14 +2386,14 @@ others are still there, should the user decide to delete the most recent one. To yank words from the text of the buffer and use them as part of the -bookmark name, type C-w while setting a bookmark. Successive C-w's +bookmark name, type \\\\[bookmark-yank-word] while setting a bookmark. Successive \\[bookmark-yank-word]'s yank successive words. -Typing C-u inserts (at the bookmark name prompt) the name of the last +Typing \\[universal-argument] inserts (at the bookmark name prompt) the name of the last bookmark used in the document where the new bookmark is being set; this helps you use a single bookmark name to track progress through a large document. If there is no prior bookmark for this document, then -C-u inserts an appropriate name based on the buffer or file. +\\[universal-argument] inserts an appropriate name based on the buffer or file. Use \\[bookmark-delete] to remove bookmarks (you give it a name and it removes only the first instance of a bookmark with that name from @@ -2415,14 +2416,14 @@ Otherwise, if a bookmark named NAME already exists but PUSH-BOOKMARK is nil, raise an error. To yank words from the text of the buffer and use them as part of the -bookmark name, type C-w while setting a bookmark. Successive C-w's +bookmark name, type \\\\[bookmark-yank-word] while setting a bookmark. Successive \\[bookmark-yank-word]'s yank successive words. -Typing C-u inserts (at the bookmark name prompt) the name of the last +Typing \\[universal-argument] inserts (at the bookmark name prompt) the name of the last bookmark used in the document where the new bookmark is being set; this helps you use a single bookmark name to track progress through a large document. If there is no prior bookmark for this document, then -C-u inserts an appropriate name based on the buffer or file. +\\[universal-argument] inserts an appropriate name based on the buffer or file. Use \\[bookmark-delete] to remove bookmarks (you give it a name and it removes only the first instance of a bookmark with that name from @@ -2489,7 +2490,7 @@ If called from Lisp, prompt for NEW-NAME if only OLD-NAME was passed as an argument. If called with two strings, then no prompting is done. You must pass at least OLD-NAME when calling from Lisp. -While you are entering the new name, consecutive C-w's insert +While you are entering the new name, consecutive \\\\[bookmark-yank-word]'s insert consecutive words from the text of the buffer into the new bookmark name. @@ -2534,7 +2535,7 @@ Write bookmarks to a file (reading the file name with the minibuffer)." t nil) Save currently defined bookmarks in FILE. FILE defaults to `bookmark-default-file'. With prefix PARG, query user for a file to save in. -If MAKE-DEFAULT is non-nil (interactively with prefix C-u C-u) +If MAKE-DEFAULT is non-nil (interactively with prefix \\[universal-argument] \\[universal-argument]) the file we save in becomes the new default in the current Emacs session (without affecting the value of `bookmark-default-file'.). @@ -2958,7 +2959,6 @@ If `current-prefix-arg' is non-nil, use ;;;### (autoloads nil "bs" "bs.el" (0 0 0 0)) ;;; Generated autoloads from bs.el -(push (purecopy '(bs 1 17)) package--builtin-versions) (autoload 'bs-cycle-next "bs" "\ Select next buffer defined by buffer cycling. @@ -3381,7 +3381,7 @@ or a list containing a character position and an error message in string form. Invoke the Calculator in \"visual keypad\" mode. This is most useful in the X window system. In this mode, click on the Calc \"buttons\" using the left mouse button. -Or, position the cursor manually and do M-x calc-keypad-press. +Or, position the cursor manually and do \\[calc-keypad-press]. \(fn &optional INTERACTIVE)" t nil) @@ -3982,7 +3982,7 @@ control). See \"cc-mode.el\" for more info. Major mode for editing C code. To submit a problem report, enter `\\[c-submit-bug-report]' from a -c-mode buffer. This automatically sets up a mail buffer with version +`c-mode' buffer. This automatically sets up a mail buffer with version information already added. You just need to add a description of the problem, including a reproducible test case, and send the message. @@ -4030,7 +4030,7 @@ Key bindings: (autoload 'objc-mode "cc-mode" "\ Major mode for editing Objective C code. To submit a problem report, enter `\\[c-submit-bug-report]' from an -objc-mode buffer. This automatically sets up a mail buffer with +`objc-mode' buffer. This automatically sets up a mail buffer with version information already added. You just need to add a description of the problem, including a reproducible test case, and send the message. @@ -4049,7 +4049,7 @@ Key bindings: (autoload 'java-mode "cc-mode" "\ Major mode for editing Java code. To submit a problem report, enter `\\[c-submit-bug-report]' from a -java-mode buffer. This automatically sets up a mail buffer with +`java-mode' buffer. This automatically sets up a mail buffer with version information already added. You just need to add a description of the problem, including a reproducible test case, and send the message. @@ -4068,7 +4068,7 @@ Key bindings: (autoload 'idl-mode "cc-mode" "\ Major mode for editing CORBA's IDL, PSDL and CIDL code. To submit a problem report, enter `\\[c-submit-bug-report]' from an -idl-mode buffer. This automatically sets up a mail buffer with +`idl-mode' buffer. This automatically sets up a mail buffer with version information already added. You just need to add a description of the problem, including a reproducible test case, and send the message. @@ -4088,7 +4088,7 @@ Key bindings: (autoload 'pike-mode "cc-mode" "\ Major mode for editing Pike code. To submit a problem report, enter `\\[c-submit-bug-report]' from a -pike-mode buffer. This automatically sets up a mail buffer with +`pike-mode' buffer. This automatically sets up a mail buffer with version information already added. You just need to add a description of the problem, including a reproducible test case, and send the message. @@ -4111,7 +4111,7 @@ Key bindings: (autoload 'awk-mode "cc-mode" "\ Major mode for editing AWK code. To submit a problem report, enter `\\[c-submit-bug-report]' from an -awk-mode buffer. This automatically sets up a mail buffer with version +`awk-mode' buffer. This automatically sets up a mail buffer with version information already added. You just need to add a description of the problem, including a reproducible test case, and send the message. @@ -4159,7 +4159,7 @@ a null operation. \(fn STYLENAME &optional DONT-OVERRIDE)" t nil) (autoload 'c-add-style "cc-styles" "\ -Adds a style to `c-style-alist', or updates an existing one. +Add a style to `c-style-alist', or update an existing one. STYLE is a string identifying the style to add or update. DESCRIPTION is an association list describing the style and must be of the form: @@ -4656,7 +4656,7 @@ Return t when OBJ is a list of strings. (autoload 'checkdoc "checkdoc" "\ Interactively check the entire buffer for style errors. The current status of the check will be displayed in a buffer which -the users will view as each check is completed." t nil) +the users will view as each check is completed." '(emacs-lisp-mode) nil) (autoload 'checkdoc-interactive "checkdoc" "\ Interactively check the current buffer for doc string errors. @@ -4667,7 +4667,7 @@ errors. Does not check for comment or space warnings. Optional argument SHOWSTATUS indicates that we should update the checkdoc status window instead of the usual behavior. -\(fn &optional START-HERE SHOWSTATUS)" t nil) +\(fn &optional START-HERE SHOWSTATUS)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-message-interactive "checkdoc" "\ Interactively check the current buffer for message string errors. @@ -4678,7 +4678,7 @@ errors. Does not check for comment or space warnings. Optional argument SHOWSTATUS indicates that we should update the checkdoc status window instead of the usual behavior. -\(fn &optional START-HERE SHOWSTATUS)" t nil) +\(fn &optional START-HERE SHOWSTATUS)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-eval-current-buffer "checkdoc" "\ Evaluate and check documentation for the current buffer. @@ -4692,7 +4692,7 @@ With a prefix argument (in Lisp, the argument TAKE-NOTES), store all errors found in a warnings buffer, otherwise stop after the first error. -\(fn &optional TAKE-NOTES)" t nil) +\(fn &optional TAKE-NOTES)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-file "checkdoc" "\ Check FILE for document, comment, error style, and rogue spaces. @@ -4706,14 +4706,14 @@ Use `checkdoc-continue' to continue checking if an error cannot be fixed. Prefix argument TAKE-NOTES means to collect all the warning messages into a separate buffer. -\(fn &optional TAKE-NOTES)" t nil) +\(fn &optional TAKE-NOTES)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-continue "checkdoc" "\ Find the next doc string in the current buffer which has a style error. Prefix argument TAKE-NOTES means to continue through the whole buffer and save warnings in a separate buffer. -\(fn &optional TAKE-NOTES)" t nil) +\(fn &optional TAKE-NOTES)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-comments "checkdoc" "\ Find missing comment sections in the current Emacs Lisp file. @@ -4721,7 +4721,7 @@ Prefix argument TAKE-NOTES non-nil means to save warnings in a separate buffer. Otherwise print a message. This returns the error if there is one. -\(fn &optional TAKE-NOTES)" t nil) +\(fn &optional TAKE-NOTES)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-rogue-spaces "checkdoc" "\ Find extra spaces at the end of lines in the current file. @@ -4730,13 +4730,13 @@ separate buffer. Otherwise print a message. This returns the error if there is one. Optional argument INTERACT permits more interactive fixing. -\(fn &optional TAKE-NOTES INTERACT)" t nil) +\(fn &optional TAKE-NOTES INTERACT)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-message-text "checkdoc" "\ Scan the buffer for occurrences of the error function, and verify text. Optional argument TAKE-NOTES causes all errors to be logged. -\(fn &optional TAKE-NOTES)" t nil) +\(fn &optional TAKE-NOTES)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-eval-defun "checkdoc" "\ Evaluate the current form with `eval-defun' and check its documentation. @@ -5423,8 +5423,9 @@ clashes. \(fn NAME PREFIX &optional FIRST)" nil nil) (autoload 'comp-clean-up-stale-eln "comp" "\ -Given FILE remove all its *.eln files in `native-comp-eln-load-path' -sharing the original source filename (including FILE). +Remove all FILE*.eln* files found in `native-comp-eln-load-path'. +The files to be removed are those produced from the original source +filename (including FILE). \(fn FILE)" nil nil) @@ -5449,10 +5450,17 @@ form, return the compiled function. \(fn FUNCTION-OR-FILE &optional OUTPUT)" nil nil) (autoload 'batch-native-compile "comp" "\ -Perform native compilation on remaining command-line arguments. -Use this from the command line, with ‘-batch’; -it won’t work in an interactive Emacs. -Native compilation equivalent to `batch-byte-compile'." nil nil) +Perform batch native compilation of remaining command-line arguments. + +Native compilation equivalent of `batch-byte-compile'. +Use this from the command line, with `-batch'; it won't work +in an interactive Emacs session. +Optional argument FOR-TARBALL non-nil means the file being compiled +as part of building the source tarball, in which case the .eln file +will be placed under the native-lisp/ directory (actually, in the +last directory in `native-comp-eln-load-path'). + +\(fn &optional FOR-TARBALL)" nil nil) (autoload 'batch-byte+native-compile "comp" "\ Like `batch-native-compile', but used for bootstrap. @@ -5512,7 +5520,7 @@ If both windows display the same buffer, the mark is pushed twice in that buffer: first in the other window, then in the selected window. -A prefix arg means reverse the value of variable +A prefix arg IGNORE-WHITESPACE, means reverse the value of variable `compare-ignore-whitespace'. If `compare-ignore-whitespace' is nil, then a prefix arg means ignore changes in whitespace. If `compare-ignore-whitespace' is non-nil, then a prefix arg means @@ -5974,8 +5982,8 @@ of load, ENDMSG at the end. \(fn PHRASE-FILE &optional COUNT STARTMSG ENDMSG)" nil nil) (autoload 'cookie-snarf "cookie1" "\ -Reads in the PHRASE-FILE, returns it as a vector of strings. -Emit STARTMSG and ENDMSG before and after. Caches the result; second +Read the PHRASE-FILE, return it as a vector of strings. +Emit STARTMSG and ENDMSG before and after. Cache the result; second and subsequent calls on the same file won't go to disk. \(fn PHRASE-FILE &optional STARTMSG ENDMSG)" nil nil) @@ -6102,7 +6110,7 @@ into \\{cperl-mode-map} -Setting the variable `cperl-font-lock' to t switches on font-lock-mode +Setting the variable `cperl-font-lock' to t switches on `font-lock-mode' \(even with older Emacsen), `cperl-electric-lbrace-space' to t switches on electric space between $ and {, `cperl-electric-parens-string' is the string that contains parentheses that should be electric in CPerl @@ -7083,7 +7091,7 @@ Variables controlling indentation style and extra features: These variables control the look of expanded templates. dcl-imenu-generic-expression - Default value for imenu-generic-expression. The default includes + Default value for `imenu-generic-expression'. The default includes SUBROUTINE labels in the main listing and sub-listings for other labels, CALL, GOTO and GOSUB statements. @@ -7169,7 +7177,7 @@ Redefining FUNCTION also cancels it. (autoload 'cancel-debug-on-entry "debug" "\ Undo effect of \\[debug-on-entry] on FUNCTION. -If FUNCTION is nil, cancel debug-on-entry for all functions. +If FUNCTION is nil, cancel `debug-on-entry' for all functions. When called interactively, prompt for FUNCTION in the minibuffer. To specify a nil argument interactively, exit with an empty minibuffer. @@ -7199,7 +7207,7 @@ another symbol also cancels it. (autoload 'cancel-debug-on-variable-change "debug" "\ Undo effect of \\[debug-on-variable-change] on VARIABLE. -If VARIABLE is nil, cancel debug-on-variable-change for all variables. +If VARIABLE is nil, cancel `debug-on-variable-change' for all variables. When called interactively, prompt for VARIABLE in the minibuffer. To specify a nil argument interactively, exit with an empty minibuffer. @@ -7266,7 +7274,7 @@ See the `delimit-columns-str-before', `delimit-columns-before', `delimit-columns-after', `delimit-columns-separator', `delimit-columns-format' and `delimit-columns-extra' variables for customization of the -look. +look. \(fn START END)" t nil) @@ -7346,7 +7354,7 @@ The arguments are as follows: CHILD: the name of the command for the derived mode. PARENT: the name of the command for the parent mode (e.g. `text-mode') or nil if there is no parent. -NAME: a string which will appear in the status line (e.g. \"Hypertext\") +NAME: a string that will appear in the mode line (e.g. \"HTML\") DOCSTRING: an optional documentation string--if you do not supply one, the function will attempt to invent something useful. KEYWORD-ARGS: @@ -7365,7 +7373,7 @@ KEYWORD-ARGS: A nil value means to simply use the same abbrev-table as the parent. :after-hook FORM - A single lisp form which is evaluated after the mode + A single Lisp form which is evaluated after the mode hooks have been run. It should not be quoted. :interactive BOOLEAN Whether the derived mode should be `interactive' or not. @@ -7392,8 +7400,8 @@ the parent, and then sets the variable `case-fold-search' to nil: Note that if the documentation string had been left out, it would have been generated automatically, with a reference to the keymap. -The new mode runs the hook constructed by the function -`derived-mode-hook-name'. +The new mode runs the hook named MODE-hook. For `foo-mode', +the hook will be named `foo-mode-hook'. See Info node `(elisp)Derived Modes' for more details. @@ -7854,16 +7862,24 @@ active it will overwrite that mode for the current buffer. \(fn &optional ARG)" t nil) (autoload 'global-dictionary-tooltip-mode "dictionary" "\ -Enable/disable dictionary-tooltip-mode for all buffers. +Enable/disable `dictionary-tooltip-mode' for all buffers. -Internally it provides a default for the dictionary-tooltip-mode. -It can be overwritten for each buffer using dictionary-tooltip-mode. +Internally it provides a default for the `dictionary-tooltip-mode'. +It can be overwritten for each buffer using `dictionary-tooltip-mode'. Note: (global-dictionary-tooltip-mode 0) will not disable the mode any buffer where (dictionary-tooltip-mode 1) has been called. \(fn &optional ARG)" t nil) +(autoload 'context-menu-dictionary "dictionary" "\ +Populate MENU with dictionary commands at CLICK. +When you add this function to `context-menu-functions', +the context menu will contain an item that searches +the word at mouse click. + +\(fn MENU CLICK)" nil nil) + (register-definition-prefixes "dictionary" '("dictionary-" "global-dictionary-tooltip-mode")) ;;;*** @@ -7901,10 +7917,10 @@ minibuffer. The default for NEW is the current buffer's file name, and the default for OLD is a backup file for NEW, if one exists. If NO-ASYNC is non-nil, call diff synchronously. -When called interactively with a prefix argument, prompt +When called interactively with a prefix argument SWITCHES, prompt interactively for diff switches. Otherwise, the switches -specified in the variable `diff-switches' are passed to the -diff command. +specified in the variable `diff-switches' are passed to the diff +command. Non-interactively, OLD and NEW may each be a file or a buffer. @@ -7915,12 +7931,12 @@ Diff this file with its backup file or vice versa. Uses the latest backup, if there are several numerical backups. If this file is a backup, diff it with its original. The backup file is the first file given to `diff'. -With prefix arg, prompt for diff switches. +With prefix arg SWITCHES, prompt for diff switches. \(fn FILE &optional SWITCHES)" t nil) (autoload 'diff-latest-backup-file "diff" "\ -Return the latest existing backup of FILE, or nil. +Return the latest existing backup of file FN, or nil. \(fn FN)" nil nil) @@ -7960,7 +7976,7 @@ Supports unified and context diffs as well as (to a lesser extent) normal diffs. When the buffer is read-only, the ESC prefix is not necessary. -If you edit the buffer manually, diff-mode will try to update the hunk +If you edit the buffer manually, `diff-mode' will try to update the hunk headers for you on-the-fly. You can also switch between context diff and unified diff with \\[diff-context->unified], @@ -8065,24 +8081,24 @@ If DIRNAME is already in a Dired buffer, that buffer is used without refresh. (define-key ctl-x-4-map "d" 'dired-other-window) (autoload 'dired-other-window "dired" "\ -\"Edit\" directory DIRNAME. Like `dired' but selects in another window. +\"Edit\" directory DIRNAME. Like `dired' but select in another window. \(fn DIRNAME &optional SWITCHES)" t nil) (define-key ctl-x-5-map "d" 'dired-other-frame) (autoload 'dired-other-frame "dired" "\ -\"Edit\" directory DIRNAME. Like `dired' but makes a new frame. +\"Edit\" directory DIRNAME. Like `dired' but make a new frame. \(fn DIRNAME &optional SWITCHES)" t nil) (define-key tab-prefix-map "d" 'dired-other-tab) (autoload 'dired-other-tab "dired" "\ -\"Edit\" directory DIRNAME. Like `dired' but makes a new tab. +\"Edit\" directory DIRNAME. Like `dired' but make a new tab. \(fn DIRNAME &optional SWITCHES)" t nil) (autoload 'dired-noselect "dired" "\ -Like `dired' but returns the Dired buffer as value, does not select it. +Like `dired' but return the Dired buffer as value, do not select it. \(fn DIR-OR-LIST &optional SWITCHES)" nil nil) @@ -8349,7 +8365,7 @@ in `.emacs'. ;;; Generated autoloads from display-fill-column-indicator.el (autoload 'display-fill-column-indicator-mode "display-fill-column-indicator" "\ -Toggle display of fill-column indicator. +Toggle display of `fill-column' indicator. This uses `display-fill-column-indicator' internally. This is a minor mode. If called interactively, toggle the @@ -8403,8 +8419,8 @@ Display-Fill-Column-Indicator mode is enabled in all buffers where See `display-fill-column-indicator-mode' for more information on Display-Fill-Column-Indicator mode. -`global-display-fill-column-indicator-modes' is used to control -which modes this minor mode is used in. +`global-display-fill-column-indicator-modes' is used to control which +modes this minor mode is used in. \(fn &optional ARG)" t nil) @@ -8735,7 +8751,7 @@ BODY contains code to execute each time the mode is enabled or disabled. It is executed after toggling the mode, and before running MODE-hook. Before the actual body code, you can write keyword arguments, i.e. alternating keywords and values. If you provide BODY, then you must - provide at least one keyword argument (e.g. `:lighter nil'). + provide at least one keyword argument (e.g. `:lighter nil`). The following special keywords are supported (other keywords are passed to `defcustom' if the minor mode is global): @@ -8750,8 +8766,8 @@ BODY contains code to execute each time the mode is enabled or disabled. Not used if you also specify :variable. :lighter SPEC Text displayed in the mode line when the mode is on. :keymap MAP Keymap bound to the mode keymap. Defaults to `MODE-map'. - If non-nil, it should be a variable name (whose value is - a keymap), or an expression that returns either a keymap or + If non-nil, it should be an unquoted variable name (whose value + is a keymap), or an expression that returns either a keymap or a list of (KEY . BINDING) pairs where KEY and BINDING are suitable for `define-key'. If you supply a KEYMAP argument that is not a symbol, this macro defines the variable MODE-map @@ -8769,7 +8785,7 @@ BODY contains code to execute each time the mode is enabled or disabled. be assigned to PLACE. If you specify a :variable, this function does not define a MODE variable (nor any of the terms used in :variable). -:after-hook A single lisp form which is evaluated after the mode hooks +:after-hook A single Lisp form which is evaluated after the mode hooks have been run. It should not be quoted. For example, you could write @@ -9670,9 +9686,11 @@ symbol describing the Ediff job type; it defaults to (defalias 'ebuffers3 #'ediff-buffers3) (autoload 'ediff-directories "ediff" "\ -Run Ediff on a pair of directories, DIR1 and DIR2, comparing files that have -the same name in both. The third argument, REGEXP, is nil or a regular -expression; only file names that match the regexp are considered. +Run Ediff on directories DIR1 and DIR2, comparing files. +Consider only files that have the same name in both directories. + +REGEXP is nil or a regular expression; only file names that match +the regexp are considered. \(fn DIR1 DIR2 REGEXP)" t nil) @@ -9688,9 +9706,11 @@ names. Only the files that are under revision control are taken into account. (defalias 'edir-revisions #'ediff-directory-revisions) (autoload 'ediff-directories3 "ediff" "\ -Run Ediff on three directories, DIR1, DIR2, and DIR3, comparing files that -have the same name in all three. The last argument, REGEXP, is nil or a -regular expression; only file names that match the regexp are considered. +Run Ediff on directories DIR1, DIR2, and DIR3, comparing files. +Consider only files that have the same name in all three directories. + +REGEXP is nil or a regular expression; only file names that match +the regexp are considered. \(fn DIR1 DIR2 DIR3 REGEXP)" t nil) @@ -9707,7 +9727,7 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files. (defalias 'edirs-merge #'ediff-merge-directories) (autoload 'ediff-merge-directories-with-ancestor "ediff" "\ -Merge files in directories DIR1 and DIR2 using files in ANCESTOR-DIR as ancestors. +Merge files in DIR1 and DIR2 using files in ANCESTOR-DIR as ancestors. Ediff merges files that have identical names in DIR1, DIR2. If a pair of files in DIR1 and DIR2 doesn't have an ancestor in ANCESTOR-DIR, Ediff will merge without ancestor. The fourth argument, REGEXP, is nil or a regular expression; @@ -9727,7 +9747,7 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files. (defalias 'edir-merge-revisions #'ediff-merge-directory-revisions) (autoload 'ediff-merge-directory-revisions-with-ancestor "ediff" "\ -Run Ediff on a directory, DIR1, merging its files with their revisions and ancestors. +Run Ediff on DIR1 and merge its files with their revisions and ancestors. The second argument, REGEXP, is a regular expression that filters the file names. Only the files that are under revision control are taken into account. MERGE-AUTOSTORE-DIR is the directory in which to store merged files. @@ -9912,7 +9932,7 @@ Call `ediff3-files' with the next three command line arguments." nil nil) Call `ediff-merge-files' with the next two command line arguments." nil nil) (autoload 'ediff-merge-with-ancestor-command "ediff" "\ -Call `ediff-merge-files-with-ancestor' with the next three command line arguments." nil nil) +Call `ediff-merge-files-with-ancestor' with next three command line arguments." nil nil) (autoload 'ediff-directories-command "ediff" "\ Call `ediff-directories' with the next three command line arguments." nil nil) @@ -9924,7 +9944,8 @@ Call `ediff-directories3' with the next four command line arguments." nil nil) Call `ediff-merge-directories' with the next three command line arguments." nil nil) (autoload 'ediff-merge-directories-with-ancestor-command "ediff" "\ -Call `ediff-merge-directories-with-ancestor' with the next four command line arguments." nil nil) +Call `ediff-merge-directories-with-ancestor' with the next four command line +arguments." nil nil) (register-definition-prefixes "ediff" '("ediff-")) @@ -10413,7 +10434,7 @@ Message buffer where you can explain more about the patch. ;;; Generated autoloads from vc/emerge.el (autoload 'emerge-files "emerge" "\ -Run Emerge on two files. +Run Emerge on two files FILE-A and FILE-B. \(fn ARG FILE-A FILE-B FILE-OUT &optional STARTUP-HOOKS QUIT-HOOKS)" t nil) @@ -10423,7 +10444,7 @@ Run Emerge on two files, giving another file as the ancestor. \(fn ARG FILE-A FILE-B FILE-ANCESTOR FILE-OUT &optional STARTUP-HOOKS QUIT-HOOKS)" t nil) (autoload 'emerge-buffers "emerge" "\ -Run Emerge on two buffers. +Run Emerge on two buffers BUFFER-A and BUFFER-B. \(fn BUFFER-A BUFFER-B &optional STARTUP-HOOKS QUIT-HOOKS)" t nil) @@ -10527,7 +10548,7 @@ List all keys matched with NAME from the private keyring. (autoload 'epa-select-keys "epa" "\ Display a user's keyring and ask him to select keys. -CONTEXT is an epg-context. +CONTEXT is an `epg-context'. PROMPT is a string to prompt with. NAMES is a list of strings to be matched with keys. If it is nil, all the keys are listed. @@ -10614,8 +10635,7 @@ For example: (function-put 'epa-verify-region 'interactive-only 't) (autoload 'epa-verify-cleartext-in-region "epa" "\ -Verify OpenPGP cleartext signed messages in the current region -between START and END. +Verify OpenPGP cleartext signed messages in current region from START to END. Don't use this command in Lisp programs! See the reason described in the `epa-verify-region' documentation. @@ -10683,8 +10703,7 @@ Import keys from the region. \(fn START END)" t nil) (autoload 'epa-import-armor-in-region "epa" "\ -Import keys in the OpenPGP armor format in the current region -between START and END. +Import keys in the OpenPGP armor format in the current region from START to END. \(fn START END)" t nil) @@ -10967,7 +10986,7 @@ first element is the certificate key file name, and the second element is the certificate file name itself, or t, which means that `auth-source' will be queried for the key and the certificate. Authenticating using a TLS client certificate is -also refered to as \"CertFP\" (Certificate Fingerprint) +also referred to as \"CertFP\" (Certificate Fingerprint) authentication by various IRC networks. Example usage: @@ -11113,6 +11132,22 @@ Kill all test buffers that are still live." t nil) (register-definition-prefixes "ert-x" '("ert-")) +;;;*** + +;;;### (autoloads nil "erts-mode" "progmodes/erts-mode.el" (0 0 0 +;;;;;; 0)) +;;; Generated autoloads from progmodes/erts-mode.el + +(autoload 'erts-mode "erts-mode" "\ +Major mode for editing erts (Emacs testing) files. +This mode mainly provides some font locking. + +\\{erts-mode-map} + +\(fn)" t nil) + +(register-definition-prefixes "erts-mode" '("erts-")) + ;;;*** ;;;### (autoloads nil "esh-arg" "eshell/esh-arg.el" (0 0 0 0)) @@ -11207,7 +11242,7 @@ session. Return the buffer selected (or created). With a nonnumeric prefix arg, create a new session. -With a numeric prefix arg (as in `C-u 42 M-x eshell RET'), switch +With a numeric prefix arg (as in `\\[universal-argument] 42 \\[eshell]'), switch to the session with that number, or create it if it doesn't already exist. @@ -11542,6 +11577,20 @@ for \\[find-tag] (which see)." t nil) (register-definition-prefixes "etags" '("default-tags-table-function" "etags-" "file-of-tag" "find-tag-" "goto-tag-location-function" "initialize-new-tags-table" "last-tag" "list-tags-function" "select-tags-table-" "snarf-tag-function" "tag" "verify-tags-table-function" "xref-")) +;;;*** + +;;;### (autoloads nil "etc-authors-mode" "textmodes/etc-authors-mode.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from textmodes/etc-authors-mode.el + +(autoload 'etc-authors-mode "etc-authors-mode" "\ +Major mode for viewing \"etc/AUTHORS\" from the Emacs distribution. +Provides some basic font locking and not much else. + +\(fn)" t nil) + +(register-definition-prefixes "etc-authors-mode" '("etc-authors-")) + ;;;*** ;;;### (autoloads nil "ethio-util" "language/ethio-util.el" (0 0 @@ -11739,8 +11788,9 @@ see `eudc-inline-expansion-servers'. Query the directory server, and return the matching responses. The variable `eudc-inline-query-format' controls how to associate the individual QUERY-WORDS with directory attribute names. -After querying the server for the given string, the expansion specified by -`eudc-inline-expansion-format' is applied to the matches before returning them.inserted in the buffer at point. +After querying the server for the given string, the expansion +specified by `eudc-inline-expansion-format' is applied to the +matches before returning them.inserted in the buffer at point. Multiple servers can be tried with the same query until one finds a match, see `eudc-inline-expansion-servers'. @@ -11946,6 +11996,8 @@ for the search engine used." t nil) (autoload 'eww-mode "eww" "\ Mode for browsing the web. +\\{eww-mode-map} + \(fn)" t nil) (autoload 'eww-browse-url "eww" "\ @@ -11968,6 +12020,11 @@ instead of `browse-url-new-window-flag'. (autoload 'eww-list-bookmarks "eww" "\ Display the bookmarks." t nil) +(autoload 'eww-bookmark-jump "eww" "\ +Default bookmark handler for EWW buffers. + +\(fn BOOKMARK)" nil nil) + (register-definition-prefixes "eww" '("erc--download-directory" "eww-")) ;;;*** @@ -12224,7 +12281,7 @@ Adjust the height of the default face by INC. INC may be passed as a numeric prefix argument. The actual adjustment made depends on the final component of the -key-binding used to invoke the command, with all modifiers removed: +keybinding used to invoke the command, with all modifiers removed: +, = Increase the height of the default face by one step - Decrease the height of the default face by one step @@ -12322,10 +12379,10 @@ If the optional argument LIST is non-nil, it should be a list of colors to display. Otherwise, this command computes a list of colors that the current display can handle. Customize `list-colors-sort' to change the order in which colors are shown. -Type `g' or \\[revert-buffer] after customizing `list-colors-sort' -to redisplay colors in the new order. +Type \\\\[revert-buffer] after customizing `list-colors-sort' to redisplay colors in +the new order. -If the optional argument BUFFER-NAME is nil, it defaults to *Colors*. +If the optional argument BUFFER-NAME is nil, it defaults to \"*Colors*\". If the optional argument CALLBACK is non-nil, it should be a function to call each time the user types RET or clicks on a @@ -12775,7 +12832,7 @@ it finishes, type \\[kill-find]. \(fn DIR ARGS)" t nil) (autoload 'find-name-dired "find-dired" "\ -Search DIR recursively for files matching the globbing pattern PATTERN, +Search DIR recursively for files matching the globbing PATTERN, and run Dired on those files. PATTERN is a shell wildcard (not an Emacs regexp) and need not be quoted. The default command run (after changing into DIR) is @@ -12906,13 +12963,16 @@ Find the Emacs Lisp source of LIBRARY. Interactively, prompt for LIBRARY using the one at or near point. +This function searches `find-library-source-path' if non-nil, and +`load-path' otherwise. + \(fn LIBRARY)" t nil) (autoload 'read-library-name "find-func" "\ Read and return a library name, defaulting to the one near point. A library name is the filename of an Emacs Lisp library located -in a directory under `load-path' (or `find-function-source-path', +in a directory under `load-path' (or `find-library-source-path', if non-nil)." nil nil) (autoload 'find-library-other-window "find-func" "\ @@ -12953,10 +13013,6 @@ If FUNCTION is a built-in function, this function normally attempts to find it in the Emacs C sources; however, if LISP-ONLY is non-nil, signal an error instead. -If the file where FUNCTION is defined is not known, then it is -searched for in `find-function-source-path' if non-nil, otherwise -in `load-path'. - \(fn FUNCTION &optional LISP-ONLY)" nil nil) (autoload 'find-function "find-func" "\ @@ -12967,8 +13023,6 @@ near point (selected by `function-called-at-point') in a buffer and places point before the definition. Set mark before moving, if the buffer already existed. -The library where FUNCTION is defined is searched for in -`find-function-source-path', if non-nil, otherwise in `load-path'. See also `find-function-recenter-line' and `find-function-after-hook'. \(fn FUNCTION)" t nil) @@ -12994,9 +13048,6 @@ Finds the library containing the definition of VARIABLE in a buffer and the point of the definition. The buffer is not selected. If the variable's definition can't be found in the buffer, return (BUFFER). -The library where VARIABLE is defined is searched for in FILE or -`find-function-source-path', if non-nil, otherwise in `load-path'. - \(fn VARIABLE &optional FILE)" nil nil) (autoload 'find-variable "find-func" "\ @@ -13008,8 +13059,6 @@ places point before the definition. Set mark before moving, if the buffer already existed. -The library where VARIABLE is defined is searched for in -`find-function-source-path', if non-nil, otherwise in `load-path'. See also `find-function-recenter-line' and `find-function-after-hook'. \(fn VARIABLE)" t nil) @@ -13035,9 +13084,6 @@ TYPE says what type of definition: nil for a function, `defvar' for a variable, `defface' for a face. This function does not switch to the buffer nor display it. -The library where SYMBOL is defined is searched for in FILE or -`find-function-source-path', if non-nil, otherwise in `load-path'. - \(fn SYMBOL TYPE &optional FILE)" nil nil) (autoload 'find-face-definition "find-func" "\ @@ -13049,8 +13095,6 @@ places point before the definition. Set mark before moving, if the buffer already existed. -The library where FACE is defined is searched for in -`find-function-source-path', if non-nil, otherwise in `load-path'. See also `find-function-recenter-line' and `find-function-after-hook'. \(fn FACE)" t nil) @@ -13080,7 +13124,7 @@ Find directly the function at point in the other window." t nil) Find directly the variable at point in the other window." t nil) (autoload 'find-function-setup-keys "find-func" "\ -Define some key bindings for the find-function family of functions." nil nil) +Define some key bindings for the `find-function' family of functions." nil nil) (register-definition-prefixes "find-func" '("find-")) @@ -13173,7 +13217,7 @@ lines. ;;;### (autoloads nil "flymake" "progmodes/flymake.el" (0 0 0 0)) ;;; Generated autoloads from progmodes/flymake.el -(push (purecopy '(flymake 1 1 1)) package--builtin-versions) +(push (purecopy '(flymake 1 2 1)) package--builtin-versions) (autoload 'flymake-log "flymake" "\ Log, at level LEVEL, the message MSG formatted with ARGS. @@ -13185,23 +13229,32 @@ generated it. \(fn LEVEL MSG &rest ARGS)" nil t) (autoload 'flymake-make-diagnostic "flymake" "\ -Make a Flymake diagnostic for BUFFER's region from BEG to END. +Make a Flymake diagnostic for LOCUS's region from BEG to END. +LOCUS is a buffer object or a string designating a file name. + TYPE is a diagnostic symbol and TEXT is string describing the problem detected in this region. DATA is any object that the caller wishes to attach to the created diagnostic for later -retrieval. +retrieval with `flymake-diagnostic-data'. + +If LOCUS is a buffer BEG and END should be buffer positions +inside it. If LOCUS designates a file, BEG and END should be a +cons (LINE . COL) indicating a file position. In this second +case, END may be ommited in which case the region is computed +using `flymake-diag-region' if the diagnostic is appended to an +actual buffer. OVERLAY-PROPERTIES is an alist of properties attached to the created diagnostic, overriding the default properties and any -properties of `flymake-overlay-control' of the diagnostic's -type. +properties listed in the `flymake-overlay-control' property of +the diagnostic's type symbol. -\(fn BUFFER BEG END TYPE TEXT &optional DATA OVERLAY-PROPERTIES)" nil nil) +\(fn LOCUS BEG END TYPE TEXT &optional DATA OVERLAY-PROPERTIES)" nil nil) (autoload 'flymake-diagnostics "flymake" "\ Get Flymake diagnostics in region determined by BEG and END. -If neither BEG or END is supplied, use the whole buffer, +If neither BEG or END is supplied, use whole accessible buffer, otherwise if BEG is non-nil and END is nil, consider only diagnostics at BEG. @@ -13678,7 +13731,7 @@ Variables controlling indentation style and extra features: `fortran-comment-line-extra-indent' Amount of extra indentation for text in full-line comments (default 0). `fortran-comment-indent-style' - How to indent the text in full-line comments. Allowed values are: + How to indent the text in full-line comments. Allowed values are: nil don't change the indentation `fixed' indent to `fortran-comment-line-extra-indent' beyond the value of either @@ -13924,7 +13977,8 @@ FORCE-ONSCREEN can be: - a list (LEFT TOP WIDTH HEIGHT), describing the workarea. It must return non-nil to force the frame onscreen, nil otherwise. -CLEANUP-FRAMES allows \"cleaning up\" the frame list after restoring a frameset: +CLEANUP-FRAMES allows \"cleaning up\" the frame list after +restoring a frameset: t Delete all frames that were not created or restored upon. nil Keep all frames. FUNC A function called with two arguments: @@ -14025,7 +14079,7 @@ becomes the initial working directory and source-file directory for your debugger. If COMMAND-LINE requests that gdb attaches to a process PID, gdb will run in *gud-PID*, otherwise it will run in *gud*; in these -cases the initial working directory is the default-directory of +cases the initial working directory is the `default-directory' of the buffer in which this command was invoked. COMMAND-LINE should include \"-i=mi\" to use gdb's MI text interface. @@ -14351,7 +14405,7 @@ Allow Gnus to be an offline newsreader. The gnus-agentize function is now called internally by gnus when gnus-agent is set. If you wish to avoid calling gnus-agentize, -customize gnus-agent to nil. +customize `gnus-agent' to nil. This will modify the `gnus-setup-news-hook', and `message-send-mail-real-function' variables, and install the Gnus agent @@ -14592,7 +14646,7 @@ Checking delayed messages is skipped if optional arg NO-CHECK is non-nil. ;;; Generated autoloads from gnus/gnus-dired.el (autoload 'turn-on-gnus-dired-mode "gnus-dired" "\ -Convenience method to turn on gnus-dired-mode." t nil) +Convenience method to turn on `gnus-dired-mode'." t nil) (register-definition-prefixes "gnus-dired" '("gnus-dired-")) @@ -14626,7 +14680,8 @@ Reminder user if there are unsent drafts." t nil) ;;; Generated autoloads from gnus/gnus-fun.el (autoload 'gnus--random-face-with-type "gnus-fun" "\ -Return file from DIR with extension EXT, omitting matches of OMIT, processed by FUN. +Return file from DIR with extension EXT. +Omit matches of OMIT, and process them by FUN. \(fn DIR EXT OMIT FUN)" nil nil) @@ -14855,7 +14910,7 @@ match any of the group-specified splitting rules. See \(fn &optional AUTO-UPDATE CATCH-ALL)" t nil) (autoload 'gnus-group-split-update "gnus-mlspl" "\ -Computes nnmail-split-fancy from group params and CATCH-ALL. +Computes `nnmail-split-fancy' from group params and CATCH-ALL. It does this by calling (gnus-group-split-fancy nil nil CATCH-ALL). If CATCH-ALL is nil, `gnus-group-split-default-catch-all-group' is used @@ -15436,7 +15491,7 @@ This variable's value takes effect when `grep-compute-defaults' is called.") History list for grep.") (defvar grep-find-history nil "\ -History list for grep-find.") +History list for `grep-find'.") (autoload 'grep-process-setup "grep" "\ Setup compilation variables and buffer for `grep'. @@ -15575,7 +15630,7 @@ becomes the initial working directory and source-file directory for your debugger. If COMMAND-LINE requests that gdb attaches to a process PID, gdb will run in *gud-PID*, otherwise it will run in *gud*; in these -cases the initial working directory is the default-directory of +cases the initial working directory is the `default-directory' of the buffer in which this command was invoked. \(fn COMMAND-LINE)" t nil) @@ -15804,7 +15859,7 @@ binding mode. ;;; Generated autoloads from play/handwrite.el (autoload 'handwrite "handwrite" "\ -Turns the buffer into a \"handwritten\" document. +Turn the buffer into a \"handwritten\" document. The functions `handwrite-10pt', `handwrite-11pt', `handwrite-12pt' and `handwrite-13pt' set up for various sizes of output. @@ -15841,9 +15896,9 @@ second since 1970-01-01 00:00:00 GMT. Repent before ring 31 moves." t nil) (autoload 'hanoi-unix-64 "hanoi" "\ -Like hanoi-unix, but pretend to have a 64-bit clock. +Like `hanoi-unix', but pretend to have a 64-bit clock. This is, necessarily (as of Emacs 20.3), a crock. When the -current-time interface is made s2G-compliant, hanoi.el will need +`current-time' interface is made s2G-compliant, hanoi.el will need to be updated." t nil) (register-definition-prefixes "hanoi" '("hanoi-")) @@ -16029,13 +16084,16 @@ different regions. With numeric argument ARG, behaves like (autoload 'describe-function "help-fns" "\ Display the full documentation of FUNCTION (a symbol). -When called from lisp, FUNCTION may also be a function object. +When called from Lisp, FUNCTION may also be a function object. + +See the `help-enable-symbol-autoload' variable for special +handling of autoloaded functions. \(fn FUNCTION)" t nil) (autoload 'describe-command "help-fns" "\ Display the full documentation of COMMAND (a symbol). -When called from lisp, COMMAND may also be a function object. +When called from Lisp, COMMAND may also be a function object. \(fn COMMAND)" t nil) @@ -16477,9 +16535,9 @@ which can be called interactively, are: When hi-lock is started and if the mode is not excluded or patterns rejected, the beginning of the buffer is searched for lines of the form: - Hi-lock: FOO + Hi-lock: (FOO ...) -where FOO is a list of patterns. The patterns must start before +where (FOO ...) is a list of patterns. The patterns must start before position (number of characters into buffer) `hi-lock-file-patterns-range'. Patterns will be read until Hi-lock: end is found. A mode is excluded if it's in the list @@ -16912,8 +16970,8 @@ Disable the mode if ARG is a negative number. Highlight-Changes mode is enabled in all buffers where `highlight-changes-mode-turn-on' would do it. -See `highlight-changes-mode' for more information on -Highlight-Changes mode. +See `highlight-changes-mode' for more information on Highlight-Changes +mode. \(fn &optional ARG)" t nil) @@ -17761,7 +17819,7 @@ The main features of this mode are Info documentation for this package is available. Use \\[idlwave-info] to display (complain to your sysadmin if that does not work). For Postscript, PDF, and HTML versions of the - documentation, check IDLWAVE's homepage at URL + documentation, check IDLWAVE's website at URL `https://github.com/jdtsmith/idlwave'. IDLWAVE has customize support - see the group `idlwave'. @@ -17983,12 +18041,12 @@ The directory is selected interactively by typing a substring. For details of keybindings, see `ido-find-file'." t nil) (autoload 'ido-dired-other-window "ido" "\ -\"Edit\" a directory. Like `ido-dired' but selects in another window. +\"Edit\" a directory. Like `ido-dired' but select in another window. The directory is selected interactively by typing a substring. For details of keybindings, see `ido-find-file'." t nil) (autoload 'ido-dired-other-frame "ido" "\ -\"Edit\" a directory. Like `ido-dired' but makes a new frame. +\"Edit\" a directory. Like `ido-dired' but make a new frame. The directory is selected interactively by typing a substring. For details of keybindings, see `ido-find-file'." t nil) @@ -18993,7 +19051,7 @@ system." t nil) (autoload 'info-lookup-symbol "info-look" "\ Display the definition of SYMBOL, as found in the relevant manual. When this command is called interactively, it reads SYMBOL from the -minibuffer. In the minibuffer, use M-n to yank the default argument +minibuffer. In the minibuffer, use \\\\[next-history-element] to yank the default argument value into the minibuffer so you can edit it. The default symbol is the one found at point. @@ -19005,7 +19063,7 @@ With prefix arg MODE a query for the symbol help mode is offered. (autoload 'info-lookup-file "info-look" "\ Display the documentation of a file. When this command is called interactively, it reads FILE from the minibuffer. -In the minibuffer, use M-n to yank the default file name +In the minibuffer, use \\\\[next-history-element] to yank the default file name into the minibuffer so you can edit it. The default file name is the one found at point. @@ -19140,7 +19198,7 @@ Check current buffer for validity as an Info file. Check that every node pointer points to an existing node." t nil) (autoload 'batch-info-validate "informat" "\ -Runs `Info-validate' on the files remaining on the command line. +Run `Info-validate' on the files remaining on the command line. Must be used only with -batch, and kills Emacs on completion. Each file will be processed even if an error occurred previously. For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\"" nil nil) @@ -19752,7 +19810,7 @@ keys are bound. `S-cursor' Bind shifted keypad keys to the shifted cursor movement keys. `cursor' Bind keypad keys to the cursor movement keys. `numeric' Plain numeric keypad, i.e. 0 .. 9 and . (or DECIMAL arg) - `none' Removes all bindings for keypad keys in function-key-map; + `none' Removes all bindings for keypad keys in `function-key-map'; this enables any user-defined bindings for the keypad keys in the global and local keymaps. @@ -20071,7 +20129,7 @@ use either \\[customize] or the function `latin1-display'.") ;;; Generated autoloads from progmodes/ld-script.el (autoload 'ld-script-mode "ld-script" "\ -A major mode to edit GNU ld script files +A major mode to edit GNU ld script files. \(fn)" t nil) @@ -20148,7 +20206,7 @@ essentially expands to .site.contents)) If you nest `let-alist' invocations, the inner one can't access -the variables of the outer one. You can, however, access alists +the variables of the outer one. You can, however, access alists inside the original alist by using dots inside the symbol, as displayed in the example above. @@ -20529,11 +20587,16 @@ use this command, and then save the file. (autoload 'kbd-macro-query "macros" "\ Query user during kbd macro execution. - With prefix argument, enters recursive edit, reading keyboard -commands even within a kbd macro. You can give different commands -each time the macro executes. - Without prefix argument, asks whether to continue running the macro. + +With prefix argument FLAG, enter recursive edit, reading +keyboard commands even within a kbd macro. You can give +different commands each time the macro executes. + +Without prefix argument, ask whether to continue running the +macro. + Your options are: \\ + \\[act] Finish this iteration normally and continue with the next. \\[skip] Skip the rest of this iteration, and start the next. \\[exit] Stop the macro entirely right now. @@ -21142,7 +21205,7 @@ Default bookmark handler for Man buffers. ;;;### (autoloads nil "map" "emacs-lisp/map.el" (0 0 0 0)) ;;; Generated autoloads from emacs-lisp/map.el -(push (purecopy '(map 3 1)) package--builtin-versions) +(push (purecopy '(map 3 2 1)) package--builtin-versions) (register-definition-prefixes "map" '("map-")) @@ -23389,8 +23452,9 @@ closing requests for requests that are used in matched pairs. (autoload 'nxml-mode "nxml-mode" "\ Major mode for editing XML. - +\\ \\[nxml-finish-element] finishes the current element by inserting an end-tag. + C-c C-i closes a start-tag with `>' and then inserts a balancing end-tag leaving point between the start-tag and end-tag. \\[nxml-balanced-close-start-tag-block] is similar but for block rather than inline elements: @@ -23485,34 +23549,12 @@ Many aspects this mode can be customized using (register-definition-prefixes "ob-C" '("org-babel-")) -;;;*** - -;;;### (autoloads nil "ob-J" "org/ob-J.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-J.el - -(register-definition-prefixes "ob-J" '("obj-" "org-babel-")) - ;;;*** ;;;### (autoloads nil "ob-R" "org/ob-R.el" (0 0 0 0)) ;;; Generated autoloads from org/ob-R.el -(register-definition-prefixes "ob-R" '("ob-R-" "org-babel-")) - -;;;*** - -;;;### (autoloads nil "ob-abc" "org/ob-abc.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-abc.el - -(register-definition-prefixes "ob-abc" '("org-babel-")) - -;;;*** - -;;;### (autoloads nil "ob-asymptote" "org/ob-asymptote.el" (0 0 0 -;;;;;; 0)) -;;; Generated autoloads from org/ob-asymptote.el - -(register-definition-prefixes "ob-asymptote" '("org-babel-")) +(register-definition-prefixes "ob-R" '("ob-" "org-babel-")) ;;;*** @@ -23542,13 +23584,6 @@ Many aspects this mode can be customized using (register-definition-prefixes "ob-comint" '("org-babel-comint-")) -;;;*** - -;;;### (autoloads nil "ob-coq" "org/ob-coq.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-coq.el - -(register-definition-prefixes "ob-coq" '("coq-program-name" "org-babel-")) - ;;;*** ;;;### (autoloads nil "ob-css" "org/ob-css.el" (0 0 0 0)) @@ -23570,13 +23605,6 @@ Many aspects this mode can be customized using (register-definition-prefixes "ob-dot" '("org-babel-")) -;;;*** - -;;;### (autoloads nil "ob-ebnf" "org/ob-ebnf.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-ebnf.el - -(register-definition-prefixes "ob-ebnf" '("org-babel-")) - ;;;*** ;;;### (autoloads nil "ob-emacs-lisp" "org/ob-emacs-lisp.el" (0 0 @@ -23641,20 +23669,6 @@ Many aspects this mode can be customized using (register-definition-prefixes "ob-haskell" '("org-babel-")) -;;;*** - -;;;### (autoloads nil "ob-hledger" "org/ob-hledger.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-hledger.el - -(register-definition-prefixes "ob-hledger" '("org-babel-")) - -;;;*** - -;;;### (autoloads nil "ob-io" "org/ob-io.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-io.el - -(register-definition-prefixes "ob-io" '("org-babel-")) - ;;;*** ;;;### (autoloads nil "ob-java" "org/ob-java.el" (0 0 0 0)) @@ -23671,24 +23685,24 @@ Many aspects this mode can be customized using ;;;*** -;;;### (autoloads nil "ob-latex" "org/ob-latex.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-latex.el +;;;### (autoloads nil "ob-julia" "org/ob-julia.el" (0 0 0 0)) +;;; Generated autoloads from org/ob-julia.el -(register-definition-prefixes "ob-latex" '("org-babel-")) +(register-definition-prefixes "ob-julia" '("org-babel-")) ;;;*** -;;;### (autoloads nil "ob-ledger" "org/ob-ledger.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-ledger.el +;;;### (autoloads nil "ob-latex" "org/ob-latex.el" (0 0 0 0)) +;;; Generated autoloads from org/ob-latex.el -(register-definition-prefixes "ob-ledger" '("org-babel-")) +(register-definition-prefixes "ob-latex" '("org-babel-")) ;;;*** ;;;### (autoloads nil "ob-lilypond" "org/ob-lilypond.el" (0 0 0 0)) ;;; Generated autoloads from org/ob-lilypond.el -(register-definition-prefixes "ob-lilypond" '("lilypond-mode" "org-babel-")) +(register-definition-prefixes "ob-lilypond" '("lilypond-mode" "ob-lilypond-header-args" "org-babel-")) ;;;*** @@ -23718,13 +23732,6 @@ Many aspects this mode can be customized using (register-definition-prefixes "ob-maxima" '("org-babel-")) -;;;*** - -;;;### (autoloads nil "ob-mscgen" "org/ob-mscgen.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-mscgen.el - -(register-definition-prefixes "ob-mscgen" '("org-babel-")) - ;;;*** ;;;### (autoloads nil "ob-ocaml" "org/ob-ocaml.el" (0 0 0 0)) @@ -23753,13 +23760,6 @@ Many aspects this mode can be customized using (register-definition-prefixes "ob-perl" '("org-babel-")) -;;;*** - -;;;### (autoloads nil "ob-picolisp" "org/ob-picolisp.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-picolisp.el - -(register-definition-prefixes "ob-picolisp" '("org-babel-")) - ;;;*** ;;;### (autoloads nil "ob-plantuml" "org/ob-plantuml.el" (0 0 0 0)) @@ -23831,13 +23831,6 @@ Many aspects this mode can be customized using (register-definition-prefixes "ob-shell" '("org-babel-")) -;;;*** - -;;;### (autoloads nil "ob-shen" "org/ob-shen.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-shen.el - -(register-definition-prefixes "ob-shen" '("org-babel-")) - ;;;*** ;;;### (autoloads nil "ob-sql" "org/ob-sql.el" (0 0 0 0)) @@ -23854,24 +23847,45 @@ Many aspects this mode can be customized using ;;;*** -;;;### (autoloads nil "ob-stan" "org/ob-stan.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-stan.el +;;;### (autoloads nil "ob-table" "org/ob-table.el" (0 0 0 0)) +;;; Generated autoloads from org/ob-table.el -(register-definition-prefixes "ob-stan" '("org-babel-")) +(register-definition-prefixes "ob-table" '("org-")) ;;;*** -;;;### (autoloads nil "ob-table" "org/ob-table.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-table.el +;;;### (autoloads nil "oc" "org/oc.el" (0 0 0 0)) +;;; Generated autoloads from org/oc.el -(register-definition-prefixes "ob-table" '("org-")) +(register-definition-prefixes "oc" '("org-cite-")) ;;;*** -;;;### (autoloads nil "ob-vala" "org/ob-vala.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-vala.el +;;;### (autoloads nil "oc-basic" "org/oc-basic.el" (0 0 0 0)) +;;; Generated autoloads from org/oc-basic.el -(register-definition-prefixes "ob-vala" '("org-babel-")) +(register-definition-prefixes "oc-basic" '("org-cite-basic-")) + +;;;*** + +;;;### (autoloads nil "oc-biblatex" "org/oc-biblatex.el" (0 0 0 0)) +;;; Generated autoloads from org/oc-biblatex.el + +(register-definition-prefixes "oc-biblatex" '("org-cite-biblatex-")) + +;;;*** + +;;;### (autoloads nil "oc-csl" "org/oc-csl.el" (0 0 0 0)) +;;; Generated autoloads from org/oc-csl.el + +(register-definition-prefixes "oc-csl" '("org-cite-csl-")) + +;;;*** + +;;;### (autoloads nil "oc-natbib" "org/oc-natbib.el" (0 0 0 0)) +;;; Generated autoloads from org/oc-natbib.el + +(register-definition-prefixes "oc-natbib" '("org-cite-natbib-")) ;;;*** @@ -23937,6 +23951,13 @@ startup file, `~/.emacs-octave'. (register-definition-prefixes "ol-docview" '("org-docview-")) +;;;*** + +;;;### (autoloads nil "ol-doi" "org/ol-doi.el" (0 0 0 0)) +;;; Generated autoloads from org/ol-doi.el + +(register-definition-prefixes "ol-doi" '("org-link-doi-")) + ;;;*** ;;;### (autoloads nil "ol-eshell" "org/ol-eshell.el" (0 0 0 0)) @@ -23994,7 +24015,8 @@ startup file, `~/.emacs-octave'. (define-obsolete-function-alias 'delphi-mode #'opascal-mode "24.4") (autoload 'opascal-mode "opascal" "\ -Major mode for editing OPascal code.\\ +Major mode for editing OPascal code. +\\ \\[opascal-find-unit] - Search for a OPascal source file. \\[opascal-fill-comment] - Fill the current comment. \\[opascal-new-comment-line] - If in a // comment, do a new comment line. @@ -24027,7 +24049,7 @@ Coloring: ;;;### (autoloads nil "org" "org/org.el" (0 0 0 0)) ;;; Generated autoloads from org/org.el -(push (purecopy '(org 9 4 4)) package--builtin-versions) +(push (purecopy '(org 9 5)) package--builtin-versions) (autoload 'org-babel-do-load-languages "org" "\ Load the languages defined in `org-babel-load-languages'. @@ -24267,7 +24289,7 @@ first press `<' once to indicate that the agenda should be temporarily Pressing `<' twice means to restrict to the current subtree or region \(if active). -\(fn &optional ARG ORG-KEYS RESTRICTION)" t nil) +\(fn &optional ARG KEYS RESTRICTION)" t nil) (autoload 'org-batch-agenda "org-agenda" "\ Run an agenda command in batch mode and send the result to STDOUT. @@ -24453,7 +24475,7 @@ 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 +in the file. Otherwise, only apply the restriction to the current subtree. \(fn &optional TYPE)" t nil) @@ -24727,6 +24749,109 @@ See the command `outline-mode' for more information on this mode. (register-definition-prefixes "outline" '("outline-")) +;;;*** + +;;;### (autoloads nil "ox-koma-letter" "org/ox-koma-letter.el" (0 +;;;;;; 0 0 0)) +;;; Generated autoloads from org/ox-koma-letter.el + +(autoload 'org-koma-letter-export-as-latex "ox-koma-letter" "\ +Export current buffer as a KOMA Scrlttr2 letter. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Export is done in a buffer named \"*Org KOMA-LETTER Export*\". It +will be displayed if `org-export-show-temporary-export-buffer' is +non-nil. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-koma-letter-export-to-latex "ox-koma-letter" "\ +Export current buffer as a KOMA Scrlttr2 letter (tex). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +When optional argument PUB-DIR is set, use it as the publishing +directory. + +Return output file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-koma-letter-export-to-pdf "ox-koma-letter" "\ +Export current buffer as a KOMA Scrlttr2 letter (pdf). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return PDF file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(register-definition-prefixes "ox-koma-letter" '("org-koma-letter-")) + ;;;*** ;;;### (autoloads nil "ox-man" "org/ox-man.el" (0 0 0 0)) @@ -24938,13 +25063,13 @@ archive). ;;;### (autoloads nil "paren" "paren.el" (0 0 0 0)) ;;; Generated autoloads from paren.el -(defvar show-paren-mode nil "\ +(defcustom show-paren-mode t "\ Non-nil if Show-Paren mode is enabled. See the `show-paren-mode' command for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') -or call the function `show-paren-mode'.") +or call the function `show-paren-mode'." :set #'custom-set-minor-mode :initialize 'custom-initialize-delay :type 'boolean :group 'paren-showing) (custom-autoload 'show-paren-mode "paren" nil) @@ -24965,9 +25090,30 @@ evaluate `(default-value 'show-paren-mode)'. The mode's hook is called both when the mode is enabled and when it is disabled. -Show Paren mode is a global minor mode. When enabled, any -matching parenthesis is highlighted in `show-paren-style' after -`show-paren-delay' seconds of Emacs idle time. +When enabled, any matching parenthesis is highlighted in `show-paren-style' +after `show-paren-delay' seconds of Emacs idle time. + +This is a global minor mode. To toggle the mode in a single buffer, +use `show-paren-local-mode'. + +\(fn &optional ARG)" t nil) + +(autoload 'show-paren-local-mode "paren" "\ +Toggle `show-paren-mode' only in this buffer. + +This is a minor mode. If called interactively, toggle the +`Show-Paren-Local mode' mode. If the prefix argument is positive, +enable the mode, and if it is zero or negative, disable the mode. + +If called from Lisp, toggle the mode if ARG is `toggle'. Enable the +mode if ARG is nil, omitted, or is a positive number. Disable the +mode if ARG is a negative number. + +To check whether the minor mode is enabled in the current buffer, +evaluate `(buffer-local-value 'show-paren-mode (current-buffer))'. + +The mode's hook is called both when the mode is enabled and when it is +disabled. \(fn &optional ARG)" t nil) @@ -25125,7 +25271,11 @@ Emacs Lisp manual for more information and examples. (autoload 'pcase-exhaustive "pcase" "\ The exhaustive version of `pcase' (which see). -If EXP fails to match any of the patterns in CASES, an error is signaled. +If EXP fails to match any of the patterns in CASES, an error is +signaled. + +In contrast, `pcase' will return nil if there is no match, but +not signal an error. \(fn EXP &rest CASES)" nil t) @@ -25516,10 +25666,10 @@ Global menu used by PCL-CVS.") (put 'perl-label-offset 'safe-local-variable 'integerp) (autoload 'perl-flymake "perl-mode" "\ -Perl backend for Flymake. Launches -`perl-flymake-command' (which see) and passes to its standard -input the contents of the current buffer. The output of this -command is analyzed for error and warning messages. +Perl backend for Flymake. +Launch `perl-flymake-command' (which see) and pass to its +standard input the contents of the current buffer. The output of +this command is analyzed for error and warning messages. \(fn REPORT-FN &rest ARGS)" nil nil) @@ -25596,10 +25746,10 @@ afterwards settable by these commands: Move southwest (sw) after insertion: \\[picture-movement-sw] Move southeast (se) after insertion: \\[picture-movement-se] - Move westnorthwest (wnw) after insertion: C-u \\[picture-movement-nw] - Move eastnortheast (ene) after insertion: C-u \\[picture-movement-ne] - Move westsouthwest (wsw) after insertion: C-u \\[picture-movement-sw] - Move eastsoutheast (ese) after insertion: C-u \\[picture-movement-se] + Move westnorthwest (wnw) after insertion: \\[universal-argument] \\[picture-movement-nw] + Move eastnortheast (ene) after insertion: \\[universal-argument] \\[picture-movement-ne] + Move westsouthwest (wsw) after insertion: \\[universal-argument] \\[picture-movement-sw] + Move eastsoutheast (ese) after insertion: \\[universal-argument] \\[picture-movement-se] The current direction is displayed in the mode line. The initial direction is right. Whitespace is inserted and tabs are changed to @@ -25826,7 +25976,7 @@ For more information, type \\[pr-interface-help]. Preview directory using ghostview. Interactively, the command prompts for N-UP printing number, a directory, a -file name regexp for matching and, when you use a prefix argument (C-u), the +file name regexp for matching and, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of saving it in a temporary file. @@ -25845,7 +25995,7 @@ See also documentation for `pr-list-directory'. Print directory using PostScript through ghostscript. Interactively, the command prompts for N-UP printing number, a directory, a -file name regexp for matching and, when you use a prefix argument (C-u), the +file name regexp for matching and, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of saving it in a temporary file. @@ -25864,7 +26014,7 @@ See also documentation for `pr-list-directory'. Print directory using PostScript printer. Interactively, the command prompts for N-UP printing number, a directory, a -file name regexp for matching and, when you use a prefix argument (C-u), the +file name regexp for matching and, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of saving it in a temporary file. @@ -25885,7 +26035,7 @@ Print directory using PostScript printer or through ghostscript. It depends on `pr-print-using-ghostscript'. Interactively, the command prompts for N-UP printing number, a directory, a -file name regexp for matching and, when you use a prefix argument (C-u), the +file name regexp for matching and, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of saving it in a temporary file. @@ -25904,7 +26054,7 @@ See also documentation for `pr-list-directory'. Preview buffer using ghostview. Interactively, the command prompts for N-UP printing number and, when you use a -prefix argument (C-u), the command prompts the user for a file name, and saves +prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of saving it in a temporary file. Noninteractively, if N-UP is nil, prompts for N-UP printing number. The @@ -25918,7 +26068,7 @@ with that name. If FILENAME is t, prompts for a file name. Print buffer using PostScript through ghostscript. Interactively, the command prompts for N-UP printing number and, when you use a -prefix argument (C-u), the command prompts the user for a file name, and saves +prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of sending it to the printer. Noninteractively, if N-UP is nil, prompts for N-UP printing number. The @@ -25932,7 +26082,7 @@ that name. If FILENAME is t, prompts for a file name. Print buffer using PostScript printer. Interactively, the command prompts for N-UP printing number and, when you use a -prefix argument (C-u), the command prompts the user for a file name, and saves +prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of sending it to the printer. Noninteractively, if N-UP is nil, prompts for N-UP printing number. The @@ -25948,7 +26098,7 @@ Print buffer using PostScript printer or through ghostscript. It depends on `pr-print-using-ghostscript'. Interactively, the command prompts for N-UP printing number and, when you use a -prefix argument (C-u), the command prompts the user for a file name, and saves +prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of sending it to the printer. Noninteractively, if N-UP is nil, prompts for N-UP printing number. The @@ -26064,7 +26214,7 @@ Print major mode using text printer." t nil) (autoload 'pr-despool-preview "printing" "\ Preview spooled PostScript. -Interactively, when you use a prefix argument (C-u), the command prompts the +Interactively, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the spooled PostScript image in that file instead of saving it in a temporary file. @@ -26077,7 +26227,7 @@ PostScript image in a file with that name. (autoload 'pr-despool-using-ghostscript "printing" "\ Print spooled PostScript using ghostscript. -Interactively, when you use a prefix argument (C-u), the command prompts the +Interactively, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the spooled PostScript image in that file instead of sending it to the printer. @@ -26090,7 +26240,7 @@ image in a file with that name. (autoload 'pr-despool-print "printing" "\ Send the spooled PostScript to the printer. -Interactively, when you use a prefix argument (C-u), the command prompts the +Interactively, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the spooled PostScript image in that file instead of sending it to the printer. @@ -26103,7 +26253,7 @@ image in a file with that name. (autoload 'pr-despool-ps-print "printing" "\ Send the spooled PostScript to the printer or use ghostscript to print it. -Interactively, when you use a prefix argument (C-u), the command prompts the +Interactively, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the spooled PostScript image in that file instead of sending it to the printer. @@ -26142,7 +26292,7 @@ Send PostScript file FILENAME to printer or use ghostscript to print it. Process a PostScript file IFILENAME and send it to printer. Interactively, the command prompts for N-UP printing number, for an input -PostScript file IFILENAME and, when you use a prefix argument (C-u), the +PostScript file IFILENAME and, when you use a prefix argument (\\[universal-argument]), the command prompts the user for an output PostScript file name OFILENAME, and saves the PostScript image in that file instead of sending it to the printer. @@ -26267,22 +26417,22 @@ printed using `pr-ps-mode-ps-print'. Interactively, you have the following situations: - M-x pr-ps-fast-fire RET + \\[pr-ps-fast-fire] The command prompts the user for a N-UP value and printing will immediately be done using the current active printer. - C-u M-x pr-ps-fast-fire RET - C-u 0 M-x pr-ps-fast-fire RET + \\[universal-argument] \\[pr-ps-fast-fire] + \\[universal-argument] 0 \\[pr-ps-fast-fire] The command prompts the user for a N-UP value and also for a current PostScript printer, then printing will immediately be done using the new current active printer. - C-u 1 M-x pr-ps-fast-fire RET + \\[universal-argument] 1 \\[pr-ps-fast-fire] The command prompts the user for a N-UP value and also for a file name, and saves the PostScript image in that file instead of sending it to the printer. - C-u 2 M-x pr-ps-fast-fire RET + \\[universal-argument] 2 \\[pr-ps-fast-fire] The command prompts the user for a N-UP value, then for a current PostScript printer and, finally, for a file name. Then change the active printer to that chosen by user and saves the PostScript image in @@ -26327,7 +26477,7 @@ Also if the current major-mode is defined in `pr-mode-alist', the settings in `pr-mode-alist' will be used, that is, the current buffer or region will be printed using `pr-txt-mode'. -Interactively, when you use a prefix argument (C-u), the command prompts the +Interactively, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a new active text printer. Noninteractively, the argument SELECT-PRINTER is treated as follows: @@ -26405,7 +26555,7 @@ Open profile FILENAME. ;;;### (autoloads nil "project" "progmodes/project.el" (0 0 0 0)) ;;; Generated autoloads from progmodes/project.el -(push (purecopy '(project 0 6 1)) package--builtin-versions) +(push (purecopy '(project 0 7 1)) package--builtin-versions) (autoload 'project-current "project" "\ Return the project instance in DIRECTORY, defaulting to `default-directory'. @@ -26426,7 +26576,7 @@ of the project instance object. \(fn &optional MAYBE-PROMPT DIRECTORY)" nil nil) -(defvar project-prefix-map (let ((map (make-sparse-keymap))) (define-key map "!" 'project-shell-command) (define-key map "&" 'project-async-shell-command) (define-key map "f" 'project-find-file) (define-key map "F" 'project-or-external-find-file) (define-key map "b" 'project-switch-to-buffer) (define-key map "s" 'project-shell) (define-key map "d" 'project-dired) (define-key map "v" 'project-vc-dir) (define-key map "c" 'project-compile) (define-key map "e" 'project-eshell) (define-key map "k" 'project-kill-buffers) (define-key map "p" 'project-switch-project) (define-key map "g" 'project-find-regexp) (define-key map "G" 'project-or-external-find-regexp) (define-key map "r" 'project-query-replace-regexp) (define-key map "x" 'project-execute-extended-command) map) "\ +(defvar project-prefix-map (let ((map (make-sparse-keymap))) (define-key map "!" 'project-shell-command) (define-key map "&" 'project-async-shell-command) (define-key map "f" 'project-find-file) (define-key map "F" 'project-or-external-find-file) (define-key map "b" 'project-switch-to-buffer) (define-key map "s" 'project-shell) (define-key map "d" 'project-find-dir) (define-key map "D" 'project-dired) (define-key map "v" 'project-vc-dir) (define-key map "c" 'project-compile) (define-key map "e" 'project-eshell) (define-key map "k" 'project-kill-buffers) (define-key map "p" 'project-switch-project) (define-key map "g" 'project-find-regexp) (define-key map "G" 'project-or-external-find-regexp) (define-key map "r" 'project-query-replace-regexp) (define-key map "x" 'project-execute-extended-command) map) "\ Keymap for project commands.") (define-key ctl-x-map "p" project-prefix-map) @@ -26478,14 +26628,17 @@ pattern to search for. (autoload 'project-find-file "project" "\ Visit a file (with completion) in the current project. -The completion default is the filename at point, determined by -`thing-at-point' (whether such file exists or not)." t nil) +The filename at point (determined by `thing-at-point'), if any, +is available as part of \"future history\"." t nil) (autoload 'project-or-external-find-file "project" "\ Visit a file (with completion) in the current project or external roots. -The completion default is the filename at point, determined by -`thing-at-point' (whether such file exists or not)." t nil) +The filename at point (determined by `thing-at-point'), if any, +is available as part of \"future history\"." t nil) + +(autoload 'project-find-dir "project" "\ +Start Dired in a directory inside the current project." t nil) (autoload 'project-dired "project" "\ Start Dired in the current project's root." t nil) @@ -26528,8 +26681,8 @@ command \\[fileloop-continue]. (autoload 'project-query-replace-regexp "project" "\ Query-replace REGEXP in all the files of the project. Stops when a match is found and prompts for whether to replace it. -If you exit the query-replace, you can later continue the query-replace -loop using the command \\[fileloop-continue]. +If you exit the `query-replace', you can later continue the +`query-replace' loop using the command \\[fileloop-continue]. \(fn FROM TO)" t nil) @@ -26586,9 +26739,10 @@ interactively. (autoload 'project-remember-project "project" "\ Add project PR to the front of the project list. -Save the result in `project-list-file' if the list of projects has changed. +Save the result in `project-list-file' if the list of projects +has changed, and NO-WRITE is nil. -\(fn PR)" nil nil) +\(fn PR &optional NO-WRITE)" nil nil) (autoload 'project-forget-project "project" "\ Remove directory PROJECT-ROOT from the project list. @@ -26924,9 +27078,11 @@ If EXTENSION is any other symbol, it is ignored. (autoload 'pulse-momentary-highlight-one-line "pulse" "\ Highlight the line around POINT, unhighlighting before next command. +If POINT is nil or missing, the current point is used instead. + Optional argument FACE specifies the face to do the highlighting. -\(fn POINT &optional FACE)" nil nil) +\(fn &optional POINT FACE)" nil nil) (autoload 'pulse-momentary-highlight-region "pulse" "\ Highlight between START and END, unhighlighting before next command. @@ -27097,7 +27253,7 @@ conversion region is active. It is an alist of single key character vs. corresponding command to be called. If SIMPLE is non-nil, then we do not alter the meanings of -commands such as C-f, C-b, C-n, C-p and TAB; they are treated as +commands such as \\[forward-char], \\[backward-char], \\[next-line], \\[previous-line] and \\[indent-for-tab-command]; they are treated as non-Quail commands. \(fn NAME LANGUAGE TITLE &optional GUIDANCE DOCSTRING TRANSLATION-KEYS FORGET-LAST-SELECTION DETERMINISTIC KBD-TRANSLATE SHOW-LAYOUT CREATE-DECODE-MAP MAXIMUM-SHORTEST OVERLAY-PLIST UPDATE-TRANSLATION-FUNCTION CONVERSION-KEYS SIMPLE)" nil nil) @@ -27997,6 +28153,7 @@ or call the function `repeat-mode'.") Toggle Repeat mode. When Repeat mode is enabled, and the command symbol has the property named `repeat-map', this map is activated temporarily for the next command. +See `describe-repeat-maps' for a list of all repeatable command. This is a minor mode. If called interactively, toggle the `Repeat mode' mode. If the prefix argument is positive, enable the mode, and @@ -29970,7 +30127,7 @@ Like `mail' command, but display mail buffer in another frame. ;;;### (autoloads nil "seq" "emacs-lisp/seq.el" (0 0 0 0)) ;;; Generated autoloads from emacs-lisp/seq.el -(push (purecopy '(seq 2 22)) package--builtin-versions) +(push (purecopy '(seq 2 23)) package--builtin-versions) (autoload 'seq-subseq "seq" "\ Return the sequence of elements of SEQUENCE from START to END. @@ -30056,14 +30213,14 @@ TESTFN is used to compare elements, or `equal' if TESTFN is nil. \(fn SEQUENCE &optional TESTFN)" nil nil) -(autoload 'seq-intersection "seq" "\ -Return a list of the elements that appear in both SEQUENCE1 and SEQUENCE2. +(autoload 'seq-union "seq" "\ +Return a list of all elements that appear in either SEQUENCE1 or SEQUENCE2. Equality is defined by TESTFN if non-nil or by `equal' if nil. \(fn SEQUENCE1 SEQUENCE2 &optional TESTFN)" nil nil) -(autoload 'seq-difference "seq" "\ -Return a list of the elements that appear in SEQUENCE1 but not in SEQUENCE2. +(autoload 'seq-intersection "seq" "\ +Return a list of the elements that appear in both SEQUENCE1 and SEQUENCE2. Equality is defined by TESTFN if non-nil or by `equal' if nil. \(fn SEQUENCE1 SEQUENCE2 &optional TESTFN)" nil nil) @@ -30081,6 +30238,12 @@ SEQUENCE must be a sequence of numbers or markers. \(fn SEQUENCE)" nil nil) +(autoload 'seq-random-elt "seq" "\ +Return a random element from SEQUENCE. +Signal an error if SEQUENCE is empty. + +\(fn SEQUENCE)" nil nil) + (register-definition-prefixes "seq" '("seq-")) ;;;*** @@ -30256,10 +30419,11 @@ can also view with a browser to see what happens: have

Very Major Headlines

through
Very Minor Headlines

Parts can be separated with horizontal rules. -

Paragraphs only need an opening tag. Line breaks and multiple spaces are -ignored unless the text is

preformatted.
Text can be marked as -bold, italic or underlined using the normal M-o -or Edit/Text Properties/Face commands. +

Paragraphs only need an opening tag. Line breaks and multiple +spaces are ignored unless the text is

preformatted.
+Text can be marked as bold, italic or +underlined using the facemenu M-o or Edit/Text +Properties/Face commands. Pages can have named points and can link other points to them with see also somename. In the same way \\[tetris-start-game] Start a new game of Tetris \\[tetris-end-game] Terminate the current game @@ -33710,7 +33878,7 @@ and also to be turned into Info files with \\[makeinfo-buffer] or the `makeinfo' program. These files must be written in a very restricted and modified version of TeX input format. - Editing commands are like text-mode except that the syntax table is + Editing commands are like `text-mode' except that the syntax table is set up so expression commands skip Texinfo bracket groups. To see what the Info version of a region of the Texinfo file will look like, use \\[makeinfo-region], which runs `makeinfo' on the current region. @@ -33738,15 +33906,15 @@ updating menus and node pointers. These functions Here are the functions: - texinfo-update-node \\[texinfo-update-node] - texinfo-every-node-update \\[texinfo-every-node-update] - texinfo-sequential-node-update + `texinfo-update-node' \\[texinfo-update-node] + `texinfo-every-node-update' \\[texinfo-every-node-update] + `texinfo-sequential-node-update' - texinfo-make-menu \\[texinfo-make-menu] - texinfo-all-menus-update \\[texinfo-all-menus-update] - texinfo-master-menu + `texinfo-make-menu' \\[texinfo-make-menu] + `texinfo-all-menus-update' \\[texinfo-all-menus-update] + `texinfo-master-menu' - texinfo-indent-menu-description (column &optional region-p) + `texinfo-indent-menu-description' (column &optional region-p) The `texinfo-column-for-description' variable specifies the column to which menu descriptions are indented. @@ -33862,6 +34030,20 @@ a symbol as a valid THING. \(fn THING &optional NO-PROPERTIES)" nil nil) +(autoload 'bounds-of-thing-at-mouse "thingatpt" "\ +Determine start and end locations for THING at mouse click given by EVENT. +Like `bounds-of-thing-at-point', but tries to use the position in EVENT +where the mouse button is clicked to find the thing nearby. + +\(fn EVENT THING)" nil nil) + +(autoload 'thing-at-mouse "thingatpt" "\ +Return the THING at mouse click specified by EVENT. +Like `thing-at-point', but tries to use the position in EVENT +where the mouse button is clicked to find the thing nearby. + +\(fn EVENT THING &optional NO-PROPERTIES)" nil nil) + (autoload 'sexp-at-point "thingatpt" "\ Return the sexp at point, or nil if none is found." nil nil) @@ -33973,15 +34155,17 @@ Compose Tibetan text the region BEG and END. (autoload 'tibetan-decompose-region "tibet-util" "\ Decompose Tibetan text in the region FROM and TO. -This is different from decompose-region because precomposed Tibetan characters -are decomposed into normal Tibetan character sequences. +This is different from `decompose-region' because precomposed +Tibetan characters are decomposed into normal Tibetan character +sequences. \(fn FROM TO)" t nil) (autoload 'tibetan-decompose-string "tibet-util" "\ Decompose Tibetan string STR. -This is different from decompose-string because precomposed Tibetan characters -are decomposed into normal Tibetan character sequences. +This is different from `decompose-string' because precomposed +Tibetan characters are decomposed into normal Tibetan character +sequences. \(fn STR)" nil nil) @@ -33991,7 +34175,7 @@ See also the documentation of the function `tibetan-decompose-region'." t nil) (autoload 'tibetan-compose-buffer "tibet-util" "\ Composes Tibetan character components in the buffer. -See also docstring of the function tibetan-compose-region." t nil) +See also docstring of the function `tibetan-compose-region'." t nil) (autoload 'tibetan-post-read-conversion "tibet-util" "\ @@ -34161,7 +34345,7 @@ point. (autoload 'emacs-init-time "time" "\ Return a string giving the duration of the Emacs initialization. -FORMAT is a string to format the result, using `format'. If nil, +FORMAT is a string to format the result, using `format'. If nil, the default format \"%f seconds\" is used. \(fn &optional FORMAT)" t nil) @@ -35445,8 +35629,7 @@ how long to wait for a response before giving up. ;;; Generated autoloads from url/url-auth.el (autoload 'url-get-authentication "url-auth" "\ -Return an authorization string suitable for use in the WWW-Authenticate -header in an HTTP/1.0 request. +Return authorization string for the WWW-Authenticate header in HTTP/1.0 request. URL is the url you are requesting authorization to. This can be either a string representing the URL, or the parsed representation returned by @@ -36056,7 +36239,7 @@ Given a QUERY in the form: \(This is the same format as produced by `url-parse-query-string') This will return a string -\"key1=val1&key2=val2&key3=val1&key3=val2&key4&key5\". Keys may +\"key1=val1&key2=val2&key3=val1&key3=val2&key4&key5\". Keys may be strings or symbols; if they are symbols, the symbol name will be used. @@ -36504,13 +36687,13 @@ Show the change log for BRANCH root in a window. \(fn BRANCH)" t nil) (autoload 'vc-log-incoming "vc" "\ -Show a log of changes that will be received with a pull operation from REMOTE-LOCATION. +Show log of changes that will be received with pull from REMOTE-LOCATION. When called interactively with a prefix argument, prompt for REMOTE-LOCATION. \(fn &optional REMOTE-LOCATION)" t nil) (autoload 'vc-log-outgoing "vc" "\ -Show a log of changes that will be sent with a push operation to REMOTE-LOCATION. +Show log of changes that will be sent with a push operation to REMOTE-LOCATION. When called interactively with a prefix argument, prompt for REMOTE-LOCATION. \(fn &optional REMOTE-LOCATION)" t nil) @@ -36741,7 +36924,7 @@ These are the commands available for use in the file status buffer: \(fn DIR &optional BACKEND)" t nil) (autoload 'vc-dir-bookmark-jump "vc-dir" "\ -Provides the bookmark-jump behavior for a `vc-dir' buffer. +Provide the `bookmark-jump' behavior for a `vc-dir' buffer. This implements the `handler' function interface for the record type returned by `vc-dir-bookmark-make-record'. @@ -36964,7 +37147,7 @@ Key bindings: ;;;### (autoloads nil "verilog-mode" "progmodes/verilog-mode.el" ;;;;;; (0 0 0 0)) ;;; Generated autoloads from progmodes/verilog-mode.el -(push (purecopy '(verilog-mode 2021 4 12 188864585)) package--builtin-versions) +(push (purecopy '(verilog-mode 2021 9 23 89128420)) package--builtin-versions) (autoload 'verilog-mode "verilog-mode" "\ Major mode for editing Verilog code. @@ -37077,9 +37260,12 @@ Some other functions are: \\[verilog-sk-repeat] Insert a repeat (..) begin .. end block. \\[verilog-sk-specify] Insert a specify .. endspecify block. \\[verilog-sk-task] Insert a task .. begin .. end endtask block. - \\[verilog-sk-while] Insert a while (...) begin .. end block, prompting for details. - \\[verilog-sk-casex] Insert a casex (...) item: begin.. end endcase block, prompting for details. - \\[verilog-sk-casez] Insert a casez (...) item: begin.. end endcase block, prompting for details. + \\[verilog-sk-while] Insert a while (...) begin .. end block, + prompting for details. + \\[verilog-sk-casex] Insert a casex (...) item: begin.. end endcase block, + prompting for details. + \\[verilog-sk-casez] Insert a casez (...) item: begin.. end endcase block, + prompting for details. \\[verilog-sk-if] Insert an if (..) begin .. end block. \\[verilog-sk-else-if] Insert an else if (..) begin .. end block. \\[verilog-sk-comment] Insert a comment block. @@ -37470,7 +37656,7 @@ Usage: `vhdl-project-alist'. - SPECIAL MENUES: + SPECIAL MENUS: As an alternative to the speedbar, an index menu can be added (set option `vhdl-index-menu' to non-nil) or made accessible as a mouse menu (e.g. add \"(global-set-key [S-down-mouse-3] \\='imenu)\" to your start-up @@ -37978,7 +38164,7 @@ Toggle Viper on/off. If Viper is enabled, turn it off. Otherwise, turn it on." t nil) (autoload 'viper-mode "viper" "\ -Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Top'." t nil) +Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Top'." t nil) (register-definition-prefixes "viper" '("set-viper-state-in-major-mode" "this-major-mode-requires-vi-state" "viper-")) @@ -38268,6 +38454,9 @@ disabled. See also `whitespace-style', `whitespace-newline' and `whitespace-display-mappings'. +This mode uses a number of faces to visualize the whitespace; see +the customization group `whitespace' for details. + \(fn &optional ARG)" t nil) (autoload 'whitespace-newline-mode "whitespace" "\ @@ -38849,28 +39038,28 @@ Default value of MODIFIERS is `shift-meta'. (autoload 'windmove-delete-left "windmove" "\ Delete the window to the left of the current one. -If prefix ARG is `C-u', delete the selected window and +If prefix ARG is \\[universal-argument], delete the selected window and select the window that was to the left of the current one. \(fn &optional ARG)" t nil) (autoload 'windmove-delete-up "windmove" "\ Delete the window above the current one. -If prefix ARG is `C-u', delete the selected window and +If prefix ARG is \\[universal-argument], delete the selected window and select the window that was above the current one. \(fn &optional ARG)" t nil) (autoload 'windmove-delete-right "windmove" "\ Delete the window to the right of the current one. -If prefix ARG is `C-u', delete the selected window and +If prefix ARG is \\[universal-argument], delete the selected window and select the window that was to the right of the current one. \(fn &optional ARG)" t nil) (autoload 'windmove-delete-down "windmove" "\ Delete the window below the current one. -If prefix ARG is `C-u', delete the selected window and +If prefix ARG is \\[universal-argument], delete the selected window and select the window that was below the current one. \(fn &optional ARG)" t nil) @@ -38881,8 +39070,8 @@ Keys are bound to commands that delete windows in the specified direction. Keybindings are of the form PREFIX MODIFIERS-{left,right,up,down}, where PREFIX is a prefix key and MODIFIERS is either a list of modifiers or a single modifier. -If PREFIX is `none', no prefix is used. If MODIFIERS is `none', the keybindings -are directly bound to the arrow keys. +If PREFIX is `none', no prefix is used. If MODIFIERS is `none', +the keybindings are directly bound to the arrow keys. Default value of PREFIX is `C-x' and MODIFIERS is `shift'. \(fn &optional PREFIX MODIFIERS)" t nil) @@ -39106,7 +39295,7 @@ If LIMIT is non-nil, then do not consider characters beyond LIMIT. ;;;### (autoloads nil "xref" "progmodes/xref.el" (0 0 0 0)) ;;; Generated autoloads from progmodes/xref.el -(push (purecopy '(xref 1 1 0)) package--builtin-versions) +(push (purecopy '(xref 1 2 2)) package--builtin-versions) (autoload 'xref-find-backend "xref" nil nil nil) @@ -39165,6 +39354,8 @@ This command is intended to be bound to a mouse event. (autoload 'xref-find-apropos "xref" "\ Find all meaningful symbols that match PATTERN. The argument has the same meaning as in `apropos'. +See `tags-apropos-additional-actions' for how to augment the +output of this command when the backend is etags. \(fn PATTERN)" t nil) (define-key esc-map "." #'xref-find-definitions) @@ -39198,6 +39389,9 @@ Find all matches for REGEXP in FILES. Return a list of xref values. FILES must be a list of absolute file names. +See `xref-search-program' and `xref-search-program-alist' for how +to control which program to use when looking for matches. + \(fn REGEXP FILES)" nil nil) (register-definition-prefixes "xref" '("xref-")) @@ -39354,48 +39548,49 @@ Zone out, completely." t nil) ;;;;;; "emacs-lisp/lisp-mode.el" "emacs-lisp/lisp.el" "emacs-lisp/macroexp.el" ;;;;;; "emacs-lisp/map-ynp.el" "emacs-lisp/nadvice.el" "emacs-lisp/syntax.el" ;;;;;; "emacs-lisp/timer.el" "env.el" "epa-hook.el" "erc/erc-autoaway.el" -;;;;;; "erc/erc-button.el" "erc/erc-capab.el" "erc/erc-dcc.el" "erc/erc-desktop-notifications.el" -;;;;;; "erc/erc-ezbounce.el" "erc/erc-fill.el" "erc/erc-identd.el" -;;;;;; "erc/erc-imenu.el" "erc/erc-join.el" "erc/erc-list.el" "erc/erc-log.el" -;;;;;; "erc/erc-match.el" "erc/erc-menu.el" "erc/erc-netsplit.el" -;;;;;; "erc/erc-notify.el" "erc/erc-page.el" "erc/erc-pcomplete.el" -;;;;;; "erc/erc-replace.el" "erc/erc-ring.el" "erc/erc-services.el" -;;;;;; "erc/erc-sound.el" "erc/erc-speedbar.el" "erc/erc-spelling.el" -;;;;;; "erc/erc-stamp.el" "erc/erc-status-sidebar.el" "erc/erc-track.el" -;;;;;; "erc/erc-truncate.el" "erc/erc-xdcc.el" "eshell/em-alias.el" -;;;;;; "eshell/em-banner.el" "eshell/em-basic.el" "eshell/em-cmpl.el" -;;;;;; "eshell/em-dirs.el" "eshell/em-glob.el" "eshell/em-hist.el" -;;;;;; "eshell/em-ls.el" "eshell/em-pred.el" "eshell/em-prompt.el" -;;;;;; "eshell/em-rebind.el" "eshell/em-script.el" "eshell/em-smart.el" -;;;;;; "eshell/em-term.el" "eshell/em-tramp.el" "eshell/em-unix.el" -;;;;;; "eshell/em-xtra.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/charscript.el" -;;;;;; "international/cp51932.el" "international/eucjp-ms.el" "international/iso-transl.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" "language/indian.el" -;;;;;; "language/japanese.el" "language/khmer.el" "language/korean.el" -;;;;;; "language/lao.el" "language/misc-lang.el" "language/romanian.el" -;;;;;; "language/sinhala.el" "language/slovak.el" "language/tai-viet.el" -;;;;;; "language/thai.el" "language/tibetan.el" "language/utf-8-lang.el" -;;;;;; "language/vietnamese.el" "ldefs-boot.el" "leim/ja-dic/ja-dic.el" -;;;;;; "leim/leim-list.el" "leim/quail/4Corner.el" "leim/quail/ARRAY30.el" -;;;;;; "leim/quail/CCDOSPY.el" "leim/quail/CTLau-b5.el" "leim/quail/CTLau.el" -;;;;;; "leim/quail/ECDICT.el" "leim/quail/ETZY.el" "leim/quail/PY-b5.el" -;;;;;; "leim/quail/PY.el" "leim/quail/Punct-b5.el" "leim/quail/Punct.el" -;;;;;; "leim/quail/QJ-b5.el" "leim/quail/QJ.el" "leim/quail/SW.el" -;;;;;; "leim/quail/TONEPY.el" "leim/quail/ZIRANMA.el" "leim/quail/ZOZY.el" -;;;;;; "leim/quail/arabic.el" "leim/quail/cham.el" "leim/quail/compose.el" -;;;;;; "leim/quail/croatian.el" "leim/quail/cyril-jis.el" "leim/quail/cyrillic.el" -;;;;;; "leim/quail/czech.el" "leim/quail/georgian.el" "leim/quail/greek.el" -;;;;;; "leim/quail/hanja-jis.el" "leim/quail/hanja.el" "leim/quail/hanja3.el" -;;;;;; "leim/quail/hebrew.el" "leim/quail/ipa-praat.el" "leim/quail/latin-alt.el" -;;;;;; "leim/quail/latin-ltx.el" "leim/quail/latin-post.el" "leim/quail/latin-pre.el" -;;;;;; "leim/quail/persian.el" "leim/quail/programmer-dvorak.el" +;;;;;; "erc/erc-button.el" "erc/erc-capab.el" "erc/erc-compat.el" +;;;;;; "erc/erc-dcc.el" "erc/erc-desktop-notifications.el" "erc/erc-ezbounce.el" +;;;;;; "erc/erc-fill.el" "erc/erc-identd.el" "erc/erc-imenu.el" +;;;;;; "erc/erc-join.el" "erc/erc-list.el" "erc/erc-log.el" "erc/erc-match.el" +;;;;;; "erc/erc-menu.el" "erc/erc-netsplit.el" "erc/erc-notify.el" +;;;;;; "erc/erc-page.el" "erc/erc-pcomplete.el" "erc/erc-replace.el" +;;;;;; "erc/erc-ring.el" "erc/erc-services.el" "erc/erc-sound.el" +;;;;;; "erc/erc-speedbar.el" "erc/erc-spelling.el" "erc/erc-stamp.el" +;;;;;; "erc/erc-status-sidebar.el" "erc/erc-track.el" "erc/erc-truncate.el" +;;;;;; "erc/erc-xdcc.el" "eshell/em-alias.el" "eshell/em-banner.el" +;;;;;; "eshell/em-basic.el" "eshell/em-cmpl.el" "eshell/em-dirs.el" +;;;;;; "eshell/em-glob.el" "eshell/em-hist.el" "eshell/em-ls.el" +;;;;;; "eshell/em-pred.el" "eshell/em-prompt.el" "eshell/em-rebind.el" +;;;;;; "eshell/em-script.el" "eshell/em-smart.el" "eshell/em-term.el" +;;;;;; "eshell/em-tramp.el" "eshell/em-unix.el" "eshell/em-xtra.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/charscript.el" +;;;;;; "international/cp51932.el" "international/emoji-zwj.el" "international/eucjp-ms.el" +;;;;;; "international/iso-transl.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" +;;;;;; "language/indian.el" "language/japanese.el" "language/khmer.el" +;;;;;; "language/korean.el" "language/lao.el" "language/misc-lang.el" +;;;;;; "language/romanian.el" "language/sinhala.el" "language/slovak.el" +;;;;;; "language/tai-viet.el" "language/thai.el" "language/tibetan.el" +;;;;;; "language/utf-8-lang.el" "language/vietnamese.el" "ldefs-boot.el" +;;;;;; "leim/ja-dic/ja-dic.el" "leim/leim-list.el" "leim/quail/4Corner.el" +;;;;;; "leim/quail/ARRAY30.el" "leim/quail/CCDOSPY.el" "leim/quail/CTLau-b5.el" +;;;;;; "leim/quail/CTLau.el" "leim/quail/ECDICT.el" "leim/quail/ETZY.el" +;;;;;; "leim/quail/PY-b5.el" "leim/quail/PY.el" "leim/quail/Punct-b5.el" +;;;;;; "leim/quail/Punct.el" "leim/quail/QJ-b5.el" "leim/quail/QJ.el" +;;;;;; "leim/quail/SW.el" "leim/quail/TONEPY.el" "leim/quail/ZIRANMA.el" +;;;;;; "leim/quail/ZOZY.el" "leim/quail/arabic.el" "leim/quail/cham.el" +;;;;;; "leim/quail/compose.el" "leim/quail/croatian.el" "leim/quail/cyril-jis.el" +;;;;;; "leim/quail/cyrillic.el" "leim/quail/czech.el" "leim/quail/georgian.el" +;;;;;; "leim/quail/greek.el" "leim/quail/hanja-jis.el" "leim/quail/hanja.el" +;;;;;; "leim/quail/hanja3.el" "leim/quail/hebrew.el" "leim/quail/ipa-praat.el" +;;;;;; "leim/quail/latin-alt.el" "leim/quail/latin-ltx.el" "leim/quail/latin-post.el" +;;;;;; "leim/quail/latin-pre.el" "leim/quail/persian.el" "leim/quail/programmer-dvorak.el" ;;;;;; "leim/quail/py-punct.el" "leim/quail/pypunct-b5.el" "leim/quail/quick-b5.el" ;;;;;; "leim/quail/quick-cns.el" "leim/quail/rfc1345.el" "leim/quail/sami.el" ;;;;;; "leim/quail/sgml-input.el" "leim/quail/slovak.el" "leim/quail/symbol-ksc.el" commit d617e3388adb6403e546f037b47022746772daa2 Author: Lars Ingebrigtsen Date: Fri Oct 1 15:25:05 2021 +0200 Fix text in erts-run-test message * lisp/progmodes/erts-mode.el (erts-run-test): New command and keystroke. diff --git a/lisp/progmodes/erts-mode.el b/lisp/progmodes/erts-mode.el index 9d3d769806..46b6a3a711 100644 --- a/lisp/progmodes/erts-mode.el +++ b/lisp/progmodes/erts-mode.el @@ -176,7 +176,7 @@ will be prompted for one." (list (cons 'dummy t) (cons 'code test-function)) (buffer-file-name)) (:success (message "Test successful")) - (ert-test-failed (message "Test failure; expected text: \n%s" + (ert-test-failed (message "Test failure; result: \n%s" (substring-no-properties (cadr (cadr arg)))))))) (defun erts-mode--goto-start-of-test () commit 09ec95c53ba2142a182cbb08e79bb6a27c6634d8 Author: Lars Ingebrigtsen Date: Fri Oct 1 15:24:01 2021 +0200 Add new command erts-run-test * lisp/progmodes/erts-mode.el (erts-run-test): New command and keystroke. diff --git a/lisp/progmodes/erts-mode.el b/lisp/progmodes/erts-mode.el index 6f3e5b3ab5..9d3d769806 100644 --- a/lisp/progmodes/erts-mode.el +++ b/lisp/progmodes/erts-mode.el @@ -24,6 +24,7 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(require 'ert) (defgroup erts-mode nil "Major mode for editing Emacs test files." @@ -67,6 +68,7 @@ (let ((map (make-keymap))) (set-keymap-parent map prog-mode-map) (define-key map "\C-c\C-r" 'erts-tag-region) + (define-key map "\C-c\C-c" 'erts-run-test) map)) (defvar erts-mode-font-lock-keywords @@ -126,7 +128,7 @@ Interactively, this is the region. NAME should be a string appropriate for output by ert if the test fails. If NAME is nil or the empty string, a name will be auto-generated." - (interactive "r\nsTest name: ") + (interactive "r\nsTest name: " erts-mode) ;; Automatically make a name. (when (zerop (length name)) (save-excursion @@ -151,6 +153,40 @@ If NAME is nil or the empty string, a name will be auto-generated." (insert "Name: " name "\n\n") (insert "=-=\n"))) +(defun erts-run-test (test-function) + "Run the current test. +If the current erts file doesn't define a test function, the user +will be prompted for one." + (interactive + (list (save-excursion + ;; Find the preceding Code spec. + (while (and (re-search-backward "^Code:" nil t) + (erts-mode--in-test-p (point)))) + (if (and (not (erts-mode--in-test-p (point))) + (re-search-forward "^=-=$" nil t)) + (progn + (goto-char (match-beginning 0)) + (cdr (assq 'code (ert--erts-specifications (point))))) + (read-string "Transformation function: ")))) + erts-mode) + (save-excursion + (erts-mode--goto-start-of-test) + (condition-case arg + (ert-test--erts-test + (list (cons 'dummy t) (cons 'code test-function)) + (buffer-file-name)) + (:success (message "Test successful")) + (ert-test-failed (message "Test failure; expected text: \n%s" + (substring-no-properties (cadr (cadr arg)))))))) + +(defun erts-mode--goto-start-of-test () + (if (not (erts-mode--in-test-p (point))) + (re-search-forward "^=-=\n" nil t) + (re-search-backward "^=-=\n" nil t) + (when (save-match-data (erts-mode--in-test-p (point))) + (re-search-backward "^=-=\n" nil t)) + (goto-char (match-end 0)))) + (provide 'erts-mode) ;;; erts-mode.el ends here commit 4b90aacf796bd5e750f85ff9bf0400be4fcb2885 Author: Lars Ingebrigtsen Date: Fri Oct 1 15:23:32 2021 +0200 Refactor out ert-test--erts-test * lisp/emacs-lisp/ert.el (ert-test--erts-test): Refactor out the bulk of the function for easier reuse. diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index ca3e4c3765..f2b20fd74e 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -2672,83 +2672,88 @@ TRANSFORM will be called to get from before to after." ;; The start of the "before" part starts with a form feed and then ;; the name of the test. (while (re-search-forward "^=-=\n" nil t) - (let* ((file-buffer (current-buffer)) - (specs (ert--erts-specifications (match-beginning 0))) - (name (cdr (assq 'name specs))) - (start-before (point)) - (end-after (if (re-search-forward "^=-=-=\n" nil t) - (match-beginning 0) - (point-max))) - (skip (cdr (assq 'skip specs))) - end-before start-after - after after-point) - (unless name - (error "No name for test case")) - (if (and skip - (eval (car (read-from-string skip)))) - ;; Skipping this test. - () - ;; Do the test. - (goto-char end-after) - ;; We have a separate after section. - (if (re-search-backward "^=-=\n" start-before t) - (setq end-before (match-beginning 0) - start-after (match-end 0)) - (setq end-before end-after - start-after start-before)) - ;; Update persistent specs. - (when-let ((point-char (assq 'point-char specs))) - (setq gen-specs - (map-insert gen-specs 'point-char (cdr point-char)))) - (when-let ((code (cdr (assq 'code specs)))) - (setq gen-specs - (map-insert gen-specs 'code (car (read-from-string code))))) - ;; Get the "after" strings. - (with-temp-buffer - (insert-buffer-substring file-buffer start-after end-after) - (ert--erts-unquote) - ;; Remove the newline at the end of the buffer. - (when-let ((no-newline (cdr (assq 'no-after-newline specs)))) - (goto-char (point-min)) - (when (re-search-forward "\n\\'" nil t) - (delete-region (match-beginning 0) (match-end 0)))) - ;; Get the expected "after" point. - (when-let ((point-char (cdr (assq 'point-char gen-specs)))) - (goto-char (point-min)) - (when (search-forward point-char nil t) - (delete-region (match-beginning 0) (match-end 0)) - (setq after-point (point)))) - (setq after (buffer-string))) - ;; Do the test. - (with-temp-buffer - (insert-buffer-substring file-buffer start-before end-before) - (ert--erts-unquote) - ;; Remove the newline at the end of the buffer. - (when-let ((no-newline (cdr (assq 'no-before-newline specs)))) - (goto-char (point-min)) - (when (re-search-forward "\n\\'" nil t) - (delete-region (match-beginning 0) (match-end 0)))) - (goto-char (point-min)) - ;; Place point in the specified place. - (when-let ((point-char (cdr (assq 'point-char gen-specs)))) - (when (search-forward point-char nil t) - (delete-region (match-beginning 0) (match-end 0)))) - (let ((code (cdr (assq 'code gen-specs)))) - (unless code - (error "No code to run the transform")) - (funcall code)) - (unless (equal (buffer-string) after) - (ert-fail (list (format "Mismatch in test \"%s\", file %s" - name file) - (buffer-string) - after))) - (when (and after-point - (not (= after-point (point)))) - (ert-fail (list (format "Point wrong in test \"%s\", expected point %d, actual %d, file %s" - name - after-point (point) - file) - (buffer-string))))))))))) + (setq gen-specs (ert-test--erts-test gen-specs file)))))) + +(defun ert-test--erts-test (gen-specs file) + (let* ((file-buffer (current-buffer)) + (specs (ert--erts-specifications (match-beginning 0))) + (name (cdr (assq 'name specs))) + (start-before (point)) + (end-after (if (re-search-forward "^=-=-=\n" nil t) + (match-beginning 0) + (point-max))) + (skip (cdr (assq 'skip specs))) + end-before start-after + after after-point) + (unless name + (error "No name for test case")) + (if (and skip + (eval (car (read-from-string skip)))) + ;; Skipping this test. + () + ;; Do the test. + (goto-char end-after) + ;; We have a separate after section. + (if (re-search-backward "^=-=\n" start-before t) + (setq end-before (match-beginning 0) + start-after (match-end 0)) + (setq end-before end-after + start-after start-before)) + ;; Update persistent specs. + (when-let ((point-char (assq 'point-char specs))) + (setq gen-specs + (map-insert gen-specs 'point-char (cdr point-char)))) + (when-let ((code (cdr (assq 'code specs)))) + (setq gen-specs + (map-insert gen-specs 'code (car (read-from-string code))))) + ;; Get the "after" strings. + (with-temp-buffer + (insert-buffer-substring file-buffer start-after end-after) + (ert--erts-unquote) + ;; Remove the newline at the end of the buffer. + (when-let ((no-newline (cdr (assq 'no-after-newline specs)))) + (goto-char (point-min)) + (when (re-search-forward "\n\\'" nil t) + (delete-region (match-beginning 0) (match-end 0)))) + ;; Get the expected "after" point. + (when-let ((point-char (cdr (assq 'point-char gen-specs)))) + (goto-char (point-min)) + (when (search-forward point-char nil t) + (delete-region (match-beginning 0) (match-end 0)) + (setq after-point (point)))) + (setq after (buffer-string))) + ;; Do the test. + (with-temp-buffer + (insert-buffer-substring file-buffer start-before end-before) + (ert--erts-unquote) + ;; Remove the newline at the end of the buffer. + (when-let ((no-newline (cdr (assq 'no-before-newline specs)))) + (goto-char (point-min)) + (when (re-search-forward "\n\\'" nil t) + (delete-region (match-beginning 0) (match-end 0)))) + (goto-char (point-min)) + ;; Place point in the specified place. + (when-let ((point-char (cdr (assq 'point-char gen-specs)))) + (when (search-forward point-char nil t) + (delete-region (match-beginning 0) (match-end 0)))) + (let ((code (cdr (assq 'code gen-specs)))) + (unless code + (error "No code to run the transform")) + (funcall code)) + (unless (equal (buffer-string) after) + (ert-fail (list (format "Mismatch in test \"%s\", file %s" + name file) + (buffer-string) + after))) + (when (and after-point + (not (= after-point (point)))) + (ert-fail (list (format "Point wrong in test \"%s\", expected point %d, actual %d, file %s" + name + after-point (point) + file) + (buffer-string))))))) + ;; Return the new value of the general specifications. + gen-specs) (defun ert--erts-unquote () (goto-char (point-min)) commit 35e6b8d3572819157034b4d52be103b77c1a862d Author: Glenn Morris Date: Fri Oct 1 06:18:35 2021 -0700 ; Auto-commit of loaddefs files. diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index 0ab9552c60..c452825e6d 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -48,7 +48,7 @@ Mutate the result." t nil) (autoload '5x5-crack "5x5" "\ Attempt to find a solution for 5x5. -5x5-crack takes the argument BREEDER which should be a function that takes +`5x5-crack' takes the argument BREEDER which should be a function that takes two parameters, the first will be a grid vector array that is the current solution and the second will be the best solution so far. The function should return a grid vector array that is the new solution. @@ -288,7 +288,7 @@ The syntax of `defadvice' is as follows: FUNCTION ::= Name of the function to be advised. CLASS ::= `before' | `around' | `after' | `activation' | `deactivation'. NAME ::= Non-nil symbol that names this piece of advice. -POSITION ::= `first' | `last' | NUMBER. Optional, defaults to `first', +POSITION ::= `first' | `last' | NUMBER. Optional, defaults to `first', see also `ad-add-advice'. ARGLIST ::= An optional argument list to be used for the advised function instead of the argument list of the original. The first one found in @@ -368,22 +368,24 @@ align them so that the opening parentheses would line up: Mary-Anne (123) 456-7890 Joe (123) 456-7890 -There is no predefined rule to handle this, but you could easily do it -using a REGEXP like \"(\". Interactively, all you would have to do is -to mark the region, call `align-regexp' and enter that regular expression. - -REGEXP must contain at least one parenthesized subexpression, typically -whitespace of the form \"\\\\(\\\\s-*\\\\)\". In normal interactive use, -this is automatically added to the start of your regular expression after -you enter it. You only need to supply the characters to be lined up, and -any preceding whitespace is replaced. - -If you specify a prefix argument (or use this function non-interactively), -you must enter the full regular expression, including the subexpression. -The function also then prompts for which subexpression parenthesis GROUP -\(default 1) within REGEXP to modify, the amount of SPACING (default -`align-default-spacing') to use, and whether or not to REPEAT the rule -throughout the line. +There is no predefined rule to handle this, but interactively, +all you would have to do is to mark the region, call `align-regexp' +and enter \"(\". + +REGEXP must contain at least one parenthesized subexpression, +typically whitespace of the form \"\\\\(\\\\s-*\\\\)\", but in +interactive use, this is automatically added to the start of your +regular expression after you enter it. Interactively, you only +need to supply the characters to be lined up, and any preceding +whitespace is replaced. + +Non-interactively (or if you specify a prefix argument), you must +enter the full regular expression, including the subexpression. +Interactively, the function also then prompts for which +subexpression parenthesis GROUP (default 1) within REGEXP to +modify, the amount of SPACING (default `align-default-spacing') +to use, and whether or not to REPEAT the rule throughout the +line. See `align-rules-list' for more information about these options. @@ -463,7 +465,7 @@ Control whether and how allout outline mode is automatically activated when files are visited with non-nil buffer-specific file variable `allout-layout'. -When allout-auto-activation is \"On\" (t), allout mode is +When `allout-auto-activation' is \"On\" (t), allout mode is activated in buffers with non-nil `allout-layout', and the specified layout is applied. @@ -1201,8 +1203,9 @@ NOT recognized as integers or real numbers. The array MUST reside at the top of the buffer. TABs are not respected, and may be converted into spaces at any time. -Setting the variable `array-respect-tabs' to non-nil will prevent TAB conversion, -but will cause many functions to give errors if they encounter one. +Setting the variable `array-respect-tabs' to non-nil will prevent +TAB conversion, but will cause many functions to give errors if +they encounter one. Upon entering array mode, you will be prompted for the values of several variables. Others will be calculated based on the values you @@ -1392,7 +1395,7 @@ Drawing with keys \\[artist-key-set-point] Does one of the following: For lines/rectangles/squares: sets the first/second endpoint - For poly-lines: sets a point (use C-u \\[artist-key-set-point] to set last point) + For poly-lines: sets a point (use \\[universal-argument] \\[artist-key-set-point] to set last point) When erase characters: toggles erasing When cutting/copying: Sets first/last endpoint of rect/square When pasting: Pastes @@ -1517,9 +1520,8 @@ Special commands: ;;; Generated autoloads from auth-source.el (defvar auth-source-cache-expiry 7200 "\ -How many seconds passwords are cached, or nil to disable -expiring. Overrides `password-cache-expiry' through a -let-binding.") +How many seconds passwords are cached, or nil to disable expiring. +Overrides `password-cache-expiry' through a let-binding.") (custom-autoload 'auth-source-cache-expiry "auth-source" t) @@ -1967,7 +1969,6 @@ Output stream used is value of `standard-output'." nil nil) (autoload 'bat-mode "bat-mode" "\ Major mode for editing DOS/Windows batch files. - Start a new script from `bat-template'. Read help pages for DOS commands with `bat-cmd-help'. Navigate between sections using `imenu'. Run script using `bat-run' and `bat-run-args'. @@ -2385,14 +2386,14 @@ others are still there, should the user decide to delete the most recent one. To yank words from the text of the buffer and use them as part of the -bookmark name, type C-w while setting a bookmark. Successive C-w's +bookmark name, type \\\\[bookmark-yank-word] while setting a bookmark. Successive \\[bookmark-yank-word]'s yank successive words. -Typing C-u inserts (at the bookmark name prompt) the name of the last +Typing \\[universal-argument] inserts (at the bookmark name prompt) the name of the last bookmark used in the document where the new bookmark is being set; this helps you use a single bookmark name to track progress through a large document. If there is no prior bookmark for this document, then -C-u inserts an appropriate name based on the buffer or file. +\\[universal-argument] inserts an appropriate name based on the buffer or file. Use \\[bookmark-delete] to remove bookmarks (you give it a name and it removes only the first instance of a bookmark with that name from @@ -2415,14 +2416,14 @@ Otherwise, if a bookmark named NAME already exists but PUSH-BOOKMARK is nil, raise an error. To yank words from the text of the buffer and use them as part of the -bookmark name, type C-w while setting a bookmark. Successive C-w's +bookmark name, type \\\\[bookmark-yank-word] while setting a bookmark. Successive \\[bookmark-yank-word]'s yank successive words. -Typing C-u inserts (at the bookmark name prompt) the name of the last +Typing \\[universal-argument] inserts (at the bookmark name prompt) the name of the last bookmark used in the document where the new bookmark is being set; this helps you use a single bookmark name to track progress through a large document. If there is no prior bookmark for this document, then -C-u inserts an appropriate name based on the buffer or file. +\\[universal-argument] inserts an appropriate name based on the buffer or file. Use \\[bookmark-delete] to remove bookmarks (you give it a name and it removes only the first instance of a bookmark with that name from @@ -2489,7 +2490,7 @@ If called from Lisp, prompt for NEW-NAME if only OLD-NAME was passed as an argument. If called with two strings, then no prompting is done. You must pass at least OLD-NAME when calling from Lisp. -While you are entering the new name, consecutive C-w's insert +While you are entering the new name, consecutive \\\\[bookmark-yank-word]'s insert consecutive words from the text of the buffer into the new bookmark name. @@ -2534,7 +2535,7 @@ Write bookmarks to a file (reading the file name with the minibuffer)." t nil) Save currently defined bookmarks in FILE. FILE defaults to `bookmark-default-file'. With prefix PARG, query user for a file to save in. -If MAKE-DEFAULT is non-nil (interactively with prefix C-u C-u) +If MAKE-DEFAULT is non-nil (interactively with prefix \\[universal-argument] \\[universal-argument]) the file we save in becomes the new default in the current Emacs session (without affecting the value of `bookmark-default-file'.). @@ -2958,7 +2959,6 @@ If `current-prefix-arg' is non-nil, use ;;;### (autoloads nil "bs" "bs.el" (0 0 0 0)) ;;; Generated autoloads from bs.el -(push (purecopy '(bs 1 17)) package--builtin-versions) (autoload 'bs-cycle-next "bs" "\ Select next buffer defined by buffer cycling. @@ -3381,7 +3381,7 @@ or a list containing a character position and an error message in string form. Invoke the Calculator in \"visual keypad\" mode. This is most useful in the X window system. In this mode, click on the Calc \"buttons\" using the left mouse button. -Or, position the cursor manually and do M-x calc-keypad-press. +Or, position the cursor manually and do \\[calc-keypad-press]. \(fn &optional INTERACTIVE)" t nil) @@ -3982,7 +3982,7 @@ control). See \"cc-mode.el\" for more info. Major mode for editing C code. To submit a problem report, enter `\\[c-submit-bug-report]' from a -c-mode buffer. This automatically sets up a mail buffer with version +`c-mode' buffer. This automatically sets up a mail buffer with version information already added. You just need to add a description of the problem, including a reproducible test case, and send the message. @@ -4030,7 +4030,7 @@ Key bindings: (autoload 'objc-mode "cc-mode" "\ Major mode for editing Objective C code. To submit a problem report, enter `\\[c-submit-bug-report]' from an -objc-mode buffer. This automatically sets up a mail buffer with +`objc-mode' buffer. This automatically sets up a mail buffer with version information already added. You just need to add a description of the problem, including a reproducible test case, and send the message. @@ -4049,7 +4049,7 @@ Key bindings: (autoload 'java-mode "cc-mode" "\ Major mode for editing Java code. To submit a problem report, enter `\\[c-submit-bug-report]' from a -java-mode buffer. This automatically sets up a mail buffer with +`java-mode' buffer. This automatically sets up a mail buffer with version information already added. You just need to add a description of the problem, including a reproducible test case, and send the message. @@ -4068,7 +4068,7 @@ Key bindings: (autoload 'idl-mode "cc-mode" "\ Major mode for editing CORBA's IDL, PSDL and CIDL code. To submit a problem report, enter `\\[c-submit-bug-report]' from an -idl-mode buffer. This automatically sets up a mail buffer with +`idl-mode' buffer. This automatically sets up a mail buffer with version information already added. You just need to add a description of the problem, including a reproducible test case, and send the message. @@ -4088,7 +4088,7 @@ Key bindings: (autoload 'pike-mode "cc-mode" "\ Major mode for editing Pike code. To submit a problem report, enter `\\[c-submit-bug-report]' from a -pike-mode buffer. This automatically sets up a mail buffer with +`pike-mode' buffer. This automatically sets up a mail buffer with version information already added. You just need to add a description of the problem, including a reproducible test case, and send the message. @@ -4111,7 +4111,7 @@ Key bindings: (autoload 'awk-mode "cc-mode" "\ Major mode for editing AWK code. To submit a problem report, enter `\\[c-submit-bug-report]' from an -awk-mode buffer. This automatically sets up a mail buffer with version +`awk-mode' buffer. This automatically sets up a mail buffer with version information already added. You just need to add a description of the problem, including a reproducible test case, and send the message. @@ -4159,7 +4159,7 @@ a null operation. \(fn STYLENAME &optional DONT-OVERRIDE)" t nil) (autoload 'c-add-style "cc-styles" "\ -Adds a style to `c-style-alist', or updates an existing one. +Add a style to `c-style-alist', or update an existing one. STYLE is a string identifying the style to add or update. DESCRIPTION is an association list describing the style and must be of the form: @@ -4656,7 +4656,7 @@ Return t when OBJ is a list of strings. (autoload 'checkdoc "checkdoc" "\ Interactively check the entire buffer for style errors. The current status of the check will be displayed in a buffer which -the users will view as each check is completed." t nil) +the users will view as each check is completed." '(emacs-lisp-mode) nil) (autoload 'checkdoc-interactive "checkdoc" "\ Interactively check the current buffer for doc string errors. @@ -4667,7 +4667,7 @@ errors. Does not check for comment or space warnings. Optional argument SHOWSTATUS indicates that we should update the checkdoc status window instead of the usual behavior. -\(fn &optional START-HERE SHOWSTATUS)" t nil) +\(fn &optional START-HERE SHOWSTATUS)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-message-interactive "checkdoc" "\ Interactively check the current buffer for message string errors. @@ -4678,7 +4678,7 @@ errors. Does not check for comment or space warnings. Optional argument SHOWSTATUS indicates that we should update the checkdoc status window instead of the usual behavior. -\(fn &optional START-HERE SHOWSTATUS)" t nil) +\(fn &optional START-HERE SHOWSTATUS)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-eval-current-buffer "checkdoc" "\ Evaluate and check documentation for the current buffer. @@ -4692,7 +4692,7 @@ With a prefix argument (in Lisp, the argument TAKE-NOTES), store all errors found in a warnings buffer, otherwise stop after the first error. -\(fn &optional TAKE-NOTES)" t nil) +\(fn &optional TAKE-NOTES)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-file "checkdoc" "\ Check FILE for document, comment, error style, and rogue spaces. @@ -4706,14 +4706,14 @@ Use `checkdoc-continue' to continue checking if an error cannot be fixed. Prefix argument TAKE-NOTES means to collect all the warning messages into a separate buffer. -\(fn &optional TAKE-NOTES)" t nil) +\(fn &optional TAKE-NOTES)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-continue "checkdoc" "\ Find the next doc string in the current buffer which has a style error. Prefix argument TAKE-NOTES means to continue through the whole buffer and save warnings in a separate buffer. -\(fn &optional TAKE-NOTES)" t nil) +\(fn &optional TAKE-NOTES)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-comments "checkdoc" "\ Find missing comment sections in the current Emacs Lisp file. @@ -4721,7 +4721,7 @@ Prefix argument TAKE-NOTES non-nil means to save warnings in a separate buffer. Otherwise print a message. This returns the error if there is one. -\(fn &optional TAKE-NOTES)" t nil) +\(fn &optional TAKE-NOTES)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-rogue-spaces "checkdoc" "\ Find extra spaces at the end of lines in the current file. @@ -4730,13 +4730,13 @@ separate buffer. Otherwise print a message. This returns the error if there is one. Optional argument INTERACT permits more interactive fixing. -\(fn &optional TAKE-NOTES INTERACT)" t nil) +\(fn &optional TAKE-NOTES INTERACT)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-message-text "checkdoc" "\ Scan the buffer for occurrences of the error function, and verify text. Optional argument TAKE-NOTES causes all errors to be logged. -\(fn &optional TAKE-NOTES)" t nil) +\(fn &optional TAKE-NOTES)" '(emacs-lisp-mode) nil) (autoload 'checkdoc-eval-defun "checkdoc" "\ Evaluate the current form with `eval-defun' and check its documentation. @@ -5423,8 +5423,9 @@ clashes. \(fn NAME PREFIX &optional FIRST)" nil nil) (autoload 'comp-clean-up-stale-eln "comp" "\ -Given FILE remove all its *.eln files in `native-comp-eln-load-path' -sharing the original source filename (including FILE). +Remove all FILE*.eln* files found in `native-comp-eln-load-path'. +The files to be removed are those produced from the original source +filename (including FILE). \(fn FILE)" nil nil) @@ -5449,10 +5450,17 @@ form, return the compiled function. \(fn FUNCTION-OR-FILE &optional OUTPUT)" nil nil) (autoload 'batch-native-compile "comp" "\ -Perform native compilation on remaining command-line arguments. -Use this from the command line, with ‘-batch’; -it won’t work in an interactive Emacs. -Native compilation equivalent to `batch-byte-compile'." nil nil) +Perform batch native compilation of remaining command-line arguments. + +Native compilation equivalent of `batch-byte-compile'. +Use this from the command line, with `-batch'; it won't work +in an interactive Emacs session. +Optional argument FOR-TARBALL non-nil means the file being compiled +as part of building the source tarball, in which case the .eln file +will be placed under the native-lisp/ directory (actually, in the +last directory in `native-comp-eln-load-path'). + +\(fn &optional FOR-TARBALL)" nil nil) (autoload 'batch-byte+native-compile "comp" "\ Like `batch-native-compile', but used for bootstrap. @@ -5512,7 +5520,7 @@ If both windows display the same buffer, the mark is pushed twice in that buffer: first in the other window, then in the selected window. -A prefix arg means reverse the value of variable +A prefix arg IGNORE-WHITESPACE, means reverse the value of variable `compare-ignore-whitespace'. If `compare-ignore-whitespace' is nil, then a prefix arg means ignore changes in whitespace. If `compare-ignore-whitespace' is non-nil, then a prefix arg means @@ -5974,8 +5982,8 @@ of load, ENDMSG at the end. \(fn PHRASE-FILE &optional COUNT STARTMSG ENDMSG)" nil nil) (autoload 'cookie-snarf "cookie1" "\ -Reads in the PHRASE-FILE, returns it as a vector of strings. -Emit STARTMSG and ENDMSG before and after. Caches the result; second +Read the PHRASE-FILE, return it as a vector of strings. +Emit STARTMSG and ENDMSG before and after. Cache the result; second and subsequent calls on the same file won't go to disk. \(fn PHRASE-FILE &optional STARTMSG ENDMSG)" nil nil) @@ -6102,7 +6110,7 @@ into \\{cperl-mode-map} -Setting the variable `cperl-font-lock' to t switches on font-lock-mode +Setting the variable `cperl-font-lock' to t switches on `font-lock-mode' \(even with older Emacsen), `cperl-electric-lbrace-space' to t switches on electric space between $ and {, `cperl-electric-parens-string' is the string that contains parentheses that should be electric in CPerl @@ -7083,7 +7091,7 @@ Variables controlling indentation style and extra features: These variables control the look of expanded templates. dcl-imenu-generic-expression - Default value for imenu-generic-expression. The default includes + Default value for `imenu-generic-expression'. The default includes SUBROUTINE labels in the main listing and sub-listings for other labels, CALL, GOTO and GOSUB statements. @@ -7169,7 +7177,7 @@ Redefining FUNCTION also cancels it. (autoload 'cancel-debug-on-entry "debug" "\ Undo effect of \\[debug-on-entry] on FUNCTION. -If FUNCTION is nil, cancel debug-on-entry for all functions. +If FUNCTION is nil, cancel `debug-on-entry' for all functions. When called interactively, prompt for FUNCTION in the minibuffer. To specify a nil argument interactively, exit with an empty minibuffer. @@ -7199,7 +7207,7 @@ another symbol also cancels it. (autoload 'cancel-debug-on-variable-change "debug" "\ Undo effect of \\[debug-on-variable-change] on VARIABLE. -If VARIABLE is nil, cancel debug-on-variable-change for all variables. +If VARIABLE is nil, cancel `debug-on-variable-change' for all variables. When called interactively, prompt for VARIABLE in the minibuffer. To specify a nil argument interactively, exit with an empty minibuffer. @@ -7266,7 +7274,7 @@ See the `delimit-columns-str-before', `delimit-columns-before', `delimit-columns-after', `delimit-columns-separator', `delimit-columns-format' and `delimit-columns-extra' variables for customization of the -look. +look. \(fn START END)" t nil) @@ -7346,7 +7354,7 @@ The arguments are as follows: CHILD: the name of the command for the derived mode. PARENT: the name of the command for the parent mode (e.g. `text-mode') or nil if there is no parent. -NAME: a string which will appear in the status line (e.g. \"Hypertext\") +NAME: a string that will appear in the mode line (e.g. \"HTML\") DOCSTRING: an optional documentation string--if you do not supply one, the function will attempt to invent something useful. KEYWORD-ARGS: @@ -7365,7 +7373,7 @@ KEYWORD-ARGS: A nil value means to simply use the same abbrev-table as the parent. :after-hook FORM - A single lisp form which is evaluated after the mode + A single Lisp form which is evaluated after the mode hooks have been run. It should not be quoted. :interactive BOOLEAN Whether the derived mode should be `interactive' or not. @@ -7392,8 +7400,8 @@ the parent, and then sets the variable `case-fold-search' to nil: Note that if the documentation string had been left out, it would have been generated automatically, with a reference to the keymap. -The new mode runs the hook constructed by the function -`derived-mode-hook-name'. +The new mode runs the hook named MODE-hook. For `foo-mode', +the hook will be named `foo-mode-hook'. See Info node `(elisp)Derived Modes' for more details. @@ -7854,16 +7862,24 @@ active it will overwrite that mode for the current buffer. \(fn &optional ARG)" t nil) (autoload 'global-dictionary-tooltip-mode "dictionary" "\ -Enable/disable dictionary-tooltip-mode for all buffers. +Enable/disable `dictionary-tooltip-mode' for all buffers. -Internally it provides a default for the dictionary-tooltip-mode. -It can be overwritten for each buffer using dictionary-tooltip-mode. +Internally it provides a default for the `dictionary-tooltip-mode'. +It can be overwritten for each buffer using `dictionary-tooltip-mode'. Note: (global-dictionary-tooltip-mode 0) will not disable the mode any buffer where (dictionary-tooltip-mode 1) has been called. \(fn &optional ARG)" t nil) +(autoload 'context-menu-dictionary "dictionary" "\ +Populate MENU with dictionary commands at CLICK. +When you add this function to `context-menu-functions', +the context menu will contain an item that searches +the word at mouse click. + +\(fn MENU CLICK)" nil nil) + (register-definition-prefixes "dictionary" '("dictionary-" "global-dictionary-tooltip-mode")) ;;;*** @@ -7901,10 +7917,10 @@ minibuffer. The default for NEW is the current buffer's file name, and the default for OLD is a backup file for NEW, if one exists. If NO-ASYNC is non-nil, call diff synchronously. -When called interactively with a prefix argument, prompt +When called interactively with a prefix argument SWITCHES, prompt interactively for diff switches. Otherwise, the switches -specified in the variable `diff-switches' are passed to the -diff command. +specified in the variable `diff-switches' are passed to the diff +command. Non-interactively, OLD and NEW may each be a file or a buffer. @@ -7915,12 +7931,12 @@ Diff this file with its backup file or vice versa. Uses the latest backup, if there are several numerical backups. If this file is a backup, diff it with its original. The backup file is the first file given to `diff'. -With prefix arg, prompt for diff switches. +With prefix arg SWITCHES, prompt for diff switches. \(fn FILE &optional SWITCHES)" t nil) (autoload 'diff-latest-backup-file "diff" "\ -Return the latest existing backup of FILE, or nil. +Return the latest existing backup of file FN, or nil. \(fn FN)" nil nil) @@ -7960,7 +7976,7 @@ Supports unified and context diffs as well as (to a lesser extent) normal diffs. When the buffer is read-only, the ESC prefix is not necessary. -If you edit the buffer manually, diff-mode will try to update the hunk +If you edit the buffer manually, `diff-mode' will try to update the hunk headers for you on-the-fly. You can also switch between context diff and unified diff with \\[diff-context->unified], @@ -8065,24 +8081,24 @@ If DIRNAME is already in a Dired buffer, that buffer is used without refresh. (define-key ctl-x-4-map "d" 'dired-other-window) (autoload 'dired-other-window "dired" "\ -\"Edit\" directory DIRNAME. Like `dired' but selects in another window. +\"Edit\" directory DIRNAME. Like `dired' but select in another window. \(fn DIRNAME &optional SWITCHES)" t nil) (define-key ctl-x-5-map "d" 'dired-other-frame) (autoload 'dired-other-frame "dired" "\ -\"Edit\" directory DIRNAME. Like `dired' but makes a new frame. +\"Edit\" directory DIRNAME. Like `dired' but make a new frame. \(fn DIRNAME &optional SWITCHES)" t nil) (define-key tab-prefix-map "d" 'dired-other-tab) (autoload 'dired-other-tab "dired" "\ -\"Edit\" directory DIRNAME. Like `dired' but makes a new tab. +\"Edit\" directory DIRNAME. Like `dired' but make a new tab. \(fn DIRNAME &optional SWITCHES)" t nil) (autoload 'dired-noselect "dired" "\ -Like `dired' but returns the Dired buffer as value, does not select it. +Like `dired' but return the Dired buffer as value, do not select it. \(fn DIR-OR-LIST &optional SWITCHES)" nil nil) @@ -8349,7 +8365,7 @@ in `.emacs'. ;;; Generated autoloads from display-fill-column-indicator.el (autoload 'display-fill-column-indicator-mode "display-fill-column-indicator" "\ -Toggle display of fill-column indicator. +Toggle display of `fill-column' indicator. This uses `display-fill-column-indicator' internally. This is a minor mode. If called interactively, toggle the @@ -8403,8 +8419,8 @@ Display-Fill-Column-Indicator mode is enabled in all buffers where See `display-fill-column-indicator-mode' for more information on Display-Fill-Column-Indicator mode. -`global-display-fill-column-indicator-modes' is used to control -which modes this minor mode is used in. +`global-display-fill-column-indicator-modes' is used to control which +modes this minor mode is used in. \(fn &optional ARG)" t nil) @@ -8735,7 +8751,7 @@ BODY contains code to execute each time the mode is enabled or disabled. It is executed after toggling the mode, and before running MODE-hook. Before the actual body code, you can write keyword arguments, i.e. alternating keywords and values. If you provide BODY, then you must - provide at least one keyword argument (e.g. `:lighter nil'). + provide at least one keyword argument (e.g. `:lighter nil`). The following special keywords are supported (other keywords are passed to `defcustom' if the minor mode is global): @@ -8750,8 +8766,8 @@ BODY contains code to execute each time the mode is enabled or disabled. Not used if you also specify :variable. :lighter SPEC Text displayed in the mode line when the mode is on. :keymap MAP Keymap bound to the mode keymap. Defaults to `MODE-map'. - If non-nil, it should be a variable name (whose value is - a keymap), or an expression that returns either a keymap or + If non-nil, it should be an unquoted variable name (whose value + is a keymap), or an expression that returns either a keymap or a list of (KEY . BINDING) pairs where KEY and BINDING are suitable for `define-key'. If you supply a KEYMAP argument that is not a symbol, this macro defines the variable MODE-map @@ -8769,7 +8785,7 @@ BODY contains code to execute each time the mode is enabled or disabled. be assigned to PLACE. If you specify a :variable, this function does not define a MODE variable (nor any of the terms used in :variable). -:after-hook A single lisp form which is evaluated after the mode hooks +:after-hook A single Lisp form which is evaluated after the mode hooks have been run. It should not be quoted. For example, you could write @@ -9670,9 +9686,11 @@ symbol describing the Ediff job type; it defaults to (defalias 'ebuffers3 #'ediff-buffers3) (autoload 'ediff-directories "ediff" "\ -Run Ediff on a pair of directories, DIR1 and DIR2, comparing files that have -the same name in both. The third argument, REGEXP, is nil or a regular -expression; only file names that match the regexp are considered. +Run Ediff on directories DIR1 and DIR2, comparing files. +Consider only files that have the same name in both directories. + +REGEXP is nil or a regular expression; only file names that match +the regexp are considered. \(fn DIR1 DIR2 REGEXP)" t nil) @@ -9688,9 +9706,11 @@ names. Only the files that are under revision control are taken into account. (defalias 'edir-revisions #'ediff-directory-revisions) (autoload 'ediff-directories3 "ediff" "\ -Run Ediff on three directories, DIR1, DIR2, and DIR3, comparing files that -have the same name in all three. The last argument, REGEXP, is nil or a -regular expression; only file names that match the regexp are considered. +Run Ediff on directories DIR1, DIR2, and DIR3, comparing files. +Consider only files that have the same name in all three directories. + +REGEXP is nil or a regular expression; only file names that match +the regexp are considered. \(fn DIR1 DIR2 DIR3 REGEXP)" t nil) @@ -9707,7 +9727,7 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files. (defalias 'edirs-merge #'ediff-merge-directories) (autoload 'ediff-merge-directories-with-ancestor "ediff" "\ -Merge files in directories DIR1 and DIR2 using files in ANCESTOR-DIR as ancestors. +Merge files in DIR1 and DIR2 using files in ANCESTOR-DIR as ancestors. Ediff merges files that have identical names in DIR1, DIR2. If a pair of files in DIR1 and DIR2 doesn't have an ancestor in ANCESTOR-DIR, Ediff will merge without ancestor. The fourth argument, REGEXP, is nil or a regular expression; @@ -9727,7 +9747,7 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files. (defalias 'edir-merge-revisions #'ediff-merge-directory-revisions) (autoload 'ediff-merge-directory-revisions-with-ancestor "ediff" "\ -Run Ediff on a directory, DIR1, merging its files with their revisions and ancestors. +Run Ediff on DIR1 and merge its files with their revisions and ancestors. The second argument, REGEXP, is a regular expression that filters the file names. Only the files that are under revision control are taken into account. MERGE-AUTOSTORE-DIR is the directory in which to store merged files. @@ -9912,7 +9932,7 @@ Call `ediff3-files' with the next three command line arguments." nil nil) Call `ediff-merge-files' with the next two command line arguments." nil nil) (autoload 'ediff-merge-with-ancestor-command "ediff" "\ -Call `ediff-merge-files-with-ancestor' with the next three command line arguments." nil nil) +Call `ediff-merge-files-with-ancestor' with next three command line arguments." nil nil) (autoload 'ediff-directories-command "ediff" "\ Call `ediff-directories' with the next three command line arguments." nil nil) @@ -9924,7 +9944,8 @@ Call `ediff-directories3' with the next four command line arguments." nil nil) Call `ediff-merge-directories' with the next three command line arguments." nil nil) (autoload 'ediff-merge-directories-with-ancestor-command "ediff" "\ -Call `ediff-merge-directories-with-ancestor' with the next four command line arguments." nil nil) +Call `ediff-merge-directories-with-ancestor' with the next four command line +arguments." nil nil) (register-definition-prefixes "ediff" '("ediff-")) @@ -10413,7 +10434,7 @@ Message buffer where you can explain more about the patch. ;;; Generated autoloads from vc/emerge.el (autoload 'emerge-files "emerge" "\ -Run Emerge on two files. +Run Emerge on two files FILE-A and FILE-B. \(fn ARG FILE-A FILE-B FILE-OUT &optional STARTUP-HOOKS QUIT-HOOKS)" t nil) @@ -10423,7 +10444,7 @@ Run Emerge on two files, giving another file as the ancestor. \(fn ARG FILE-A FILE-B FILE-ANCESTOR FILE-OUT &optional STARTUP-HOOKS QUIT-HOOKS)" t nil) (autoload 'emerge-buffers "emerge" "\ -Run Emerge on two buffers. +Run Emerge on two buffers BUFFER-A and BUFFER-B. \(fn BUFFER-A BUFFER-B &optional STARTUP-HOOKS QUIT-HOOKS)" t nil) @@ -10527,7 +10548,7 @@ List all keys matched with NAME from the private keyring. (autoload 'epa-select-keys "epa" "\ Display a user's keyring and ask him to select keys. -CONTEXT is an epg-context. +CONTEXT is an `epg-context'. PROMPT is a string to prompt with. NAMES is a list of strings to be matched with keys. If it is nil, all the keys are listed. @@ -10614,8 +10635,7 @@ For example: (function-put 'epa-verify-region 'interactive-only 't) (autoload 'epa-verify-cleartext-in-region "epa" "\ -Verify OpenPGP cleartext signed messages in the current region -between START and END. +Verify OpenPGP cleartext signed messages in current region from START to END. Don't use this command in Lisp programs! See the reason described in the `epa-verify-region' documentation. @@ -10683,8 +10703,7 @@ Import keys from the region. \(fn START END)" t nil) (autoload 'epa-import-armor-in-region "epa" "\ -Import keys in the OpenPGP armor format in the current region -between START and END. +Import keys in the OpenPGP armor format in the current region from START to END. \(fn START END)" t nil) @@ -10967,7 +10986,7 @@ first element is the certificate key file name, and the second element is the certificate file name itself, or t, which means that `auth-source' will be queried for the key and the certificate. Authenticating using a TLS client certificate is -also refered to as \"CertFP\" (Certificate Fingerprint) +also referred to as \"CertFP\" (Certificate Fingerprint) authentication by various IRC networks. Example usage: @@ -11207,7 +11226,7 @@ session. Return the buffer selected (or created). With a nonnumeric prefix arg, create a new session. -With a numeric prefix arg (as in `C-u 42 M-x eshell RET'), switch +With a numeric prefix arg (as in `\\[universal-argument] 42 \\[eshell]'), switch to the session with that number, or create it if it doesn't already exist. @@ -11540,7 +11559,21 @@ for \\[find-tag] (which see)." t nil) (autoload 'etags--xref-backend "etags" nil nil nil) -(register-definition-prefixes "etags" '("default-tags-table-function" "etags-" "file-of-tag" "find-tag-" "goto-tag-location-function" "initialize-new-tags-table" "last-tag" "list-tags-function" "select-tags-table-" "snarf-tag-function" "tag" "verify-tags-table-function" "xref-")) +(register-definition-prefixes "etags" '("default-tags-table-function" "etags-" "file-of-tag" "find-tag-" "goto-tag-location-function" "initialize-new-tags-table" "last-tag" "list-tags-function" "select-tags-table-" "snarf-tag-function" "tag" "verify-tags-table-function")) + +;;;*** + +;;;### (autoloads nil "etc-authors-mode" "textmodes/etc-authors-mode.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from textmodes/etc-authors-mode.el + +(autoload 'etc-authors-mode "etc-authors-mode" "\ +Major mode for viewing \"etc/AUTHORS\" from the Emacs distribution. +Provides some basic font locking and not much else. + +\(fn)" t nil) + +(register-definition-prefixes "etc-authors-mode" '("etc-authors-")) ;;;*** @@ -11739,8 +11772,9 @@ see `eudc-inline-expansion-servers'. Query the directory server, and return the matching responses. The variable `eudc-inline-query-format' controls how to associate the individual QUERY-WORDS with directory attribute names. -After querying the server for the given string, the expansion specified by -`eudc-inline-expansion-format' is applied to the matches before returning them.inserted in the buffer at point. +After querying the server for the given string, the expansion +specified by `eudc-inline-expansion-format' is applied to the +matches before returning them.inserted in the buffer at point. Multiple servers can be tried with the same query until one finds a match, see `eudc-inline-expansion-servers'. @@ -11946,6 +11980,8 @@ for the search engine used." t nil) (autoload 'eww-mode "eww" "\ Mode for browsing the web. +\\{eww-mode-map} + \(fn)" t nil) (autoload 'eww-browse-url "eww" "\ @@ -11968,6 +12004,11 @@ instead of `browse-url-new-window-flag'. (autoload 'eww-list-bookmarks "eww" "\ Display the bookmarks." t nil) +(autoload 'eww-bookmark-jump "eww" "\ +Default bookmark handler for EWW buffers. + +\(fn BOOKMARK)" nil nil) + (register-definition-prefixes "eww" '("erc--download-directory" "eww-")) ;;;*** @@ -12224,7 +12265,7 @@ Adjust the height of the default face by INC. INC may be passed as a numeric prefix argument. The actual adjustment made depends on the final component of the -key-binding used to invoke the command, with all modifiers removed: +keybinding used to invoke the command, with all modifiers removed: +, = Increase the height of the default face by one step - Decrease the height of the default face by one step @@ -12322,10 +12363,10 @@ If the optional argument LIST is non-nil, it should be a list of colors to display. Otherwise, this command computes a list of colors that the current display can handle. Customize `list-colors-sort' to change the order in which colors are shown. -Type `g' or \\[revert-buffer] after customizing `list-colors-sort' -to redisplay colors in the new order. +Type \\\\[revert-buffer] after customizing `list-colors-sort' to redisplay colors in +the new order. -If the optional argument BUFFER-NAME is nil, it defaults to *Colors*. +If the optional argument BUFFER-NAME is nil, it defaults to \"*Colors*\". If the optional argument CALLBACK is non-nil, it should be a function to call each time the user types RET or clicks on a @@ -12775,7 +12816,7 @@ it finishes, type \\[kill-find]. \(fn DIR ARGS)" t nil) (autoload 'find-name-dired "find-dired" "\ -Search DIR recursively for files matching the globbing pattern PATTERN, +Search DIR recursively for files matching the globbing PATTERN, and run Dired on those files. PATTERN is a shell wildcard (not an Emacs regexp) and need not be quoted. The default command run (after changing into DIR) is @@ -12906,13 +12947,16 @@ Find the Emacs Lisp source of LIBRARY. Interactively, prompt for LIBRARY using the one at or near point. +This function searches `find-library-source-path' if non-nil, and +`load-path' otherwise. + \(fn LIBRARY)" t nil) (autoload 'read-library-name "find-func" "\ Read and return a library name, defaulting to the one near point. A library name is the filename of an Emacs Lisp library located -in a directory under `load-path' (or `find-function-source-path', +in a directory under `load-path' (or `find-library-source-path', if non-nil)." nil nil) (autoload 'find-library-other-window "find-func" "\ @@ -12953,10 +12997,6 @@ If FUNCTION is a built-in function, this function normally attempts to find it in the Emacs C sources; however, if LISP-ONLY is non-nil, signal an error instead. -If the file where FUNCTION is defined is not known, then it is -searched for in `find-function-source-path' if non-nil, otherwise -in `load-path'. - \(fn FUNCTION &optional LISP-ONLY)" nil nil) (autoload 'find-function "find-func" "\ @@ -12967,8 +13007,6 @@ near point (selected by `function-called-at-point') in a buffer and places point before the definition. Set mark before moving, if the buffer already existed. -The library where FUNCTION is defined is searched for in -`find-function-source-path', if non-nil, otherwise in `load-path'. See also `find-function-recenter-line' and `find-function-after-hook'. \(fn FUNCTION)" t nil) @@ -12994,9 +13032,6 @@ Finds the library containing the definition of VARIABLE in a buffer and the point of the definition. The buffer is not selected. If the variable's definition can't be found in the buffer, return (BUFFER). -The library where VARIABLE is defined is searched for in FILE or -`find-function-source-path', if non-nil, otherwise in `load-path'. - \(fn VARIABLE &optional FILE)" nil nil) (autoload 'find-variable "find-func" "\ @@ -13008,8 +13043,6 @@ places point before the definition. Set mark before moving, if the buffer already existed. -The library where VARIABLE is defined is searched for in -`find-function-source-path', if non-nil, otherwise in `load-path'. See also `find-function-recenter-line' and `find-function-after-hook'. \(fn VARIABLE)" t nil) @@ -13035,9 +13068,6 @@ TYPE says what type of definition: nil for a function, `defvar' for a variable, `defface' for a face. This function does not switch to the buffer nor display it. -The library where SYMBOL is defined is searched for in FILE or -`find-function-source-path', if non-nil, otherwise in `load-path'. - \(fn SYMBOL TYPE &optional FILE)" nil nil) (autoload 'find-face-definition "find-func" "\ @@ -13049,8 +13079,6 @@ places point before the definition. Set mark before moving, if the buffer already existed. -The library where FACE is defined is searched for in -`find-function-source-path', if non-nil, otherwise in `load-path'. See also `find-function-recenter-line' and `find-function-after-hook'. \(fn FACE)" t nil) @@ -13080,7 +13108,7 @@ Find directly the function at point in the other window." t nil) Find directly the variable at point in the other window." t nil) (autoload 'find-function-setup-keys "find-func" "\ -Define some key bindings for the find-function family of functions." nil nil) +Define some key bindings for the `find-function' family of functions." nil nil) (register-definition-prefixes "find-func" '("find-")) @@ -13173,7 +13201,7 @@ lines. ;;;### (autoloads nil "flymake" "progmodes/flymake.el" (0 0 0 0)) ;;; Generated autoloads from progmodes/flymake.el -(push (purecopy '(flymake 1 1 1)) package--builtin-versions) +(push (purecopy '(flymake 1 2 1)) package--builtin-versions) (autoload 'flymake-log "flymake" "\ Log, at level LEVEL, the message MSG formatted with ARGS. @@ -13185,23 +13213,32 @@ generated it. \(fn LEVEL MSG &rest ARGS)" nil t) (autoload 'flymake-make-diagnostic "flymake" "\ -Make a Flymake diagnostic for BUFFER's region from BEG to END. +Make a Flymake diagnostic for LOCUS's region from BEG to END. +LOCUS is a buffer object or a string designating a file name. + TYPE is a diagnostic symbol and TEXT is string describing the problem detected in this region. DATA is any object that the caller wishes to attach to the created diagnostic for later -retrieval. +retrieval with `flymake-diagnostic-data'. + +If LOCUS is a buffer BEG and END should be buffer positions +inside it. If LOCUS designates a file, BEG and END should be a +cons (LINE . COL) indicating a file position. In this second +case, END may be ommited in which case the region is computed +using `flymake-diag-region' if the diagnostic is appended to an +actual buffer. OVERLAY-PROPERTIES is an alist of properties attached to the created diagnostic, overriding the default properties and any -properties of `flymake-overlay-control' of the diagnostic's -type. +properties listed in the `flymake-overlay-control' property of +the diagnostic's type symbol. -\(fn BUFFER BEG END TYPE TEXT &optional DATA OVERLAY-PROPERTIES)" nil nil) +\(fn LOCUS BEG END TYPE TEXT &optional DATA OVERLAY-PROPERTIES)" nil nil) (autoload 'flymake-diagnostics "flymake" "\ Get Flymake diagnostics in region determined by BEG and END. -If neither BEG or END is supplied, use the whole buffer, +If neither BEG or END is supplied, use whole accessible buffer, otherwise if BEG is non-nil and END is nil, consider only diagnostics at BEG. @@ -13678,7 +13715,7 @@ Variables controlling indentation style and extra features: `fortran-comment-line-extra-indent' Amount of extra indentation for text in full-line comments (default 0). `fortran-comment-indent-style' - How to indent the text in full-line comments. Allowed values are: + How to indent the text in full-line comments. Allowed values are: nil don't change the indentation `fixed' indent to `fortran-comment-line-extra-indent' beyond the value of either @@ -13924,7 +13961,8 @@ FORCE-ONSCREEN can be: - a list (LEFT TOP WIDTH HEIGHT), describing the workarea. It must return non-nil to force the frame onscreen, nil otherwise. -CLEANUP-FRAMES allows \"cleaning up\" the frame list after restoring a frameset: +CLEANUP-FRAMES allows \"cleaning up\" the frame list after +restoring a frameset: t Delete all frames that were not created or restored upon. nil Keep all frames. FUNC A function called with two arguments: @@ -14025,7 +14063,7 @@ becomes the initial working directory and source-file directory for your debugger. If COMMAND-LINE requests that gdb attaches to a process PID, gdb will run in *gud-PID*, otherwise it will run in *gud*; in these -cases the initial working directory is the default-directory of +cases the initial working directory is the `default-directory' of the buffer in which this command was invoked. COMMAND-LINE should include \"-i=mi\" to use gdb's MI text interface. @@ -14351,7 +14389,7 @@ Allow Gnus to be an offline newsreader. The gnus-agentize function is now called internally by gnus when gnus-agent is set. If you wish to avoid calling gnus-agentize, -customize gnus-agent to nil. +customize `gnus-agent' to nil. This will modify the `gnus-setup-news-hook', and `message-send-mail-real-function' variables, and install the Gnus agent @@ -14592,7 +14630,7 @@ Checking delayed messages is skipped if optional arg NO-CHECK is non-nil. ;;; Generated autoloads from gnus/gnus-dired.el (autoload 'turn-on-gnus-dired-mode "gnus-dired" "\ -Convenience method to turn on gnus-dired-mode." t nil) +Convenience method to turn on `gnus-dired-mode'." t nil) (register-definition-prefixes "gnus-dired" '("gnus-dired-")) @@ -14626,7 +14664,8 @@ Reminder user if there are unsent drafts." t nil) ;;; Generated autoloads from gnus/gnus-fun.el (autoload 'gnus--random-face-with-type "gnus-fun" "\ -Return file from DIR with extension EXT, omitting matches of OMIT, processed by FUN. +Return file from DIR with extension EXT. +Omit matches of OMIT, and process them by FUN. \(fn DIR EXT OMIT FUN)" nil nil) @@ -14855,7 +14894,7 @@ match any of the group-specified splitting rules. See \(fn &optional AUTO-UPDATE CATCH-ALL)" t nil) (autoload 'gnus-group-split-update "gnus-mlspl" "\ -Computes nnmail-split-fancy from group params and CATCH-ALL. +Computes `nnmail-split-fancy' from group params and CATCH-ALL. It does this by calling (gnus-group-split-fancy nil nil CATCH-ALL). If CATCH-ALL is nil, `gnus-group-split-default-catch-all-group' is used @@ -15436,7 +15475,7 @@ This variable's value takes effect when `grep-compute-defaults' is called.") History list for grep.") (defvar grep-find-history nil "\ -History list for grep-find.") +History list for `grep-find'.") (autoload 'grep-process-setup "grep" "\ Setup compilation variables and buffer for `grep'. @@ -15575,7 +15614,7 @@ becomes the initial working directory and source-file directory for your debugger. If COMMAND-LINE requests that gdb attaches to a process PID, gdb will run in *gud-PID*, otherwise it will run in *gud*; in these -cases the initial working directory is the default-directory of +cases the initial working directory is the `default-directory' of the buffer in which this command was invoked. \(fn COMMAND-LINE)" t nil) @@ -15804,7 +15843,7 @@ binding mode. ;;; Generated autoloads from play/handwrite.el (autoload 'handwrite "handwrite" "\ -Turns the buffer into a \"handwritten\" document. +Turn the buffer into a \"handwritten\" document. The functions `handwrite-10pt', `handwrite-11pt', `handwrite-12pt' and `handwrite-13pt' set up for various sizes of output. @@ -15841,9 +15880,9 @@ second since 1970-01-01 00:00:00 GMT. Repent before ring 31 moves." t nil) (autoload 'hanoi-unix-64 "hanoi" "\ -Like hanoi-unix, but pretend to have a 64-bit clock. +Like `hanoi-unix', but pretend to have a 64-bit clock. This is, necessarily (as of Emacs 20.3), a crock. When the -current-time interface is made s2G-compliant, hanoi.el will need +`current-time' interface is made s2G-compliant, hanoi.el will need to be updated." t nil) (register-definition-prefixes "hanoi" '("hanoi-")) @@ -16029,13 +16068,16 @@ different regions. With numeric argument ARG, behaves like (autoload 'describe-function "help-fns" "\ Display the full documentation of FUNCTION (a symbol). -When called from lisp, FUNCTION may also be a function object. +When called from Lisp, FUNCTION may also be a function object. + +See the `help-enable-symbol-autoload' variable for special +handling of autoloaded functions. \(fn FUNCTION)" t nil) (autoload 'describe-command "help-fns" "\ Display the full documentation of COMMAND (a symbol). -When called from lisp, COMMAND may also be a function object. +When called from Lisp, COMMAND may also be a function object. \(fn COMMAND)" t nil) @@ -16477,9 +16519,9 @@ which can be called interactively, are: When hi-lock is started and if the mode is not excluded or patterns rejected, the beginning of the buffer is searched for lines of the form: - Hi-lock: FOO + Hi-lock: (FOO ...) -where FOO is a list of patterns. The patterns must start before +where (FOO ...) is a list of patterns. The patterns must start before position (number of characters into buffer) `hi-lock-file-patterns-range'. Patterns will be read until Hi-lock: end is found. A mode is excluded if it's in the list @@ -16912,8 +16954,8 @@ Disable the mode if ARG is a negative number. Highlight-Changes mode is enabled in all buffers where `highlight-changes-mode-turn-on' would do it. -See `highlight-changes-mode' for more information on -Highlight-Changes mode. +See `highlight-changes-mode' for more information on Highlight-Changes +mode. \(fn &optional ARG)" t nil) @@ -17761,7 +17803,7 @@ The main features of this mode are Info documentation for this package is available. Use \\[idlwave-info] to display (complain to your sysadmin if that does not work). For Postscript, PDF, and HTML versions of the - documentation, check IDLWAVE's homepage at URL + documentation, check IDLWAVE's website at URL `https://github.com/jdtsmith/idlwave'. IDLWAVE has customize support - see the group `idlwave'. @@ -17983,12 +18025,12 @@ The directory is selected interactively by typing a substring. For details of keybindings, see `ido-find-file'." t nil) (autoload 'ido-dired-other-window "ido" "\ -\"Edit\" a directory. Like `ido-dired' but selects in another window. +\"Edit\" a directory. Like `ido-dired' but select in another window. The directory is selected interactively by typing a substring. For details of keybindings, see `ido-find-file'." t nil) (autoload 'ido-dired-other-frame "ido" "\ -\"Edit\" a directory. Like `ido-dired' but makes a new frame. +\"Edit\" a directory. Like `ido-dired' but make a new frame. The directory is selected interactively by typing a substring. For details of keybindings, see `ido-find-file'." t nil) @@ -18993,7 +19035,7 @@ system." t nil) (autoload 'info-lookup-symbol "info-look" "\ Display the definition of SYMBOL, as found in the relevant manual. When this command is called interactively, it reads SYMBOL from the -minibuffer. In the minibuffer, use M-n to yank the default argument +minibuffer. In the minibuffer, use \\\\[next-history-element] to yank the default argument value into the minibuffer so you can edit it. The default symbol is the one found at point. @@ -19005,7 +19047,7 @@ With prefix arg MODE a query for the symbol help mode is offered. (autoload 'info-lookup-file "info-look" "\ Display the documentation of a file. When this command is called interactively, it reads FILE from the minibuffer. -In the minibuffer, use M-n to yank the default file name +In the minibuffer, use \\\\[next-history-element] to yank the default file name into the minibuffer so you can edit it. The default file name is the one found at point. @@ -19140,7 +19182,7 @@ Check current buffer for validity as an Info file. Check that every node pointer points to an existing node." t nil) (autoload 'batch-info-validate "informat" "\ -Runs `Info-validate' on the files remaining on the command line. +Run `Info-validate' on the files remaining on the command line. Must be used only with -batch, and kills Emacs on completion. Each file will be processed even if an error occurred previously. For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\"" nil nil) @@ -19752,7 +19794,7 @@ keys are bound. `S-cursor' Bind shifted keypad keys to the shifted cursor movement keys. `cursor' Bind keypad keys to the cursor movement keys. `numeric' Plain numeric keypad, i.e. 0 .. 9 and . (or DECIMAL arg) - `none' Removes all bindings for keypad keys in function-key-map; + `none' Removes all bindings for keypad keys in `function-key-map'; this enables any user-defined bindings for the keypad keys in the global and local keymaps. @@ -20071,7 +20113,7 @@ use either \\[customize] or the function `latin1-display'.") ;;; Generated autoloads from progmodes/ld-script.el (autoload 'ld-script-mode "ld-script" "\ -A major mode to edit GNU ld script files +A major mode to edit GNU ld script files. \(fn)" t nil) @@ -20148,7 +20190,7 @@ essentially expands to .site.contents)) If you nest `let-alist' invocations, the inner one can't access -the variables of the outer one. You can, however, access alists +the variables of the outer one. You can, however, access alists inside the original alist by using dots inside the symbol, as displayed in the example above. @@ -20529,11 +20571,16 @@ use this command, and then save the file. (autoload 'kbd-macro-query "macros" "\ Query user during kbd macro execution. - With prefix argument, enters recursive edit, reading keyboard -commands even within a kbd macro. You can give different commands -each time the macro executes. - Without prefix argument, asks whether to continue running the macro. + +With prefix argument FLAG, enter recursive edit, reading +keyboard commands even within a kbd macro. You can give +different commands each time the macro executes. + +Without prefix argument, ask whether to continue running the +macro. + Your options are: \\ + \\[act] Finish this iteration normally and continue with the next. \\[skip] Skip the rest of this iteration, and start the next. \\[exit] Stop the macro entirely right now. @@ -21142,7 +21189,7 @@ Default bookmark handler for Man buffers. ;;;### (autoloads nil "map" "emacs-lisp/map.el" (0 0 0 0)) ;;; Generated autoloads from emacs-lisp/map.el -(push (purecopy '(map 3 1)) package--builtin-versions) +(push (purecopy '(map 3 2 1)) package--builtin-versions) (register-definition-prefixes "map" '("map-")) @@ -23389,8 +23436,9 @@ closing requests for requests that are used in matched pairs. (autoload 'nxml-mode "nxml-mode" "\ Major mode for editing XML. - +\\ \\[nxml-finish-element] finishes the current element by inserting an end-tag. + C-c C-i closes a start-tag with `>' and then inserts a balancing end-tag leaving point between the start-tag and end-tag. \\[nxml-balanced-close-start-tag-block] is similar but for block rather than inline elements: @@ -23485,34 +23533,12 @@ Many aspects this mode can be customized using (register-definition-prefixes "ob-C" '("org-babel-")) -;;;*** - -;;;### (autoloads nil "ob-J" "org/ob-J.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-J.el - -(register-definition-prefixes "ob-J" '("obj-" "org-babel-")) - ;;;*** ;;;### (autoloads nil "ob-R" "org/ob-R.el" (0 0 0 0)) ;;; Generated autoloads from org/ob-R.el -(register-definition-prefixes "ob-R" '("ob-R-" "org-babel-")) - -;;;*** - -;;;### (autoloads nil "ob-abc" "org/ob-abc.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-abc.el - -(register-definition-prefixes "ob-abc" '("org-babel-")) - -;;;*** - -;;;### (autoloads nil "ob-asymptote" "org/ob-asymptote.el" (0 0 0 -;;;;;; 0)) -;;; Generated autoloads from org/ob-asymptote.el - -(register-definition-prefixes "ob-asymptote" '("org-babel-")) +(register-definition-prefixes "ob-R" '("ob-" "org-babel-")) ;;;*** @@ -23542,13 +23568,6 @@ Many aspects this mode can be customized using (register-definition-prefixes "ob-comint" '("org-babel-comint-")) -;;;*** - -;;;### (autoloads nil "ob-coq" "org/ob-coq.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-coq.el - -(register-definition-prefixes "ob-coq" '("coq-program-name" "org-babel-")) - ;;;*** ;;;### (autoloads nil "ob-css" "org/ob-css.el" (0 0 0 0)) @@ -23570,13 +23589,6 @@ Many aspects this mode can be customized using (register-definition-prefixes "ob-dot" '("org-babel-")) -;;;*** - -;;;### (autoloads nil "ob-ebnf" "org/ob-ebnf.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-ebnf.el - -(register-definition-prefixes "ob-ebnf" '("org-babel-")) - ;;;*** ;;;### (autoloads nil "ob-emacs-lisp" "org/ob-emacs-lisp.el" (0 0 @@ -23641,20 +23653,6 @@ Many aspects this mode can be customized using (register-definition-prefixes "ob-haskell" '("org-babel-")) -;;;*** - -;;;### (autoloads nil "ob-hledger" "org/ob-hledger.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-hledger.el - -(register-definition-prefixes "ob-hledger" '("org-babel-")) - -;;;*** - -;;;### (autoloads nil "ob-io" "org/ob-io.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-io.el - -(register-definition-prefixes "ob-io" '("org-babel-")) - ;;;*** ;;;### (autoloads nil "ob-java" "org/ob-java.el" (0 0 0 0)) @@ -23671,24 +23669,24 @@ Many aspects this mode can be customized using ;;;*** -;;;### (autoloads nil "ob-latex" "org/ob-latex.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-latex.el +;;;### (autoloads nil "ob-julia" "org/ob-julia.el" (0 0 0 0)) +;;; Generated autoloads from org/ob-julia.el -(register-definition-prefixes "ob-latex" '("org-babel-")) +(register-definition-prefixes "ob-julia" '("org-babel-")) ;;;*** -;;;### (autoloads nil "ob-ledger" "org/ob-ledger.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-ledger.el +;;;### (autoloads nil "ob-latex" "org/ob-latex.el" (0 0 0 0)) +;;; Generated autoloads from org/ob-latex.el -(register-definition-prefixes "ob-ledger" '("org-babel-")) +(register-definition-prefixes "ob-latex" '("org-babel-")) ;;;*** ;;;### (autoloads nil "ob-lilypond" "org/ob-lilypond.el" (0 0 0 0)) ;;; Generated autoloads from org/ob-lilypond.el -(register-definition-prefixes "ob-lilypond" '("lilypond-mode" "org-babel-")) +(register-definition-prefixes "ob-lilypond" '("lilypond-mode" "ob-lilypond-header-args" "org-babel-")) ;;;*** @@ -23718,13 +23716,6 @@ Many aspects this mode can be customized using (register-definition-prefixes "ob-maxima" '("org-babel-")) -;;;*** - -;;;### (autoloads nil "ob-mscgen" "org/ob-mscgen.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-mscgen.el - -(register-definition-prefixes "ob-mscgen" '("org-babel-")) - ;;;*** ;;;### (autoloads nil "ob-ocaml" "org/ob-ocaml.el" (0 0 0 0)) @@ -23753,13 +23744,6 @@ Many aspects this mode can be customized using (register-definition-prefixes "ob-perl" '("org-babel-")) -;;;*** - -;;;### (autoloads nil "ob-picolisp" "org/ob-picolisp.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-picolisp.el - -(register-definition-prefixes "ob-picolisp" '("org-babel-")) - ;;;*** ;;;### (autoloads nil "ob-plantuml" "org/ob-plantuml.el" (0 0 0 0)) @@ -23831,13 +23815,6 @@ Many aspects this mode can be customized using (register-definition-prefixes "ob-shell" '("org-babel-")) -;;;*** - -;;;### (autoloads nil "ob-shen" "org/ob-shen.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-shen.el - -(register-definition-prefixes "ob-shen" '("org-babel-")) - ;;;*** ;;;### (autoloads nil "ob-sql" "org/ob-sql.el" (0 0 0 0)) @@ -23854,24 +23831,45 @@ Many aspects this mode can be customized using ;;;*** -;;;### (autoloads nil "ob-stan" "org/ob-stan.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-stan.el +;;;### (autoloads nil "ob-table" "org/ob-table.el" (0 0 0 0)) +;;; Generated autoloads from org/ob-table.el -(register-definition-prefixes "ob-stan" '("org-babel-")) +(register-definition-prefixes "ob-table" '("org-")) ;;;*** -;;;### (autoloads nil "ob-table" "org/ob-table.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-table.el +;;;### (autoloads nil "oc" "org/oc.el" (0 0 0 0)) +;;; Generated autoloads from org/oc.el -(register-definition-prefixes "ob-table" '("org-")) +(register-definition-prefixes "oc" '("org-cite-")) + +;;;*** + +;;;### (autoloads nil "oc-basic" "org/oc-basic.el" (0 0 0 0)) +;;; Generated autoloads from org/oc-basic.el + +(register-definition-prefixes "oc-basic" '("org-cite-basic-")) + +;;;*** + +;;;### (autoloads nil "oc-biblatex" "org/oc-biblatex.el" (0 0 0 0)) +;;; Generated autoloads from org/oc-biblatex.el + +(register-definition-prefixes "oc-biblatex" '("org-cite-biblatex-")) + +;;;*** + +;;;### (autoloads nil "oc-csl" "org/oc-csl.el" (0 0 0 0)) +;;; Generated autoloads from org/oc-csl.el + +(register-definition-prefixes "oc-csl" '("org-cite-csl-")) ;;;*** -;;;### (autoloads nil "ob-vala" "org/ob-vala.el" (0 0 0 0)) -;;; Generated autoloads from org/ob-vala.el +;;;### (autoloads nil "oc-natbib" "org/oc-natbib.el" (0 0 0 0)) +;;; Generated autoloads from org/oc-natbib.el -(register-definition-prefixes "ob-vala" '("org-babel-")) +(register-definition-prefixes "oc-natbib" '("org-cite-natbib-")) ;;;*** @@ -23937,6 +23935,13 @@ startup file, `~/.emacs-octave'. (register-definition-prefixes "ol-docview" '("org-docview-")) +;;;*** + +;;;### (autoloads nil "ol-doi" "org/ol-doi.el" (0 0 0 0)) +;;; Generated autoloads from org/ol-doi.el + +(register-definition-prefixes "ol-doi" '("org-link-doi-")) + ;;;*** ;;;### (autoloads nil "ol-eshell" "org/ol-eshell.el" (0 0 0 0)) @@ -23994,7 +23999,8 @@ startup file, `~/.emacs-octave'. (define-obsolete-function-alias 'delphi-mode #'opascal-mode "24.4") (autoload 'opascal-mode "opascal" "\ -Major mode for editing OPascal code.\\ +Major mode for editing OPascal code. +\\ \\[opascal-find-unit] - Search for a OPascal source file. \\[opascal-fill-comment] - Fill the current comment. \\[opascal-new-comment-line] - If in a // comment, do a new comment line. @@ -24027,7 +24033,7 @@ Coloring: ;;;### (autoloads nil "org" "org/org.el" (0 0 0 0)) ;;; Generated autoloads from org/org.el -(push (purecopy '(org 9 4 4)) package--builtin-versions) +(push (purecopy '(org 9 5)) package--builtin-versions) (autoload 'org-babel-do-load-languages "org" "\ Load the languages defined in `org-babel-load-languages'. @@ -24267,7 +24273,7 @@ first press `<' once to indicate that the agenda should be temporarily Pressing `<' twice means to restrict to the current subtree or region \(if active). -\(fn &optional ARG ORG-KEYS RESTRICTION)" t nil) +\(fn &optional ARG KEYS RESTRICTION)" t nil) (autoload 'org-batch-agenda "org-agenda" "\ Run an agenda command in batch mode and send the result to STDOUT. @@ -24453,7 +24459,7 @@ 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 +in the file. Otherwise, only apply the restriction to the current subtree. \(fn &optional TYPE)" t nil) @@ -24727,6 +24733,109 @@ See the command `outline-mode' for more information on this mode. (register-definition-prefixes "outline" '("outline-")) +;;;*** + +;;;### (autoloads nil "ox-koma-letter" "org/ox-koma-letter.el" (0 +;;;;;; 0 0 0)) +;;; Generated autoloads from org/ox-koma-letter.el + +(autoload 'org-koma-letter-export-as-latex "ox-koma-letter" "\ +Export current buffer as a KOMA Scrlttr2 letter. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Export is done in a buffer named \"*Org KOMA-LETTER Export*\". It +will be displayed if `org-export-show-temporary-export-buffer' is +non-nil. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-koma-letter-export-to-latex "ox-koma-letter" "\ +Export current buffer as a KOMA Scrlttr2 letter (tex). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +When optional argument PUB-DIR is set, use it as the publishing +directory. + +Return output file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-koma-letter-export-to-pdf "ox-koma-letter" "\ +Export current buffer as a KOMA Scrlttr2 letter (pdf). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return PDF file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(register-definition-prefixes "ox-koma-letter" '("org-koma-letter-")) + ;;;*** ;;;### (autoloads nil "ox-man" "org/ox-man.el" (0 0 0 0)) @@ -24938,13 +25047,13 @@ archive). ;;;### (autoloads nil "paren" "paren.el" (0 0 0 0)) ;;; Generated autoloads from paren.el -(defvar show-paren-mode nil "\ +(defcustom show-paren-mode t "\ Non-nil if Show-Paren mode is enabled. See the `show-paren-mode' command for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') -or call the function `show-paren-mode'.") +or call the function `show-paren-mode'." :set #'custom-set-minor-mode :initialize 'custom-initialize-delay :type 'boolean :group 'paren-showing) (custom-autoload 'show-paren-mode "paren" nil) @@ -24965,9 +25074,30 @@ evaluate `(default-value 'show-paren-mode)'. The mode's hook is called both when the mode is enabled and when it is disabled. -Show Paren mode is a global minor mode. When enabled, any -matching parenthesis is highlighted in `show-paren-style' after -`show-paren-delay' seconds of Emacs idle time. +When enabled, any matching parenthesis is highlighted in `show-paren-style' +after `show-paren-delay' seconds of Emacs idle time. + +This is a global minor mode. To toggle the mode in a single buffer, +use `show-paren-local-mode'. + +\(fn &optional ARG)" t nil) + +(autoload 'show-paren-local-mode "paren" "\ +Toggle `show-paren-mode' only in this buffer. + +This is a minor mode. If called interactively, toggle the +`Show-Paren-Local mode' mode. If the prefix argument is positive, +enable the mode, and if it is zero or negative, disable the mode. + +If called from Lisp, toggle the mode if ARG is `toggle'. Enable the +mode if ARG is nil, omitted, or is a positive number. Disable the +mode if ARG is a negative number. + +To check whether the minor mode is enabled in the current buffer, +evaluate `(buffer-local-value 'show-paren-mode (current-buffer))'. + +The mode's hook is called both when the mode is enabled and when it is +disabled. \(fn &optional ARG)" t nil) @@ -25125,7 +25255,11 @@ Emacs Lisp manual for more information and examples. (autoload 'pcase-exhaustive "pcase" "\ The exhaustive version of `pcase' (which see). -If EXP fails to match any of the patterns in CASES, an error is signaled. +If EXP fails to match any of the patterns in CASES, an error is +signaled. + +In contrast, `pcase' will return nil if there is no match, but +not signal an error. \(fn EXP &rest CASES)" nil t) @@ -25516,10 +25650,10 @@ Global menu used by PCL-CVS.") (put 'perl-label-offset 'safe-local-variable 'integerp) (autoload 'perl-flymake "perl-mode" "\ -Perl backend for Flymake. Launches -`perl-flymake-command' (which see) and passes to its standard -input the contents of the current buffer. The output of this -command is analyzed for error and warning messages. +Perl backend for Flymake. +Launch `perl-flymake-command' (which see) and pass to its +standard input the contents of the current buffer. The output of +this command is analyzed for error and warning messages. \(fn REPORT-FN &rest ARGS)" nil nil) @@ -25596,10 +25730,10 @@ afterwards settable by these commands: Move southwest (sw) after insertion: \\[picture-movement-sw] Move southeast (se) after insertion: \\[picture-movement-se] - Move westnorthwest (wnw) after insertion: C-u \\[picture-movement-nw] - Move eastnortheast (ene) after insertion: C-u \\[picture-movement-ne] - Move westsouthwest (wsw) after insertion: C-u \\[picture-movement-sw] - Move eastsoutheast (ese) after insertion: C-u \\[picture-movement-se] + Move westnorthwest (wnw) after insertion: \\[universal-argument] \\[picture-movement-nw] + Move eastnortheast (ene) after insertion: \\[universal-argument] \\[picture-movement-ne] + Move westsouthwest (wsw) after insertion: \\[universal-argument] \\[picture-movement-sw] + Move eastsoutheast (ese) after insertion: \\[universal-argument] \\[picture-movement-se] The current direction is displayed in the mode line. The initial direction is right. Whitespace is inserted and tabs are changed to @@ -25826,7 +25960,7 @@ For more information, type \\[pr-interface-help]. Preview directory using ghostview. Interactively, the command prompts for N-UP printing number, a directory, a -file name regexp for matching and, when you use a prefix argument (C-u), the +file name regexp for matching and, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of saving it in a temporary file. @@ -25845,7 +25979,7 @@ See also documentation for `pr-list-directory'. Print directory using PostScript through ghostscript. Interactively, the command prompts for N-UP printing number, a directory, a -file name regexp for matching and, when you use a prefix argument (C-u), the +file name regexp for matching and, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of saving it in a temporary file. @@ -25864,7 +25998,7 @@ See also documentation for `pr-list-directory'. Print directory using PostScript printer. Interactively, the command prompts for N-UP printing number, a directory, a -file name regexp for matching and, when you use a prefix argument (C-u), the +file name regexp for matching and, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of saving it in a temporary file. @@ -25885,7 +26019,7 @@ Print directory using PostScript printer or through ghostscript. It depends on `pr-print-using-ghostscript'. Interactively, the command prompts for N-UP printing number, a directory, a -file name regexp for matching and, when you use a prefix argument (C-u), the +file name regexp for matching and, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of saving it in a temporary file. @@ -25904,7 +26038,7 @@ See also documentation for `pr-list-directory'. Preview buffer using ghostview. Interactively, the command prompts for N-UP printing number and, when you use a -prefix argument (C-u), the command prompts the user for a file name, and saves +prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of saving it in a temporary file. Noninteractively, if N-UP is nil, prompts for N-UP printing number. The @@ -25918,7 +26052,7 @@ with that name. If FILENAME is t, prompts for a file name. Print buffer using PostScript through ghostscript. Interactively, the command prompts for N-UP printing number and, when you use a -prefix argument (C-u), the command prompts the user for a file name, and saves +prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of sending it to the printer. Noninteractively, if N-UP is nil, prompts for N-UP printing number. The @@ -25932,7 +26066,7 @@ that name. If FILENAME is t, prompts for a file name. Print buffer using PostScript printer. Interactively, the command prompts for N-UP printing number and, when you use a -prefix argument (C-u), the command prompts the user for a file name, and saves +prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of sending it to the printer. Noninteractively, if N-UP is nil, prompts for N-UP printing number. The @@ -25948,7 +26082,7 @@ Print buffer using PostScript printer or through ghostscript. It depends on `pr-print-using-ghostscript'. Interactively, the command prompts for N-UP printing number and, when you use a -prefix argument (C-u), the command prompts the user for a file name, and saves +prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the PostScript image in that file instead of sending it to the printer. Noninteractively, if N-UP is nil, prompts for N-UP printing number. The @@ -26064,7 +26198,7 @@ Print major mode using text printer." t nil) (autoload 'pr-despool-preview "printing" "\ Preview spooled PostScript. -Interactively, when you use a prefix argument (C-u), the command prompts the +Interactively, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the spooled PostScript image in that file instead of saving it in a temporary file. @@ -26077,7 +26211,7 @@ PostScript image in a file with that name. (autoload 'pr-despool-using-ghostscript "printing" "\ Print spooled PostScript using ghostscript. -Interactively, when you use a prefix argument (C-u), the command prompts the +Interactively, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the spooled PostScript image in that file instead of sending it to the printer. @@ -26090,7 +26224,7 @@ image in a file with that name. (autoload 'pr-despool-print "printing" "\ Send the spooled PostScript to the printer. -Interactively, when you use a prefix argument (C-u), the command prompts the +Interactively, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the spooled PostScript image in that file instead of sending it to the printer. @@ -26103,7 +26237,7 @@ image in a file with that name. (autoload 'pr-despool-ps-print "printing" "\ Send the spooled PostScript to the printer or use ghostscript to print it. -Interactively, when you use a prefix argument (C-u), the command prompts the +Interactively, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a file name, and saves the spooled PostScript image in that file instead of sending it to the printer. @@ -26142,7 +26276,7 @@ Send PostScript file FILENAME to printer or use ghostscript to print it. Process a PostScript file IFILENAME and send it to printer. Interactively, the command prompts for N-UP printing number, for an input -PostScript file IFILENAME and, when you use a prefix argument (C-u), the +PostScript file IFILENAME and, when you use a prefix argument (\\[universal-argument]), the command prompts the user for an output PostScript file name OFILENAME, and saves the PostScript image in that file instead of sending it to the printer. @@ -26267,22 +26401,22 @@ printed using `pr-ps-mode-ps-print'. Interactively, you have the following situations: - M-x pr-ps-fast-fire RET + \\[pr-ps-fast-fire] The command prompts the user for a N-UP value and printing will immediately be done using the current active printer. - C-u M-x pr-ps-fast-fire RET - C-u 0 M-x pr-ps-fast-fire RET + \\[universal-argument] \\[pr-ps-fast-fire] + \\[universal-argument] 0 \\[pr-ps-fast-fire] The command prompts the user for a N-UP value and also for a current PostScript printer, then printing will immediately be done using the new current active printer. - C-u 1 M-x pr-ps-fast-fire RET + \\[universal-argument] 1 \\[pr-ps-fast-fire] The command prompts the user for a N-UP value and also for a file name, and saves the PostScript image in that file instead of sending it to the printer. - C-u 2 M-x pr-ps-fast-fire RET + \\[universal-argument] 2 \\[pr-ps-fast-fire] The command prompts the user for a N-UP value, then for a current PostScript printer and, finally, for a file name. Then change the active printer to that chosen by user and saves the PostScript image in @@ -26327,7 +26461,7 @@ Also if the current major-mode is defined in `pr-mode-alist', the settings in `pr-mode-alist' will be used, that is, the current buffer or region will be printed using `pr-txt-mode'. -Interactively, when you use a prefix argument (C-u), the command prompts the +Interactively, when you use a prefix argument (\\[universal-argument]), the command prompts the user for a new active text printer. Noninteractively, the argument SELECT-PRINTER is treated as follows: @@ -26405,7 +26539,7 @@ Open profile FILENAME. ;;;### (autoloads nil "project" "progmodes/project.el" (0 0 0 0)) ;;; Generated autoloads from progmodes/project.el -(push (purecopy '(project 0 6 1)) package--builtin-versions) +(push (purecopy '(project 0 7 1)) package--builtin-versions) (autoload 'project-current "project" "\ Return the project instance in DIRECTORY, defaulting to `default-directory'. @@ -26426,7 +26560,7 @@ of the project instance object. \(fn &optional MAYBE-PROMPT DIRECTORY)" nil nil) -(defvar project-prefix-map (let ((map (make-sparse-keymap))) (define-key map "!" 'project-shell-command) (define-key map "&" 'project-async-shell-command) (define-key map "f" 'project-find-file) (define-key map "F" 'project-or-external-find-file) (define-key map "b" 'project-switch-to-buffer) (define-key map "s" 'project-shell) (define-key map "d" 'project-dired) (define-key map "v" 'project-vc-dir) (define-key map "c" 'project-compile) (define-key map "e" 'project-eshell) (define-key map "k" 'project-kill-buffers) (define-key map "p" 'project-switch-project) (define-key map "g" 'project-find-regexp) (define-key map "G" 'project-or-external-find-regexp) (define-key map "r" 'project-query-replace-regexp) (define-key map "x" 'project-execute-extended-command) map) "\ +(defvar project-prefix-map (let ((map (make-sparse-keymap))) (define-key map "!" 'project-shell-command) (define-key map "&" 'project-async-shell-command) (define-key map "f" 'project-find-file) (define-key map "F" 'project-or-external-find-file) (define-key map "b" 'project-switch-to-buffer) (define-key map "s" 'project-shell) (define-key map "d" 'project-find-dir) (define-key map "D" 'project-dired) (define-key map "v" 'project-vc-dir) (define-key map "c" 'project-compile) (define-key map "e" 'project-eshell) (define-key map "k" 'project-kill-buffers) (define-key map "p" 'project-switch-project) (define-key map "g" 'project-find-regexp) (define-key map "G" 'project-or-external-find-regexp) (define-key map "r" 'project-query-replace-regexp) (define-key map "x" 'project-execute-extended-command) map) "\ Keymap for project commands.") (define-key ctl-x-map "p" project-prefix-map) @@ -26478,14 +26612,17 @@ pattern to search for. (autoload 'project-find-file "project" "\ Visit a file (with completion) in the current project. -The completion default is the filename at point, determined by -`thing-at-point' (whether such file exists or not)." t nil) +The filename at point (determined by `thing-at-point'), if any, +is available as part of \"future history\"." t nil) (autoload 'project-or-external-find-file "project" "\ Visit a file (with completion) in the current project or external roots. -The completion default is the filename at point, determined by -`thing-at-point' (whether such file exists or not)." t nil) +The filename at point (determined by `thing-at-point'), if any, +is available as part of \"future history\"." t nil) + +(autoload 'project-find-dir "project" "\ +Start Dired in a directory inside the current project." t nil) (autoload 'project-dired "project" "\ Start Dired in the current project's root." t nil) @@ -26528,8 +26665,8 @@ command \\[fileloop-continue]. (autoload 'project-query-replace-regexp "project" "\ Query-replace REGEXP in all the files of the project. Stops when a match is found and prompts for whether to replace it. -If you exit the query-replace, you can later continue the query-replace -loop using the command \\[fileloop-continue]. +If you exit the `query-replace', you can later continue the +`query-replace' loop using the command \\[fileloop-continue]. \(fn FROM TO)" t nil) @@ -26586,9 +26723,10 @@ interactively. (autoload 'project-remember-project "project" "\ Add project PR to the front of the project list. -Save the result in `project-list-file' if the list of projects has changed. +Save the result in `project-list-file' if the list of projects +has changed, and NO-WRITE is nil. -\(fn PR)" nil nil) +\(fn PR &optional NO-WRITE)" nil nil) (autoload 'project-forget-project "project" "\ Remove directory PROJECT-ROOT from the project list. @@ -26924,9 +27062,11 @@ If EXTENSION is any other symbol, it is ignored. (autoload 'pulse-momentary-highlight-one-line "pulse" "\ Highlight the line around POINT, unhighlighting before next command. +If POINT is nil or missing, the current point is used instead. + Optional argument FACE specifies the face to do the highlighting. -\(fn POINT &optional FACE)" nil nil) +\(fn &optional POINT FACE)" nil nil) (autoload 'pulse-momentary-highlight-region "pulse" "\ Highlight between START and END, unhighlighting before next command. @@ -27097,7 +27237,7 @@ conversion region is active. It is an alist of single key character vs. corresponding command to be called. If SIMPLE is non-nil, then we do not alter the meanings of -commands such as C-f, C-b, C-n, C-p and TAB; they are treated as +commands such as \\[forward-char], \\[backward-char], \\[next-line], \\[previous-line] and \\[indent-for-tab-command]; they are treated as non-Quail commands. \(fn NAME LANGUAGE TITLE &optional GUIDANCE DOCSTRING TRANSLATION-KEYS FORGET-LAST-SELECTION DETERMINISTIC KBD-TRANSLATE SHOW-LAYOUT CREATE-DECODE-MAP MAXIMUM-SHORTEST OVERLAY-PLIST UPDATE-TRANSLATION-FUNCTION CONVERSION-KEYS SIMPLE)" nil nil) @@ -27997,6 +28137,7 @@ or call the function `repeat-mode'.") Toggle Repeat mode. When Repeat mode is enabled, and the command symbol has the property named `repeat-map', this map is activated temporarily for the next command. +See `describe-repeat-maps' for a list of all repeatable command. This is a minor mode. If called interactively, toggle the `Repeat mode' mode. If the prefix argument is positive, enable the mode, and @@ -29970,7 +30111,7 @@ Like `mail' command, but display mail buffer in another frame. ;;;### (autoloads nil "seq" "emacs-lisp/seq.el" (0 0 0 0)) ;;; Generated autoloads from emacs-lisp/seq.el -(push (purecopy '(seq 2 22)) package--builtin-versions) +(push (purecopy '(seq 2 23)) package--builtin-versions) (autoload 'seq-subseq "seq" "\ Return the sequence of elements of SEQUENCE from START to END. @@ -30056,14 +30197,14 @@ TESTFN is used to compare elements, or `equal' if TESTFN is nil. \(fn SEQUENCE &optional TESTFN)" nil nil) -(autoload 'seq-intersection "seq" "\ -Return a list of the elements that appear in both SEQUENCE1 and SEQUENCE2. +(autoload 'seq-union "seq" "\ +Return a list of all elements that appear in either SEQUENCE1 or SEQUENCE2. Equality is defined by TESTFN if non-nil or by `equal' if nil. \(fn SEQUENCE1 SEQUENCE2 &optional TESTFN)" nil nil) -(autoload 'seq-difference "seq" "\ -Return a list of the elements that appear in SEQUENCE1 but not in SEQUENCE2. +(autoload 'seq-intersection "seq" "\ +Return a list of the elements that appear in both SEQUENCE1 and SEQUENCE2. Equality is defined by TESTFN if non-nil or by `equal' if nil. \(fn SEQUENCE1 SEQUENCE2 &optional TESTFN)" nil nil) @@ -30081,6 +30222,12 @@ SEQUENCE must be a sequence of numbers or markers. \(fn SEQUENCE)" nil nil) +(autoload 'seq-random-elt "seq" "\ +Return a random element from SEQUENCE. +Signal an error if SEQUENCE is empty. + +\(fn SEQUENCE)" nil nil) + (register-definition-prefixes "seq" '("seq-")) ;;;*** @@ -30256,10 +30403,11 @@ can also view with a browser to see what happens: have

Very Major Headlines

through
Very Minor Headlines

Parts can be separated with horizontal rules. -

Paragraphs only need an opening tag. Line breaks and multiple spaces are -ignored unless the text is

preformatted.
Text can be marked as -bold, italic or underlined using the normal M-o -or Edit/Text Properties/Face commands. +

Paragraphs only need an opening tag. Line breaks and multiple +spaces are ignored unless the text is

preformatted.
+Text can be marked as bold, italic or +underlined using the facemenu M-o or Edit/Text +Properties/Face commands. Pages can have
named points and can link other points to them with see also somename. In the same way \\[tetris-start-game] Start a new game of Tetris \\[tetris-end-game] Terminate the current game @@ -33710,7 +33862,7 @@ and also to be turned into Info files with \\[makeinfo-buffer] or the `makeinfo' program. These files must be written in a very restricted and modified version of TeX input format. - Editing commands are like text-mode except that the syntax table is + Editing commands are like `text-mode' except that the syntax table is set up so expression commands skip Texinfo bracket groups. To see what the Info version of a region of the Texinfo file will look like, use \\[makeinfo-region], which runs `makeinfo' on the current region. @@ -33738,15 +33890,15 @@ updating menus and node pointers. These functions Here are the functions: - texinfo-update-node \\[texinfo-update-node] - texinfo-every-node-update \\[texinfo-every-node-update] - texinfo-sequential-node-update + `texinfo-update-node' \\[texinfo-update-node] + `texinfo-every-node-update' \\[texinfo-every-node-update] + `texinfo-sequential-node-update' - texinfo-make-menu \\[texinfo-make-menu] - texinfo-all-menus-update \\[texinfo-all-menus-update] - texinfo-master-menu + `texinfo-make-menu' \\[texinfo-make-menu] + `texinfo-all-menus-update' \\[texinfo-all-menus-update] + `texinfo-master-menu' - texinfo-indent-menu-description (column &optional region-p) + `texinfo-indent-menu-description' (column &optional region-p) The `texinfo-column-for-description' variable specifies the column to which menu descriptions are indented. @@ -33862,6 +34014,20 @@ a symbol as a valid THING. \(fn THING &optional NO-PROPERTIES)" nil nil) +(autoload 'bounds-of-thing-at-mouse "thingatpt" "\ +Determine start and end locations for THING at mouse click given by EVENT. +Like `bounds-of-thing-at-point', but tries to use the position in EVENT +where the mouse button is clicked to find the thing nearby. + +\(fn EVENT THING)" nil nil) + +(autoload 'thing-at-mouse "thingatpt" "\ +Return the THING at mouse click specified by EVENT. +Like `thing-at-point', but tries to use the position in EVENT +where the mouse button is clicked to find the thing nearby. + +\(fn EVENT THING &optional NO-PROPERTIES)" nil nil) + (autoload 'sexp-at-point "thingatpt" "\ Return the sexp at point, or nil if none is found." nil nil) @@ -33973,15 +34139,17 @@ Compose Tibetan text the region BEG and END. (autoload 'tibetan-decompose-region "tibet-util" "\ Decompose Tibetan text in the region FROM and TO. -This is different from decompose-region because precomposed Tibetan characters -are decomposed into normal Tibetan character sequences. +This is different from `decompose-region' because precomposed +Tibetan characters are decomposed into normal Tibetan character +sequences. \(fn FROM TO)" t nil) (autoload 'tibetan-decompose-string "tibet-util" "\ Decompose Tibetan string STR. -This is different from decompose-string because precomposed Tibetan characters -are decomposed into normal Tibetan character sequences. +This is different from `decompose-string' because precomposed +Tibetan characters are decomposed into normal Tibetan character +sequences. \(fn STR)" nil nil) @@ -33991,7 +34159,7 @@ See also the documentation of the function `tibetan-decompose-region'." t nil) (autoload 'tibetan-compose-buffer "tibet-util" "\ Composes Tibetan character components in the buffer. -See also docstring of the function tibetan-compose-region." t nil) +See also docstring of the function `tibetan-compose-region'." t nil) (autoload 'tibetan-post-read-conversion "tibet-util" "\ @@ -34161,7 +34329,7 @@ point. (autoload 'emacs-init-time "time" "\ Return a string giving the duration of the Emacs initialization. -FORMAT is a string to format the result, using `format'. If nil, +FORMAT is a string to format the result, using `format'. If nil, the default format \"%f seconds\" is used. \(fn &optional FORMAT)" t nil) @@ -35445,8 +35613,7 @@ how long to wait for a response before giving up. ;;; Generated autoloads from url/url-auth.el (autoload 'url-get-authentication "url-auth" "\ -Return an authorization string suitable for use in the WWW-Authenticate -header in an HTTP/1.0 request. +Return authorization string for the WWW-Authenticate header in HTTP/1.0 request. URL is the url you are requesting authorization to. This can be either a string representing the URL, or the parsed representation returned by @@ -36056,7 +36223,7 @@ Given a QUERY in the form: \(This is the same format as produced by `url-parse-query-string') This will return a string -\"key1=val1&key2=val2&key3=val1&key3=val2&key4&key5\". Keys may +\"key1=val1&key2=val2&key3=val1&key3=val2&key4&key5\". Keys may be strings or symbols; if they are symbols, the symbol name will be used. @@ -36504,13 +36671,13 @@ Show the change log for BRANCH root in a window. \(fn BRANCH)" t nil) (autoload 'vc-log-incoming "vc" "\ -Show a log of changes that will be received with a pull operation from REMOTE-LOCATION. +Show log of changes that will be received with pull from REMOTE-LOCATION. When called interactively with a prefix argument, prompt for REMOTE-LOCATION. \(fn &optional REMOTE-LOCATION)" t nil) (autoload 'vc-log-outgoing "vc" "\ -Show a log of changes that will be sent with a push operation to REMOTE-LOCATION. +Show log of changes that will be sent with a push operation to REMOTE-LOCATION. When called interactively with a prefix argument, prompt for REMOTE-LOCATION. \(fn &optional REMOTE-LOCATION)" t nil) @@ -36741,7 +36908,7 @@ These are the commands available for use in the file status buffer: \(fn DIR &optional BACKEND)" t nil) (autoload 'vc-dir-bookmark-jump "vc-dir" "\ -Provides the bookmark-jump behavior for a `vc-dir' buffer. +Provide the `bookmark-jump' behavior for a `vc-dir' buffer. This implements the `handler' function interface for the record type returned by `vc-dir-bookmark-make-record'. @@ -36964,7 +37131,7 @@ Key bindings: ;;;### (autoloads nil "verilog-mode" "progmodes/verilog-mode.el" ;;;;;; (0 0 0 0)) ;;; Generated autoloads from progmodes/verilog-mode.el -(push (purecopy '(verilog-mode 2021 4 12 188864585)) package--builtin-versions) +(push (purecopy '(verilog-mode 2021 9 23 89128420)) package--builtin-versions) (autoload 'verilog-mode "verilog-mode" "\ Major mode for editing Verilog code. @@ -37077,9 +37244,12 @@ Some other functions are: \\[verilog-sk-repeat] Insert a repeat (..) begin .. end block. \\[verilog-sk-specify] Insert a specify .. endspecify block. \\[verilog-sk-task] Insert a task .. begin .. end endtask block. - \\[verilog-sk-while] Insert a while (...) begin .. end block, prompting for details. - \\[verilog-sk-casex] Insert a casex (...) item: begin.. end endcase block, prompting for details. - \\[verilog-sk-casez] Insert a casez (...) item: begin.. end endcase block, prompting for details. + \\[verilog-sk-while] Insert a while (...) begin .. end block, + prompting for details. + \\[verilog-sk-casex] Insert a casex (...) item: begin.. end endcase block, + prompting for details. + \\[verilog-sk-casez] Insert a casez (...) item: begin.. end endcase block, + prompting for details. \\[verilog-sk-if] Insert an if (..) begin .. end block. \\[verilog-sk-else-if] Insert an else if (..) begin .. end block. \\[verilog-sk-comment] Insert a comment block. @@ -37470,7 +37640,7 @@ Usage: `vhdl-project-alist'. - SPECIAL MENUES: + SPECIAL MENUS: As an alternative to the speedbar, an index menu can be added (set option `vhdl-index-menu' to non-nil) or made accessible as a mouse menu (e.g. add \"(global-set-key [S-down-mouse-3] \\='imenu)\" to your start-up @@ -37978,7 +38148,7 @@ Toggle Viper on/off. If Viper is enabled, turn it off. Otherwise, turn it on." t nil) (autoload 'viper-mode "viper" "\ -Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Top'." t nil) +Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Top'." t nil) (register-definition-prefixes "viper" '("set-viper-state-in-major-mode" "this-major-mode-requires-vi-state" "viper-")) @@ -38268,6 +38438,9 @@ disabled. See also `whitespace-style', `whitespace-newline' and `whitespace-display-mappings'. +This mode uses a number of faces to visualize the whitespace; see +the customization group `whitespace' for details. + \(fn &optional ARG)" t nil) (autoload 'whitespace-newline-mode "whitespace" "\ @@ -38849,28 +39022,28 @@ Default value of MODIFIERS is `shift-meta'. (autoload 'windmove-delete-left "windmove" "\ Delete the window to the left of the current one. -If prefix ARG is `C-u', delete the selected window and +If prefix ARG is \\[universal-argument], delete the selected window and select the window that was to the left of the current one. \(fn &optional ARG)" t nil) (autoload 'windmove-delete-up "windmove" "\ Delete the window above the current one. -If prefix ARG is `C-u', delete the selected window and +If prefix ARG is \\[universal-argument], delete the selected window and select the window that was above the current one. \(fn &optional ARG)" t nil) (autoload 'windmove-delete-right "windmove" "\ Delete the window to the right of the current one. -If prefix ARG is `C-u', delete the selected window and +If prefix ARG is \\[universal-argument], delete the selected window and select the window that was to the right of the current one. \(fn &optional ARG)" t nil) (autoload 'windmove-delete-down "windmove" "\ Delete the window below the current one. -If prefix ARG is `C-u', delete the selected window and +If prefix ARG is \\[universal-argument], delete the selected window and select the window that was below the current one. \(fn &optional ARG)" t nil) @@ -38881,8 +39054,8 @@ Keys are bound to commands that delete windows in the specified direction. Keybindings are of the form PREFIX MODIFIERS-{left,right,up,down}, where PREFIX is a prefix key and MODIFIERS is either a list of modifiers or a single modifier. -If PREFIX is `none', no prefix is used. If MODIFIERS is `none', the keybindings -are directly bound to the arrow keys. +If PREFIX is `none', no prefix is used. If MODIFIERS is `none', +the keybindings are directly bound to the arrow keys. Default value of PREFIX is `C-x' and MODIFIERS is `shift'. \(fn &optional PREFIX MODIFIERS)" t nil) @@ -39106,7 +39279,7 @@ If LIMIT is non-nil, then do not consider characters beyond LIMIT. ;;;### (autoloads nil "xref" "progmodes/xref.el" (0 0 0 0)) ;;; Generated autoloads from progmodes/xref.el -(push (purecopy '(xref 1 1 0)) package--builtin-versions) +(push (purecopy '(xref 1 2 2)) package--builtin-versions) (autoload 'xref-find-backend "xref" nil nil nil) @@ -39165,6 +39338,8 @@ This command is intended to be bound to a mouse event. (autoload 'xref-find-apropos "xref" "\ Find all meaningful symbols that match PATTERN. The argument has the same meaning as in `apropos'. +See `tags-apropos-additional-actions' for how to augment the +output of this command when the backend is etags. \(fn PATTERN)" t nil) (define-key esc-map "." #'xref-find-definitions) @@ -39198,6 +39373,9 @@ Find all matches for REGEXP in FILES. Return a list of xref values. FILES must be a list of absolute file names. +See `xref-search-program' and `xref-search-program-alist' for how +to control which program to use when looking for matches. + \(fn REGEXP FILES)" nil nil) (register-definition-prefixes "xref" '("xref-")) @@ -39354,48 +39532,49 @@ Zone out, completely." t nil) ;;;;;; "emacs-lisp/lisp-mode.el" "emacs-lisp/lisp.el" "emacs-lisp/macroexp.el" ;;;;;; "emacs-lisp/map-ynp.el" "emacs-lisp/nadvice.el" "emacs-lisp/syntax.el" ;;;;;; "emacs-lisp/timer.el" "env.el" "epa-hook.el" "erc/erc-autoaway.el" -;;;;;; "erc/erc-button.el" "erc/erc-capab.el" "erc/erc-dcc.el" "erc/erc-desktop-notifications.el" -;;;;;; "erc/erc-ezbounce.el" "erc/erc-fill.el" "erc/erc-identd.el" -;;;;;; "erc/erc-imenu.el" "erc/erc-join.el" "erc/erc-list.el" "erc/erc-log.el" -;;;;;; "erc/erc-match.el" "erc/erc-menu.el" "erc/erc-netsplit.el" -;;;;;; "erc/erc-notify.el" "erc/erc-page.el" "erc/erc-pcomplete.el" -;;;;;; "erc/erc-replace.el" "erc/erc-ring.el" "erc/erc-services.el" -;;;;;; "erc/erc-sound.el" "erc/erc-speedbar.el" "erc/erc-spelling.el" -;;;;;; "erc/erc-stamp.el" "erc/erc-status-sidebar.el" "erc/erc-track.el" -;;;;;; "erc/erc-truncate.el" "erc/erc-xdcc.el" "eshell/em-alias.el" -;;;;;; "eshell/em-banner.el" "eshell/em-basic.el" "eshell/em-cmpl.el" -;;;;;; "eshell/em-dirs.el" "eshell/em-glob.el" "eshell/em-hist.el" -;;;;;; "eshell/em-ls.el" "eshell/em-pred.el" "eshell/em-prompt.el" -;;;;;; "eshell/em-rebind.el" "eshell/em-script.el" "eshell/em-smart.el" -;;;;;; "eshell/em-term.el" "eshell/em-tramp.el" "eshell/em-unix.el" -;;;;;; "eshell/em-xtra.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/charscript.el" -;;;;;; "international/cp51932.el" "international/eucjp-ms.el" "international/iso-transl.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" "language/indian.el" -;;;;;; "language/japanese.el" "language/khmer.el" "language/korean.el" -;;;;;; "language/lao.el" "language/misc-lang.el" "language/romanian.el" -;;;;;; "language/sinhala.el" "language/slovak.el" "language/tai-viet.el" -;;;;;; "language/thai.el" "language/tibetan.el" "language/utf-8-lang.el" -;;;;;; "language/vietnamese.el" "ldefs-boot.el" "leim/ja-dic/ja-dic.el" -;;;;;; "leim/leim-list.el" "leim/quail/4Corner.el" "leim/quail/ARRAY30.el" -;;;;;; "leim/quail/CCDOSPY.el" "leim/quail/CTLau-b5.el" "leim/quail/CTLau.el" -;;;;;; "leim/quail/ECDICT.el" "leim/quail/ETZY.el" "leim/quail/PY-b5.el" -;;;;;; "leim/quail/PY.el" "leim/quail/Punct-b5.el" "leim/quail/Punct.el" -;;;;;; "leim/quail/QJ-b5.el" "leim/quail/QJ.el" "leim/quail/SW.el" -;;;;;; "leim/quail/TONEPY.el" "leim/quail/ZIRANMA.el" "leim/quail/ZOZY.el" -;;;;;; "leim/quail/arabic.el" "leim/quail/cham.el" "leim/quail/compose.el" -;;;;;; "leim/quail/croatian.el" "leim/quail/cyril-jis.el" "leim/quail/cyrillic.el" -;;;;;; "leim/quail/czech.el" "leim/quail/georgian.el" "leim/quail/greek.el" -;;;;;; "leim/quail/hanja-jis.el" "leim/quail/hanja.el" "leim/quail/hanja3.el" -;;;;;; "leim/quail/hebrew.el" "leim/quail/ipa-praat.el" "leim/quail/latin-alt.el" -;;;;;; "leim/quail/latin-ltx.el" "leim/quail/latin-post.el" "leim/quail/latin-pre.el" -;;;;;; "leim/quail/persian.el" "leim/quail/programmer-dvorak.el" +;;;;;; "erc/erc-button.el" "erc/erc-capab.el" "erc/erc-compat.el" +;;;;;; "erc/erc-dcc.el" "erc/erc-desktop-notifications.el" "erc/erc-ezbounce.el" +;;;;;; "erc/erc-fill.el" "erc/erc-identd.el" "erc/erc-imenu.el" +;;;;;; "erc/erc-join.el" "erc/erc-list.el" "erc/erc-log.el" "erc/erc-match.el" +;;;;;; "erc/erc-menu.el" "erc/erc-netsplit.el" "erc/erc-notify.el" +;;;;;; "erc/erc-page.el" "erc/erc-pcomplete.el" "erc/erc-replace.el" +;;;;;; "erc/erc-ring.el" "erc/erc-services.el" "erc/erc-sound.el" +;;;;;; "erc/erc-speedbar.el" "erc/erc-spelling.el" "erc/erc-stamp.el" +;;;;;; "erc/erc-status-sidebar.el" "erc/erc-track.el" "erc/erc-truncate.el" +;;;;;; "erc/erc-xdcc.el" "eshell/em-alias.el" "eshell/em-banner.el" +;;;;;; "eshell/em-basic.el" "eshell/em-cmpl.el" "eshell/em-dirs.el" +;;;;;; "eshell/em-glob.el" "eshell/em-hist.el" "eshell/em-ls.el" +;;;;;; "eshell/em-pred.el" "eshell/em-prompt.el" "eshell/em-rebind.el" +;;;;;; "eshell/em-script.el" "eshell/em-smart.el" "eshell/em-term.el" +;;;;;; "eshell/em-tramp.el" "eshell/em-unix.el" "eshell/em-xtra.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/charscript.el" +;;;;;; "international/cp51932.el" "international/emoji-zwj.el" "international/eucjp-ms.el" +;;;;;; "international/iso-transl.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" +;;;;;; "language/indian.el" "language/japanese.el" "language/khmer.el" +;;;;;; "language/korean.el" "language/lao.el" "language/misc-lang.el" +;;;;;; "language/romanian.el" "language/sinhala.el" "language/slovak.el" +;;;;;; "language/tai-viet.el" "language/thai.el" "language/tibetan.el" +;;;;;; "language/utf-8-lang.el" "language/vietnamese.el" "ldefs-boot.el" +;;;;;; "leim/ja-dic/ja-dic.el" "leim/leim-list.el" "leim/quail/4Corner.el" +;;;;;; "leim/quail/ARRAY30.el" "leim/quail/CCDOSPY.el" "leim/quail/CTLau-b5.el" +;;;;;; "leim/quail/CTLau.el" "leim/quail/ECDICT.el" "leim/quail/ETZY.el" +;;;;;; "leim/quail/PY-b5.el" "leim/quail/PY.el" "leim/quail/Punct-b5.el" +;;;;;; "leim/quail/Punct.el" "leim/quail/QJ-b5.el" "leim/quail/QJ.el" +;;;;;; "leim/quail/SW.el" "leim/quail/TONEPY.el" "leim/quail/ZIRANMA.el" +;;;;;; "leim/quail/ZOZY.el" "leim/quail/arabic.el" "leim/quail/cham.el" +;;;;;; "leim/quail/compose.el" "leim/quail/croatian.el" "leim/quail/cyril-jis.el" +;;;;;; "leim/quail/cyrillic.el" "leim/quail/czech.el" "leim/quail/georgian.el" +;;;;;; "leim/quail/greek.el" "leim/quail/hanja-jis.el" "leim/quail/hanja.el" +;;;;;; "leim/quail/hanja3.el" "leim/quail/hebrew.el" "leim/quail/ipa-praat.el" +;;;;;; "leim/quail/latin-alt.el" "leim/quail/latin-ltx.el" "leim/quail/latin-post.el" +;;;;;; "leim/quail/latin-pre.el" "leim/quail/persian.el" "leim/quail/programmer-dvorak.el" ;;;;;; "leim/quail/py-punct.el" "leim/quail/pypunct-b5.el" "leim/quail/quick-b5.el" ;;;;;; "leim/quail/quick-cns.el" "leim/quail/rfc1345.el" "leim/quail/sami.el" ;;;;;; "leim/quail/sgml-input.el" "leim/quail/slovak.el" "leim/quail/symbol-ksc.el" commit ad0798a395c172c8befdb5190c74bd7ab38df938 Author: Stefan Kangas Date: Fri Oct 1 15:09:31 2021 +0200 * etc/TODO: Add interactive mode tagging. diff --git a/etc/TODO b/etc/TODO index f92e43402b..d9149a521f 100644 --- a/etc/TODO +++ b/etc/TODO @@ -30,7 +30,7 @@ difficult to fix. Bugs with severity "minor" may be simpler, but this is not always true. * Simple tasks -These don't require much Emacs knowledge, they are suitable for anyone +These don't require much Emacs knowledge and are suitable for anyone from beginners to experts. ** Convert modes that use view-mode to be derived from special-mode instead @@ -52,6 +52,13 @@ things in their .emacs. ** See if other files can use generated-autoload-file (see eg ps-print) +** Do interactive mode tagging for commands +Change "(interactive)" to "(interactive nil foo-mode)" for command +completion purposes. Pick a major mode or ELisp library, and check +all interactive commands to see if they are only relevant in one +particular mode. This requires care as some commands might be useful +outside of the mode they were written for. + ** Write more tests Pick a fixed bug from the database, write a test case to make sure it stays fixed. Or pick your favorite programming major-mode, and write commit 879ef5b19ab1dd90284aef829ef306d56b4e5adb Author: Stefan Kangas Date: Fri Oct 1 15:00:29 2021 +0200 * etc/TODO: Rearrange to start with "Simple tasks". diff --git a/etc/TODO b/etc/TODO index 62b140a016..f92e43402b 100644 --- a/etc/TODO +++ b/etc/TODO @@ -29,81 +29,6 @@ are the ones we consider more important, but these also may be difficult to fix. Bugs with severity "minor" may be simpler, but this is not always true. -* Speed up Elisp execution - -** Speed up function calls -Change src/bytecode.c so that calls from byte-code functions to byte-code -functions don't go through Ffuncall/funcall_lambda/exec_byte_code but instead -stay within exec_byte_code. - -** Improve the byte-compiler to recognize immutable bindings -Recognize immutable (lexical) bindings and get rid of them if they're -used only once and/or they're bound to a constant expression. - -Such things aren't present in hand-written code, but macro expansion and -defsubst can often end up generating things like -(funcall (lambda (arg) (body)) actual) which then get optimized to -(let ((arg actual)) (body)) but should additionally get optimized further -when 'actual' is a constant/copyable expression. - -** Add an "indirect goto" byte-code -Such a byte-code can be used for local lambda expressions. -E.g. when you have code like - - (let ((foo (lambda (x) bar))) - (dosomething - (funcall foo toto) - (blabla (funcall foo titi)))) - -turn those 'funcalls' into jumps and their return into indirect jumps back. - -** Compile efficiently local recursive functions -Similar to the previous point, we should be able to handle something like - - (letrec ((loop () (blabla) (if (toto) (loop)))) - (loop)) - -which ideally should generate the same byte-code as - - (while (progn (blabla) (toto))) - -* Things that were planned for Emacs-24 - -** Concurrency -Including it as an "experimental" compile-time option sounds good. Of -course there might still be big questions around "which form of -concurrency" we'll want. - -** Better support for dynamic embedded graphics -I like this idea (my mpc.el code could use it for the volume widget), -though I wonder if the resulting efficiency will be sufficient. - -** Spread Semantic - -** Improve the "code snippets" support -Consolidate skeleton.el, tempo.el, and expand.el (any other?) and then -advertise/use/improve it. - -** Improve VC -Yes, there's a lot of work to be done there :-( - -** Random things that cross my mind right now that I'd like to see -Some of them from my local hacks, but it's not obvious at all whether -they'll make it. - -*** Prog-mode could/should provide a better fill-paragraph default -That default should use syntax-tables to recognize string/comment -boundaries. - -*** Provide more completion-at-point-functions -Make existing in-buffer completion use completion-at-point. - -*** "Functional" function-key-map -It would make it easy to add (and remove) mappings like -"FOO-mouse-4 -> FOO-scroll-down", "FOO-tab -> ?\FOO-\t", -"uppercase -> lowercase", "[fringe KEY...] -> [KEY]", -"H-FOO -> M-FOO", "C-x C-y FOO -> H-FOO", ... - * Simple tasks These don't require much Emacs knowledge, they are suitable for anyone from beginners to experts. @@ -219,6 +144,44 @@ https://lists.gnu.org/r/emacs-devel/2008-08/msg00456.html * Important features +** Speed up Elisp execution + +*** Speed up function calls +Change src/bytecode.c so that calls from byte-code functions to byte-code +functions don't go through Ffuncall/funcall_lambda/exec_byte_code but instead +stay within exec_byte_code. + +*** Improve the byte-compiler to recognize immutable bindings +Recognize immutable (lexical) bindings and get rid of them if they're +used only once and/or they're bound to a constant expression. + +Such things aren't present in hand-written code, but macro expansion and +defsubst can often end up generating things like +(funcall (lambda (arg) (body)) actual) which then get optimized to +(let ((arg actual)) (body)) but should additionally get optimized further +when 'actual' is a constant/copyable expression. + +*** Add an "indirect goto" byte-code +Such a byte-code can be used for local lambda expressions. +E.g. when you have code like + + (let ((foo (lambda (x) bar))) + (dosomething + (funcall foo toto) + (blabla (funcall foo titi)))) + +turn those 'funcalls' into jumps and their return into indirect jumps back. + +*** Compile efficiently local recursive functions +Similar to the previous point, we should be able to handle something like + + (letrec ((loop () (blabla) (if (toto) (loop)))) + (loop)) + +which ideally should generate the same byte-code as + + (while (progn (blabla) (toto))) + ** "Emacs as word processor" https://lists.gnu.org/r/emacs-devel/2013-11/msg00515.html rms writes: @@ -476,6 +439,15 @@ consistency checks that make sure the new code computes the same results as the old code. And once that works well, we can remove the old code and old fields. +** Better support for dynamic embedded graphics +I like this idea (my mpc.el code could use it for the volume widget), +though I wonder if the resulting efficiency will be sufficient. + +** Concurrency +Including it as an "experimental" compile-time option sounds good. Of +course there might still be big questions around "which form of +concurrency" we'll want. + ** FFI (foreign function interface) See eg https://lists.gnu.org/r/emacs-devel/2013-10/msg00246.html @@ -883,6 +855,32 @@ The idea is to add an "X" of some kind, that when clicked deletes the window associated with that modeline. https://lists.gnu.org/r/emacs-devel/2007-09/msg02416.html +** Improve the "code snippets" support +Consolidate skeleton.el, tempo.el, and expand.el (any other?) and then +advertise/use/improve it. + +** Improve VC +Yes, there's a lot of work to be done there :-( + +** Spread Semantic + +** Random things that crossed Stefan Monnier's mind for Emacs 24 +Stefan Monnier writes: "Some of them from my local hacks, but it's not +obvious at all whether they'll make it." + +*** Prog-mode could/should provide a better fill-paragraph default +That default should use syntax-tables to recognize string/comment +boundaries. + +*** Provide more completion-at-point-functions +Make existing in-buffer completion use completion-at-point. + +*** "Functional" function-key-map +It would make it easy to add (and remove) mappings like +"FOO-mouse-4 -> FOO-scroll-down", "FOO-tab -> ?\FOO-\t", +"uppercase -> lowercase", "[fringe KEY...] -> [KEY]", +"H-FOO -> M-FOO", "C-x C-y FOO -> H-FOO", ... + * Things to be done for specific packages or features ** NeXTstep port commit d73f0e96a7026808c01861f7525a2909279fc00d Author: Stefan Kangas Date: Fri Oct 1 14:04:04 2021 +0200 ; * etc/TODO: Move elpa.gnu.org items to the end. It makes no sense to have them before "easy" items intended for beginners, especially since we miss some things to make this happen. diff --git a/etc/TODO b/etc/TODO index 494bd6ba99..62b140a016 100644 --- a/etc/TODO +++ b/etc/TODO @@ -69,12 +69,12 @@ which ideally should generate the same byte-code as * Things that were planned for Emacs-24 -** concurrency +** Concurrency Including it as an "experimental" compile-time option sounds good. Of course there might still be big questions around "which form of concurrency" we'll want. -** better support for dynamic embedded graphics +** Better support for dynamic embedded graphics I like this idea (my mpc.el code could use it for the volume widget), though I wonder if the resulting efficiency will be sufficient. @@ -104,23 +104,6 @@ It would make it easy to add (and remove) mappings like "uppercase -> lowercase", "[fringe KEY...] -> [KEY]", "H-FOO -> M-FOO", "C-x C-y FOO -> H-FOO", ... -* Things related to elpa.gnu.org. - -** Move idlwave to elpa.gnu.org -Need to sync up the Emacs and external versions. -See - - -** Move Org mode to elpa.gnu.org -See - - -** Move verilog-mode to elpa.gnu.org -See - -** Move vhdl-mode to elpa.gnu.org -See - * Simple tasks These don't require much Emacs knowledge, they are suitable for anyone from beginners to experts. @@ -1753,6 +1736,26 @@ Add a standard button-class named "link", and make all other link-like button classes inherit from it. Set the default face of the "link" button class to the standard "link" face. +* Things related to elpa.gnu.org. + +We need to figure out how to best include GNU ELPA packages in the +Emacs tarball before doing any of the items below. + +** Move idlwave to elpa.gnu.org +Need to sync up the Emacs and external versions. +See + + +** Move Org mode to elpa.gnu.org +See + + +** Move verilog-mode to elpa.gnu.org +See + +** Move vhdl-mode to elpa.gnu.org +See + * Wishlist items ** Maybe replace etags.c with a Lisp implementation. commit a2a6c7abcbb5c2776ab5cdbb415df9ad5daa4e13 Author: Peter Münster Date: Fri Oct 1 14:49:28 2021 +0200 New command for unmarking all images in image-dired * lisp/image-dired.el (image-dired-unmark-all-marks): Remove marks from Dired buffer and update the view of the thumbnails (bug#50920). diff --git a/etc/NEWS b/etc/NEWS index 18eb248b26..3892ba2c79 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -54,6 +54,13 @@ This change also affects 'cl-macrolet', 'cl-flet*' and * Changes in Specialized Modes and Packages in Emacs 29.1 +** image-dired + +--- +*** New command for the thumbnail buffer. +The new command 'image-dired-unmark-all-marks' has been added with a +binding in the menu. + * New Modes and Packages in Emacs 29.1 diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 3ca47300a9..ec3f988bfb 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -1433,6 +1433,14 @@ dired." (interactive) (image-dired-modify-mark-on-thumb-original-file 'toggle)) +(defun image-dired-unmark-all-marks () + "Remove all marks from all files. +Do this in the Dired buffer and update this thumbnail buffer." + (interactive) + (with-current-buffer (image-dired-associated-dired-buffer) + (dired-unmark-all-marks)) + (image-dired-thumb-update-marks)) + (defun image-dired-jump-original-dired-buffer () "Jump to the dired buffer associated with the current image file. You probably want to use this together with @@ -1536,6 +1544,7 @@ You probably want to use this together with ["Quit" quit-window] ["Delete thumbnail from buffer" image-dired-delete-char] ["Delete marked images" image-dired-delete-marked] + ["Unmark all marks" image-dired-unmark-all-marks] ["Remove tag from current or marked thumbnails" image-dired-tag-thumbnail-remove] ["Tag current or marked thumbnails" image-dired-tag-thumbnail] commit 6c0824f711906cd0413b14d7dfc35a5bf411eb52 Author: Alexandre Duret-Lutz Date: Wed Sep 22 22:28:28 2021 +0200 default role for attendees is REQ-PARTICIPANT * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event--get-attendee-names, gnus-icalendar-event-from-ical): When the ROLE property is missing from an ATTENDEE line, follow RFC5546 and default to REQ-PARTICIPANT. diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el index 348da12db1..a2ae2a9668 100644 --- a/lisp/gnus/gnus-icalendar.el +++ b/lisp/gnus/gnus-icalendar.el @@ -194,7 +194,9 @@ (caddr event)))) (cl-labels - ((attendee-role (prop) (plist-get (cadr prop) 'ROLE)) + ((attendee-role (prop) + ;; RFC5546: default ROLE is REQ-PARTICIPANT + (or (plist-get (cadr prop) 'ROLE) "REQ-PARTICIPANT")) (attendee-name (prop) (or (plist-get (cadr prop) 'CN) @@ -225,7 +227,8 @@ (gnus-icalendar-event--find-attendee ical attendee-name-or-email))) (attendee-names (gnus-icalendar-event--get-attendee-names ical)) - (role (plist-get (cadr attendee) 'ROLE)) + ;; RFC5546: default ROLE is REQ-PARTICIPANT + (role (or (plist-get (cadr attendee) 'ROLE) "REQ-PARTICIPANT")) (participation-type (pcase role ("REQ-PARTICIPANT" 'required) ("OPT-PARTICIPANT" 'optional) commit 16e51ad6bfa9275ebf9fc2df49eb724099ca2764 Author: Alexandre Duret-Lutz Date: Wed Sep 22 16:38:42 2021 +0200 allow party crashers to respond to ical events If an ical invitation is sent to a mailing list, the recipients are probably not listed as attendees. However there are legitimate situations where these unlisted (or indirectly listed) recipients are still expected to respond. RFC5546 allows that, calling those respondents "party crashers". * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:inline-reply-buttons): Display the response buttons even if the user was not found in the list of attendees, but change the labels of those buttons to make clear they are not explicitly invited. (gnus-icalendar-event--build-reply-event-body): Add an attendee line for the user in case one was not found. diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el index 514feff284..348da12db1 100644 --- a/lisp/gnus/gnus-icalendar.el +++ b/lisp/gnus/gnus-icalendar.el @@ -345,10 +345,16 @@ status will be retrieved from the first matching attendee record." (mapc #'process-event-line (split-string ical-request "\n")) + ;; RFC5546 refers to uninvited attendees as "party crashers". + ;; This situation is common if the invitation is sent to a group + ;; of people via a mailing list. (unless (gnus-icalendar-find-if (lambda (x) (string-match "^ATTENDEE" x)) reply-event-lines) (lwarn 'gnus-icalendar :warning - "Could not find an event attendee matching given identity")) + "Could not find an event attendee matching given identity") + (push (format "ATTENDEE;RSVP=TRUE;PARTSTAT=%s;CN=%s:MAILTO:%s" + attendee-status user-full-name user-mail-address) + reply-event-lines)) (mapconcat #'identity `("BEGIN:VEVENT" ,@(nreverse reply-event-lines) @@ -902,10 +908,16 @@ These will be used to retrieve the RSVP information from ical events." (gnus-icalendar-event:sync-to-org event gnus-icalendar-reply-status)) (cl-defmethod gnus-icalendar-event:inline-reply-buttons ((event gnus-icalendar-event) handle) - (when (gnus-icalendar-event:rsvp event) - `(("Accept" gnus-icalendar-reply (,handle accepted ,event)) - ("Tentative" gnus-icalendar-reply (,handle tentative ,event)) - ("Decline" gnus-icalendar-reply (,handle declined ,event))))) + (let ((accept-btn "Accept") + (tentative-btn "Tentative") + (decline-btn "Decline")) + (unless (gnus-icalendar-event:rsvp event) + (setq accept-btn "Uninvited Accept" + tentative-btn "Uninvited Tentative" + decline-btn "Uninvited Decline")) + `((,accept-btn gnus-icalendar-reply (,handle accepted ,event)) + (,tentative-btn gnus-icalendar-reply (,handle tentative ,event)) + (,decline-btn gnus-icalendar-reply (,handle declined ,event))))) (cl-defmethod gnus-icalendar-event:inline-reply-buttons ((_event gnus-icalendar-event-reply) _handle) "No buttons for REPLY events." commit 51226e42807c1554a83fde0081d57c0c9248c409 Author: Alexandre Duret-Lutz Date: Wed Sep 22 16:30:21 2021 +0200 reply to the organizer of an ical event RFC5546 specifies that participant status (accepted, tentative, declined) should be sent to the organizer of the event. That organizer is not necessarily the sender of the invitation; for instance Google Calendar uses custom email addresses to receive these notifications. * lisp/gnus/gnus-icalendar.el (gnus-icalendar-send-buffer-by-mail): Replace the default recipient of the reply by the organizer of the event. (gnus-icalendar-reply) Pass that organizer to the previous function. diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el index b6e5e7f786..514feff284 100644 --- a/lisp/gnus/gnus-icalendar.el +++ b/lisp/gnus/gnus-icalendar.el @@ -847,10 +847,14 @@ These will be used to retrieve the RSVP information from ical events." button t gnus-data ,data)))) -(defun gnus-icalendar-send-buffer-by-mail (buffer-name subject) +(defun gnus-icalendar-send-buffer-by-mail (buffer-name subject organizer) (let ((message-signature nil)) (with-current-buffer gnus-summary-buffer (gnus-summary-reply) + ;; Reply to the organizer, not to whoever sent the invitation. person + ;; Some calendar systems use specific email address as organizer to + ;; receive these responses. + (message-replace-header "To" organizer) (message-goto-body) (mml-insert-multipart "alternative") (mml-insert-empty-tag 'part 'type "text/plain") @@ -866,7 +870,8 @@ These will be used to retrieve the RSVP information from ical events." (event (caddr data)) (reply (gnus-icalendar-with-decoded-handle handle (gnus-icalendar-event-reply-from-buffer - (current-buffer) status (gnus-icalendar-identities))))) + (current-buffer) status (gnus-icalendar-identities)))) + (organizer (gnus-icalendar-event:organizer event))) (when reply (cl-labels @@ -883,7 +888,7 @@ These will be used to retrieve the RSVP information from ical events." (delete-region (point-min) (point-max)) (insert reply) (fold-icalendar-buffer) - (gnus-icalendar-send-buffer-by-mail (buffer-name) subject)) + (gnus-icalendar-send-buffer-by-mail (buffer-name) subject organizer)) ;; Back in article buffer (setq-local gnus-icalendar-reply-status status) commit 7cf1229706f28e0512488f717f777608c54afad4 Author: Stefan Kangas Date: Fri Oct 1 13:57:06 2021 +0200 ; * etc/TODO: Mention a relevant bug report. diff --git a/etc/TODO b/etc/TODO index ad3362a763..494bd6ba99 100644 --- a/etc/TODO +++ b/etc/TODO @@ -109,6 +109,7 @@ It would make it easy to add (and remove) mappings like ** Move idlwave to elpa.gnu.org Need to sync up the Emacs and external versions. See + ** Move Org mode to elpa.gnu.org See commit 5988d6fa2610097f91d822df813cecbdeed26185 Author: akater Date: Fri Oct 1 13:25:42 2021 +0200 Restore the flet indentation fixes * lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p): New function. (lisp-indent-function): Use it to fix cl-flet indentation. diff --git a/etc/NEWS b/etc/NEWS index cf3c8b6eb0..18eb248b26 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -40,6 +40,17 @@ buffer is already open. Now, the old point is pushed to mark ring. * Editing Changes in Emacs 29.1 +--- +** Indentation of 'cl-flet' and 'cl-labels' has changed. +These forms now indent like this: + + (cl-flet ((bla (x) + (* x x))) + (bla 42)) + +This change also affects 'cl-macrolet', 'cl-flet*' and +'cl-symbol-macrolet'. + * Changes in Specialized Modes and Packages in Emacs 29.1 diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index eac3c03cd1..57196dfec4 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -29,6 +29,7 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'subr-x)) (defvar font-lock-comment-face) (defvar font-lock-doc-face) @@ -1105,6 +1106,62 @@ is the buffer position of the start of the containing expression." (t normal-indent)))))) +(defun lisp--local-defform-body-p (state) + "Return non-nil when at local definition body according to STATE. +STATE is the `parse-partial-sexp' state for current position." + (when-let ((start-of-innermost-containing-list (nth 1 state))) + (let* ((parents (nth 9 state)) + (second-cons-after (cddr parents)) + second-order-parent) + (while second-cons-after + (when (= start-of-innermost-containing-list + (car second-cons-after)) + (setq second-order-parent (car parents) + ;; Leave the loop. + second-cons-after nil)) + (pop second-cons-after) + (pop parents)) + (when second-order-parent + (save-excursion + (goto-char (1+ second-order-parent)) + (and (when-let ((head (ignore-errors + ;; FIXME: This does not distinguish + ;; between reading nil and a read error. + ;; We don't care but still, better fix this. + (read (current-buffer))))) + (memq head '( cl-flet cl-labels cl-macrolet cl-flet* + cl-symbol-macrolet))) + ;; Now we must check that we are + ;; in the second element of the flet-like form. + ;; It would be easier if `parse-partial-sexp' also recorded + ;; relative positions of subsexps in supersexps + ;; but it doesn't so we check manually. + ;; + ;; First, we must be looking at list now. + (ignore-errors (when (= (scan-lists (point) 1 0) + (scan-sexps (point) 1)) + ;; Looking at list; descend into it: + (down-list 1) + t)) + ;; In Wishful Lisp, the following form would be + ;; (cl-member start-of-innermost-containing-list + ;; (points-at-beginning-of-lists-at-this-level) + ;; :test #'=) + (cl-loop + with pos = (ignore-errors + ;; The first local definition may be indented + ;; with whitespace following open paren. + (goto-char (scan-lists (point) 1 0)) + (goto-char (scan-lists (point) -1 0)) + (point)) + while pos + do (if (= start-of-innermost-containing-list pos) + (cl-return t) + (setq pos (ignore-errors + (goto-char (scan-lists (point) 2 0)) + (goto-char (scan-lists (point) -1 0)) + (point))))))))))) + (defun lisp-indent-function (indent-point state) "This function is the normal value of the variable `lisp-indent-function'. The function `calculate-lisp-indent' calls this to determine @@ -1138,16 +1195,19 @@ Lisp function does not specify a special indentation." (if (and (elt state 2) (not (looking-at "\\sw\\|\\s_"))) ;; car of form doesn't seem to be a symbol - (progn + (if (lisp--local-defform-body-p state) + ;; We nevertheless check whether we are in flet-like form + ;; as we presume local function names could be non-symbols. + (lisp-indent-defform state indent-point) (if (not (> (save-excursion (forward-line 1) (point)) calculate-lisp-indent-last-sexp)) - (progn (goto-char calculate-lisp-indent-last-sexp) - (beginning-of-line) - (parse-partial-sexp (point) - calculate-lisp-indent-last-sexp 0 t))) - ;; Indent under the list or under the first sexp on the same - ;; line as calculate-lisp-indent-last-sexp. Note that first - ;; thing on that line has to be complete sexp since we are + (progn (goto-char calculate-lisp-indent-last-sexp) + (beginning-of-line) + (parse-partial-sexp (point) + calculate-lisp-indent-last-sexp 0 t))) + ;; Indent under the list or under the first sexp on the same + ;; line as calculate-lisp-indent-last-sexp. Note that first + ;; thing on that line has to be complete sexp since we are ;; inside the innermost containing sexp. (backward-prefix-chars) (current-column)) @@ -1160,13 +1220,15 @@ Lisp function does not specify a special indentation." (cond ((or (eq method 'defun) (and (null method) (> (length function) 3) - (string-match "\\`def" function))) + (string-match "\\`def" function)) + ;; Check whether we are in flet-like form. + (lisp--local-defform-body-p state)) (lisp-indent-defform state indent-point)) ((integerp method) (lisp-indent-specform method state indent-point normal-indent)) (method - (funcall method indent-point state))))))) + (funcall method indent-point state))))))) (defcustom lisp-body-indent 2 "Number of columns to indent the second line of a `(def...)' form." diff --git a/test/lisp/progmodes/elisp-mode-resources/flet.erts b/test/lisp/progmodes/elisp-mode-resources/flet.erts new file mode 100644 index 0000000000..447cf08cc2 --- /dev/null +++ b/test/lisp/progmodes/elisp-mode-resources/flet.erts @@ -0,0 +1,222 @@ +Name: flet1 + +=-= +(cl-flet () + (a (dangerous-position + b))) +=-=-= + +Name: flet2 + +=-= +(cl-flet wrong-syntax-but-should-not-obstruct-indentation + (a (dangerous-position + b))) +=-=-= + +Name: flet3 + +=-= +(cl-flet ((a (arg-of-flet-a) + b + c))) +=-=-= + +Name: flet4 + +=-= +(cl-flet ((a (arg-of-flet-a) + b + c + (if d + e + f)) + (irregular-local-def (form + returning + lambda)) + (g (arg-of--flet-g) + h + i)) + (let ((j k)) + (if dangerous-position + l + m))) +=-=-= + +Name: flet5 + +=-= +(cl-flet ((a (arg-of-flet-a) + b + c + (if d + e + f)) + (irregular-local-def (form + returning + lambda)) + (g (arg-of--flet-g) + h + i)) + (let ((j k)) + (if dangerous-position + l + m))) +=-=-= + +Name: flet6 + +=-= +(cl-flet ((a (arg-of-flet-a) + b + c + (if d + e + f)) + (irregular-local-def (form + returning + lambda)) + (irregular-local-def (form returning + lambda)) + wrong-syntax-but-should-not-osbtruct-indentation + (g (arg-of--flet-g) + h + i)) + (let ((j k)) + (if dangerous-position + l + m))) +=-=-= + +Name: flet7 + +=-= +(cl-flet ((a (arg-of-flet-a) + b + c + (if d + e + f)) + (irregular-local-def (form + returning + lambda)) + wrong-syntax-but-should-not-osbtruct-indentation + (g (arg-of--flet-g) + h + i)) + (let ((j k)) + (if dangerous-position + l + m))) +=-=-= + +Name: flet8 + +=-= +(cl-flet (wrong-syntax-but-should-not-obstruct-indentation + (g (arg-of--flet-g) + h + i)) + (let ((j k)) + (if dangerous-position + l + m))) +=-=-= + +;; (setf _) not yet supported but looks like it will be +Name: flet9 + +=-= +(cl-flet (((setf a) (new value) + stuff) + wrong-syntax-but-should-not-obstruct-indentation + (g (arg-of--flet-g) + h + i)) + (let ((j k)) + (if dangerous-position + l + m))) +=-=-= + +Name: flet10 + +=-= +(cl-flet ( (a (arg-of-flet-a) + b + c + (if d + e + f)) + (irregular-local-def (form + returning + lambda)) + (g (arg-of--flet-g) + h + i)) + (let ((j k)) + (if dangerous-position + l + m))) +=-=-= + +Name: flet11 + +=-= +(cl-flet ( wrong-syntax-but-should-not-obstruct-indentation + (g (arg-of--flet-g) + h + i)) + (let ((j k)) + (if dangerous-position + l + m))) +=-=-= + +Name: flet12 + +=-= +(cl-flet ( wrong-syntax-but-should-not-obstruct-indentation + (g (arg-of--flet-g) + h + i)) + (let ((j k)) + (if dangerous-position + l + m))) +=-=-= + +Name: flet13 + +=-= +(cl-flet (wrong-syntax-but-should-not-obstruct-indentation + (g (arg-of--flet-g) + h + i) + wrong-syntax-but-should-not-obstruct-indentation + (g (arg-of--flet-g) + h + i))) +=-=-= + +Name: flet14 + +=-= +(cl-flet (wrong-syntax-but-should-not-obstruct-indentation + wrong-syntax-but-should-not-obstruct-indentation + (g (arg-of--flet-g) + h + i) + wrong-syntax-but-should-not-obstruct-indentation)) +=-=-= + +Name: flet15 + +=-= +(cl-flet (wrong-syntax-but-should-not-obstruct-indentation + wrong-syntax-but-should-not-obstruct-indentation + wrong-syntax-but-should-not-obstruct-indentation + (g (arg-of--flet-g) + h + i))) +=-=-= diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 3c76f86650..8ce3c1e093 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -1085,7 +1085,11 @@ evaluation of BODY." (should (unintern "f-test4---")))) (ert-deftest test-indentation () - (ert-test-erts-file (ert-resource-file "elisp-indents.erts"))) + (ert-test-erts-file (ert-resource-file "elisp-indents.erts")) + (ert-test-erts-file (ert-resource-file "flet.erts") + (lambda () + (emacs-lisp-mode) + (indent-region (point-min) (point-max))))) (provide 'elisp-mode-tests) ;;; elisp-mode-tests.el ends here commit efd239c1475de43806a739702583316cfb297003 Author: Lars Ingebrigtsen Date: Fri Oct 1 13:22:03 2021 +0200 Add a new command to mark a region as a test in erts-mode * lisp/progmodes/erts-mode.el (erts-mode--in-test-p): Fix test. (erts-tag-region): New command and keystroke. diff --git a/lisp/progmodes/erts-mode.el b/lisp/progmodes/erts-mode.el index cf7eca50c5..6f3e5b3ab5 100644 --- a/lisp/progmodes/erts-mode.el +++ b/lisp/progmodes/erts-mode.el @@ -23,6 +23,8 @@ ;;; Code: +(eval-when-compile (require 'cl-lib)) + (defgroup erts-mode nil "Major mode for editing Emacs test files." :group 'lisp) @@ -64,6 +66,7 @@ (defvar erts-mode-map (let ((map (make-keymap))) (set-keymap-parent map prog-mode-map) + (define-key map "\C-c\C-r" 'erts-tag-region) map)) (defvar erts-mode-font-lock-keywords @@ -100,7 +103,8 @@ (beginning-of-line) (if (looking-at "=-=\\(-=\\)?$") t - (let ((test-start (re-search-backward "^=-=\n" nil t))) + (let ((test-start (save-excursion + (re-search-backward "^=-=\n" nil t)))) ;; Before the first test. (and test-start (let ((test-end (re-search-backward "^=-=-=\n" nil t))) @@ -111,9 +115,42 @@ ;;;###autoload (define-derived-mode erts-mode prog-mode "erts" "Major mode for editing erts (Emacs testing) files. -This mode mainly provides some font locking." +This mode mainly provides some font locking. + +\\{erts-mode-map}" (setq-local font-lock-defaults '(erts-mode-font-lock-keywords t))) +(defun erts-tag-region (start end name) + "Tag the region between START and END as a test. +Interactively, this is the region. + +NAME should be a string appropriate for output by ert if the test fails. +If NAME is nil or the empty string, a name will be auto-generated." + (interactive "r\nsTest name: ") + ;; Automatically make a name. + (when (zerop (length name)) + (save-excursion + (goto-char (point-min)) + (let ((names nil)) + (while (re-search-forward "^Name:[ \t]*\\(.*\\)" nil t) + (let ((name (match-string 1))) + (unless (erts-mode--in-test-p (point)) + (push name names)))) + (setq name + (cl-loop with base = (file-name-sans-extension (buffer-name)) + for i from 1 + for name = (format "%s%d" base i) + unless (member name names) + return name))))) + (save-excursion + (goto-char end) + (unless (bolp) + (insert "\n")) + (insert "=-=-=\n") + (goto-char start) + (insert "Name: " name "\n\n") + (insert "=-=\n"))) + (provide 'erts-mode) ;;; erts-mode.el ends here commit 295d552e4ea3b88e1a75f21aa050abd3074fb557 Author: Lars Ingebrigtsen Date: Fri Oct 1 13:20:20 2021 +0200 Allow skipping erts tests * doc/misc/ert.texi (erts files): Document it. * lisp/emacs-lisp/ert.el (ert-test-erts-file): Allow skipping tests. diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index 6604829b2b..0eb9cdf09f 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -873,6 +873,10 @@ make @code{ert-test-erts-file} place point where @samp{|} is in the where the @samp{|} character is in the ``after'' form (and issue a test failure if that isn't the case). (This is used in all subsequent tests, unless overridden by a new @samp{Point-Char} spec.) + +@item Skip +If this is present and value is a form that evaluates to a +non-@code{nil} value, the test will be skipped. @end table If you need to use the literal line single line @samp{=-=} in a test diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 204ccf5858..ca3e4c3765 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -2679,65 +2679,76 @@ TRANSFORM will be called to get from before to after." (end-after (if (re-search-forward "^=-=-=\n" nil t) (match-beginning 0) (point-max))) + (skip (cdr (assq 'skip specs))) end-before start-after after after-point) - (goto-char end-after) - ;; We have a separate after section. - (if (re-search-backward "^=-=\n" start-before t) - (setq end-before (match-beginning 0) - start-after (match-end 0)) - (setq end-before end-after - start-after start-before)) - ;; Update persistent specs. - (when-let ((point-char (assq 'point-char specs))) - (setq gen-specs - (map-insert gen-specs 'point-char (cdr point-char)))) - (when-let ((code (cdr (assq 'code specs)))) - (setq gen-specs - (map-insert gen-specs 'code (car (read-from-string code))))) - ;; Get the "after" strings. - (with-temp-buffer - (insert-buffer-substring file-buffer start-after end-after) - (ert--erts-unquote) - ;; Remove the newline at the end of the buffer. - (when-let ((no-newline (cdr (assq 'no-after-newline specs)))) - (goto-char (point-min)) - (when (re-search-forward "\n\\'" nil t) - (delete-region (match-beginning 0) (match-end 0)))) - ;; Get the expected "after" point. - (when-let ((point-char (cdr (assq 'point-char gen-specs)))) - (goto-char (point-min)) - (when (search-forward point-char nil t) - (delete-region (match-beginning 0) (match-end 0)) - (setq after-point (point)))) - (setq after (buffer-string))) - ;; Do the test. - (with-temp-buffer - (insert-buffer-substring file-buffer start-before end-before) - (ert--erts-unquote) - ;; Remove the newline at the end of the buffer. - (when-let ((no-newline (cdr (assq 'no-before-newline specs)))) + (unless name + (error "No name for test case")) + (if (and skip + (eval (car (read-from-string skip)))) + ;; Skipping this test. + () + ;; Do the test. + (goto-char end-after) + ;; We have a separate after section. + (if (re-search-backward "^=-=\n" start-before t) + (setq end-before (match-beginning 0) + start-after (match-end 0)) + (setq end-before end-after + start-after start-before)) + ;; Update persistent specs. + (when-let ((point-char (assq 'point-char specs))) + (setq gen-specs + (map-insert gen-specs 'point-char (cdr point-char)))) + (when-let ((code (cdr (assq 'code specs)))) + (setq gen-specs + (map-insert gen-specs 'code (car (read-from-string code))))) + ;; Get the "after" strings. + (with-temp-buffer + (insert-buffer-substring file-buffer start-after end-after) + (ert--erts-unquote) + ;; Remove the newline at the end of the buffer. + (when-let ((no-newline (cdr (assq 'no-after-newline specs)))) + (goto-char (point-min)) + (when (re-search-forward "\n\\'" nil t) + (delete-region (match-beginning 0) (match-end 0)))) + ;; Get the expected "after" point. + (when-let ((point-char (cdr (assq 'point-char gen-specs)))) + (goto-char (point-min)) + (when (search-forward point-char nil t) + (delete-region (match-beginning 0) (match-end 0)) + (setq after-point (point)))) + (setq after (buffer-string))) + ;; Do the test. + (with-temp-buffer + (insert-buffer-substring file-buffer start-before end-before) + (ert--erts-unquote) + ;; Remove the newline at the end of the buffer. + (when-let ((no-newline (cdr (assq 'no-before-newline specs)))) + (goto-char (point-min)) + (when (re-search-forward "\n\\'" nil t) + (delete-region (match-beginning 0) (match-end 0)))) (goto-char (point-min)) - (when (re-search-forward "\n\\'" nil t) - (delete-region (match-beginning 0) (match-end 0)))) - (goto-char (point-min)) - ;; Place point in the specified place. - (when-let ((point-char (cdr (assq 'point-char gen-specs)))) - (when (search-forward point-char nil t) - (delete-region (match-beginning 0) (match-end 0)))) - (funcall (cdr (assq 'code gen-specs))) - (unless (equal (buffer-string) after) - (ert-fail (list (format "Mismatch in test \"%s\", file %s" - name file) - (buffer-string) - after))) - (when (and after-point - (not (= after-point (point)))) - (ert-fail (list (format "Point wrong in test \"%s\", expected point %d, actual %d, file %s" - name - after-point (point) - file) - (buffer-string)))))))))) + ;; Place point in the specified place. + (when-let ((point-char (cdr (assq 'point-char gen-specs)))) + (when (search-forward point-char nil t) + (delete-region (match-beginning 0) (match-end 0)))) + (let ((code (cdr (assq 'code gen-specs)))) + (unless code + (error "No code to run the transform")) + (funcall code)) + (unless (equal (buffer-string) after) + (ert-fail (list (format "Mismatch in test \"%s\", file %s" + name file) + (buffer-string) + after))) + (when (and after-point + (not (= after-point (point)))) + (ert-fail (list (format "Point wrong in test \"%s\", expected point %d, actual %d, file %s" + name + after-point (point) + file) + (buffer-string))))))))))) (defun ert--erts-unquote () (goto-char (point-min)) commit f733b909ff54ebceaefd71c144164150b565c4eb Author: Stefan Kangas Date: Fri Oct 1 13:07:31 2021 +0200 * etc/TODO: Remove outdated item. (Bug#50904) diff --git a/etc/TODO b/etc/TODO index 792552f1dd..ad3362a763 100644 --- a/etc/TODO +++ b/etc/TODO @@ -829,11 +829,6 @@ gametree, page-ext, refbib, refer, scribe, texinfo, underline, cmacexp, hideif, pcomplete, xml, cvs-status (should be described in PCL-CVS manual); other progmodes, probably in separate manual. -** Deprecate and remove XPM icons -Convert the XPM bitmaps to PPM, replace the PBMs with them and scrap -the XPMs so that the color versions work generally. (Requires care -with the color used for the transparent regions.) - ** Convenient access to the 'values' variable It would be nice to have an interface that would show you the printed reps of the elements of the list in a menu, let you select one of the commit 30bbb5735cbc5df67c6229d6f1151adf2eb56f5c Author: Lars Ingebrigtsen Date: Fri Oct 1 12:18:17 2021 +0200 Add more indentation tests for Emacs Lisp mode diff --git a/test/lisp/progmodes/elisp-mode-resources/elisp-indents.erts b/test/lisp/progmodes/elisp-mode-resources/elisp-indents.erts new file mode 100644 index 0000000000..69d2598bb1 --- /dev/null +++ b/test/lisp/progmodes/elisp-mode-resources/elisp-indents.erts @@ -0,0 +1,50 @@ +Code: + (lambda () + (emacs-lisp-mode) + (indent-region (point-min) (point-max))) + +Name: defun + +=-= +(defun foo () +"doc" +(+ 1 2)) +=-= +(defun foo () + "doc" + (+ 1 2)) +=-=-= + +Name: function call + +=-= +(foo zot +bar +(zot bar)) +=-= +(foo zot + bar + (zot bar)) +=-=-= + +Name: lisp data + +=-= +( foo zot +bar +(zot bar)) +=-= +( foo zot + bar + (zot bar)) +=-=-= + +Name: defun-space + +=-= +(defun x () + (print (quote ( thingy great + stuff))) + (print (quote (thingy great + stuff)))) +=-=-= diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index bc94aaac1f..3c76f86650 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -26,6 +26,7 @@ (require 'ert-x) (require 'xref) (eval-when-compile (require 'cl-lib)) +(require 'ert-x) ;;; Completion @@ -843,18 +844,6 @@ to (xref-elisp-test-descr-to-target xref)." (insert "?\\N{HEAVY CHECK MARK}") (should (equal (elisp--preceding-sexp) ?\N{HEAVY CHECK MARK})))) -(ert-deftest elisp-indent-basic () - (with-temp-buffer - (emacs-lisp-mode) - (let ((orig "(defun x () - (print (quote ( thingy great - stuff))) - (print (quote (thingy great - stuff))))")) - (insert orig) - (indent-region (point-min) (point-max)) - (should (equal (buffer-string) orig))))) - (defun test--font (form search) (with-temp-buffer (emacs-lisp-mode) @@ -1095,17 +1084,8 @@ evaluation of BODY." (should (= 84 (funcall (intern-soft "f-test4---")))) (should (unintern "f-test4---")))) -(ert-deftest test-cl-flet-indentation () - :expected-result :failed ; FIXME: bug#9622 - (should (equal - (with-temp-buffer - (emacs-lisp-mode) - (insert "(cl-flet ((bla (x)\n(* x x)))\n(bla 42))") - (indent-region (point-min) (point-max)) - (buffer-string)) - "(cl-flet ((bla (x) - (* x x))) - (bla 42))"))) +(ert-deftest test-indentation () + (ert-test-erts-file (ert-resource-file "elisp-indents.erts"))) (provide 'elisp-mode-tests) ;;; elisp-mode-tests.el ends here commit 1a653209030279aa03898f647376f768f5d1e9f2 Author: Lars Ingebrigtsen Date: Fri Oct 1 12:17:47 2021 +0200 Add new functionality to write buffer-based tests * doc/misc/ert.texi (erts files): New node. * lisp/files.el (auto-mode-alist): Map .erts to erts-mode. * lisp/emacs-lisp/ert.el (ert-test-erts-file): New function. * lisp/emacs-lisp/ert.el (ert--erts-specifications) (ert--erts-unquote): Helper functions. * lisp/progmodes/erts-mode.el: New mode and file. diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index 19f2d7d609..6604829b2b 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -486,6 +486,7 @@ to find where a test was defined if the test was loaded from a file. * Expected Failures:: Tests for known bugs. * Tests and Their Environment:: Don't depend on customizations; no side effects. * Useful Techniques:: Some examples. +* erts files:: Files containing many buffer tests. @end menu @node The @code{should} Macro @@ -767,6 +768,115 @@ code is to restructure the code slightly to provide better interfaces for testing. Usually, this makes the interfaces easier to use as well. +@node erts files +@section erts files + +@findex ert-test-erts-file +Many relevant Emacs tests depend on comparing the contents of a buffer +before and after executing a particular function. These tests can be +written the normal way---making a temporary buffer, inserting the +``before'' text, running the function, and then comparing with the +expected ``after'' text. However, this often leads to test code +that's pretty difficult to read and write, especially when the text in +question is multi-line. + +So ert provides a function called @code{ert-test-erts-file} that takes +two parameters: The name of a specially-formatted @dfn{erts} file, and +(optionally) a function that performs the transform. + +@findex erts-mode +These erts files can be edited with the @code{erts-mode} major mode. + +An erts file is divided into sections by the (@samp{=-=}) separator. + +Here's an example file containing two tests: + +@example +Name: flet + +=-= +(cl-flet ((bla (x) +(* x x))) +(bla 42)) +=-= +(cl-flet ((bla (x) + (* x x))) + (bla 42)) +=-=-= + +Name: defun + +=-= +(defun x () + (print (quote ( thingy great + stuff)))) +=-=-= +@end example + +A test starts with a line containing just @samp{=-=} and ends with a +line containing just just @samp{=-=-=}. The test may be preceded by +freeform text (for instance, comments), and also name/value pairs (see +below for a list of them). + +If there is a line with @samp{=-=} inside the test, that designates +the start of the ``after'' text. Otherwise, the ``before'' and +``after'' texts are assumed to be identical, which you typically see +when writing indentation tests. + +@code{ert-test-erts-file} puts the ``before'' section into a temporary +buffer, calls the transform function, and then compares with the +``after'' section. + +Here's an example usage: + +@lisp +(ert-test-erts-file "elisp.erts" + (lambda () + (emacs-lisp-mode) + (indent-region (point-min) (point-max)))) +@end lisp + +A list of the name/value specifications that can appear before a test +follows. The general syntax is @samp{Name: Value}, but continuation +lines can be used (along the same lines as in mail -- subsequent lines +that start with a space are part of the value). + +@example +Name: foo +Code: (indent-region + (point-min) (point-max)) +@end example + +@table @samp +@item Name +All tests should have a name. This name will appear in the output +from ert if the test fails, and helps identifying the failing test. + +@item Code +This is the code that will be run to do the transform. This can also +be passed in via the @code{ert-test-erts-file} call, but @samp{Code} +overrides that. It's used not only in the following test, but in all +subsequent tests in the file (until overridden by another @samp{Code} +specification). + +@item No-Before-Newline +@itemx No-After-Newline +These specifications say whether the ``before'' or ``after'' portions +have a newline at the end. (This would otherwise be impossible to +specify.) + +@item Point-Char +Sometimes it's useful to be able to put point at a specific place +before executing the transform character. @samp{Point-Char: |} will +make @code{ert-test-erts-file} place point where @samp{|} is in the +``before'' form (and remove that character), and will check that it's +where the @samp{|} character is in the ``after'' form (and issue a +test failure if that isn't the case). (This is used in all subsequent +tests, unless overridden by a new @samp{Point-Char} spec.) +@end table + +If you need to use the literal line single line @samp{=-=} in a test +section, you can quote it with a @samp{\} character. @node How to Debug Tests @chapter How to Debug Tests diff --git a/etc/NEWS b/etc/NEWS index 04b690806d..cf3c8b6eb0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -46,6 +46,12 @@ buffer is already open. Now, the old point is pushed to mark ring. * New Modes and Packages in Emacs 29.1 ++++ +** New mode 'erts-mode' +This mode is used to edit files geared towards testing actions in +Emacs buffers, like indentation and the like. The new ert function +'ert-test-erts-file' is used to parse these files. + * Incompatible Lisp Changes in Emacs 29.1 diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 72fe19461f..204ccf5858 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -63,6 +63,7 @@ (require 'ewoc) (require 'find-func) (require 'pp) +(require 'map) ;;; UI customization options. @@ -2661,6 +2662,109 @@ To be used in the ERT results buffer." 'ert--activate-font-lock-keywords) nil) +(defun ert-test-erts-file (file &optional transform) + "Parse FILE as a file containing before/after parts. +TRANSFORM will be called to get from before to after." + (with-temp-buffer + (insert-file-contents file) + (let ((gen-specs (list (cons 'dummy t) + (cons 'code transform)))) + ;; The start of the "before" part starts with a form feed and then + ;; the name of the test. + (while (re-search-forward "^=-=\n" nil t) + (let* ((file-buffer (current-buffer)) + (specs (ert--erts-specifications (match-beginning 0))) + (name (cdr (assq 'name specs))) + (start-before (point)) + (end-after (if (re-search-forward "^=-=-=\n" nil t) + (match-beginning 0) + (point-max))) + end-before start-after + after after-point) + (goto-char end-after) + ;; We have a separate after section. + (if (re-search-backward "^=-=\n" start-before t) + (setq end-before (match-beginning 0) + start-after (match-end 0)) + (setq end-before end-after + start-after start-before)) + ;; Update persistent specs. + (when-let ((point-char (assq 'point-char specs))) + (setq gen-specs + (map-insert gen-specs 'point-char (cdr point-char)))) + (when-let ((code (cdr (assq 'code specs)))) + (setq gen-specs + (map-insert gen-specs 'code (car (read-from-string code))))) + ;; Get the "after" strings. + (with-temp-buffer + (insert-buffer-substring file-buffer start-after end-after) + (ert--erts-unquote) + ;; Remove the newline at the end of the buffer. + (when-let ((no-newline (cdr (assq 'no-after-newline specs)))) + (goto-char (point-min)) + (when (re-search-forward "\n\\'" nil t) + (delete-region (match-beginning 0) (match-end 0)))) + ;; Get the expected "after" point. + (when-let ((point-char (cdr (assq 'point-char gen-specs)))) + (goto-char (point-min)) + (when (search-forward point-char nil t) + (delete-region (match-beginning 0) (match-end 0)) + (setq after-point (point)))) + (setq after (buffer-string))) + ;; Do the test. + (with-temp-buffer + (insert-buffer-substring file-buffer start-before end-before) + (ert--erts-unquote) + ;; Remove the newline at the end of the buffer. + (when-let ((no-newline (cdr (assq 'no-before-newline specs)))) + (goto-char (point-min)) + (when (re-search-forward "\n\\'" nil t) + (delete-region (match-beginning 0) (match-end 0)))) + (goto-char (point-min)) + ;; Place point in the specified place. + (when-let ((point-char (cdr (assq 'point-char gen-specs)))) + (when (search-forward point-char nil t) + (delete-region (match-beginning 0) (match-end 0)))) + (funcall (cdr (assq 'code gen-specs))) + (unless (equal (buffer-string) after) + (ert-fail (list (format "Mismatch in test \"%s\", file %s" + name file) + (buffer-string) + after))) + (when (and after-point + (not (= after-point (point)))) + (ert-fail (list (format "Point wrong in test \"%s\", expected point %d, actual %d, file %s" + name + after-point (point) + file) + (buffer-string)))))))))) + +(defun ert--erts-unquote () + (goto-char (point-min)) + (while (re-search-forward "^\\=-=\\(-=\\)$" nil t) + (delete-region (match-beginning 0) (1+ (match-beginning 0))))) + +(defun ert--erts-specifications (end) + "Find specifications before point (back to the previous test)." + (save-excursion + (goto-char end) + (goto-char + (if (re-search-backward "^=-=-=\n" nil t) + (match-end 0) + (point-min))) + (let ((specs nil)) + (while (< (point) end) + (if (looking-at "\\([^ \n\t:]+\\):\\([ \t]+\\)?\\(.*\\)") + (let ((name (intern (downcase (match-string 1)))) + (value (match-string 3))) + (forward-line 1) + (while (looking-at "[ \t]+\\(.*\\)") + (setq value (concat value (match-string 1))) + (forward-line 1)) + (push (cons name value) specs)) + (forward-line 1))) + (nreverse specs)))) + (defvar ert-unload-hook ()) (add-hook 'ert-unload-hook #'ert--unload-function) diff --git a/lisp/files.el b/lisp/files.el index 05875b48e3..50ca49409f 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2883,6 +2883,7 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|CBR\\|7Z\\|SQUASHFS\\)\\'" . ("\\.[ds]?va?h?\\'" . verilog-mode) ("\\.by\\'" . bovine-grammar-mode) ("\\.wy\\'" . wisent-grammar-mode) + ("\\.erts\\'" . erts-mode) ;; .emacs or .gnus or .viper following a directory delimiter in ;; Unix or MS-DOS syntax. ("[:/\\]\\..*\\(emacs\\|gnus\\|viper\\)\\'" . emacs-lisp-mode) diff --git a/lisp/progmodes/erts-mode.el b/lisp/progmodes/erts-mode.el new file mode 100644 index 0000000000..cf7eca50c5 --- /dev/null +++ b/lisp/progmodes/erts-mode.el @@ -0,0 +1,119 @@ +;;; erts-mode.el --- major mode to edit erts files -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; Keywords: tools + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;;; Code: + +(defgroup erts-mode nil + "Major mode for editing Emacs test files." + :group 'lisp) + +(defface erts-mode-specification-name + '((((class color) + (background dark)) + :foreground "green") + (((class color) + (background light)) + :foreground "cornflower blue") + (t + :bold t)) + "Face used for displaying specification names." + :group 'erts-mode) + +(defface erts-mode-specification-value + '((((class color) + (background dark)) + :foreground "DeepSkyBlue1") + (((class color) + (background light)) + :foreground "blue") + (t + :bold t)) + "Face used for displaying specificaton values." + :group 'erts-mode) + +(defface erts-mode-start-test + '((t :inherit font-lock-keyword-face)) + "Face used for displaying specificaton test start markers." + :group 'erts-mode) + +(defface erts-mode-end-test + '((t :inherit font-lock-comment-face)) + "Face used for displaying specificaton test start markers." + :group 'erts-mode) + +(defvar erts-mode-map + (let ((map (make-keymap))) + (set-keymap-parent map prog-mode-map) + map)) + +(defvar erts-mode-font-lock-keywords + ;; Specifications. + `((erts-mode--match-not-in-test + ("^\\([^ \t\n:]+:\\)[ \t]*\\(.*\\(\n[ \t].*\\)*\\)\n?" + (progn (goto-char (match-beginning 0)) (match-end 0)) nil + (1 'erts-mode-specification-name) + (2 'erts-mode-specification-value))) + ("^=-=$" 0 'erts-mode-start-test) + ("^=-=-=$" 0 'erts-mode-end-test))) + +(defun erts-mode--match-not-in-test (_limit) + (when (erts-mode--in-test-p (point)) + (erts-mode--end-of-test)) + (let ((start (point))) + (goto-char + (if (re-search-forward "^=-=$" nil t) + (match-beginning 0) + (point-max))) + (if (< (point) start) + nil + ;; Here we disregard LIMIT so that we may extend the area again. + (set-match-data (list start (point))) + (point)))) + +(defun erts-mode--end-of-test () + (search-forward "^=-=-=\n" nil t)) + +(defun erts-mode--in-test-p (point) + "Say whether POINT is in a test." + (save-excursion + (goto-char point) + (beginning-of-line) + (if (looking-at "=-=\\(-=\\)?$") + t + (let ((test-start (re-search-backward "^=-=\n" nil t))) + ;; Before the first test. + (and test-start + (let ((test-end (re-search-backward "^=-=-=\n" nil t))) + (or (null test-end) + ;; Between tests. + (> test-start test-end)))))))) + +;;;###autoload +(define-derived-mode erts-mode prog-mode "erts" + "Major mode for editing erts (Emacs testing) files. +This mode mainly provides some font locking." + (setq-local font-lock-defaults '(erts-mode-font-lock-keywords t))) + +(provide 'erts-mode) + +;;; erts-mode.el ends here commit 2e92f90a5d38f92f5d4a8a01e28e49f648ef07b4 Author: Ihor Radchenko Date: Fri Oct 1 09:11:37 2021 +0200 Save position in mark ring before jumping to definition * lisp/help-mode.el (help-function-def--button-function): Current point is saved in the mark ring before jumping to definition. diff --git a/etc/NEWS b/etc/NEWS index d0e41baaeb..04b690806d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -30,6 +30,13 @@ applies, and please also update docstrings as needed. * Changes in Emacs 29.1 +** Help + +--- +*** Jumping to function/variable source now saves mark before moving point. +Jumping to source from "*Help*" buffer moves the point when the source +buffer is already open. Now, the old point is pushed to mark ring. + * Editing Changes in Emacs 29.1 diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 0b404fe89f..d61b1bdc62 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -273,6 +273,10 @@ The format is (FUNCTION ARGS...).") (when (or (< position (point-min)) (> position (point-max))) (widen)) + ;; Save mark for the old location, unless the point is not + ;; actually going to move. + (unless (= (point) position) + (push-mark nil t)) (goto-char position)) (message "Unable to find location in file"))))) commit 94c247d65978c204c51c829e6b03b651d5bbd454 Author: Amin Bandali Date: Fri Oct 1 01:31:29 2021 -0400 ; Oops, fix up last commit diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index a57c3320f9..c4077d48ab 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -3311,7 +3311,7 @@ Specifying the server is useful for getting the time the user has been idle for, when the user is connected to a different server on the same IRC network. (Only the server a user is connected to knows how long the user has been idle for.)" - (let ((send (if nick-if-server + (let ((send (if second (format "WHOIS %s %s" first second) (format "WHOIS %s" first)))) (erc-log (format "cmd: %s" send)) commit 88378acbfc79fafef2d877c9a32c5d1bef931ffc Author: Stefan Kangas Date: Fri Oct 1 01:21:08 2021 -0400 Rename arguments of ERC's '/whois' and simplify doc string * lisp/erc/erc.el (erc-cmd-WHOIS): Rename arguments and reword the doc string to further clarify and simplify. diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 2427332189..a57c3320f9 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -3298,24 +3298,22 @@ a script after exceeding the flood threshold." t) (t nil))) -(defun erc-cmd-WHOIS (nick-or-server &optional nick-if-server) +(defun erc-cmd-WHOIS (first &optional second) "Display whois information for the given user. -If NICK-IF-SERVER is nil, NICK-OR-SERVER should be the nick of -the user about whom the whois information is to be requested. -Otherwise, if NICK-IF-SERVER is non-nil, NICK-OR-SERVER should be -the server to which the user with the nick NICK-IF-USER is -connected to. - -Specifying the server NICK-OR-SERVER that the nick NICK-IF-SERVER -is connected to is useful for getting the time the NICK-IF-SERVER -user has been idle for, when the user NICK-IF-SERVER is connected -to a different server of the network than the one current user is -connected to, since only the server a user is connected to knows -the idle time of that user." +With one argument, FIRST is the nickname of the user to request +whois information for. + +With two arguments, FIRST is the server, and SECOND is the user +nickname. + +Specifying the server is useful for getting the time the user has +been idle for, when the user is connected to a different server +on the same IRC network. (Only the server a user is connected to +knows how long the user has been idle for.)" (let ((send (if nick-if-server - (format "WHOIS %s %s" nick-or-server nick-if-server) - (format "WHOIS %s" nick-or-server)))) + (format "WHOIS %s %s" first second) + (format "WHOIS %s" first)))) (erc-log (format "cmd: %s" send)) (erc-server-send send) t)) commit 205eb7f8014d5426b722e57c965385f770c707d7 Author: Dmitry Gutov Date: Fri Oct 1 03:05:56 2021 +0300 ; s/class/type diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index f151a980bb..267ee16400 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -99,7 +99,7 @@ When it is a file name, it should be the \"expanded\" version.") "Return the length of the match." nil) -;;;; Commonly needed location classes are defined here: +;;;; Commonly needed location types are defined here: (defcustom xref-file-name-display 'project-relative "Style of file name display in *xref* buffers. @@ -999,7 +999,7 @@ to that style. Otherwise it is returned unchanged." ;; `tags-apropos-additional-actions', is pretty lax. But we don't ;; want to use `file-exists-p' for performance reasons. If this ;; ever turns out to be a problem, some other alternatives are to - ;; either have every location class which uses file names format the + ;; either have every location type which uses file names format the ;; values themselves (e.g. by piping through some public function), ;; or adding a new accessor to locations, like GROUP-TYPE. (cl-ecase xref-file-name-display commit 86da812afb2572c7fead2bb07570b976bffd7c55 Author: Dmitry Gutov Date: Fri Oct 1 00:02:21 2021 +0300 Migrate Xref off EIEIO To improve performance and flexibility (bug#50777). * lisp/progmodes/xref.el (xref-location): Remove. (xref-file-location): Change to cl-struct. (xref-buffer-location, xref-bogus-location): Ditto. (xref-item, xref-match-item): Same. And update all method definitions accordingly. (xref--insert-xrefs): Don't use 'oref', use 'xref-item-location'. (xref--insert-xrefs, xref-show-definitions-completing-read): Insetad of 'with-slots', use 'xref-item-summary' and 'xref-item-location'. * lisp/progmodes/etags.el (xref-etags-location): Change from EIEIO class into a cl-struct. (xref-etags-apropos-location): Ditto. Update all method definitions. * test/lisp/progmodes/elisp-mode-tests.el (xref-elisp-test-run): Avoid using 'oref'. diff --git a/etc/NEWS b/etc/NEWS index b9f5830656..10a46571b7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3294,6 +3294,20 @@ file: (add-hook 'foo-mode-hook (lambda () (auto-fill-mode -1)) +** Xref migrated from EIEIO to cl-defstruct for its core objects. +This means that 'oref' and 'with-slots' no longer works on them, and +'make-instance' can no longer be used to create those instances (which +wasn't recommended anyway). Packages should keep to using the +functions like 'xref-make', 'xref-make-match', 'xref-make-*-location', +as well as accessor functions 'xref-item-summary' and +'xref-item-location'. + +Among the benefits are better performance (noticeable when there are a +lot of matches) and improved flexibility: 'xref-match-item' instances +do not require that 'location' inherits from 'xref-location' anymore +(that class was removed), so packages can create new location types to +use with "match items" without adding EIEIO as a dependency. + * Incompatible Lisp Changes in Emacs 28.1 diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index e6af2b12c7..f53b09d9e8 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -2161,18 +2161,16 @@ file name, add `tag-partial-file-name-match-p' to the list value.") (nreverse res)))) tags-apropos-additional-actions)) -(defclass xref-etags-location (xref-location) - ((tag-info :type list :initarg :tag-info) - (file :type string :initarg :file - :reader xref-location-group)) - :documentation "Location of an etags tag.") +(cl-defstruct (xref-etags-location + (:constructor xref-make-etags-location (tag-info file))) + "Location of an etags tag." + tag-info file) -(defun xref-make-etags-location (tag-info file) - (make-instance 'xref-etags-location :tag-info tag-info - :file (expand-file-name file))) +(cl-defmethod xref-location-group ((l xref-etags-location)) + (xref-etags-location-file l)) (cl-defmethod xref-location-marker ((l xref-etags-location)) - (with-slots (tag-info file) l + (pcase-let (((cl-struct xref-etags-location tag-info file) l)) (let ((buffer (find-file-noselect file))) (with-current-buffer buffer (save-excursion @@ -2182,25 +2180,20 @@ file name, add `tag-partial-file-name-match-p' to the list value.") (point-marker))))))) (cl-defmethod xref-location-line ((l xref-etags-location)) - (with-slots (tag-info) l + (pcase-let (((cl-struct xref-etags-location tag-info) l)) (nth 1 tag-info))) -(defclass xref-etags-apropos-location (xref-location) - ((symbol :type symbol :initarg :symbol) - (goto-fun :type function :initarg :goto-fun) - (group :type string :initarg :group - :reader xref-location-group)) - :documentation "Location of an additional apropos etags symbol.") +(cl-defstruct (xref-etags-apropos-location + (:constructor xref-make-etags-apropos-location (symbol goto-fun group))) + "Location of an additional apropos etags symbol." + symbol goto-fun group) -(defun xref-make-etags-apropos-location (symbol goto-fun group) - (make-instance 'xref-etags-apropos-location - :symbol symbol - :goto-fun goto-fun - :group group)) +(cl-defmethod xref-location-group ((l xref-etags-apropos-location)) + (xref-etags-apropos-location-group l)) (cl-defmethod xref-location-marker ((l xref-etags-apropos-location)) (save-window-excursion - (with-slots (goto-fun symbol) l + (pcase-let (((cl-struct xref-etags-apropos-location goto-fun symbol) l)) (funcall goto-fun symbol) (point-marker)))) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 8906f6326a..f151a980bb 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -46,9 +46,9 @@ ;; ;; One would usually call `make-xref' and `xref-make-file-location', ;; `xref-make-buffer-location' or `xref-make-bogus-location' to create -;; them. More generally, a location must be an instance of an EIEIO -;; class inheriting from `xref-location' and implementing -;; `xref-location-group' and `xref-location-marker'. +;; them. More generally, a location must be an instance of a type for +;; which methods `xref-location-group' and `xref-location-marker' are +;; implemented. ;; ;; There's a special kind of xrefs we call "match xrefs", which ;; correspond to search results. For these values, @@ -62,12 +62,15 @@ ;; distinct, because the user can't see the properties when making the ;; choice. ;; +;; Older versions of Xref used EIEIO for implementation of the +;; built-in types, and included a class called `xref-location' which +;; was supposed to be inherited from. Neither is true anymore. +;; ;; See the etags and elisp-mode implementations for full examples. ;;; Code: (require 'cl-lib) -(require 'eieio) (require 'ring) (require 'project) @@ -78,9 +81,6 @@ ;;; Locations -(defclass xref-location () () - :documentation "A location represents a position in a file or buffer.") - (cl-defgeneric xref-location-marker (location) "Return the marker for LOCATION.") @@ -121,19 +121,20 @@ in its full absolute form." ;; FIXME: might be useful to have an optional "hint" i.e. a string to ;; search for in case the line number is slightly out of date. -(defclass xref-file-location (xref-location) - ((file :type string :initarg :file :reader xref-location-group) - (line :type fixnum :initarg :line :reader xref-location-line) - (column :type fixnum :initarg :column :reader xref-file-location-column)) - :documentation "A file location is a file/line/column triple. -Line numbers start from 1 and columns from 0.") +(cl-defstruct (xref-file-location + (:constructor xref-make-file-location (file line column))) + "A file location is a file/line/column triple. +Line numbers start from 1 and columns from 0." + file line column) -(defun xref-make-file-location (file line column) - "Create and return a new `xref-file-location'." - (make-instance 'xref-file-location :file file :line line :column column)) +(cl-defmethod xref-location-group ((l xref-file-location)) + (xref-file-location-file l)) + +(cl-defmethod xref-location-line ((l xref-file-location)) + (xref-file-location-line l)) (cl-defmethod xref-location-marker ((l xref-file-location)) - (with-slots (file line column) l + (pcase-let (((cl-struct xref-file-location file line column) l)) (with-current-buffer (or (get-file-buffer file) (let ((find-file-suppress-same-file-warnings t)) @@ -151,77 +152,51 @@ Line numbers start from 1 and columns from 0.") (forward-char column)) (point-marker)))))) -(defclass xref-buffer-location (xref-location) - ((buffer :type buffer :initarg :buffer) - (position :type fixnum :initarg :position))) - -(defun xref-make-buffer-location (buffer position) - "Create and return a new `xref-buffer-location'." - (make-instance 'xref-buffer-location :buffer buffer :position position)) +(cl-defstruct (xref-buffer-location + (:constructor xref-make-buffer-location (buffer position))) + buffer position) (cl-defmethod xref-location-marker ((l xref-buffer-location)) - (with-slots (buffer position) l + (pcase-let (((cl-struct xref-buffer-location buffer position) l)) (let ((m (make-marker))) (move-marker m position buffer)))) (cl-defmethod xref-location-group ((l xref-buffer-location)) - (with-slots (buffer) l + (pcase-let (((cl-struct xref-buffer-location buffer) l)) (or (buffer-file-name buffer) (format "(buffer %s)" (buffer-name buffer))))) -(defclass xref-bogus-location (xref-location) - ((message :type string :initarg :message - :reader xref-bogus-location-message)) - :documentation "Bogus locations are sometimes useful to -indicate errors, e.g. when we know that a function exists but the -actual location is not known.") - -(defun xref-make-bogus-location (message) - "Create and return a new `xref-bogus-location'." - (make-instance 'xref-bogus-location :message message)) +(cl-defstruct (xref-bogus-location + (:constructor xref-make-bogus-location (message))) + "Bogus locations are sometimes useful to indicate errors, +e.g. when we know that a function exists but the actual location +is not known." + message) (cl-defmethod xref-location-marker ((l xref-bogus-location)) - (user-error "%s" (oref l message))) + (user-error "%s" (xref-bogus-location-message l))) (cl-defmethod xref-location-group ((_ xref-bogus-location)) "(No location)") ;;; Cross-reference -(defclass xref-item () - ((summary :type string :initarg :summary - :reader xref-item-summary - :documentation "One line which will be displayed for -this item in the output buffer.") - (location :initarg :location - :reader xref-item-location - :documentation "An object describing how to navigate -to the reference's target.")) - :comment "An xref item describes a reference to a location -somewhere.") - -(defun xref-make (summary location) - "Create and return a new `xref-item'. -SUMMARY is a short string to describe the xref. -LOCATION is an `xref-location'." - (make-instance 'xref-item :summary summary :location location)) - -(defclass xref-match-item () - ((summary :type string :initarg :summary - :reader xref-item-summary) - (location :initarg :location - :type xref-location - :reader xref-item-location) - (length :initarg :length :reader xref-match-length)) - :comment "A match xref item describes a search result.") - -(defun xref-make-match (summary location length) - "Create and return a new `xref-match-item'. -SUMMARY is a short string to describe the xref. -LOCATION is an `xref-location'. -LENGTH is the match length, in characters." - (make-instance 'xref-match-item :summary summary - :location location :length length)) +(cl-defstruct (xref-item + (:constructor xref-make (summary location)) + (:noinline t)) + "An xref item describes a reference to a location somewhere." + summary location) + +(cl-defstruct (xref-match-item + (:include xref-item) + (:constructor xref-make-match (summary location length)) + (:noinline t)) + "A match xref item describes a search result." + length) + +(cl-defgeneric xref-match-length ((item xref-match-item)) + "Return the length of the match." + (xref-match-item-length item)) ;;; API @@ -970,7 +945,7 @@ GROUP is a string for decoration purposes and XREF is an for max-line-width = (cl-loop for xref in xrefs maximize (let ((line (xref-location-line - (oref xref location)))) + (xref-item-location xref)))) (and line (1+ (floor (log line 10)))))) for line-format = (and max-line-width (format "%%%dd: " max-line-width)) @@ -985,7 +960,7 @@ GROUP is a string for decoration purposes and XREF is an (xref--insert-propertized '(face xref-file-header xref-group t) group "\n") (cl-loop for xref in xrefs do - (with-slots (summary location) xref + (pcase-let (((cl-struct xref-item summary location) xref)) (let* ((line (xref-location-line location)) (prefix (cond @@ -1206,22 +1181,23 @@ between them by typing in the minibuffer with completion." (cl-loop for ((group . xrefs) . more1) on xref-alist do (cl-loop for (xref . more2) on xrefs do - (with-slots (summary location) xref - (let* ((line (xref-location-line location)) - (line-fmt - (if line - (format #("%d:" 0 2 (face xref-line-number)) - line) - "")) - (group-prefix - (substring group group-prefix-length)) - (group-fmt - (propertize group-prefix - 'face 'xref-file-header - 'xref--group group-prefix)) - (candidate - (format "%s:%s%s" group-fmt line-fmt summary))) - (push (cons candidate xref) xref-alist-with-line-info))))) + (let* ((summary (xref-item-summary xref)) + (location (xref-item-location xref)) + (line (xref-location-line location)) + (line-fmt + (if line + (format #("%d:" 0 2 (face xref-line-number)) + line) + "")) + (group-prefix + (substring group group-prefix-length)) + (group-fmt + (propertize group-prefix + 'face 'xref-file-header + 'xref--group group-prefix)) + (candidate + (format "%s:%s%s" group-fmt line-fmt summary))) + (push (cons candidate xref) xref-alist-with-line-info)))) (setq xref (if (not (cdr xrefs)) (car xrefs) diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index bc94aaac1f..a3449c2b33 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -316,27 +316,27 @@ (expected (pop expected-xrefs)) (expected-xref (or (when (consp expected) (car expected)) expected)) (expected-source (when (consp expected) (cdr expected))) - (xref-file (xref-elisp-location-file (oref xref location))) + (xref-file (xref-elisp-location-file (xref-item-location xref))) (expected-file (xref-elisp-location-file - (oref expected-xref location)))) + (xref-item-location expected-xref)))) ;; Make sure file names compare as strings. (when (file-name-absolute-p xref-file) - (setf (xref-elisp-location-file (oref xref location)) - (file-truename (xref-elisp-location-file (oref xref location))))) + (setf (xref-elisp-location-file (xref-item-location xref)) + (file-truename (xref-elisp-location-file (xref-item-location xref))))) (when (file-name-absolute-p expected-file) - (setf (xref-elisp-location-file (oref expected-xref location)) + (setf (xref-elisp-location-file (xref-item-location expected-xref)) (file-truename (xref-elisp-location-file - (oref expected-xref location))))) + (xref-item-location expected-xref))))) ;; Downcase the filenames for case-insensitive file systems. (when xref--case-insensitive - (setf (xref-elisp-location-file (oref xref location)) - (downcase (xref-elisp-location-file (oref xref location)))) + (setf (xref-elisp-location-file (xref-item-location xref)) + (downcase (xref-elisp-location-file (xref-item-location xref)))) - (setf (xref-elisp-location-file (oref expected-xref location)) + (setf (xref-elisp-location-file (xref-item-location expected-xref)) (downcase (xref-elisp-location-file - (oref expected-xref location))))) + (xref-item-location expected-xref))))) (should (equal xref expected-xref)) @@ -417,8 +417,6 @@ to (xref-elisp-test-descr-to-target xref)." ;; FIXME: defconst -;; FIXME: eieio defclass - ;; Possible ways of defining the default method implementation for a ;; generic function. We declare these here, so we know we cover all ;; cases, and we don't rely on other code not changing. commit 5c73dfcbcb12d107dfdad335328b7c258bdd64c8 Author: Eli Zaretskii Date: Thu Sep 30 22:19:14 2021 +0300 * admin/release-branch.txt: New file. diff --git a/admin/release-branch.txt b/admin/release-branch.txt new file mode 100644 index 0000000000..2be0495c41 --- /dev/null +++ b/admin/release-branch.txt @@ -0,0 +1,75 @@ +Instructions for cutting the Emacs release branch + +1. In the clone of the Emacs Git repository, switch to the 'master' + branch, "git pull", and build it to make sure it's not broken. + Consider deleting all the *.elc and *.o files, or running the + command "make extraclean", before building. + +2. Create the release branch and switch to it. Assuming that it is + for releasing Emacs versions XY.1, XY.2, etc., the command is: + + git checkout -b emacs-XY + +3. Switch the release branch to the suitable version. The convention + is that release branches start with version XY.0.60, whereas the + master branch from which the release branch was cut was at the + version XY.0.50. To change the version, do the following inside + Emacs: + + M-x load-file RET admin/admin.el RET + M-x set-version RET XY.0.60 RET + + Change the value of 'customize-changed-options-previous-release' + in cus-edit.el to reference the last release from the emacs-XY-1 + branch (last release for the previous major version). + + The above modifies several files in the tree; commit the changes + with the appropriate log message, something like "Bump Emacs + version to XY.0.60", and with header saying "Cut the emacs-XY + release branch". Then push the changes: + + git push --set-upstream origin emacs-XY + + The "push" command should show the new branch just created. + +4. Switch back to the master branch. + + git checkout master + git pull + + Set the version on the master branch to the next major release: + + M-x set-version RET XY+1.0.50 RET + + This creates a new file etc/NEWS.XY. "git add" it. + + Change the value of 'customize-changed-options-previous-release' + in cus-edit.el to reference emacs-XY.1, the next version to be + released from the newly-committed release branch. + + Update the emacs-module sources for the new version XY+1. This + entails: + + . adding a new file src/module-env-XY+1.h, with contents just the + comment taken from the beginning of src/module-env-XY.h + . removing the comment from the beginning of src/module-env-XY.h + . adding two lines to configure.ac: + + AC_SUBST_FILE([module_env_snippet_XY+1]) + module_env_snippet_XY+1="$srcdir/src/module-env-XY+1.h" + + . adding a new 'struct emacs_env_XY+1' to src/emacs-module.h.in, + with the contents identical to'struct emacs_env_XY', with one + line added: + + @module_env_snippet_XY+1@ + + (FIXME: "M-x set-version" should do this emacs-module stuff + automatically when the version is NN.0.60, or when there's no + src/module-env-NN.h file.) + + "git add" the new src/module-env-XY+1.h file. + + Then rebuild Emacs. Then commit the new/changed files and push. + +5. Announce the new release branch on emacs-devel. commit f060d1c9a4d3f2c5990914e1272ebd55a72645a5 Author: Eli Zaretskii Date: Thu Sep 30 22:16:23 2021 +0300 * lisp/dired.el (dired-omit-mode): Declare, to avoid compiler warning. diff --git a/lisp/dired.el b/lisp/dired.el index 07c13e18b9..fff4f16ee9 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -4490,6 +4490,7 @@ Ask means pop up a menu for the user to select one of copy, move or link." (defvar archive-superior-buffer) (defvar tar-superior-buffer) +(declare-function dired-omit-mode "dired-x" (&optional arg)) ;;;###autoload (defun dired-jump (&optional other-window file-name) commit 44c13eefe8d30841000a96d82f467fb8d222e365 Author: Eli Zaretskii Date: Thu Sep 30 20:26:00 2021 +0300 Update emacs-module sources for Emacs 29 * configure.ac (module_env_snippet_29): New. * src/module-env-28.h: Remove the comment with instructions for the next release. * src/module-env-29.h: New file. diff --git a/configure.ac b/configure.ac index c4509a5859..31c715e20c 100644 --- a/configure.ac +++ b/configure.ac @@ -3738,10 +3738,12 @@ AC_SUBST_FILE([module_env_snippet_25]) AC_SUBST_FILE([module_env_snippet_26]) AC_SUBST_FILE([module_env_snippet_27]) AC_SUBST_FILE([module_env_snippet_28]) +AC_SUBST_FILE([module_env_snippet_29]) module_env_snippet_25="$srcdir/src/module-env-25.h" module_env_snippet_26="$srcdir/src/module-env-26.h" module_env_snippet_27="$srcdir/src/module-env-27.h" module_env_snippet_28="$srcdir/src/module-env-28.h" +module_env_snippet_29="$srcdir/src/module-env-29.h" emacs_major_version="${PACKAGE_VERSION%%.*}" AC_SUBST(emacs_major_version) diff --git a/etc/NEWS.28 b/etc/NEWS.28 new file mode 100644 index 0000000000..b9f5830656 --- /dev/null +++ b/etc/NEWS.28 @@ -0,0 +1,4570 @@ +GNU Emacs NEWS -- history of user-visible changes. + +Copyright (C) 2019-2021 Free Software Foundation, Inc. +See the end of the file for license conditions. + +Please send Emacs bug reports to 'bug-gnu-emacs@gnu.org'. +If possible, use 'M-x report-emacs-bug'. + +This file is about changes in Emacs version 28. + +See file HISTORY for a list of GNU Emacs versions and release dates. +See files NEWS.27, NEWS.26, ..., NEWS.18, and NEWS.1-17 for changes +in older Emacs versions. + +You can narrow news to a specific version by calling 'view-emacs-news' +with a prefix argument or by typing 'C-u C-h C-n'. + +Temporary note: ++++ indicates that all relevant manuals in doc/ have been updated. +--- means no change in the manuals is needed. +When you add a new item, use the appropriate mark if you are sure it +applies, and please also update docstrings as needed. + + +* Installation Changes in Emacs 28.1 + +** Emacs now optionally supports native compilation of Lisp files. +To enable this, configure Emacs with the '--with-native-compilation' option. +This requires the libgccjit library to be installed and functional, +and also requires GCC and Binutils to be available when Lisp code is +natively compiled. See the Info node "(elisp) Native Compilation" for +more details. + +If you build Emacs with native compilation, but without zlib, be sure +to configure with the '--without-compress-install' option, so that the +installed *.el files are not compressed; otherwise, you will not be +able to use JIT native compilation of the installed *.el files. + +** The Cairo graphics library is now used by default if present. +'--with-cairo' is now the default, if the appropriate development files +are found by 'configure'. Note that building with Cairo means using +Pango instead of libXFT for font support. Since Pango 1.44 has +removed support for bitmapped fonts, this may require you to adjust +your font settings. + +Note also that 'FontBackend' settings in ".Xdefaults" or +".Xresources", or 'font-backend' frame parameter settings in your init +files, may need to be adjusted, as 'xft' is no longer a valid backend +when using Cairo. Use 'ftcrhb' if your Emacs was built with HarfBuzz +text shaping support, and 'ftcr' otherwise. You can determine this by +checking 'system-configuration-features'. The 'ftcr' backend will +still be available when HarfBuzz is supported, but will not be used by +default. We strongly recommend building with HarBuzz support. 'x' is +still a valid backend. + +--- +** 'configure' now warns about building with libXft support. +libXft is unmaintained, and causes a number of problems with modern +fonts including but not limited to crashes; support for it may be +removed in a future version of Emacs. Please consider using +Cairo + HarfBuzz instead. + +--- +** 'configure' now warns about not using HarfBuzz if using Cairo. +We want to encourage people to use the most modern font features +available, and this is the Cairo graphics library + HarfBuzz for font +shaping, so 'configure' now recommends that combination. + +--- +** Building without double buffering support. +'configure --with-xdbe=no' can now be used to disable double buffering +at build time. + +--- +** Support for building with Motif has been removed. + +--- +** The configure option '--without-makeinfo' has been removed. +This was only ever relevant when building from a repository checkout. +This now requires makeinfo, which is part of the texinfo package. + +--- +** Support for building with '-fcheck-pointer-bounds' has been removed. +GCC has withdrawn the '-fcheck-pointer-bounds' option and support for +its implementation has been removed from the Linux kernel. + +--- +** The ftx font backend driver has been removed. +It was declared obsolete in Emacs 27.1. + +--- +** Emacs no longer supports old OpenBSD systems. +OpenBSD 5.3 and older releases are no longer supported, as they lack +proper pty support that Emacs needs. + + +* Startup Changes in Emacs 28.1 + +--- +** In GTK builds, Emacs now supports startup notification. +This means that Emacs won't steal keyboard focus upon startup +(when started via the Desktop) if the user is typing into another +application. + +--- +** Errors in 'kill-emacs-hook' no longer prevent Emacs from shutting down. +If a function in that hook signals an error in an interactive Emacs, +the user will be prompted on whether to continue. If the user doesn't +answer within five seconds, Emacs will continue shutting down anyway. + +** Emacs now supports loading a Secure Computing filter. +This is supported only on capable GNU/Linux systems. To activate, +invoke Emacs with the '--seccomp=FILE' command-line option. FILE must +name a binary file containing an array of 'struct sock_filter' +structures. Emacs will then install that list of Secure Computing +filters into its own process early during the startup process. You +can use this functionality to put an Emacs process in a sandbox to +avoid security issues when executing untrusted code. See the manual +page for 'seccomp' system call, for details about Secure Computing +filters. + +** Emacs can support 24-bit color TTY without terminfo database. +If your text-mode terminal supports 24-bit true color, but your system +lacks the terminfo database, you can instruct Emacs to support 24-bit +true color by setting 'COLORTERM=truecolor' in the environment. This is +useful on systems such as FreeBSD which ships only with "etc/termcap". + +--- +** File names given on the command line are now be pushed onto history. +The file names will be pushed onto 'file-name-history', like the names +of files visited via 'C-x C-f' and other commands. + + +* Changes in Emacs 28.1 + +--- +** Emacs now supports Unicode Standard version 14.0. + ++++ +** New character script 'emoji' has been created. +Various blocks of codepoints have been split out of the 'symbol' +script into their own 'emoji' script to allow easier specification of +their treatment. Which codepoints are treated as emoji is derived +from the Unicode specifications. Also, Emacs will now use "Noto Color +Emoji" by default for that script. Use: + +(set-fontset-font t 'emoji + '("My New Emoji Font" . "iso10646-1") nil 'prepend) + +to change the font used. + ++++ +** Zero Width Joiner (ZWJ) and emoji sequences are now composed. +Emacs can now compose (almost) all the Unicode-14 ZWJ and emoji +sequences (if a suitable font is installed) so that they are displayed +as single glyphs instead of multiple ones. 'Noto Color Emoji' is one +such suitable font. + ++++ +** Composition of emoji has been improved. +If autocomposition is triggered by an emoji character, then the emoji +font is now used to check if composition can be performed, rather than +the font of the first character of the string being composed. This +allows e.g. + +'Emoji codepoint' + VS-16 + +to be displayed using the emoji font even if 'Emoji codepoint' does +not have emoji presentation by default. + ++++ +** 'glyphless-char-display-control' now applies to Variation Selectors. +VS-1 through VS-16 are now displayed as 'thin-space' by default when +not composed. + ++++ +** New command 'execute-extended-command-for-buffer'. +This new command, bound to 'M-S-x', works like +'execute-extended-command', but limits the set of commands to the +commands that have been determined to be particularly useful with the +current mode. + ++++ +** New user option 'read-extended-command-predicate'. +This user option controls how 'M-x' performs completion of commands when +you type 'TAB'. By default, any command that matches what you have +typed is considered a completion candidate, but you can customize this +option to exclude commands that are not applicable to the current +buffer's major and minor modes, and respect the command's completion +predicate (if any). + ++++ +** Completion on 'M-x' shows key bindings for commands. +When 'suggest-key-bindings' is non-nil (as it is by default), the +completion list popped up by 'M-x' shows the key bindings for all the +commands shown in the list of candidate completions that have a key +binding. + ++++ +** New user option 'completions-detailed'. +When non-nil, some commands like 'describe-symbol' show more detailed +completions with more information in completion prefix and suffix. +The default is nil. + +--- +** 'C-s' in 'M-x' now once again searches over completions. +In Emacs 23, typing 'M-x' ('read-extended-command') and then 'C-s' (to +do an interactive search) would search over possible completions. +This was lost in Emacs 24, but is now back again. + +--- +** User option 'completions-format' supports a new value 'one-column'. + ++++ +** New system for displaying documentation for groups of functions. +This can either be used by saying 'M-x shortdoc-display-group' and +choosing a group, or clicking a button in the "*Help*" buffers when +looking at the doc string of a function that belongs to one of these +groups. + ++++ +** New minor mode 'context-menu-mode' for context menus popped by 'mouse-3'. +When this mode is enabled, clicking 'down-mouse-3' anywhere in the buffer +pops up a menu whose contents depends on surrounding context near the +mouse click. You can change the order of the default sub-menus in the +context menu by customizing the user option 'context-menu-functions'. +You can also invoke the context menu by pressing 'S-' or, +on macOS, by clicking 'C-down-mouse-1'. + ++++ +** A new keymap for buffer actions has been added. +The 'C-x x' keymap now holds keystrokes for various buffer-oriented +commands. The new keystrokes are 'C-x x g' ('revert-buffer-quick'), +'C-x x r' ('rename-buffer'), 'C-x x u' ('rename-uniquely'), 'C-x x n' +('clone-buffer'), 'C-x x i' ('insert-buffer'), 'C-x x t' +('toggle-truncate-lines') and 'C-x x f' ('font-lock-update'). + ++++ +** Modifiers now go outside angle brackets in pretty-printed key bindings. +For example, 'RET' 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). + +--- +** 'eval-expression' no longer signals an error on incomplete expressions. +Previously, typing 'M-: ( RET' would result in Emacs saying "End of +file during parsing" and dropping out of the minibuffer. The user +would have to type 'M-: M-p' to edit and redo the expression. Now +Emacs will echo the message and allow the user to continue editing. + ++++ +** 'eval-last-sexp' now handles 'defvar'/'defcustom'/'defface' specially. +This command would previously not redefine values defined by these +forms, but this command has now been changed to work more like +'eval-defun', and reset the values as specified. + +--- +** New user option 'use-short-answers'. +When non-nil, the function 'y-or-n-p' is used instead of +'yes-or-no-p'. This eliminates the need to define an alias that maps +one to another in the init file. The same user option also controls +whether the function 'read-answer' accepts short answers. + ++++ +** New user option 'kill-buffer-delete-auto-save-files'. +If non-nil, killing a buffer that has an auto-save file will prompt +the user for whether that file should be deleted. (Note that +'delete-auto-save-files', if non-nil, was previously documented to +result in deletion of auto-save files when killing a buffer without +unsaved changes, but this has apparently not worked for several +decades, so the documented semantics of this variable has been changed +to match the behavior.) + ++++ +** New user option 'next-error-message-highlight'. +In addition to a fringe arrow, 'next-error' error may now optionally +highlight the current error message in the 'next-error' buffer. +This user option can be also customized to keep highlighting on all +visited errors, so you can have an overview what errors were already visited. + +--- +** New choice 'next-error-quit-window' for 'next-error-found-function'. +When 'next-error-found-function' is customized to 'next-error-quit-window', +then typing the numeric prefix argument 0 before the command 'next-error' +will quit the source window after visiting the next occurrence. + ++++ +** New user option 'file-preserve-symlinks-on-save'. +This controls what Emacs does when saving buffers that visit files via +symbolic links, and 'file-precious-flag' is non-nil. + ++++ +** New user option 'copy-directory-create-symlink'. +If non-nil, will make 'copy-directory' (when used on a symbolic +link) copy the link instead of following the link. The default is +nil, so the default behavior is unchanged. + ++++ +** New user option 'ignored-local-variable-values'. +This is the opposite of 'safe-local-variable-values' -- it's an alist +of variable-value pairs that are to be ignored when reading a +local-variables section of a file. + +--- +** Specific warnings can now be disabled from the warning buffer. +When a warning is displayed to the user, the resulting buffer now has +buttons which allow making permanent changes to the treatment of that +warning. Automatic showing of the warning can be disabled (although +it is still logged to the "*Messages*" buffer), or the warning can be +disabled entirely. + ++++ +** ".dir-locals.el" now supports setting 'auto-mode-alist'. +The new 'auto-mode-alist' specification in ".dir-locals.el" files can +now be used to override the global 'auto-mode-alist' in the current +directory tree. + +--- +** User option 'uniquify-buffer-name-style' can now be a function. +This user option can be one of the predefined styles or a function to +personalize the uniquified buffer name. + +--- +** 'remove-hook' is now an interactive command. + +--- +** 'expand-file-name' now checks for null bytes in filenames. +The function will now check for null bytes in both NAME and +DEFAULT-DIRECTORY arguments, as well as in the 'default-directory' +buffer-local variable, when its value is used. If null bytes are +found, 'expand-file-name' will signal an error. +This means that practically all file-related operations will now check +file names for null bytes, thus avoiding subtle bugs with silently +using only the part of file name up to the first null byte. + +--- +** Frames + ++++ +*** The key prefix 'C-x 5 5' displays next command buffer in a new frame. +It's bound to the command 'other-frame-prefix' that requests the buffer +of the next command to be displayed in a new frame. + ++++ +*** New command 'clone-frame' (bound to 'C-x 5 c'). +This is like 'C-x 5 2', but uses the frame parameters of the current +frame instead of 'default-frame-alist'. + +--- +*** Default values of 'frame-title-format' and 'icon-title-format' have changed. +These variables are used to display the title bar of visible frames +and the title bar of an iconified frame. They now show the name of +the current buffer and the text "GNU Emacs" instead of the value of +'invocation-name'. To get the old behavior back, add the following to +your init file: + + (setq frame-title-format '(multiple-frames "%b" + ("" invocation-name "@" system-name))) + ++++ +*** New frame parameter 'drag-with-tab-line'. +This parameter, similar to 'drag-with-header-line', allows moving frames +by dragging the tab lines of their topmost windows with the mouse. + ++++ +*** New optional behavior of 'delete-other-frames'. +When invoked with a prefix argument, 'delete-other-frames' now +iconifies frames, rather than deleting them. + +--- +*** Commands 'set-frame-width' and 'set-frame-height' now prompt for values. +These commands now prompt for the value via the minibuffer, instead of +requiring the user to specify the value via the prefix argument. + +** Windows + +*** 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. + +*** The key prefix 'C-x 4 4' displays next command buffer in a new window. +It's bound to the command 'other-window-prefix' that requests the buffer +of the next command to be displayed in a new window. + ++++ +*** New command 'recenter-other-window', bound to 'S-M-C-l'. +Like 'recenter-top-bottom' acting on the other window. + ++++ +*** New user option 'delete-window-choose-selected'. +This allows to choose a window that will be the frame's selected +window after deleting the currently selected one. + ++++ +*** New argument NO-OTHER for some window functions. +'get-lru-window', 'get-mru-window' and 'get-largest-window' now accept a +new optional argument NO-OTHER which, if non-nil, avoids returning a +window whose 'no-other-window' parameter is non-nil. + ++++ +*** 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. + +** Minibuffer + ++++ +*** Minibuffer scrolling is now conservative by default. +This is controlled by the new variable 'scroll-minibuffer-conservatively'. +It is t by default; setting it to nil will cause scrolling in the +minibuffer obey the value of 'scroll-conservatively'. + ++++ +*** Improved handling of minibuffers on switching frames. +By default, when you switch to another frame, an active minibuffer now +moves to the newly selected frame. Nevertheless, the effect of what +you type in the minibuffer happens in the frame where the minibuffer +was first activated. An alternative behavior is available by +customizing 'minibuffer-follows-selected-frame' to nil. Here, the +minibuffer stays in the frame where you first opened it, and you must +switch back to this frame to continue or abort its command. The old +behavior, which mixed these two, can be approximated by customizing +'minibuffer-follows-selected-frame' to a value which is neither nil +nor t. + ++++ +*** New user option 'read-minibuffer-restore-windows'. +When customized to nil, it uses 'minibuffer-restore-windows' in +'minibuffer-exit-hook' to remove only the window showing the +"*Completions*" buffer. + +--- +*** New variable 'redisplay-adhoc-scroll-in-resize-mini-windows'. +Customizing it to nil will disable the ad-hoc auto-scrolling of +minibuffer text shown in mini-windows when resizing those windows. +The default heuristics of that scrolling can be counter productive in +some corner cases, though the cure might be worse than the disease. +This said, the effect should be negligible in the vast majority of +cases anyway. + +** Mode Line + ++++ +*** New user option 'mode-line-compact'. +If non-nil, repeating spaces are compressed into a single space. If +'long', this is only done when the mode line is longer than the +current window width (in columns). + ++++ +*** New user options to control format of line/column numbers in the mode line. +'mode-line-position-line-format' is the line number format (when +'line-number-mode' is on), 'mode-line-position-column-format' is +the column number format (when 'column-number-mode' is on), and +'mode-line-position-column-line-format' is the combined format (when +both modes are on). + +** Tab Bars and Tab Lines + ++++ +*** The prefix key 'C-x t t' can be used to display a buffer in a new tab. +Typing 'C-x t t' before a command will cause the buffer shown by that +command to be displayed in a new tab. 'C-x t t" is bound to the +command 'other-tab-prefix'. + ++++ +*** New command 'C-x t C-r' to open file read-only in the other tab. + +*** The tab bar now supports more mouse commands. +Clicking 'mouse-2' closes the tab, 'mouse-3' displays the context menu +with items that operate on the clicked tab. Dragging the tab with +'mouse-1' moves it to another position on the tab bar. Mouse wheel +scrolling switches to the previous/next tab, and holding the Shift key +during scrolling moves the tab to the left/right. + +--- +*** Frame-specific appearance of the tab bar when 'tab-bar-show' is a number. +When 'tab-bar-show' is a number, the tab bar on different frames can +be shown or hidden independently, as determined by the number of tabs +on each frame compared to the numerical value of 'tab-bar-show'. + +--- +*** New command 'toggle-frame-tab-bar'. +It can be used to enable/disable the tab bar on the currently selected +frame regardless of the values of 'tab-bar-mode' and 'tab-bar-show'. +This allows to enable/disable the tab bar independently on different +frames. + +--- +*** New user option 'tab-bar-format' defines a list of tab bar items. +When it contains 'tab-bar-format-global' (possibly appended after +'tab-bar-format-align-right'), then after enabling 'display-time-mode' +(or any other mode that uses 'global-mode-string') it displays time +aligned to the right on the tab bar instead of on the mode line. +When 'tab-bar-format-tabs' is replaced with 'tab-bar-format-tabs-groups', +the tab bar displays tab groups. + +--- +*** New optional key binding for 'tab-last'. +If you customize the user option 'tab-bar-select-tab-modifiers' for +selecting tabs using its index numbers, the '-9' key is +bound to 'tab-last', and switches to the last tab. Here is +any of the modifiers in the list that is the value of +'tab-bar-select-tab-modifiers'. You can also use negative indices, +which count from the last tab: -1 is the last tab, -2 the one before +that, etc. + +--- +*** New command 'tab-duplicate' bound to 'C-x t n'. + +--- +*** 'C-x t N' creates a new tab at the specified absolute position. +The position is provided as prefix arg, and specifies an index that +starts at 1. Negative values count from the end of the tab bar. + +--- +*** 'C-x t M' moves the current tab to the specified absolute position. +The position is provided as prefix arg, whose interpretation is as in +'C-x t N'. + +--- +*** 'C-x t G' assigns a tab to a named group of tabs. +'tab-close-group' closes all tabs that belong to the selected group. +The user option 'tab-bar-new-tab-group' defines the default group of +new tabs. After customizing 'tab-bar-tab-post-change-group-functions' +to 'tab-bar-move-tab-to-group', changing the group of a tab will also +move it closer to other tabs in the same group. + +--- +*** New user option 'tab-bar-tab-name-format-function'. + +--- +*** New user option 'tab-line-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 +the mouse pointer is in the tab line by scrolling left or right. + +--- +*** New tab-line faces and options. +The face 'tab-line-tab-special' is used for tabs whose buffers are +special, i.e. buffers that don't visit a file. The face +'tab-line-tab-modified' is used to display modified, file-backed +buffers. The face 'tab-line-tab-inactive-alternate' is used to +display inactive tabs with an alternating background color, making +them easier to distinguish, especially if the face 'tab-line-tab' is +configured to not display with a box; this alternate face is only +applied when the option 'tab-line-tab-face-functions' is so +configured. That option may also be used to customize tab-line faces +in other ways. + +** Mouse wheel + +--- +*** Mouse wheel scrolling now defaults to one line at a time. + +--- +*** Mouse wheel scrolling now works on more parts of frame's display. +When using 'mwheel-mode', the mouse wheel will now scroll also when +the mouse cursor is on the scroll bars, fringes, margins, header line, +and mode line. ('mwheel-mode' is enabled by default on most graphical +displays.) + ++++ +*** Mouse wheel scrolling with Shift modifier now scrolls horizontally. +This works in text buffers and over images. Typing a numeric prefix arg +(e.g. 'M-5') before starting horizontal scrolling changes its step value. +The value is saved in the user option 'mouse-wheel-scroll-amount-horizontal'. + +** Customize + +--- +*** Customize buffers can now be reverted with 'C-x x g'. + +--- +*** Most customize commands now hide obsolete user options. +Obsolete user options are no longer shown in the listings produced by +the commands 'customize', 'customize-group', 'customize-apropos' and +'customize-changed'. + +To customize obsolete user options, use 'customize-option' or +'customize-saved'. + +--- +*** New SVG icons for checkboxes and arrows. +They will be used automatically instead of the old icons. If Emacs is +built without SVG support, the old icons will be used instead. + +** Help + +--- +*** The order things are displayed in the *Help* buffer has been changed. +The indented "administrative" block (containing the "probably +introduced" and "other relevant functions" (and similar things) has +been moved to after the doc string. + ++++ +*** New command 'describe-command' shows help for a command. +This can be used instead of 'describe-function' for interactive +commands and is globally bound to 'C-h x'. + ++++ +*** New command 'describe-keymap' describes keybindings in a keymap. + +--- +*** New command 'apropos-function'. +This works like 'C-u M-x apropos-command' but is more discoverable. + +--- +*** New keybinding 'C-h R' prompts for an Info manual and displays it. + +--- +*** Keybindings in 'help-mode' use the new 'help-key-binding' face. +This face is added by 'substitute-command-keys' to any "\[command]" +substitution. The return value of that function should consequently +be assumed to be a propertized string. + +Note that the new face will also be used in tooltips. When using the +GTK toolkit, this is only true if 'x-gtk-use-system-tooltips' is t. + ++++ +*** New user option 'help-enable-symbol-autoload'. +If non-nil, displaying help for an autoloaded function whose +'autoload' form provides no documentation string will try to load the +file it's from. This will give more extensive help for such +functions. + +--- +*** The 'help-for-help' ('C-h C-h') screen has been redesigned. + ++++ +*** New convenience commands with short keys in the Help buffer. +New command 'help-view-source' ('s') will view the source file (if +any) of the current help topic. New command 'help-goto-info' ('i') +will look up the current symbol (if any) in Info. New command +'help-customize' ('c') will customize the user option or the face +(if any) whose doc string is being shown in the Help buffer. + +--- +*** New user option 'describe-bindings-outline'. +It enables outlines in the output buffer of 'describe-bindings' that +can provide a better overview in a long list of available bindings. + ++++ +*** New command 'lossage-size'. +It allows users to change the maximum number of keystrokes and +commands recorded for the purpose of 'view-lossage'. + ++++ +*** New commands to describe buttons and widgets. +'widget-describe' (on a widget) will pop up a help buffer and give a +description of the properties. Likewise 'button-describe' does the +same for a button. + +--- +*** Improved "find definition" feature of "*Help*" buffers. +Now clicking on the link to find the definition of functions generated +by 'cl-defstruct', or variables generated by 'define-derived-mode', +for example, will go to the exact place where they are defined. + +--- +*** New commands 'apropos-next-symbol' and 'apropos-previous-symbol'. +These new navigation commands are bound to 'n' and 'p' in +'apropos-mode'. + +--- +*** The command 'view-lossage' can now be invoked from the menu bar. +The menu bar "Help" menu now has a "Show Recent Inputs" item under the +"Describe" sub-menu. + +--- +*** Closing the "*Help*" buffer from the toolbar now buries the buffer. +In previous Emacs versions, the "*Help*" buffer was killed instead when +clicking the "X" icon in the tool bar. + +--- +*** 'g' ('revert-buffer') in 'help-mode' no longer requires confirmation. + +** File Locks + ++++ +*** New user option 'lock-file-name-transforms'. +This option allows controlling where lock files are written. It uses +the same syntax as 'auto-save-file-name-transforms'. + ++++ +*** New user option 'remote-file-name-inhibit-locks'. +When non-nil, this option suppresses lock files for remote files. + ++++ +*** New minor mode 'lock-file-mode'. +This command, called interactively, toggles the local value of +'create-lockfiles' in the current buffer. + +** Emacs Server + ++++ +*** New user option 'server-client-instructions'. +When emacsclient connects, Emacs will (by default) output a message +about how to exit the client frame. If 'server-client-instructions' +is set to nil, this message is inhibited. + ++++ +*** New command 'server-edit-abort'. +This command (not bound to any key by default) can be used to abort +an edit instead of marking it as "Done" (which the 'C-x #' command +does). The 'emacsclient' program exits with an abnormal status as +result of this command. + ++++ +*** New desktop integration for connecting to the server. +If your operating system’s desktop environment is +freedesktop.org-compatible (which is true of most GNU/Linux and other +recent Unix-like desktops), you may use the new "Emacs (Client)" +desktop menu entry to open files in an existing Emacs instance rather +than starting a new one. The daemon starts if it is not already +running. + +** Miscellaneous + ++++ +*** New command 'font-lock-update', bound to 'C-x x f'. +This command updates the syntax highlighting in this buffer. + ++++ +*** New command 'memory-report'. +This command opens a new buffer called "*Memory Report*" and gives a +summary of where Emacs is using memory currently. + ++++ +*** New command 'submit-emacs-patch'. +This works like 'report-emacs-bug', but is more geared towards sending +patches to the Emacs issue tracker. + +--- +*** New face 'apropos-button'. +Applies to buttons that indicate a face. + ++++ +*** New face 'font-lock-doc-markup-face'. +Intended for documentation mark-up syntax and tags inside text that +uses 'font-lock-doc-face', with which it should harmonize. It would +typically be used in structured documentation comments in program +source code by language-specific modes, for mark-up conventions like +Haddock, Javadoc or Doxygen. By default this face inherits from +'font-lock-constant-face'. + ++++ +*** New face 'flat-button'. +This is a plain 2D button, but uses the background color instead of +the foreground color. + +--- +*** New face 'shortdoc-heading'. +Applies to headings of shortdoc sections. + +--- +*** New face 'separator-line'. +This is used by 'make-separator-line' (see below). + ++++ +*** '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. + +--- +*** Obsolete aliases are no longer hidden from command completion. +Completion of command names now considers obsolete aliases as +candidates, if they were marked obsolete in the current major version +of Emacs. Invoking a command via an obsolete alias now mentions the +obsolescence fact and shows the new name of the command. + ++++ +*** Support for '(box . SIZE)' 'cursor-type'. +By default, 'box' cursor always has a filled box shape. But if you +specify 'cursor-type' to be '(box . SIZE)', the cursor becomes a hollow +box if the point is on an image larger than SIZE pixels in any +dimension. + ++++ +*** The user can now customize how "default" values are prompted for. +The new utility function 'format-prompt' has been added which uses the +new 'minibuffer-default-prompt-format' user option to format "default" +prompts. This means that prompts that look like "Enter a number +(default 10)" can be customized to look like, for instance, "Enter a +number [10]", or not have the default displayed at all, like "Enter a +number". (This only affects callers that were altered to use +'format-prompt'.) + +--- +*** New help window when Emacs prompts before opening a large file. +Commands like 'find-file' or 'visit-tags-table' ask to visit a file +normally or literally when the file is larger than a certain size (by +default, 9.5 MiB). Press '?' or 'C-h' in that prompt to read more +about the different options to visit a file, how you can disable the +prompt, and how you can tweak the file size threshold. + ++++ +*** Emacs now defaults to UTF-8 instead of ISO-8859-1. +This is only for the default, where the user has set no 'LANG' (or +similar) variable or environment. This change should lead to no +user-visible changes for normal usage. + +--- +*** 'global-display-fill-column-indicator-mode' skips some buffers. +By default, turning on 'global-display-fill-column-indicator-mode' +doesn't turn on 'display-fill-column-indicator-mode' in special-mode +buffers. This can be controlled by customizing the user option +'global-display-fill-column-indicator-modes'. + ++++ +*** 'nobreak-char-display' now also affects all non-ASCII space characters. +Previously, this was limited only to 'NO-BREAK SPACE' and hyphen +characters. Now it also covers the rest of the non-ASCII Unicode +space characters. + ++++ +*** Improved support for terminal emulators that encode the Meta flag. +Some terminal emulators set the 8th bit of Meta characters, and then +encode the resulting character code as if it were non-ASCII character +above codepoint 127. Previously, the only way of using these in Emacs +was to set up the terminal emulator to use the 'ESC' characters to send +Meta characters to Emacs, e.g., send "ESC x" when the user types +'M-x'. You can now avoid the need for this setup of such terminal +emulators by using the new input-meta-mode with the special value +'encoded' with these terminal emulators. + +--- +*** 'auto-composition-mode' can now be selectively disabled on some TTYs. +Some text-mode terminals produce display glitches trying to compose +characters. The 'auto-composition-mode' can now have a string value +that names a terminal type; if the value returned by the 'tty-type' +function compares equal with that string, automatic composition will +be disabled in windows shown on that terminal. The Linux terminal +sets this up by default. + +--- +*** Support for the 'strike-through' face attribute on TTY frames. +If your terminal's termcap or terminfo database entry has the 'smxx' +capability defined, Emacs will now emit the prescribed escape +sequences necessary to render faces with the 'strike-through' +attribute on TTY frames. + +--- +*** TTY menu navigation is now supported in 'xterm-mouse-mode'. +TTY menus support mouse navigation and selection when 'xterm-mouse-mode' +is active. When run on a terminal, clicking on the menu bar with the +mouse now pops up a TTY menu by default instead of running the command +'tmm-menubar'. To restore the old behavior, set the user option +'tty-menu-open-use-tmm' to non-nil. + +--- +*** 'M-x report-emacs-bug' will no longer include "Recent messages" section. +These were taken from the "*Messages*" buffer, and may inadvertently +leak information from the reporting user. + +--- +*** 'C-u M-x dig' will now prompt for a query type to use. + +--- +*** Rudimentary support for the 'st' terminal emulator. +Emacs now supports 256 color display on the 'st' terminal emulator. + ++++ +*** Update IRC-related references to point to Libera.Chat. +The Free Software Foundation and the GNU Project have moved their +official IRC channels from the Freenode network to Libera.Chat. For the +original announcement and the follow-up update, including more details, +see: + +https://lists.gnu.org/archive/html/info-gnu/2021-06/msg00005.html +https://lists.gnu.org/archive/html/info-gnu/2021-06/msg00007.html + +Given the relocation of GNU and FSF's official IRC channels, as well +as #emacs and various other Emacs-themed channels (see the link below) +to Libera.Chat, IRC-related references in the Emacs repository have +now been updated to point to Libera.Chat. + +https://lists.gnu.org/archive/html/info-gnu-emacs/2021-06/msg00000.html + + +* Editing Changes in Emacs 28.1 + +** Input methods + ++++ +*** Emacs now supports "transient" input methods. +A transient input method is enabled for inserting a single character, +and is then automatically disabled. 'C-x \' temporarily enables the +selected transient input method. Use 'C-u C-x \' to select a +transient input method (which can be different from the input method +enabled by 'C-\'). For example, 'C-u C-x \ compose RET' selects the +'compose' input method; then typing 'C-x \ 1 2' will insert the +character '½', and disable the 'compose' input method afterwards. +You can use 'C-x \' in incremental search to insert a single character +to the search string. + +--- +*** New input method 'compose' based on X Multi_key sequences. + +--- +*** New input method 'iso-transl' with the same keys as 'C-x 8'. +After selecting it as a transient input method with 'C-u C-x \ +iso-transl RET', it supports the same key sequences as 'C-x 8', +so e.g. like 'C-x 8 [' inserts a left single quotation mark, +'C-x \ [' does the same. + +--- +*** New user option 'read-char-by-name-sort'. +It defines the sorting order of characters for completion of 'C-x 8 RET TAB' +and can be customized to sort them by codepoints instead of character names. +Additionally, you can group characters by Unicode blocks after customizing +'completions-group' and 'completions-group-sort'. + +--- +*** Improved language transliteration in Malayalam input methods. +Added a new Mozhi scheme. The inapplicable ITRANS scheme is now +deprecated. Errors in the Inscript method were corrected. + +--- +*** New input method 'cham'. +There's also a Cham greeting in "etc/HELLO". + +--- +*** New input methods for Lakota language orthographies. +Two orthographies are represented here, the Suggested Lakota +Orthography and what is known as the White Hat Orthography. Input +methods 'lakota-slo-prefix', 'lakota-slo-postfix', and +'lakota-white-hat-postfix' have been added. There is also a Lakota +greeting in "etc/HELLO". + ++++ +** Standalone 'M-y' allows interactive selection from previous kills. +'M-y' can now be typed after a command that is not a yank command. +When invoked like that, it prompts in the minibuffer for one of the +previous kills, offering completion and minibuffer-history navigation +through previous kills recorded in the kill ring. A similar feature +in Isearch can be invoked if you bind 'C-s M-y' to the command +'isearch-yank-pop'. When the user option 'yank-from-kill-ring-rotate' +is nil the kill ring is not rotated after 'yank-from-kill-ring'. + ++++ +** New user option 'word-wrap-by-category'. +When word-wrap is enabled, and this option is non-nil, that allows +Emacs to break lines after more characters than just whitespace +characters. In particular, this significantly improves word-wrapping +for CJK text mixed with Latin text. + ++++ +** New command 'undo-redo'. +It undoes previous undo commands, but doesn't record itself as an +undoable command. It is bound to 'C-?' and 'C-M-_', the first binding +works well in graphical mode, and the second one is easy to hit on tty. + +For full conventional undo/redo behavior, you can also customize the +user option 'undo-no-redo' to t. + ++++ +** New commands 'copy-matching-lines' and 'kill-matching-lines'. +These commands are similar to the command 'flush-lines', +but add the matching lines to the kill ring as a single string, +including the newlines that separate the lines. + ++++ +** New user option 'kill-transform-function'. +This can be used to transform (and suppress) strings from entering the +kill ring. + ++++ +** 'save-interprogram-paste-before-kill' can now be a number. +In that case, it's interpreted as a limit on the size of the clipboard +data that will be saved to the 'kill-ring' prior to killing text: if +the size of the clipboard data is greater than or equal to the limit, +it will not be saved. + ++++ +** New user option 'tab-first-completion'. +If 'tab-always-indent' is 'complete', this new user option can be used to +further tweak whether to complete or indent. + +--- +** 'indent-tabs-mode' is now a global minor mode instead of just a variable. + +--- +** New choice 'permanent' for 'shift-select-mode'. +When the mark was activated by shifted motion keys, non-shifted motion +keys don't deactivate the mark after customizing 'shift-select-mode' +to 'permanent'. + ++++ +** The "Edit => Clear" menu item now obeys a rectangular region. + ++++ +** New command 'revert-buffer-with-fine-grain'. +Revert a buffer trying to be as non-destructive as possible, +preserving markers, properties and overlays. The new variable +'revert-buffer-with-fine-grain-max-seconds' specifies the maximum +number of seconds that 'revert-buffer-with-fine-grain' should spend +trying to be non-destructive, with a default value of 2 seconds. + ++++ +** New command 'revert-buffer-quick'. +This is bound to 'C-x x g' and is like 'revert-buffer', but prompts +less. + ++++ +** New user option 'revert-buffer-quick-short-answers'. +This controls how the new 'revert-buffer-quick' ('C-x x g') command +prompts. + ++++ +** New user option 'query-about-changed-file'. +If non-nil (the default), Emacs prompts as before when re-visiting a +file that has changed externally after it was visited the first time. +If nil, Emacs does not prompt, but instead shows the buffer with its +contents before the change, and provides instructions how to revert +the buffer. + +--- +** New value 'save-some-buffers-root' of 'save-some-buffers-default-predicate'. +When using this predicate, only buffers under the current project root +will be considered when saving buffers with 'save-some-buffers'. + +--- +** New user option 'save-place-abbreviate-file-names'. +This can simplify sharing the 'save-place-file' file across +different hosts. + +--- +** New user options 'copy-region-blink-delay' and 'delete-pair-blink-delay'. +'copy-region-blink-delay' specifies a delay to indicate the region +copied by 'kill-ring-save'. 'delete-pair-blink-delay' specifies +a delay to show the paired character to delete. + +--- +** 'zap-up-to-char' now uses 'read-char-from-minibuffer'. +This allows navigating through the history of characters that have +been input. This is mostly useful for characters that have complex +input methods where inputting the character again may involve many +keystrokes. + ++++ +** Input history for 'goto-line' can now be made local to every buffer. +In any event, line numbers used with 'goto-line' are kept in their own +history list. This should help make faster the process of finding +line numbers that were previously jumped to. By default, all buffers +share a single history list. To make every buffer have its own +history list, customize the user option 'goto-line-history-local'. + ++++ +** New command 'goto-line-relative' for use in a narrowed buffer. +It moves point to the line relative to the accessible portion of the +narrowed buffer. 'M-g M-g' in Info is rebound to this command. +When 'widen-automatically' is non-nil, 'goto-line' widens the narrowed +buffer to be able to move point to the inaccessible portion. +'goto-line-relative' is bound to 'C-x n g'. + ++++ +** 'got-char' prompts for the character position. +When called interactively, 'goto-char' now offers the position at +point as the default. + +** Autosaving via 'auto-save-visited-mode' can now be inhibited. +Set the variable 'auto-save-visited-mode' buffer-locally to nil to +achieve that. + ++++ +** New command 'kdb-macro-redisplay' to force redisplay in keyboard macros. +This command is bound to 'C-x C-k d'. + +--- +** 'blink-cursor-mode' is now enabled by default regardless of the UI. +It used to be enabled when Emacs is started in GUI mode but not when started +in text mode. The cursor still only actually blinks in GUI frames. + +** 'show-paren-mode' is now enabled by default. +To go back to the previous behavior, customize the user option by the +same name to nil. + ++++ +** New minor mode 'show-paren-local-mode'. +It serves as a local counterpart for 'show-paren-mode', allowing you +to toggle it separately in different buffers. To use it only in +programming modes, for example, add the following to your init file: + +(add-hook 'prog-mode-hook #'show-paren-local-mode) + + +* Changes in Specialized Modes and Packages in Emacs 28.1 + +** Isearch and Replace + ++++ +*** Interactive regular expression search now uses faces for sub-groups. +E.g., 'C-M-s foo-\([0-9]+\)' will now use the 'isearch-group-1' face +on the part of the regexp that matches the sub-expression "[0-9]+". +By default, there are two faces for sub-group highlighting, but you +can define more faces whose names are of the form 'isearch-group-N', +where N are successive numbers above 2. + +This is controlled by the 'search-highlight-submatches' user option. +This feature is available only on terminals that have enough colors to +distinguish between sub-expression highlighting. + ++++ +*** Interactive regular expression replace now uses faces for sub-groups. +Like 'search-highlight-submatches', this is controlled by the new user option +'query-replace-highlight-submatches'. + ++++ +*** New user option 'isearch-wrap-pause' defines how to wrap the search. +There are choices to disable wrapping completely and to wrap immediately. +When wrapping immediately, it consistently handles the numeric arguments +of 'C-s' ('isearch-repeat-forward') and 'C-r' ('isearch-repeat-backward'), +continuing with the remaining count after wrapping. + ++++ +*** New user option 'isearch-repeat-on-direction-change'. +When this option is set, direction changes in Isearch move to another +search match, if there is one, instead of moving point to the other +end of the current match. + +*** New key 'M-s M-.' starts isearch looking for the thing at point. +This key is bound to the new command 'isearch-forward-thing-at-point'. +The new user option 'isearch-forward-thing-at-point' defines +a list of symbols to try to get the "thing" at point. By default, +the first element of the list is 'region' that tries to yank +the currently active region to the search string. + ++++ +*** New user option 'lazy-highlight-no-delay-length'. +Lazy highlighting of matches in Isearch now starts immediately if the +search string is at least this long. 'lazy-highlight-initial-delay' +still applies for shorter search strings, which avoids flicker in the +search buffer due to too many matches being highlighted. + +--- +*** The default 'search-whitespace-regexp' value has changed. +This used to be "\\s-+", which meant that it was mode-dependent whether +newlines were included in the whitespace set. This has now been +changed to only match spaces and tab characters. + +** Dired + ++++ +*** New user option 'dired-kill-when-opening-new-dired-buffer'. +If non-nil, Dired will kill the current buffer when selecting a new +directory to display. + ++++ +*** Behavior change on 'dired-do-chmod'. +As a security precaution, Dired's M command no longer follows symbolic +links. Instead, it changes the symbolic link's own mode; this always +fails on platforms where such modes are immutable. + +--- +*** Behavior change on 'dired-clean-confirm-killing-deleted-buffers'. +Previously, if 'dired-clean-up-buffers-too' was non-nil, and +'dired-clean-confirm-killing-deleted-buffers' was nil, the buffers +wouldn't be killed. This combination will now kill the buffers. + ++++ +*** New user option 'dired-switches-in-mode-line'. +This user option controls how 'ls' switches are displayed in the mode +line, and allows truncating them (to preserve space on the mode line) +or showing them literally, either instead of, or in addition to, +displaying "by name" or "by date" sort order. + ++++ +*** New user option 'dired-compress-directory-default-suffix'. +This user option controls default suffix for compressing a directory. +If it's nil, ".tar.gz" will be used. Refer to +'dired-compress-files-alist' for a list of supported suffixes. + ++++ +*** New user option 'dired-compress-file-default-suffix'. +This user option controls the default suffix for compressing files. +If it's nil, ".gz" will be used. Refer to 'dired-compress-file-alist' +for a list of supported suffixes. + +--- +*** Broken and circular links are shown with the 'dired-broken-symlink' face. + +--- +*** '=' ('dired-diff') will now put all backup files into the 'M-n' history. +When using '=' on a file with backup files, the default file to use +for diffing is the newest backup file. You can now use 'M-n' to quickly +select a different backup file instead. + ++++ +*** New user option 'dired-maybe-use-globstar'. +If set, enables globstar (recursive globbing) in shells that support +this feature, but turn it off by default. This allows producing +directory listings with files matching a wildcard in all the +subdirectories of a given directory. The new variable +'dired-enable-globstar-in-shell' lists which shells can have globstar +enabled, and how to enable it. + ++++ +*** New user option 'dired-copy-dereference'. +If set to non-nil, Dired will dereference symbolic links when copying. +This can be switched off on a per-usage basis by providing +'dired-do-copy' with a 'C-u' prefix. + +--- +*** New user option 'dired-do-revert-buffer'. +Non-nil reverts the destination Dired buffer after performing one +of these operations: 'dired-do-copy', 'dired-do-rename', +'dired-do-symlink', 'dired-do-hardlink'. + +*** New user option 'dired-mark-region'. +This option affects all Dired commands that mark files. When non-nil +and the region is active in Transient Mark mode, then Dired commands +operate only on files in the active region. The values 'file' and +'line' of this user option define the details of marking the file at +the end of the region. + +*** State changing VC operations are supported in Dired. +These operations are supported on files and directories via the new +command 'dired-vc-next-action'. + ++++ +*** 'dired-jump' and 'dired-jump-other-window' moved from 'dired-x' to 'dired'. +The 'dired-jump' and 'dired-jump-other-window' commands have been +moved from the 'dired-x' package to 'dired'. The user option +'dired-bind-jump' no longer has any effect and is now obsolete. +The commands are now bound to 'C-x C-j' and 'C-x 4 C-j' by default. + +To get the old behavior of 'dired-bind-jump' back and unbind the above +keys, add the following to your init file: + +(global-set-key "\C-x\C-j" nil) +(global-set-key "\C-x4\C-j" nil) + +--- +*** 'dired-query' now uses 'read-char-from-minibuffer'. +Using it instead of 'read-char-choice' allows using 'C-x o' +to switch to the help window displayed after typing 'C-h'. + ++++ +** New user option 'isearch-allow-motion'. +When 'isearch-allow-motion' is set, the commands 'beginning-of-buffer', +'end-of-buffer', 'scroll-up-command' and 'scroll-down-command', when +invoked during I-search, move respectively to the first occurrence of +the current search string in the buffer, the last one, the first one +after the current window, and the last one before the current window. +Additionally, users can change the meaning of other motion commands +during I-search by using their 'isearch-motion' property. The +option 'isearch-motion-changes-direction' controls whether the +direction of the search changes after a motion command. + ++++ +** Emacs 28.1 comes with Org v9.5. +See the file ORG-NEWS for user-visible changes in Org. + +** Outline + ++++ +*** New commands to cycle heading visibility. +Typing 'TAB' on a heading line cycles the current section between +"hide all", "subheadings", and "show all" states. Typing 'S-TAB' +anywhere in the buffer cycles the whole buffer between "only top-level +headings", "all headings and subheadings", and "show all" states. + ++++ +*** New user option 'outline-minor-mode-cycle'. +This user option customizes 'outline-minor-mode', with the difference +that 'TAB' and 'S-TAB' on heading lines cycle heading visibility. +Typing 'TAB' on a heading line cycles the current section between +"hide all", "subheadings", and "show all" states. Typing 'S-TAB' on a +heading line cycles the whole buffer between "only top-level +headings", "all headings and subheadings", and "show all" states. + +--- +*** New user option 'outline-minor-mode-highlight'. +This user option customizes 'outline-minor-mode'. It puts +highlighting on heading lines using standard outline faces. This +works well only when there are no conflicts with faces used by the +major mode. + +** Ispell + ++++ +*** 'ispell-comments-and-strings' now accepts START and END arguments. +These arguments default to active region when used interactively. + ++++ +*** New command 'ispell-comment-or-string-at-point'. + +--- +*** New user option 'ispell-help-timeout'. +This controls how long the ispell help (on the '?' key) is displayed. + +** Flyspell mode + ++++ +*** Corrections and actions menu can be optionally bound to 'mouse-3'. +When Flyspell mode highlights a word as misspelled, you can click on +it to display a menu of possible corrections and actions. You can now +easily bind this menu to 'down-mouse-3' (usually the right mouse button) +instead of 'mouse-2' (the default) by enabling 'context-menu-mode'. + +--- +*** The current dictionary is now displayed in the minor mode lighter. +Clicking the dictionary name changes the current dictionary. + +** Package + +*** The new NonGNU ELPA archive is enabled by default alongside GNU ELPA. +Thus, packages on NonGNU ELPA will appear by default in the list shown +by 'list-packages'. + +--- +*** '/ s' ('package-menu-filter-by-status') changed parameter handling. +The command was documented to take a comma-separated list of statuses +to filter by, but instead it used the parameter as a regexp. The +command has been changed so that it now works as documented, and +checks statuses not as a regexp, but instead an exact match from the +comma-separated list. + ++++ +*** New command 'package-browse-url' and keystroke 'w'. + ++++ +*** New commands to filter the package list. +The filter commands are bound to the following keys: + +key binding +--- ------- +/ a package-menu-filter-by-archive +/ d package-menu-filter-by-description +/ k package-menu-filter-by-keyword +/ N package-menu-filter-by-name-or-description +/ n package-menu-filter-by-name +/ s package-menu-filter-by-status +/ v package-menu-filter-by-version +/ m package-menu-filter-marked +/ u package-menu-filter-upgradable +/ / package-menu-filter-clear + +*** Option to automatically native-compile packages upon installation. +Customize the user option 'package-native-compile' to enable automatic +native compilation of packages when they are installed. That option +is nil by default; if set non-nil, and if your Emacs was built with +native-compilation support, each package will be natively compiled +when it is installed, by invoking an asynchronous Emacs subprocess to +run the native-compilation of the package files. (Be sure to leave +Emacs running until these asynchronous subprocesses exit, or else the +native-compilation will be aborted when you exit Emacs.) + +--- +*** Column widths in 'list-packages' display can now be customized. +See the new user options 'package-name-column-width', +'package-version-column-width', 'package-status-column-width', and +'package-archive-column-width'. + +** Info + +--- +*** New user option 'Info-warn-on-index-alternatives-wrap'. +This option affects what happens when using the ',' command after +looking up an entry with 'i' in info buffers. If non-nil (the +default), the ',' command will now display a warning when proceeding +beyond the final index match, and tapping ',' once more will then take +you to the first match. + +** Abbrev mode + ++++ +*** Emacs can now suggest to use an abbrev based on text you type. +A new user option, 'abbrev-suggest', enables the new abbrev suggestion +feature. When enabled, if a user manually types a piece of text that +could have saved enough typing by using an abbrev, a hint will be +displayed in the echo area, mentioning the abbrev that could have been +used instead. + +** Bookmarks + +*** Bookmarks can now be targets for new tabs. +When the bookmark.el library is loaded, a customize choice is added +to 'tab-bar-new-tab-choice' for new tabs to show the bookmark list. + +--- +*** The 'list-bookmarks' menu is now based on 'tabulated-list-mode'. +The interactive bookmark list will now benefit from features in +'tabulated-list-mode' like sorting columns or changing column width. + +Support for the optional "inline" header line, allowing for a header +without using 'header-line-format', has been dropped. Consequently, +the variables 'bookmark-bmenu-use-header-line' and +'bookmark-bmenu-inline-header-height' are now declared obsolete. + +--- +*** New user option 'bookmark-set-fringe-mark'. +If non-nil, setting a bookmark will set a fringe mark on the current +line, and jumping to a bookmark will also set this mark. + +--- +*** New user option 'bookmark-menu-confirm-deletion'. +In Bookmark Menu mode, Emacs by default does not prompt for +confirmation when you type 'x' to execute the deletion of bookmarks +that have been marked for deletion. However, if this new option is +non-nil then Emacs will require confirmation with 'yes-or-no-p' before +deleting. + +** Recentf + +--- +*** The recentf files are no longer backed up. + +--- +*** 'recentf-auto-cleanup' now repeats daily when set to a time string. +When 'recentf-auto-cleanup' is set to a time string, it now repeats +every day, rather than only running once after the mode is turned on. + +** Calc + +--- +*** The behavior when doing forward-delete has been changed. +Previously, using the 'C-d' command would delete the final number in +the input field, no matter where point was. This has been changed to +work more traditionally, with 'C-d' deleting the next character. +Likewise, point isn't moved to the end of the string before inserting +digits. + ++++ +*** Setting the word size to zero disables word clipping. +The word size normally clips the results of certain bit-oriented +operations such as shifts and bitwise XOR. A word size of zero, set +by 'b w', makes the operation have effect on the whole argument values +and the result is not truncated in any way. + +--- +*** The '/' operator now has higher precedence in (La)TeX input mode. +It no longer has lower precedence than '+' and '-'. + +--- +*** Calc now marks its windows dedicated. +The new user option 'calc-make-windows-dedicated' controls this. It +is t by default; set to nil to get back the old behavior. + +** Calendar + ++++ +*** New user option 'calendar-time-zone-style'. +If 'numeric', calendar functions (eg 'calendar-sunrise-sunset') that display +time zones will use a form like "+0100" instead of "CET". + +** Imenu + ++++ +*** New user option 'imenu-max-index-time'. +If creating the imenu index takes longer than specified by this +option (default 5 seconds), imenu indexing is stopped. + +** ido + +--- +*** Switching on 'ido-mode' now also overrides 'ffap-file-finder'. + +--- +*** Killing virtual ido buffers interactively will make them go away. +Previously, killing a virtual ido buffer with 'ido-kill-buffer' didn't +do anything. This has now been changed, and killing virtual buffers +with that command will remove the buffer from recentf. + +** So Long + +--- +*** New 'so-long-predicate' function 'so-long-statistics-excessive-p'. +It efficiently detects the presence of a long line anywhere in the +buffer using 'buffer-line-statistics' (see above). This is now the +default predicate (replacing 'so-long-detected-long-line-p'). + +--- +*** Default values 'so-long-threshold' and 'so-long-max-lines' increased. +The values of these user options have been raised to 10000 bytes and 500 +lines respectively, to reduce the likelihood of false-positives when +'global-so-long-mode' is enabled. The latter value is now only used +by the old predicate, as the new predicate knows the longest line in +the entire buffer. + +--- +*** 'so-long-target-modes' now includes 'fundamental-mode' by default. +This means that 'global-so-long-mode' will also process files which were +not recognised. (This only has an effect if 'set-auto-mode' chooses +'fundamental-mode'; buffers which are simply in 'fundamental-mode' by +default are unaffected.) + +--- +*** New user options to preserve modes and variables. +The new options 'so-long-mode-preserved-minor-modes' and +'so-long-mode-preserved-variables' allow specified mode and variable +states to be maintained if 'so-long-mode' replaces the original major +mode. By default, these new options support 'view-mode'. + +** Grep + ++++ +*** New user option 'grep-match-regexp' matches grep markers to highlight. +Grep emits SGR ANSI escape sequences to color its output. The new +user option 'grep-match-regexp' holds the regular expression to match +the appropriate markers in order to provide highlighting in the source +buffer. The user option can be customized to accommodate other +grep-like tools. + +--- +*** The 'lgrep' command now ignores directories. +On systems where the grep command supports it, directories will be +skipped. + +*** Commands that use 'grep-find' now follow symlinks for command-line args. +This is because the default value of 'grep-find-template' now includes +the 'find' option '-H'. Commands that use that variable, including +indirectly via a call to 'xref-matches-in-directory', might be +affected. In particular, there should be no need anymore to ensure +any directory names on the 'find' command lines end in a slash. +This change is for better compatibility with old versions of non-GNU +'find', such as the one used on macOS. + +--- +*** New utility function 'grep-file-at-point'. +This returns the name of the file at point (if any) in 'grep-mode' +buffers. + +** Shell + +--- +*** New command in 'shell-mode': 'narrow-to-prompt'. +This is bound to 'C-x n d' in 'shell-mode' buffers, and narrows to the +command line under point (and any following output). + +--- +*** New user option 'shell-has-auto-cd'. +If non-nil, 'shell-mode' handles implicit "cd" commands, changing the +directory if the command is a directory. Useful for shells like "zsh" +that has this feature. + +** term-mode + +--- +*** New user option 'term-scroll-snap-to-bottom'. +By default, 'term' and 'ansi-term' will now recenter the buffer so +that the prompt is on the final line in the window. Setting this new +user option to nil inhibits this behavior. + +--- +*** New user option 'term-set-terminal-size' +If non-nil, the 'LINES' and 'COLUMNS' environment variables will be set +based on the current window size. In previous versions of Emacs, this +was always done (and that could lead to odd displays when resizing the +window after starting). This variable defaults to nil. + +--- +*** 'term-mode' now supports "bright" color codes. +"Bright" ANSI color codes are now displayed using the color values +defined in 'term-color-bright-*'. In addition, bold text with regular +ANSI colors can be displayed as "bright" if 'ansi-color-bold-is-bright' +is non-nil. + +** Eshell + +--- +*** 'eshell-hist-ignoredups' can now also be used to mimic "erasedups" in bash. + +--- +*** Environment variable 'INSIDE_EMACS' is now copied to subprocesses. +Its value contains the result of evaluating '(format "%s,eshell" +emacs-version)'. Other package names, like "tramp", could also be included. + +--- +*** Eshell no longer re-initializes its keymap every call. +This allows users to use (define-key eshell-mode-map ...) as usual. +Some modules have their own minor mode now to account for these +changes. + +*** Support for bookmark.el. +The command `bookmark-set' (bound to `C-x r m') is now supported, and +will create a bookmark that opens the current directory in Eshell. + +** Archive mode + +--- +*** Archive Mode can now parse ".squashfs" files. + +*** Can now modify members of 'ar' archives. + +*** Display of summaries is unified between backends. + +*** New user option and command to control displayed columns. +New user option 'archive-hidden-columns' and new command +'archive-hideshow-column' let you control which columns are displayed +and which are kept hidden. + +--- +*** New command bound to 'C': 'archive-copy-file'. +This command extracts the file at point and writes its data to a +file. + +** browse-url + +*** Added support for custom URL handlers. +There is a new variable 'browse-url-default-handlers' and a user +option 'browse-url-handlers' being alists with '(REGEXP-OR-PREDICATE +. FUNCTION)' entries allowing to define different browsing FUNCTIONs +depending on the URL to be browsed. The variable is for default +handlers provided by Emacs itself or external packages, the user +option is for the user (and allows for overriding the default +handlers). + +Formerly, one could do the same by setting +'browse-url-browser-function' to such an alist. This usage is still +supported but deprecated. + +*** Categorization of browsing commands into internal vs. external. +All standard browsing commands such as 'browse-url-firefox', +'browse-url-mail', or 'eww' have been categorized into internal (URL +is browsed in Emacs) or external (an external application is spawned +with the URL). This is done by adding a 'browse-url-browser-kind' +symbol property to the browsing commands. With a new command +'browse-url-with-browser-kind', an URL can explicitly be browsed with +either an internal or external browser. + +--- +*** Support for browsing of remote files. +If a remote file is specified, a local temporary copy of that file is +passed to the browser. + +--- +*** Support for the conkeror browser is now obsolete. + +--- +*** Support for the Mosaic browser has been removed. +This support has been obsolete since 25.1. + +** Completion List Mode + +*** Improved navigation in the "*Completions*" buffer. +New key bindings have been added to 'completion-list-mode': 'n' and +'p' now navigate completions, and 'M-g M-c' switches to the +minibuffer and back to the completion list buffer. + ++++ +** profiler.el +The results displayed by 'profiler-report' now have the usage figures +at the left hand side followed by the function name. This is intended +to make better use of the horizontal space, in particular eliminating +the truncation of function names. There is no way to get the former +layout back. + +** Icomplete + +--- +*** New user option 'icomplete-matches-format'. +This allows controlling the current/total number of matches for the +prompt prefix. + ++++ +*** New minor modes 'icomplete-vertical-mode' and 'fido-vertical-mode'. +These modes modify Icomplete ('M-x icomplete-mode') and Fido ('M-x +fido-mode'), to display completion candidates vertically instead of +horizontally. In Icomplete, completions are rotated and selection +kept at the top. In Fido, completions scroll like a typical dropdown +widget. Both these new minor modes will turn on their non-vertical +counterparts first, if they are not on already. + +--- +*** Default value of 'icomplete-compute-delay' has been changed to 0.15 s. + +--- +*** Default value of 'icomplete-max-delay-chars' has been changed to 2. + +--- +*** Reduced blinking while completing the next completions set. +Icomplete doesn't hide the hint with the previously computed +completions anymore when compute delay is in effect, or the previous +computation has been aborted by input. Instead it shows the previous +completions until the new ones are ready. + +--- +*** Change in meaning of 'icomplete-show-matches-on-no-input'. +Previously, choosing a different completion with commands like 'C-.' +and then hitting 'RET' would choose the default completion. Doing this +will now choose the completion under point instead. Also when this option +is nil, completions are not shown when the minibuffer reads a file name +with initial input as the default directory. + +** Windmove + ++++ +*** New user options to customize windmove keybindings. +These options include 'windmove-default-keybindings', +'windmove-display-default-keybindings', +'windmove-delete-default-keybindings', +'windmove-swap-states-default-keybindings'. + +** Occur mode + +*** New bindings in occur-mode. +The command 'next-error-no-select' is now bound to 'n' and +'previous-error-no-select' is bound to 'p'. + +*** The new command 'recenter-current-error'. +It is bound to 'l' in Occur or compilation buffers, and recenters the +current displayed occurrence/error. + +*** Matches in target buffers are now highlighted as in 'compilation-mode'. +The method of highlighting is specified by the user options +'next-error-highlight' and 'next-error-highlight-no-select'. + +--- +*** A fringe arrow in the "*Occur*" buffer indicates the selected match. + +--- +*** Occur mode may use a different type for 'occur-target' property values. +The value was previously always a marker set to the start of the first +match on the line but can now also be a list of '(BEGIN . END)' pairs +of markers delimiting each match on the line. +This is a fully compatible change to the internal occur-mode +implementation, and code creating their own occur-mode buffers will +work as before. + +** Emacs Lisp mode + +--- +*** The mode-line now indicates whether we're using lexical or dynamic scoping. + ++++ +*** A space between an open paren and a symbol changes the indentation rule. +The presence of a space between an open paren and a symbol now is +taken as a statement by the programmer that this should be indented +as a data list rather than as a piece of code. + +** Lisp Mode + +*** New minor mode 'cl-font-lock-built-in-mode' for 'lisp-mode'. +The mode provides refined highlighting of built-in functions, types, +and variables. + +--- +*** Lisp mode now uses 'common-lisp-indent-function'. +To revert to the previous behavior, +'(setq lisp-indent-function 'lisp-indent-function)' from 'lisp-mode-hook'. + +** Change Logs and VC + ++++ +*** 'vc-revert-show-diff' now has a third possible value: 'kill'. +If this user option is 'kill', then the diff buffer will be killed +after the 'vc-revert' action instead of buried. + +*** More VC commands can be used from non-file buffers. +The relevant commands are those that don't change the VC state. +The non-file buffers which can use VC commands are those that have +their 'default-directory' under VC. + +*** New command 'vc-dir-root' uses the root directory without asking. + +--- +*** New face 'log-view-commit-body'. +This is used when expanding commit messages from 'vc-print-root-log' +and similar commands. + +--- +*** New faces for 'vc-dir' buffers. +Those are: 'vc-dir-header', 'vc-dir-header-value', 'vc-dir-directory', +'vc-dir-file', 'vc-dir-mark-indicator', 'vc-dir-status-warning', +'vc-dir-status-edited', 'vc-dir-status-up-to-date', +'vc-dir-status-ignored'. + +--- +*** The responsible VC backend is now the most specific one. +'vc-responsible-backend' loops over the backends in +'vc-handled-backends' to determine which backend is responsible for a +specific (unregistered) file. Previously, the first matching backend +was chosen, but now the one with the most specific path is chosen (in +case there's a directory handled by one backend inside another). + +*** New commands 'vc-dir-mark-registered-files' (bound to '* r') and +'vc-dir-mark-unregistered-files'. + +*** Support for bookmark.el. +Bookmark locations can refer to VC directory buffers. + +--- +*** New user option 'vc-hg-create-bookmark'. +It controls whether a bookmark or branch will be created when you +invoke 'C-u C-x v s' ('vc-create-tag'). + +--- +*** 'vc-hg' now uses 'hg summary' to populate extra 'vc-dir' headers. + +--- +*** New user option 'vc-git-revision-complete-only-branches'. +If non-nil, only branches and remotes are considered when doing +completion over Git branch names. The default is nil, which causes +tags to be considered as well. + +--- +*** New user option 'vc-git-log-switches'. +String or list of strings specifying switches for Git log under VC. + +** Gnus + ++++ +*** New user option 'gnus-topic-display-predicate'. +This can be used to inhibit the display of some topics completely. + ++++ +*** nnimap now supports the oauth2.el library. + ++++ +*** New Summary buffer sort options for extra headers. +The extra header sort option ('C-c C-s C-x') prompts for a header +and fails if no sort function has been defined. Sorting by +Newsgroups ('C-c C-s C-u') has been pre-defined. + ++++ +*** The '#' command in the Group and Summary buffer now toggles, +instead of sets, the process mark. + ++++ +*** New user option 'gnus-process-mark-toggle'. +If non-nil (the default), the '#' command in the Group and Summary +buffers will toggle, instead of set, the process mark. + + ++++ +*** New user option 'gnus-registry-register-all'. +If non-nil (the default), create registry entries for all messages. +If nil, don't automatically create entries, they must be created +manually. + ++++ +*** New user options to customise the summary line specs "%[" and "%]". +Four new options introduced in customisation group +'gnus-summary-format'. These are 'gnus-sum-opening-bracket', +'gnus-sum-closing-bracket', 'gnus-sum-opening-bracket-adopted', and +'gnus-sum-closing-bracket-adopted'. Their default values are "[", "]", +"<", ">" respectively. These options control the appearance of "%[" +and "%]" specs in the summary line format. "%[" will normally display +the value of 'gnus-sum-opening-bracket', but can also be +'gnus-sum-opening-bracket-adopted' for the adopted articles. "%]" will +normally display the value of 'gnus-sum-closing-bracket', but can also +be 'gnus-sum-closing-bracket-adopted' for the adopted articles. + ++++ +*** New user option 'gnus-paging-select-next'. +This controls what happens when using commands like 'SPC' and 'DEL' to +page the current article. If non-nil (the default), go to the +next/prev article, but if nil, do nothing at the end/start of the article. + ++++ +*** New gnus-search library. +A new unified search syntax which can be used across multiple +supported search engines. Set 'gnus-search-use-parsed-queries' to +non-nil to enable. + ++++ +*** New value for user option 'smiley-style'. +Smileys can now be rendered with emojis instead of small images when +using the new 'emoji' value in 'smiley-style'. + ++++ +*** New user option 'gnus-agent-eagerly-store-articles'. +If non-nil (which is the default), the Gnus Agent will store all read +articles in the Agent cache. + ++++ +*** New user option 'gnus-global-groups'. +Gnus handles private groups differently from public (i.e., NNTP-like) +groups. Most importantly, Gnus doesn't download external images from +mail-like groups. This can be overridden by putting group names in +'gnus-global-groups': Any group present in that list will be treated +like a public group. + ++++ +*** New scoring types for the Date header. +You can now score based on the relative age of an article with the new +'<' and '>' date scoring types. + ++++ +*** User-defined scoring is now possible. +The new type is 'score-fn'. More information in the Gnus manual node +"(gnus) Score File Format". + ++++ +*** New backend 'nnselect'. +The newly added 'nnselect' backend allows creating groups from an +arbitrary list of articles that may come from multiple groups and +servers. These groups generally behave like any other group: they may +be ephemeral or persistent, and allow article marking, moving, +deletion, etc. 'nnselect' groups may be created like any other group, +but there are three convenience functions for the common case of +obtaining the list of articles as a result of a search: +'gnus-group-make-search-group' ('G g') that will prompt for an 'nnir' +search query and create a persistent group for that search; +'gnus-group-read-ephemeral-search-group' ('G G') that will prompt for +an 'nnir' search query and create an ephemeral group for that search; +and 'gnus-summary-make-group-from-search' ('C-c C-p') that will create +a persistent group with the search parameters of a current ephemeral +search group. + +As part of this addition, the user option 'nnir-summary-line-format' +has been removed; its functionality is now available directly in the +'gnus-summary-line-format' specs '%G' and '%g'. The user option +'gnus-refer-thread-use-nnir' has been renamed to +'gnus-refer-thread-use-search'. + ++++ +*** New user option 'gnus-dbus-close-on-sleep'. +On systems with D-Bus support, it is now possible to register a signal +to close all Gnus servers before the system sleeps. + ++++ +*** The key binding of 'gnus-summary-search-article-forward' has changed. +This command was previously on 'M-s' and shadowed the global 'M-s' +search prefix. The command has now been moved to 'M-s M-s'. (For +consistency, the 'M-s M-r' key binding has been added for the +'gnus-summary-search-article-backward' command.) + +--- +*** The value of "all" in the 'large-newsgroup-initial' group parameter changes. +It was previously nil, which didn't work, because nil is +indistinguishable from not being present. The new value for "all" is +the symbol 'all'. + ++++ +*** The name of dependent Gnus sessions has changed from "slave" to "child". +The names of the commands 'gnus-slave', 'gnus-slave-no-server' and +'gnus-slave-unplugged' have changed to 'gnus-child', +'gnus-child-no-server' and 'gnus-child-unplugged' respectively. + ++++ +*** The 'W Q' summary mode command now takes a numerical prefix to +allow adjusting the fill width. + ++++ +*** New variable 'mm-inline-font-lock'. +This variable is supposed to be bound by callers to determine whether +inline MIME parts (that support it) are supposed to be font-locked or +not. + +** Message + +--- +*** Respect 'message-forward-ignored-headers' more. +Previously, this user option would not be consulted if +'message-forward-show-mml' was nil and forwarding as MIME. + ++++ +*** New user option 'message-forward-included-mime-headers'. +This is used when forwarding messages as MIME, but not using MML. + ++++ +*** Message now supports the OpenPGP header. +To generate these headers, add the new function +'message-add-openpgp-header' to 'message-send-hook'. The header will +be generated according to the new 'message-openpgp-header' user +option. + +--- +*** A change to how "Mail-Copies-To: never" is handled. +If a user has specified "Mail-Copies-To: never", and Message was asked +to do a "wide reply", some other arbitrary recipient would end up in +the resulting "To" header, while the remaining recipients would be put +in the "Cc" header. This is somewhat misleading, as it looks like +you're responding to a specific person in particular. This has been +changed so that all the recipients are put in the "To" header in these +instances. + ++++ +*** New command to start Emacs in Message mode to send an email. +Emacs can be defined as a handler for the "x-scheme-handler/mailto" +MIME type with the following command: "emacs -f message-mailto %u". +An "emacs-mail.desktop" file has been included, suitable for +installing in desktop directories like "/usr/share/applications" or +"~/.local/share/applications". +Clicking on a 'mailto:' link in other applications will then open +Emacs with headers filled out according to the link, e.g. +"mailto:larsi@gnus.org?subject=This+is+a+test". If you prefer +emacsclient, use "emacsclient -e '(message-mailto "%u")'" +or "emacsclient-mail.desktop". + +--- +*** Change to default value of 'message-draft-headers' user option. +The 'Date' symbol has been removed from the default value, meaning that +draft or delayed messages will get a date reflecting when the message +was sent. To restore the original behavior of dating a message +from when it is first saved or delayed, add the symbol 'Date' back to +this user option. + ++++ +*** New command to take screenshots. +In Message mode buffers, the 'C-c C-p' ('message-insert-screenshot') +command has been added. It depends on using an external program to +take the actual screenshot, and defaults to "ImageMagick import". + +** Smtpmail + ++++ +*** smtpmail now supports using the oauth2.el library. + ++++ +*** New user option 'smtpmail-store-queue-variables'. +If non-nil, SMTP variables will be stored together with the queued +messages, and will then be used when sending with +'M-x smtpmail-send-queued-mail'. + ++++ +*** Allow direct selection of smtp authentication mechanism. +A server entry retrieved by auth-source can request a desired smtp +authentication mechanism by setting a value for the key 'smtp-auth'. + +** ElDoc + ++++ +*** New user option 'eldoc-echo-area-display-truncation-message'. +If non-nil (the default), eldoc will display a message saying +something like "(Documentation truncated. Use `M-x eldoc-doc-buffer' +to see rest)" when a message has been truncated. If nil, truncated +messages will be marked with just "..." at the end. + ++++ +*** New hook 'eldoc-documentation-functions'. +This hook is intended to be used for registering doc string functions. +These functions don't need to produce the doc string right away, they +may arrange for it to be produced asynchronously. The results of all +doc string functions are accessible to the user through the user +option 'eldoc-documentation-strategy'. + +*** New hook 'eldoc-display-functions'. +This hook is intended to be used for displaying doc strings. The +functions receive the doc string composed according to +'eldoc-documentation-strategy' and are tasked with displaying it to +the user. Examples of such functions would use the echo area, a +separate buffer, or a tooltip. + ++++ +*** New user option 'eldoc-documentation-strategy'. +The built-in choices available for this user option let users compose +the results of 'eldoc-documentation-functions' in various ways, even +if some of those functions are synchronous and some asynchronous. +The user option replaces 'eldoc-documentation-function', which is now +obsolete. + +*** 'eldoc-echo-area-use-multiline-p' is now handled by ElDoc. +The user option 'eldoc-echo-area-use-multiline-p' is now handled +by the ElDoc library itself. Functions in +'eldoc-documentation-functions' don't need to worry about consulting +it when producing a doc string. + +** Tramp + ++++ +*** New connection method "mtp". +It allows accessing media devices like cell phones, tablets or +cameras. + ++++ +*** New connection method "sshfs". +It allows accessing remote files via a file system mounted with +'sshfs'. + ++++ +*** Tramp supports SSH authentication via a hardware security key now. +This requires at least OpenSSH 8.2, and a FIDO U2F compatible +security key, like yubikey, solokey, or nitrokey. + ++++ +*** Trashed remote files are moved to the local trash directory. +All remote files that are trashed are moved to the local trash +directory, except remote encrypted files, which are always deleted. + ++++ +*** New command 'tramp-crypt-add-directory'. +This command marks a remote directory to contain only encrypted files. +See the "(tramp) Keeping files encrypted" node of the Tramp manual for +details. This feature is experimental. + ++++ +*** Support of direct asynchronous process invocation. +When Tramp connection property "direct-async-process" is set to +non-nil for a given connection, 'make-process' and 'start-file-process' +calls are performed directly as in "ssh ... ". This avoids +initialization performance penalties. See the "(tramp) Improving +performance of asynchronous remote processes" node of the Tramp manual +for details, and also for a discussion or restrictions. This feature +is experimental. + ++++ +*** New user option 'tramp-debug-to-file'. +When non-nil, this user option instructs Tramp to mirror the debug +buffer to a file under the "/tmp/" directory. This is useful, if (in +rare cases) Tramp blocks Emacs, and we need further debug information. + ++++ +*** Tramp supports lock files now. +In order to deactivate this, set user option +'remote-file-name-inhibit-locks' to t. + ++++ +*** Writing sensitive data locally requires confirmation. +Writing auto-save, backup or lock files to the local temporary +directory must be confirmed. In order to suppress this confirmation, +set user option 'tramp-allow-unsafe-temporary-files' to t. + ++++ +*** 'make-directory' of a remote directory honors the default file modes. + +** gdb-mi + +*** New user option 'gdb-registers-enable-filter'. +If non-nil, apply a register filter based on +'gdb-registers-filter-pattern-list'. + ++++ +*** gdb-mi can now save and restore window configurations. +Use 'gdb-save-window-configuration' to save window configuration to a +file and 'gdb-load-window-configuration' to load from a file. These +commands can also be accessed through the menu bar under "Gud => +GDB-Windows". 'gdb-default-window-configuration-file', when non-nil, +is loaded when GDB starts up. + ++++ +*** gdb-mi can now restore window configuration after quitting. +Set 'gdb-restore-window-configuration-after-quit' to non-nil and Emacs +will remember the window configuration before GDB started and restore +it after GDB quits. A toggle button is also provided under "Gud => +GDB-Windows" menu item. + ++++ +*** gdb-mi now has a better logic for displaying source buffers. +Now GDB only uses one source window to display source file by default. +Customize 'gdb-max-source-window-count' to use more than one window. +Control source file display by 'gdb-display-source-buffer-action'. + ++++ +*** The default value of 'gdb-mi-decode-strings' is now t. +This means that the default coding-system is now used to decode strings +and source file names from GDB. + +** Compilation mode + +--- +*** New function 'ansi-color-compilation-filter'. +This function is meant to be used in 'compilation-filter-hook'. + +--- +*** New user option 'ansi-color-for-compilation-mode'. +This controls what 'ansi-color-compilation-filter' does. + +*** Regexp matching of messages is now case-sensitive by default. +The variable 'compilation-error-case-fold-search' can be set for +case-insensitive matching of messages when the old behavior is +required, but the recommended solution is to use a correctly matching +regexp instead. + +--- +*** New user option 'compilation-search-all-directories'. +When doing parallel builds, directories and compilation errors may +arrive in the "*compilation*" buffer out-of-order. If this option is +non-nil (the default), Emacs will now search backwards in the buffer +for any directory the file with errors may be in. If nil, this won't +be done (and this restores how this previously worked). + +--- +*** Messages from ShellCheck are now recognized. + +--- +*** Messages from Visual Studio that mention column numbers are now recognized. + +** Hi Lock mode + +--- +*** Matching in 'hi-lock-mode' can be case-sensitive. +The matching is case-sensitive when a regexp contains upper case +characters and 'search-upper-case' is non-nil. 'highlight-phrase' +also uses 'search-whitespace-regexp' to substitute spaces in regexp +search. + +--- +*** The default value of 'hi-lock-highlight-range' was enlarged. +The new default value is 2000000 (2 megabytes). + +** Whitespace mode + ++++ +*** New style 'missing-newline-at-eof'. +If present in 'whitespace-style' (as it is by default), the final +character in the buffer will be highlighted if the buffer doesn't end +with a newline. + +--- +*** The default 'whitespace-enable-predicate' predicate has changed. +It used to check elements in the list version of +'whitespace-global-modes' with 'eq', but now uses 'derived-mode-p'. + +** Texinfo + +--- +*** New user option 'texinfo-texi2dvi-options'. +This is used when invoking 'texi2dvi' from 'texinfo-tex-buffer'. + +--- +*** New commands for moving in and between environments. +An "environment" is something that ends with '@end'. The commands are +'C-c C-c C-f' (next end), 'C-c C-c C-b' (previous end), +'C-c C-c C-n' (next start) and 'C-c C-c C-p' (previous start), as well +as 'C-c .', which will alternate between the start and the end of the +current environment. + +** Rmail + +--- +*** New user option 'rmail-re-abbrevs'. +Its default value matches localized abbreviations of the "reply" +prefix on the Subject line in various languages. + +--- +*** New user option 'shr-offer-extend-specpdl'. +If this is nil, rendering of HTML in the email message body that +requires to enlarge 'max-specpdl-size', the number of Lisp variable +bindings, will be aborted, and Emacs will not ask you whether to +enlarge 'max-specpdl-size' to complete the rendering. The default is +t, which preserves the original behavior. + +--- +*** New user option 'rmail-show-message-set-modified'. +If set non-nil, showing an unseen message will set the Rmail buffer's +modified flag. The default is nil, to preserve the old behavior. + +** CC Mode + ++++ +*** Added support for Doxygen documentation style. +'doxygen' is now a valid 'c-doc-comment-style' which recognises all +comment styles supported by Doxygen (namely '///', '//!', '/** … */' +and '/*! … */'. 'gtkdoc' remains the default for C and C++ modes; to +use 'doxygen' by default one might evaluate: + + (setq-default c-doc-comment-style + '((java-mode . javadoc) + (pike-mode . autodoc) + (c-mode . doxygen) + (c++-mode . doxygen))) + +or use it in a custom 'c-style'. + ++++ +*** Added support to line up '?' and ':' of a ternary operator. +The new 'c-lineup-ternary-bodies' function can be used as a lineup +function to align question mark and colon which are part of a ternary +operator ('?:'). For example: + + return arg % 2 == 0 ? arg / 2 + : (3 * arg + 1); + +To enable, add it to appropriate entries in 'c-offsets-alist', e.g.: + + (c-set-offset 'arglist-cont '(c-lineup-ternary-bodies + c-lineup-gcc-asm-reg)) + (c-set-offset 'arglist-cont-nonempty '(c-lineup-ternary-bodies + c-lineup-gcc-asm-reg + c-lineup-arglist)) + (c-set-offset 'statement-cont '(c-lineup-ternary-bodies +)) + +** Images + +--- +*** You can explicitly specify base_uri for svg images. +':base-uri' image property can be used to explicitly specify base_uri +for embedded images into svg. ':base-uri' is supported for both file +and data svg images. + ++++ +*** 'svg-embed-base-uri-image' added to embed images. +'svg-embed-base-uri-image' can be used to embed images located +relatively to 'file-name-directory' of the ':base-uri' svg image property. +This works much faster then 'svg-embed'. + ++++ +*** New function 'image-cache-size'. +This function returns the size of the current image cache, in bytes. + +--- +*** Animated images stop automatically under high CPU pressure sooner. +Previously, an animated image would stop animating if any single image +took more than two seconds to display. The new algorithm maintains a +decaying average of delays, and if this number gets too high, the +animation is stopped. + ++++ +*** The 'n' and 'p' commands (next/previous image) now respect Dired order. +These commands would previously display the next/previous image in +lexicographic order, but will now find the "parent" Dired buffer and +select the next/previous image file according to how the files are +sorted there. The commands have also been extended to work when the +"parent" buffer is an archive mode (i.e., zip file or the like) or tar +mode buffer. + +--- +*** 'image-converter' is now restricted to formats in 'auto-mode-alist'. +When using external image converters, the external program is queried +for what formats it supports. This list may contain formats that are +problematic in some contexts (like PDFs), so this list is now filtered +based on 'auto-mode-alist'. Only file names that map to 'image-mode' +are now supported. + +--- +*** The background and foreground of images now default to face colors. +When an image doesn't specify a foreground or background color, Emacs +now uses colors from the face used to draw the surrounding text +instead of the frame's default colors. + +To load images with the default frame colors use the ':foreground' and +':background' image attributes, for example: + + (create-image "filename" nil nil + :foreground (face-attribute 'default :foreground) + :background (face-attribute 'default :background)) + +This change only affects image types that support foreground and +background colors or transparency, such as xbm, pbm, svg, png and gif. + ++++ +*** Image smoothing can now be explicitly enabled or disabled. +Smoothing applies a bilinear filter while scaling or rotating an image +to prevent aliasing and other unwanted effects. The new image +property ':transform-smoothing' can be set to t to force smoothing +and nil to disable smoothing. + +The default behavior of smoothing on down-scaling and not smoothing +on up-scaling remains unchanged. + ++++ +*** New user option 'image-transform-smoothing'. +This controls whether to use smoothing or not for an image. Values +include nil (no smoothing), t (do smoothing) or a predicate function +that's called with the image object and should return nil/t. + ++++ +*** SVG images now support user stylesheets. +The ':css' image attribute can be used to override the default CSS +stylesheet for an image. The default sets 'font-family' and +'font-size' to match the current face, so an image with 'height="1em"' +will match the font size in use where it is embedded. + +This feature relies on librsvg 2.48 or above being available. + ++++ +*** Image properties support 'em' sizes. +Size image properties, for example ':height', ':max-height', etc., can +be given a cons of the form '(SIZE . em)', where SIZE is an integer or +float which is multiplied by the font size to calculate the image +size, and 'em' is a symbol. + +** EWW + ++++ +*** New user option 'eww-use-browse-url'. +This is a regexp that can be set to alter how links are followed in eww. + ++++ +*** New user option 'eww-retrieve-command'. +This can be used to download data via an external command. If nil +(the default), then 'url-retrieve' is used. When 'sync', then +'url-retrieve-synchronously' is used. + ++++ +*** New Emacs command line convenience command. +The 'eww-browse' command has been added, which allows you to register +Emacs as a MIME handler for "text/x-uri", and will call 'eww' on the +supplied URL. Usage example: "emacs -f eww-browse https://gnu.org". + ++++ +*** 'eww-download-directory' will now use the XDG location, if defined. +However, if "~/Downloads/" already exists, that will continue to be +used. + +--- +*** The command 'eww-follow-link' now supports custom mailto handlers. +The function that is invoked when clicking on or otherwise following a +'mailto:' link in an EWW buffer can now be customized. For more +information, see the related entry about 'shr-browse-url' above. + +--- +*** Support for bookmark.el. +The command `bookmark-set' (bound to `C-x r m') is now supported, and +will create a bookmark that opens the current URL in EWW. + +** SHR + +--- +*** The command 'shr-browse-url' now supports custom mailto handlers. +Clicking on or otherwise following a 'mailto:' link in a HTML buffer +rendered by SHR previously invoked the command 'browse-url-mailto'. +This is still the case by default, but if you customize +'browse-url-mailto-function' or 'browse-url-handlers' to call some +other function, it will now be called instead of the default. + ++++ +*** New user option 'shr-max-width'. +If this user option is non-nil, and 'shr-width' is nil, then SHR will +use the value of 'shr-max-width' to limit the width of the rendered +HTML. The default is 120 characters, so even if you have very wide +frames, HTML text will be rendered more narrowly, which usually leads +to a more readable text. Customize it to nil to get the previous +behavior of rendering as wide as the 'window-width' allows. If +'shr-width' is non-nil, it overrides this option. + +--- +*** New faces for heading elements. +Those are 'shr-h1', 'shr-h2', 'shr-h3', 'shr-h4', 'shr-h5', 'shr-h6'. + +** Project + +*** New user option 'project-vc-merge-submodules'. + +*** Project commands now have their own history. +Previously used project directories are now suggested by all commands +that prompt for a project directory. + ++++ +*** New prefix keymap 'project-prefix-map'. +Key sequences that invoke project-related commands start with the +prefix 'C-x p'. Type "C-x p C-h" to show the full list. + ++++ +*** New commands 'project-dired', 'project-vc-dir', 'project-shell', +'project-eshell'. These commands run Dired/VC-Dir and Shell/Eshell in +a project's root directory, respectively. + ++++ +*** New command 'project-compile'. +This command runs compilation in the current project's root +directory. + ++++ +*** New command 'project-switch-project'. +This command lets you "switch" to another project and run a project +command chosen from a dispatch menu. + ++++ +*** New commands 'project-shell-command' and 'project-async-shell-command'. +These commands run 'shell-command' and 'async-shell-command' in a +project's root directory, respectively. + ++++ +*** New user option 'project-list-file'. +This specifies the file in which to save the list of known projects. + ++++ +*** New command 'project-remember-projects-under'. +This command can automatically locate and index projects in a +directory and optionally also its subdirectories, storing them in +'project-list-file'. + ++++ +*** New commands 'project-forget-project' and 'project-forget-projects-under'. +These command lets you interactively remove entries from the list of projects +in 'project-list-file'. + ++++ +*** New command 'project-forget-zombie-projects'. +This command detects indexed projects that have since been deleted, +and removes them from the list of known projects in 'project-list-file'. + +--- +*** 'project-find-file' now accepts non-existent file names. +This is to allow easy creation of files inside some nested +sub-directory. + ++++ +*** 'project-find-file' doesn't use the string at point as default input. +Now it's only suggested as part of the "future history". + ++++ +*** New command 'project-find-dir' runs Dired in a directory inside project. + +** Xref + +--- +*** Prefix arg of 'xref-goto-xref' quits the "*xref*" buffer. +So typing 'C-u RET' in the "*xref*" buffer quits its window +before navigating to the selected location. + ++++ +*** New user options to automatically show the first Xref match. +The new user option 'xref-auto-jump-to-first-definition' controls the +behavior of 'xref-find-definitions' and its variants, like +'xref-find-definitions-other-window': if it's t or 'show', the first +match is automatically displayed; if it's 'move', point in the +"*xref*" buffer is automatically moved to the first match without +displaying it. +The new user option 'xref-auto-jump-to-first-xref' changes the +behavior of Xref commands such as 'xref-find-references', +'xref-find-apropos', and 'project-find-regexp', which are expected to +display many matches that the user would like to +visit. 'xref-auto-jump-to-first-xref' changes their behavior much in +the same way as 'xref-auto-jump-to-first-definition' affects the +"find-definitions" commands. + +--- +*** New user options 'xref-search-program' and 'xref-search-program-alist'. +So far 'grep' and 'ripgrep' are supported. 'ripgrep' seems to offer better +performance in certain cases, in particular for case-insensitive +searches. + ++++ +*** New commands 'xref-prev-group' and 'xref-next-group'. +These commands are bound respectively to 'P' and 'N', and navigate to +the first item of the previous or next group in the "*xref*" buffer. + +--- +*** New alternative value for 'xref-show-definitions-function': +'xref-show-definitions-completing-read'. + +--- +*** The two existing alternatives for 'xref-show-definitions-function' +have been renamed to have "proper" public names and documented +('xref-show-definitions-buffer' and +'xref-show-definitions-buffer-at-bottom'). + ++++ +*** New command 'xref-quit-and-pop-marker-stack'. +This command is bound to 'M-,' in "*xref*" buffers. This combination +is easy to press semi-accidentally if the user wants to go back in the +middle of choosing the exact definition to go to, and this should do +TRT. + +--- +*** New value 'project-relative' for 'xref-file-name-display'. +If chosen, file names in "*xref*" buffers will be displayed relative +to the 'project-root' of the current project, when available. + ++++ +*** The 'TAB' key binding in "*xref*" buffers is obsolete. +Use 'C-u RET' instead. The 'TAB' binding in "*xref*" buffers is still +supported, but we plan on removing it in a future version; at that +time, the command 'xref-quit-and-goto-xref' will no longer have a key +binding in 'xref--xref-buffer-mode-map'. + +--- +*** New user option 'etags-xref-prefer-current-file'. +When non-nil, matches for identifiers in the file visited by the +current buffer will be shown first in the "*xref*" buffer. + ++++ +*** The etags Xref backend now honors 'tags-apropos-additional-actions'. +You can customize it to augment the output of 'xref-find-apropos', +like it affected the output of 'tags-apropos', which is obsolete since +Emacs 25.1. + +** Battery + +--- +*** UPower is now the default battery status backend when available. +UPower support via the function 'battery-upower' was added in Emacs +26.1, but was disabled by default. It is now the default value of +'battery-status-function' when the system provides a UPower D-Bus +service. The user options 'battery-upower-device' and +'battery-upower-subscribe' control which power sources to query and +whether to respond to status change notifications in addition to +polling, respectively. + +--- +*** A richer syntax can be used to format battery status information. +The user options 'battery-mode-line-format' and +'battery-echo-area-format' now support the full formatting syntax of +the function 'format-spec' documented under node "(elisp) Custom Format +Strings". The new syntax includes specifiers for padding and +truncation, amongst other things. + +** bug-reference.el + +--- +*** Bug reference mode uses auto-setup. +If 'bug-reference-mode' or 'bug-reference-prog-mode' have been +activated, their respective hook has been run, and both +'bug-reference-bug-regexp' and 'bug-reference-url-format' are still +not set, it tries to guess appropriate values for those two variables. +There are three guessing mechanisms so far: based on version control +information of the current buffer's file, based on +newsgroup/mail-folder name and several news and mail message headers +in Gnus buffers, and based on IRC channel and network in rcirc and ERC +buffers. All the mechanisms are extensible with custom rules, see the +variables 'bug-reference-setup-from-vc-alist', +'bug-reference-setup-from-mail-alist', and +'bug-reference-setup-from-irc-alist'. + +** HTML Mode + +--- +*** A new skeleton for adding relative URLs has been added. +It's bound to the 'C-c C-c f' keystroke, and prompts for a local file +name. + +** Widget + ++++ +*** 'widget-choose' now supports menus in extended format. + +--- +*** The 'editable-list' widget now supports moving items up and down. +You can now move items up and down by deleting and then reinserting +them, using the 'DEL' and 'INS' buttons respectively. This is useful +in Custom buffers, for example, to change the order of the elements in +a list. + +** Diff + +--- +*** New face 'diff-changed-unspecified'. +This is used to highlight "changed" lines (those marked with '!') in +context diffs, when 'diff-use-changed-face' is non-nil. + +--- +*** New 'diff-mode' font locking face 'diff-error'. +This face is used for error messages from 'diff'. + ++++ +*** New command 'diff-refresh-hunk'. +This new command (bound to 'C-c C-l') regenerates the current hunk. + +** thing-at-point + ++++ +*** New 'thing-at-point' target: 'existing-filename'. +This is like 'filename', but is a full path, and is nil if the file +doesn't exist. + ++++ +*** New 'thing-at-point' target: 'string'. +If point is inside a string, it returns that string. + ++++ +*** New variable 'thing-at-point-provider-alist'. +This allows mode-specific alterations to how 'thing-at-point' works. + +--- +*** thing-at-point now respects fields. +'thing-at-point' (and all functions that use it, like +'symbol-at-point') will narrow to the current field (if any) before +trying to identify the thing at point. + +*** New function 'thing-at-mouse'. + +** image-dired + +--- +*** 'image-dired-mouse-toggle-mark' now toggles files in the active region. + ++++ +*** New user option 'image-dired-thumb-visible-marks'. +If non-nil (the default), use 'image-dired-thumb-mark' to say what +images are marked. + +--- +*** New command 'image-dired-delete-marked'. + +** Flymake mode + ++++ +*** New command 'flymake-show-project-diagnostics' +This lists all diagnostics for buffers in the currently active +project. The listing is similar to the one obtained by +'flymake-show-buffer-diagnostics', but adds a column for the +project-relative file name. For backends which support it, +'flymake-show-project-diagnostics' also lists diagnostics for files +that have not yet been visited. + ++++ +*** New user options to customize Flymake's mode-line. +The new user option 'flymake-mode-line-format' is a mix of strings and +symbols like 'flymake-mode-line-title', 'flymake-mode-line-exception' +and 'flymake-mode-line-counters'. The new user option +'flymake-mode-line-counter-format' is a mix of strings and symbols +like 'flymake-mode-line-error-counter', +'flymake-mode-line-warning-counter' and 'flymake-mode-line-note-counter'. + +** Time + +--- +*** 'display-time-world' has been renamed to 'world-clock'. +'world-clock' creates a buffer with an updating time display using +several time zones. It is hoped that the new names are more +discoverable. + +The following commands have been renamed: + + 'display-time-world' to 'world-clock' + 'display-time-world-mode' to 'world-clock-mode' + 'display-time-world-display' to 'world-clock-display' + 'display-time-world-timer' to 'world-clock-update' + +The following user options have been renamed: + + 'display-time-world-list' to 'world-clock-list' + 'display-time-world-time-format' to 'world-clock-time-format' + 'display-time-world-buffer-name' to 'world-clock-buffer-name' + 'display-time-world-timer-enable' to 'world-clock-timer-enable' + 'display-time-world-timer-second' to 'world-clock-timer-second' + +The old names are now obsolete. + +--- +*** 'world-clock-mode' can no longer be turned on interactively. +Use 'world-clock' to turn on that mode. + +** Python mode + +--- +*** New user option 'python-forward-sexp-function'. +This allows the user easier customization of whether to use block-based +navigation or not. + +--- +*** 'python-shell-interpreter' now defaults to python3 on systems with python3. + +--- +*** 'C-c C-r' can now be used on arbitrary regions. +The command previously extended the start of the region to the start +of the line, but will now actually send the marked region, as +documented. + +** Ruby Mode + +--- +*** 'ruby-use-smie' is declared obsolete. +SMIE is now always enabled and 'ruby-use-smie' only controls whether +indentation is done using SMIE or with the old ad-hoc code. + +--- +*** Indentation has changed when 'ruby-align-chained-calls' is non-nil. +This previously used to align subsequent lines with the last sibling, +but it now aligns with the first sibling (which is the preferred style +in Ruby). + +** 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 +Conway's book "Perl Best Practices" for indentation and formatting +of conditionals. + +** Perl mode + +--- +*** New face 'perl-non-scalar-variable'. +This is used to fontify non-scalar variables. + +** Octave Mode + ++++ +*** Line continuations in double-quoted strings now use a backslash. +Typing 'C-M-j' (bound to 'octave-indent-new-comment-line') now follows +the behavior introduced in Octave 3.8 of using a backslash as a line +continuation marker within double-quoted strings, and an ellipsis +everywhere else. + ++++ +** EasyPG +GPG key servers can now be queried for keys with the +'M-x epa-search-keys' command. Keys can then be added to your +personal key ring. + +** Etags + ++++ +*** Etags now supports the Mercury programming language. +See https://mercurylang.org. + ++++ +*** Etags command line option '--declarations' now has Mercury-specific behavior. +All Mercury declarations are tagged by default. However, for +compatibility with 'etags' support for Prolog, predicates and +functions appearing first in clauses will also be tagged if 'etags' is +invoked with the '--declarations' command-line option. + +** Comint + ++++ +*** Support for OSC escape sequences. +Adding the new 'comint-osc-process-output' to +'comint-output-filter-functions' enables the interpretation of OSC +("Operating System Command") escape sequences in comint buffers. By +default, only OSC 8, for hyperlinks, and OSC 7, for directory +tracking, are acted upon. Adding more entries to +'comint-osc-handlers' allows a customized treatment of further escape +sequences. + ++++ +*** 'comint-delete-output' can now save deleted text in the kill-ring. +Interactively, 'C-u C-c C-o' triggers this new optional behavior. + +** ansi-color.el + +--- +*** Colors are now defined by faces. +ANSI SGR codes now have corresponding faces to describe their +appearance, e.g. 'ansi-color-bold'. + +--- +*** Support for "bright" color codes. +"Bright" ANSI color codes are now displayed when applying ANSI color +filters using the color values defined by the faces +'ansi-color-bright-COLOR'. In addition, bold text with regular ANSI +colors can be displayed as "bright" if 'ansi-color-bold-is-bright' is +non-nil. + +** ERC + +--- +*** NickServ passwords can now be retrieved from auth-source. +The 'erc-use-auth-source-for-nickserv-password' user option enables +querying auth-source for NickServ passwords. To enable this, add the +following to your init file: + + (setq erc-use-auth-source-for-nickserv-password t) + +--- +*** NickServ identification now prompts for password last. +When 'erc-prompt-for-nickserv-password' is non-nil, the user used to +be unconditionally prompted interactively for a password, regardless +of the value of 'erc-nickserv-passwords', which was effectively +ignored (same for the new +'erc-use-auth-source-for-nickserv-password'). This limitation is now +lifted, and the user is interactively prompted last, after the other +identification methods have run. + +--- +*** The '/ignore' command will now ask for a timeout to stop ignoring the user. +Allowed inputs are seconds or ISO8601-like periods like "1h" or "4h30m". + +--- +*** ERC now recognizes 'C-]' for italic text. +Italic text is displayed in the new 'erc-italic-face'. + +--- +*** erc-match.el now supports 'message' highlight type (not including the nick). +The 'erc-current-nick-highlight-type', 'erc-pal-highlight-type', +'erc-fool-highlight-type', 'erc-keyword-highlight-type', and +'erc-dangerous-host-highlight-type' user options now support a +'message' type for highlighting the entire message but not the +sender's nick. + +--- +*** erc-status-sidebar.el is now part of ERC. +The 'erc-status-sidebar' package which provides a HexChat-like +activity overview sidebar for joined IRC channels is now part of ERC. + ++++ +*** erc-tls now supports specifying a TLS client certificate. +The 'erc-tls' function has been updated to allow specifying a TLS +client certificate for authentication, as an alternative to NickServ +password-based authentication. This is referred to as "CertFP" (short +for Certificate Fingerprint) by several IRC networks. See the Info +node "(erc) Connecting" in the ERC manual for more details and +examples on how to specify and use TLS client certificates with +'erc-tls'. + +--- +*** Add 'erc-track-select-mode-line-face' (obsoletes 'erc-track-find-face'). +The 'erc-track-find-face' function of the erc-track module has been +declared obsolete and rewritten as 'erc-track-select-mode-line-face', +with different expected arguments (the current and old faces are now +separated) and clearer documentation. + +--- +*** Add '/opme' and '/deopme' convenience commands. +The new '/opme' convenience command asks ChanServ to set the operator +status for the current nick in the current channel, and '/deopme' +unsets it. + +--- +*** Add '/wii' convenience command for whois with idle time. +The new '/wii' convenience command calls the '/whois' command with the +given nick as both arguments, which is useful for displaying the whois +information for the nick along with idle time, even if the nick is on +a different server than the one the current user is connected to. +Using the given nick itself instead of the server it is connected to +is not standardized, but is widely supported across IRC networks. + +** xwidget-webkit mode + +--- +*** New xwidget commands. +'xwidget-webkit-uri' (return the current URL), 'xwidget-webkit-title' +(return the current title), and 'xwidget-webkit-goto-history' (goto a +point in history). + +--- +*** Pixel-based scrolling. +The 'xwidget-webkit-scroll-up', 'xwidget-webkit-scroll-down' commands +now supports scrolling arbitrary pixel values. It now treats the +optional 2nd argument as the pixel values to scroll. + +--- +*** New commands for scrolling. +The new commands 'xwidget-webkit-scroll-up-line', +'xwidget-webkit-scroll-down-line', 'xwidget-webkit-scroll-forward', +'xwidget-webkit-scroll-backward' can be used to scroll webkit by the +height of lines or width of chars. + +--- +*** New user option 'xwidget-webkit-bookmark-jump-new-session'. +When non-nil, use a new xwidget webkit session after bookmark jump. +Otherwise, it will use 'xwidget-webkit-last-session'. + +** Checkdoc + +--- +*** No longer warns about command substitutions by default. +Checkdoc used to warn about "too many command substitutions" (as in +"\\[foo-command]"), even if you only used ten of them in a docstring. +On modern machines, you can have hundreds or thousands of command +substitutions before it becomes a performance issue, so this warning +is now disabled by default. To re-enable this warning, customize the +user option 'checkdoc-max-keyref-before-warn'. + +--- +*** New user option 'checkdoc-column-zero-backslash-before-paren'. +Checkdoc warns if there is a left parenthesis in column zero of a +documentation string. That warning can now be disabled by customizing +this new user option to nil. This is useful if you don't expect +your code to be edited with an Emacs older than version 27.1. + +--- +*** Now checks the prompt format for 'yes-or-no-p'. +In addition to verifying the format of the prompt for 'y-or-n-p', +checkdoc will now check the format of 'yes-or-no-p'. + +--- +*** New command 'checkdoc-dired'. +This can be used to run checkdoc on files from a Dired buffer. + +--- +*** No longer checks for "A-" modifiers. +Checkdoc recommends usage of command substitutions ("\\[foo-command]") +in favor of writing keybindings like "C-c f". It now no longer warns +about the "A-" modifier as it is not used very much in practice, and +this warning therefore mostly led to false positives. + +** Enriched mode + +--- +*** 'C-a' is by default no longer bound to 'beginning-of-line-text'. +This is so 'C-a' works as in other modes, and in particular holding +Shift while typing 'C-a', i.e. 'C-S-a', will now highlight the text. + +** Gravatar + +--- +*** New user option 'gravatar-service' for host to query for gravatars. +Defaults to 'libravatar', with 'unicornify' and 'gravatar' as options. + +** MH-E mail handler for Emacs + +Functions and variables related to handling junk mail have been +renamed to not associate color with sender quality. + ++++ +*** New names for mh-junk interactive functions. +Function 'mh-junk-whitelist' is renamed 'mh-junk-allowlist'. +Function 'mh-junk-blacklist' is renamed 'mh-junk-blocklist'. + ++++ +*** New binding for 'mh-junk-allowlist'. +The key binding for 'mh-junk-allowlist' is changed from 'J w' to 'J a'. +The old binding is supported but warns that it is obsolete. + ++++ +*** New names for some hooks. +'mh-whitelist-msg-hook' is renamed 'mh-allowlist-msg-hook'. +'mh-blacklist-msg-hook' is renamed 'mh-blocklist-msg-hook'. + ++++ +*** New names for some user options. +User option 'mh-whitelist-preserves-sequences-flag' is renamed +'mh-allowlist-preserves-sequences-flag'. + ++++ +*** New names for some faces. +Face 'mh-folder-blacklisted' is renamed 'mh-folder-blocklisted'. +Face 'mh-folder-whitelisted' is renamed 'mh-folder-allowlisted'. + +** Rcirc + ++++ +*** rcirc now supports SASL authentication. + +--- +*** rcirc connects asynchronously. + +--- +*** Integrate formatting into 'rcirc-send-string'. +The function now accepts a variable number of arguments. + ++++ +*** Deprecate 'defun-rcirc-command' in favour of 'rcirc-define-command'. +The new macro handles multiple and optional arguments. + +--- +*** Add basic IRCv3 support. +This includes support for the capabilities: 'server-time', 'batch', +'message-ids', 'invite-notify', 'multi-prefix' and 'standard-replies'. + +--- +*** Add mouse property support to 'rcirc-track-minor-mode'. + +--- +*** Improve support for IRC markup codes. + +--- +*** Check 'auth-sources' for server passwords. + ++++ +*** Implement repeated reconnection strategy. +See 'rcirc-reconnect-attempts'. + +** MPC + +--- +*** New command 'mpc-goto-playing-song'. +This command, bound to 'o' in any 'mpc-mode' buffer, moves point to +the currently playing song in the "*Songs*" buffer. + +--- +*** New user option 'mpc-cover-image-re'. +If non-nil, it is a regexp that should match a valid cover image. + +** Miscellaneous + +--- +*** 'shell-script-mode' now supports 'outline-minor-mode'. +The outline headings have lines that start with "###". + +--- +*** fileloop will now skip missing files instead of signalling an error. + +--- +*** 'tabulated-list-mode' can now restore original display order. +Many commands (like 'C-x C-b') are derived from 'tabulated-list-mode', +and that mode allows the user to sort on any column. There was +previously no easy way to get back to the original displayed order +after sorting, but giving a -1 numerical prefix to the sorting command +will now restore the original order. + +--- +*** 'M-left' and 'M-right' now move between columns in 'tabulated-list-mode'. + +--- +*** New variable 'hl-line-overlay-priority'. +This can be used to change the priority of the hl-line overlays. + ++++ +*** New command 'mailcap-view-file'. +This command will open a viewer based on the file type, as determined +by "~/.mailcap" and related files and variables. + +--- +*** New user option 'remember-diary-regexp'. + +--- +*** New user option 'remember-text-format-function'. + +--- +*** New user option 'authinfo-hide-elements'. +This can be set to nil to inhibit hiding passwords in ".authinfo" files. + +--- +*** 'hexl-mode' scrolling commands now heed 'next-screen-context-lines'. +Previously, 'hexl-scroll-down' and 'hexl-scroll-up' would scroll +up/down an entire window, but they now work more like the standard +scrolling commands. + +--- +*** New user option 'bibtex-unify-case-function'. +This new option allows the user to customize how case is converted +when unifying entries. + +--- +*** The user option 'bibtex-maintain-sorted-entries' now permits +user-defined sorting schemes. + +--- +*** New user option 'reveal-auto-hide'. +If non-nil (the default), revealed text is automatically hidden when +point leaves the text. If nil, the text is not hidden again. Instead +'M-x reveal-hide-revealed' can be used to hide all the revealed text. + +--- +*** New user option 'ffap-file-name-with-spaces'. +If non-nil, 'find-file-at-point' and friends will try to guess more +expansively to identify a file name with spaces. Default value is +nil. + +--- +*** Two new commands for centering in 'doc-view-mode'. +The new commands 'doc-view-center-page-horizontally' (bound to 'c h') +and 'doc-view-center-page-vertically' (bound to 'c v') center the page +horizontally and vertically, respectively. + +--- +*** 'tempo-define-template' can now re-assign templates to tags. +Previously, assigning a new template to an already defined tag had no +effect. + +--- +*** The width of the buffer-name column in 'list-buffers' is now dynamic. +The width now depends of the width of the window, but will never be +wider than the length of the longest buffer name, except that it will +never be narrower than 19 characters. + ++++ +*** New diary sexp 'diary-offset'. +It offsets another diary sexp by a number of days. This is useful +when for example your organization has a committee meeting two days +after every monthly meeting which takes place on the third Thursday, +or if you would like to attend a virtual meeting scheduled in a +different timezone causing a difference in the date. + +--- +*** The old non-SMIE indentation of 'sh-mode' has been removed. + +--- +*** 'mspools-show' is now autoloaded. + +--- +*** Loading dunnet.el in batch mode doesn't start the game any more. +Instead you need to do "emacs -f dun-batch" to start the game in +batch mode. + + +* New Modes and Packages in Emacs 28.1 + ++++ +** New transient mode 'repeat-mode' to allow shorter key sequences. +You can type 'C-x u u' instead of 'C-x u C-x u' to undo many changes, +'C-x o o' instead of 'C-x o C-x o' to switch several windows, +'C-x { { } } ^ ^ v v' to resize the selected window interactively, +'M-g n n p p' to navigate next-error matches. Any other key exits +transient mode and then is executed normally. 'repeat-exit-key' +defines an additional key to exit mode like 'isearch-exit' ('RET'). +The user option 'repeat-exit-timeout' specifies the number of +seconds of idle time to break the repetition chain automatically. +With 'repeat-keep-prefix' you can keep the prefix arg of the previous +command. For example, this can help to reverse the window navigation +direction with e.g. 'C-x o M-- o o'. Also it can help to set a new +step with e.g. 'C-x { C-5 { { {', which will set the window resizing +step to 5 columns. + +--- +** New themes 'modus-vivendi' and 'modus-operandi'. +These themes are designed to conform with the highest standard for +color-contrast accessibility (WCAG AAA). You can load either of them +using 'M-x customize-themes' or 'load-theme' from your init file. +Consult the Modus Themes Info manual for more information on the user +options they provide. + +** Dictionary mode +This is a mode for searching a RFC 2229 dictionary server. +'dictionary' opens a buffer for starting operations. +'dictionary-search' performs a lookup for a word. It also supports a +'dictionary-tooltip-mode' which performs a lookup of the word under +the mouse in 'dictionary-tooltip-dictionary' (which must be customized +first). + +--- +** Lisp Data mode +The new command 'lisp-data-mode' enables a major mode for buffers +composed of Lisp symbolic expressions that do not form a computer +program. The ".dir-locals.el" file is automatically set to use this +mode, as are other data files produced by Emacs. + ++++ +** New global mode 'global-goto-address-mode'. +This will enable 'goto-address-mode' in all buffers. + +** transient.el +This library implements support for powerful keyboard-driven menus. +Such menus can be used as simple visual command dispatchers. More +complex menus take advantage of infix arguments, which are somewhat +similar to prefix arguments, but are more flexible and discoverable. + +** hierarchy.el +This library can create, query, navigate and display hierarchical +structures. + +--- +** New major mode for displaying the "etc/AUTHORS" file. +This new 'etc-authors-mode' provides font-locking for displaying the +"etc/AUTHORS" file from the Emacs distribution, and not much else. + + +* Incompatible Editing Changes in Emacs 28.1 + +--- +** 'toggle-truncate-lines' now disables 'visual-line-mode'. +This is for symmetry with 'visual-line-mode', which disables +'truncate-lines'. + +--- +** 'electric-indent-mode' now also indents inside strings and comments. +(This only happens when indentation function also supports this.) + +To recover the previous behavior you can use: + + (add-hook 'electric-indent-functions + (lambda (_) (if (nth 8 (syntax-ppss)) 'no-indent))) + +--- +** The 'M-o' ('facemenu-keymap') global binding has been removed. +To restore the old binding, say something like: + + (require 'facemenu) + (define-key global-map "\M-o" 'facemenu-keymap) + (define-key facemenu-keymap "\es" 'center-line) + (define-key facemenu-keymap "\eS" 'center-paragraph) + +The last two lines are not strictly necessary if you don't care about +having those two commands on the 'M-o' keymap; see the next section. + +--- +** The 'M-o M-s' and 'M-o M-S' global bindings have been removed. +Use 'M-x center-line' and 'M-x center-paragraph' instead. See the +previous section for how to get back the old bindings. Alternatively, +if you only want these two commands to have global bindings they had +before, you can add the following to your init file: + + (define-key global-map "\M-o\M-s" 'center-line) + (define-key global-map "\M-o\M-S" 'center-paragraph) + +--- +** The 'M-o M-o' global binding has been removed. +Use 'M-x font-lock-fontify-block' instead, or the new 'C-x x f' +command, which updates the syntax highlighting in the current buffer. + +--- +** The escape sequence '\e[29~' in Xterm is now mapped to 'menu'. +Xterm sends this sequence for both 'F16' and 'Menu' keys +It used to be mapped to 'print' but we couldn't find a terminal +that uses this sequence for any kind of 'Print' key. +This makes the Menu key (see https://en.wikipedia.org/wiki/Menu_key) +work for 'context-menu-mode' in Xterm. + +--- +** New user option 'xterm-store-paste-on-kill-ring'. +If non-nil (the default), Emacs pushes pasted text onto the kill ring +(if using an xterm-like terminal that supports bracketed paste). +Setting this to nil inhibits that. + +--- +** 'vc-print-branch-log' shows the change log from its root directory. +It previously used to use the default directory. + +--- +** 'project-shell' and 'shell' now use 'pop-to-buffer-same-window'. +This is to keep the same behavior as Eshell. + +--- +** In 'nroff-mode', 'center-line' is no longer bound to a key. +The original key binding was 'M-s', which interfered with I-search, +since the latter uses 'M-s' as a prefix key of the search prefix map. + +--- +** In 'f90-mode', the backslash character ('\') no longer escapes. +For about a decade, the backslash character has no longer had a +special escape syntax in Fortran F90. To get the old behavior back, +say something like: + + (modify-syntax-entry ?\\ "\\" f90-mode-syntax-table) + ++++ +** Setting 'fill-column' to nil is obsolete. +This undocumented use of 'fill-column' is now obsolete. To disable +auto filling, turn off 'auto-fill-mode' instead. + +For instance, you could add something like the following to your init +file: + + (add-hook 'foo-mode-hook (lambda () (auto-fill-mode -1)) + + +* Incompatible Lisp Changes in Emacs 28.1 + ++++ +** Emacs now prints a backtrace when signaling an error in batch mode. +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. + +--- +** Some floating-point numbers are now handled differently by the Lisp reader. +In previous versions of Emacs, numbers with a trailing dot and an exponent +were read as integers and the exponent ignored: 2.e6 was interpreted as the +integer 2. Such numerals are now read as floats with the exponent included: +2.e6 is now read as the floating-point value 2000000.0. +That is, '(read-from-string "1.e3")' => '(1000.0 . 4)' now. + +--- +** 'equal' no longer examines some contents of window configurations. +Instead, it considers window configurations to be equal only if they +are 'eq'. To compare contents, use 'compare-window-configurations' +instead. This change helps fix a bug in 'sxhash-equal', which returned +incorrect hashes for window configurations and some other objects. + ++++ +** The 'lexical-binding' local variable is always enabled. +Previously, if 'enable-local-variables' was nil, a 'lexical-binding' +local variable would not be heeded. This has now changed, and a file +with a 'lexical-binding' cookie is always heeded. To revert to the +old behavior, set 'permanently-enabled-local-variables' to nil. + ++++ +** '&rest' in argument lists must always be followed by a variable name. +Omitting the variable name after '&rest' was previously tolerated in +some cases but not consistently so; it could lead to crashes or +outright wrong results. Since the utility was marginal at best, it is +now an error to omit the variable. + +--- +** 'kill-all-local-variables' has changed how it handles non-symbol hooks. +The function is documented to eliminate all buffer-local bindings +except variables with a 'permanent-local' property, or hooks that +have elements with a 'permanent-local-hook' property. In addition, it +would also keep lambda expressions in hooks sometimes. The latter has +now been changed: The function will now also remove these. + ++++ +** Temporary buffers no longer run certain buffer hooks. +The macros 'with-temp-buffer' and 'with-temp-file' no longer run the +hooks 'kill-buffer-hook', 'kill-buffer-query-functions', and +'buffer-list-update-hook' for the temporary buffers they create. This +avoids slowing them down when a lot of these hooks are defined. + ++++ +** New face 'child-frame-border' and frame parameter 'child-frame-border-width'. +The face and width of child frames borders can now be determined +separately from those of normal frames. To minimize backward +incompatibility, child frames without a 'child-frame-border-width' +parameter will fall back to using 'internal-border-width'. However, +the new 'child-frame-border' face does constitute a breaking change +since child frames' borders no longer use the 'internal-border' face. + +--- +** 'run-at-time' now tries harder to implement the t TIME parameter. +If TIME is t, the timer runs at an integral multiple of REPEAT. +(I.e., if given a REPEAT of 60, it'll run at 08:11:00, 08:12:00, +08:13:00.) However, when a machine goes to sleep (or otherwise didn't +get a time slot to run when the timer was scheduled), the timer would +then fire every 60 seconds after the time the timer was fired. This +has now changed, and the timer code now recomputes the integral +multiple every time it runs, which means that if the laptop wakes at +08:16:43, it'll fire at that time, but then at 08:17:00, 08:18:00... + +--- +** 'parse-partial-sexp' now signals an error if TO is smaller than FROM. +Previously, this would lead to the function interpreting FROM as TO and +vice versa, which would be confusing when passing in OLDSTATE, which +refers to the old state at FROM. + ++++ +** 'global-mode-string' constructs should end with a space. +This was previously not formalized, which led to combinations of modes +displaying data "smushed together" on the mode line. + ++++ +** 'overlays-in' now handles zero-length overlays slightly differently. +Previously, zero-length overlays at the end of the buffer were included +in the result (if the region queried for stopped at that position). +The same was not the case if the buffer had been narrowed to exclude +the real end of the buffer. This has now been changed, and +zero-length overlays at 'point-max' are always included in the results. + +--- +** 'replace-match' now runs modification hooks slightly later. +The function is documented to leave point after the replacement text, +but this was not always the case if a modification hook inserted text +in front of the replaced text -- 'replace-match' would instead leave +point where the end of the inserted text would have been before the +hook ran. 'replace-match' now always leaves point after the +replacement text. + ++++ +** 'completing-read-default' sets completion variables buffer-locally. +'minibuffer-completion-table' and related variables are now set buffer-locally +in the minibuffer instead of being set via a global let-binding. + +--- +** XML serialization functions now reject invalid characters. +Previously, 'xml-print' would produce invalid XML when given a string +with characters that are not valid in XML (see +https://www.w3.org/TR/xml/#charsets). Now it rejects such strings. + +--- +** JSON + +--- +*** JSON number parsing is now stricter. +Numbers with a leading plus sign, leading zeros, or a missing integer +component are now rejected by 'json-read' and friends. This makes +them more compliant with the JSON specification and consistent with +the native JSON parsing functions. + +--- +*** JSON functions support the semantics of RFC 8259. +The JSON functions 'json-serialize', 'json-insert', +'json-parse-string', and 'json-parse-buffer' now implement some of the +semantics of RFC 8259 instead of the earlier RFC 4627. In particular, +these functions now accept top-level JSON values that are neither +arrays nor objects. + +--- +*** Some JSON encoding functions are now obsolete. +The functions 'json-encode-number', 'json-encode-hash-table', +'json-encode-key', and 'json-encode-list' are now obsolete. + +The first two are kept as aliases of 'json-encode', which should be +used instead. Uses of 'json-encode-list' should be changed to call +one of 'json-encode', 'json-encode-alist', 'json-encode-plist', or +'json-encode-array' instead. + ++++ +*** Native JSON functions now signal an error if libjansson is unavailable. +This affects 'json-serialize', 'json-insert', 'json-parse-string', +and 'json-parse-buffer'. This can happen if Emacs was compiled with +libjansson, but the DLL cannot be found and/or loaded by Emacs at run +time. Previously, Emacs would display a message and return nil in +these cases. + ++++ +** The use of positional arguments in 'define-minor-mode' is obsolete. +These were actually rendered obsolete in Emacs 21 but were never +marked as such. + +--- +** 'pcomplete-ignore-case' is now an obsolete alias of 'completion-ignore-case'. + ++++ +** 'completions-annotations' face is not used when the caller puts own face. +This affects the suffix specified by completion 'annotation-function'. + ++++ +** An active minibuffer now has major mode 'minibuffer-mode'. +This is instead of the erroneous 'minibuffer-inactive-mode' it +formerly had. + +--- +** 'make-text-button' no longer modifies text properties of its first argument. +When its first argument is a string, 'make-text-button' no longer +modifies the string's text properties; instead, it uses and returns +a copy of the string. This helps avoid trouble when strings are +shared or constants. + ++++ +** Some properties from completion tables are now preserved. +If 'minibuffer-allow-text-properties' is non-nil, doing completion +over a table of strings with properties will no longer remove all the +properties before returning. This affects things like 'completing-read'. + +--- +** 'dns-query' now consistently uses Lisp integers to represent integers. +Formerly it made an exception for integer components of SOA records, +because SOA serial numbers can exceed fixnum ranges on 32-bit platforms. +Emacs now supports bignums so this old glitch is no longer needed. + ++++ +** The '&define' keyword in an Edebug specification now disables backtracking. +The implementation was buggy, and multiple '&define' forms in an '&or' +form should be exceedingly rare. See the Info node "(elisp) Backtracking" in +the Emacs Lisp reference manual for background. + ++++ +** The error 'ftp-error' belongs also to category 'remote-file-error'. + ++++ +** 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'. + ++++ +** 'inhibit-nul-byte-detection' is renamed to 'inhibit-null-byte-detection'. + +--- +** Some functions are no longer considered safe by 'unsafep': +'replace-regexp-in-string', 'catch', 'throw', 'error', 'signal' +and 'play-sound-file'. + +--- +** 'sql-*-statement-starters' are no longer user options. +These variables describe facts about the SQL standard and +product-specific additions. There should be no need for users to +customize them. + +--- +** Some locale-related variables have been removed. +The Lisp variables 'previous-system-messages-locale' and +'previous-system-time-locale' have been removed, as they were created +by mistake and were not useful to Lisp code. + +--- +** Function 'lm-maintainer' is replaced with 'lm-maintainers'. +The former is now declared obsolete. + ++++ +** 'facemenu.el' is no longer preloaded. +To use functions/variables from the package, you now have to say +'(require 'facemenu)' or similar. + +--- +** 'facemenu-color-alist' is now obsolete, and is not used. + +--- +** The variable 'keyboard-type' is obsolete and not dynamically scoped any more. + ++++ +** The 'values' variable is now obsolete. +Using it just contributes to the growth of the Emacs memory +footprint. + +--- +** The 'load-dangerous-libraries' variable is now obsolete. +It was used to allow loading Lisp libraries compiled by XEmacs, a +modified version of Emacs which is no longer actively maintained. +This is no longer supported, and setting this variable has no effect. + ++++ +** The macro 'with-displayed-buffer-window' is now obsolete. +Use macro 'with-current-buffer-window' with action alist entry 'body-function'. + +--- +** The rfc2368.el library is now obsolete. +Use rfc6068.el instead. The main difference is that +'rfc2368-parse-mailto-url' and 'rfc2368-unhexify-string' assumed that +the strings were all-ASCII, while 'rfc6068-parse-mailto-url' and +'rfc6068-unhexify-string' parse UTF-8 strings. + +--- +** The inversion.el library is now obsolete. + +--- +** The metamail.el library is now obsolete. + +** Edebug changes + +--- +*** 'get-edebug-spec' is obsolete, replaced by 'edebug-get-spec'. + ++++ +*** The spec operator ':name NAME' is obsolete, use '&name' instead. + ++++ +*** The spec element 'function-form' is obsolete, use 'form' instead. + ++++ +*** New function 'def-edebug-elem-spec' to define Edebug spec elements. +These used to be defined with 'def-edebug-spec' thus conflating the +two name spaces, which lead to name collisions. +The use of 'def-edebug-spec' to define Edebug spec elements is +declared obsolete. + +--- +** The sb-image.el library is now obsolete. +This was a compatibility kludge which is no longer needed. + +--- +** Some libraries obsolete since Emacs 23 have been removed: +ledit.el, lmenu.el, lucid.el and old-whitespace.el. + +--- +** Some functions and variables obsolete since Emacs 23 have been removed: +'GOLD-map', 'advertised-xscheme-send-previous-expression', +'allout-init', 'bookmark-jump-noselect', +'bookmark-read-annotation-text-func', 'buffer-menu-mode-hook', +'c-forward-into-nomenclature', 'char-coding-system-table', +'char-valid-p', 'charset-bytes', 'charset-id', 'charset-list', +'choose-completion-delete-max-match', 'complete-in-turn', +'completion-base-size', 'completion-common-substring', +'crm-minibuffer-complete', 'crm-minibuffer-complete-and-exit', +'crm-minibuffer-completion-help', 'custom-mode', 'custom-mode-hook', +'define-key-rebound-commands', 'define-mode-overload-implementation', +'detect-coding-with-priority', 'dirtrack-debug', +'dirtrack-debug-toggle', 'dynamic-completion-table', +'easy-menu-precalculate-equivalent-keybindings', +'epa-display-verify-result', 'epg-passphrase-callback-function', +'erc-announced-server-name', 'erc-default-coding-system', +'erc-process', 'erc-send-command', 'eshell-report-bug', +'eval-next-after-load', 'exchange-dot-and-mark', 'ffap-bug', +'ffap-submit-bug', 'ffap-version', 'file-cache-mouse-choose-completion', +'forward-point', 'generic-char-p', 'global-highlight-changes', +'hi-lock-face-history', 'hi-lock-regexp-history', +'highlight-changes-active-string', 'highlight-changes-initial-state', +'highlight-changes-passive-string', +'icalendar--datetime-to-noneuropean-date', 'image-mode-maybe', +'imenu-example--name-and-position', 'ispell-aspell-supports-utf8', +'lisp-mode-auto-fill', 'locate-file-completion', 'make-coding-system', +'menu-bar-files-menu', 'minibuffer-local-must-match-filename-map', +'mouse-choose-completion', 'mouse-major-mode-menu', +'mouse-popup-menubar', 'mouse-popup-menubar-stuff', +'newsticker-groups-filename', 'nnir-swish-e-index-file', +'nnmail-fix-eudora-headers', 'non-iso-charset-alist', +'nonascii-insert-offset', 'nonascii-translation-table', +'password-read-and-add', 'pre-abbrev-expand-hook', 'princ-list', +'print-help-return-message', 'process-filter-multibyte-p', +'read-file-name-predicate', 'remember-buffer', 'rmail-highlight-face', +'rmail-message-filter', 'semantic-after-idle-scheduler-reparse-hooks', +'semantic-after-toplevel-bovinate-hook', +'semantic-before-idle-scheduler-reparse-hooks', +'semantic-before-toplevel-bovination-hook', +'semantic-bovinate-from-nonterminal-full', +'semantic-bovinate-region-until-error', 'semantic-bovinate-toplevel', +'semantic-bovination-working-type', +'semantic-decorate-pending-decoration-hooks', +'semantic-edits-incremental-reparse-failed-hooks', +'semantic-eldoc-current-symbol-info', 'semantic-expand-nonterminal', +'semantic-file-token-stream', 'semantic-find-dependency', +'semantic-find-nonterminal', 'semantic-flex', 'semantic-flex-buffer', +'semantic-flex-keyword-get', 'semantic-flex-keyword-p', +'semantic-flex-keyword-put', 'semantic-flex-keywords', +'semantic-flex-list', 'semantic-flex-make-keyword-table', +'semantic-flex-map-keywords', 'semantic-flex-token-end', +'semantic-flex-token-start', 'semantic-flex-token-text', +'semantic-imenu-bucketize-type-parts', +'semantic-imenu-expand-type-parts', 'semantic-imenu-expandable-token', +'semantic-init-db-hooks', 'semantic-init-hooks', +'semantic-init-mode-hooks', 'semantic-java-prototype-nonterminal', +'semantic-nonterminal-abstract', 'semantic-nonterminal-full-name', +'semantic-nonterminal-leaf', 'semantic-nonterminal-protection', +'semantic-something-to-stream', 'semantic-tag-make-assoc-list', +'semantic-token-type-parent', 'semantic-toplevel-bovine-cache', +'semantic-toplevel-bovine-table', 'semanticdb-mode-hooks', +'set-coding-priority', 'set-process-filter-multibyte', +'shadows-compare-text-p', 'shell-dirtrack-toggle', +'speedbar-navigating-speed', 'speedbar-update-speed', 't-mouse-mode', +'term-dynamic-simple-complete', 'tooltip-hook', 'tpu-have-ispell', +'url-generate-unique-filename', 'url-temporary-directory', +'vc-arch-command', 'vc-default-working-revision' (variable), +'vc-mtn-command', 'vc-revert-buffer', 'vc-workfile-version', +'vcursor-toggle-vcursor-map', 'w32-focus-frame', 'w32-select-font', +'wisent-lex-make-token-table'. + +--- +** Some functions and variables obsolete since Emacs 22 have been removed: +'erc-current-network', 'gnus-article-hide-pgp-hook', +'gnus-inews-mark-gcc-as-read', 'gnus-treat-display-xface', +'gnus-treat-strip-pgp', 'nnmail-spool-file'. + +--- +** The obsolete function 'thread-alive-p' has been removed. + +--- +** The variable 'force-new-style-backquotes' has been removed. +This removes the final remaining trace of old-style backquotes. + +--- +** Some obsolete variable and function aliases in dbus.el have been removed. +In Emacs 24.3, the variable 'dbus-event-error-hooks' was renamed to +'dbus-event-error-functions' and the function +'dbus-call-method-non-blocking' was renamed to 'dbus-call-method'. +The old names, which were kept as obsolete aliases of the new names, +have now been removed. + +--- +** 'find-function-source-path' renamed and re-documented. +The 'find-function' command (and various related commands) were +documented to respect 'find-function-source-path', and to search for +objects in files specified by that variable. It's unclear when this +actually changed, but at some point (perhaps decades ago) these +commands started using 'load-history' to determine where symbols had +been defined (which is much faster). The doc strings of all the +affected function has been updated. 'find-function-source-path' was +still being used by 'find-library' and related commands, so the +variable has been renamed to 'find-library-source-path', and +'find-function-source-path' is now an obsolete variable alias. + +--- +** The macro 'vc-call' no longer evaluates its second argument twice. + + +* Lisp Changes in Emacs 28.1 + ++++ +** The 'interactive' syntax has been extended to allow listing applicable modes. +Forms like '(interactive "p" dired-mode)' can be used to annotate the +commands as being applicable for modes derived from 'dired-mode', +or if the mode is a minor mode, that the current buffer has that +minor mode activated. Note that using this form will create byte code +that is not compatible with byte code in previous Emacs versions. + ++++ +** New forms to declare how completion should happen has been added. +'(declare (completion PREDICATE))' can be used as a general predicate +to say whether the command should be present when completing with +'M-x TAB'. '(declare (modes MODE...))' can be used as a short-hand +way of saying that the command should be present when completing from +buffers in major modes derived from MODE..., or, if it's a minor mode, +whether that minor mode is enabled in the current buffer. + ++++ +** 'define-minor-mode' now takes an ':interactive' argument. +This can be used for specifying which modes this minor mode is meant +for, or to make the new minor mode non-interactive. The default value +is t. + ++++ +** 'define-derived-mode' now takes an ':interactive' argument. +This can be used to control whether the defined mode is a command +or not, and is useful when defining commands that aren't meant to be +used by users directly. + ++++ +** 'define-globalized-minor-mode' now takes a ':predicate' parameter. +This can be used to control which major modes the minor mode should be +used in. + ++++ +** 'condition-case' now allows for a success handler. +It is written as '(:success BODY...)' where BODY is executed +whenever the protected form terminates without error, with the +specified variable bound to the value of the protected form. + ++++ +** New function 'benchmark-call' to measure the execution time of a function. +Additionally, the number of repetitions can be expressed as a minimal duration +in seconds. + ++++ +** The value thrown to the 'exit' label can now be a function. +This is in addition to values t or nil. If the value is a function, +the command loop will call it with zero arguments before returning. + ++++ +** The behavior of 'format-spec' is now closer to that of 'format'. +In order for the two functions to behave more consistently, +'format-spec' now pads and truncates based on string width rather than +length, and also supports format specifications that include a +truncating precision field, such as "%.2a". + +--- +** 'defvar' detects the error of defining a variable currently lexically bound. +Such mixes are always signs that the outer lexical binding was an +error and should have used dynamic binding instead. + +--- +** New variable 'inhibit-mouse-event-check'. +If bound to non-nil, a command with '(interactive "e")' doesn't signal +an error when invoked by input event that is not a mouse click (e.g., +a key sequence). + +--- +** New variable 'redisplay-skip-initial-frame' to enable batch redisplay tests. +Setting it to nil forces the redisplay to do its job even in the +initial frame used in batch mode. + ++++ +** Doc strings can now link to customization groups. +Text like "customization group `whitespace'" will be made into a +button. When clicked, it will open a Custom buffer displaying that +customization group. + ++++ +** Doc strings can now link to man pages. +Text like "man page `chmod(1)'" will be made into a button. When +clicked, it will open a Man mode buffer displaying that man page. + ++++ +** Buffers can now be created with certain hooks disabled. +The functions 'get-buffer-create' and 'generate-new-buffer' accept a +new optional argument INHIBIT-BUFFER-HOOKS. If non-nil, the new +buffer does not run the hooks 'kill-buffer-hook', +'kill-buffer-query-functions', and 'buffer-list-update-hook'. This +avoids slowing down internal or temporary buffers that are never +presented to users or passed on to other applications. + ++++ +** New command 'make-directory-autoloads'. +This does the same as the old command 'update-directory-autoloads', +but has different semantics: Instead of passing in the output file via +the dynamically bound 'generated-autoload-file' variable, the output +file is now a explicit parameter. + +--- +** Dragging a file into Emacs pushes the file name onto 'file-name-history'. + +--- +** The 'easymenu' library is now preloaded. + +--- +** The 'iso-transl' library is now preloaded. +This means that keystrokes like 'Alt-[' are defined by default, +instead of only becoming available after doing (for instance) +'C-x 8 '. + +--- +** ':safe' settings in 'defcustom' are now propagated to the loaddefs files. + ++++ +** New ':type' for 'defcustom' for nonnegative integers. +The new 'natnum' type can be used for options that should be +nonnegative integers. + ++++ +** ERT can now output more verbose test failure reports. +If the 'EMACS_TEST_VERBOSE' environment variable is set, failure +summaries will include the failing condition. + +** Byte compiler changes + ++++ +*** New byte-compiler check for missing dynamic variable declarations. +It is meant as an (experimental) aid for converting Emacs Lisp code +to lexical binding, where dynamic (special) variables bound in one +file can affect code in another. For details, see the manual section +"(elisp) Converting to Lexical Binding". + ++++ +*** 'byte-recompile-directory' can now compile symlinked ".el" files. +This is achieved by giving a non-nil FOLLOW-SYMLINKS parameter. + +--- +*** The byte-compiler now warns about too wide documentation strings. +By default, it will warn if a documentation string is wider than the +largest of 'byte-compile-docstring-max-column' or 'fill-column' +characters. + ++++ +*** 'byte-compile-file' optional argument LOAD is now obsolete. +To load the file after byte-compiling, add a call to 'load' from Lisp +or use 'M-x emacs-lisp-byte-compile-and-load' interactively. + +** Macroexp + +--- +*** New function 'macroexp-file-name' to know the name of the current file. + +--- +*** New function 'macroexp-compiling-p' to know if we're compiling. + +--- +*** New function 'macroexp-warn-and-return' to help emit warnings. +This used to be named 'macroexp--warn-and-return' and has proved useful +and well-behaved enough to lose the "internal" marker. + +** map.el + +--- +*** Alist keys are now consistently compared with 'equal' by default. +Until now, 'map-elt' and 'map-delete' compared alist keys with 'eq' by +default. They now use 'equal' instead, for consistency with +'map-put!' and 'map-contains-key'. + +*** Pcase 'map' pattern added keyword symbols abbreviation. +A pattern like '(map :sym)' binds the map's value for ':sym' to 'sym', +equivalent to '(map (:sym sym))'. + +--- +*** The function 'map-copy' now uses 'copy-alist' on alists. +This is a slightly deeper copy than the previous 'copy-sequence'. + +--- +*** The function 'map-contains-key' now supports plists. + +--- +*** More consistent duplicate key handling in 'map-merge-with'. +Until now, 'map-merge-with' promised to call its function argument +whenever multiple maps contained 'eql' keys. However, this did not +always coincide with the keys that were actually merged, which could +be 'equal' instead. The function argument is now called whenever keys +are merged, for greater consistency with 'map-merge' and 'map-elt'. + +** pcase + ++++ +*** The 'or' pattern now binds the union of the vars of its sub-patterns. +If a variable is not bound by the subpattern that matched, it gets bound +to nil. This was already sometimes the case, but it is now guaranteed. + ++++ +*** The 'pred' pattern can now take the form '(pred (not FUN))'. +This is like '(pred (lambda (x) (not (FUN x))))' but results +in better code. + +--- +*** New function 'pcase-compile-patterns' to write other macros. + ++++ +*** Added 'cl-type' pattern. +The new 'cl-type' pattern compares types using 'cl-typep', which allows +comparing simple types like '(cl-type integer)', as well as forms like +'(cl-type (integer 0 10))'. + ++++ +*** New macro 'pcase-setq'. +This macro is the 'setq' equivalent of 'pcase-let', which allows for +destructuring patterns in a 'setq' form. + +** Edebug + +*** Edebug specification lists can use some new keywords: + ++++ +**** '&interpose SPEC FUN ARGS..' lets FUN control parsing after SPEC. +More specifically, FUN is called with 'HEAD PF ARGS..' where +PF is a parsing function that expects a single argument (the specs to +use) and HEAD is the code that matched SPEC. + ++++ +**** '&error MSG' unconditionally aborts the current edebug instrumentation. + ++++ +**** '&name SPEC FUN' extracts the current name from the code matching SPEC. + +** Dynamic modules changes + ++++ +*** Type aliases for module functions and finalizers. +The module header 'emacs-module.h' now contains type aliases +'emacs_function' and 'emacs_finalizer' for module functions and +finalizers, respectively. + ++++ +*** Module functions can now be made interactive. +Use 'make_interactive' to give a module function an interactive +specification. + ++++ +*** Module functions can now install an optional finalizer. +The finalizer is called when the function object is garbage-collected. +Use 'set_function_finalizer' to set the finalizer and +'get_function_finalizer' to retrieve it. + ++++ +*** Modules can now open a channel to an existing pipe process. +Modules can use the new module function 'open_channel' to do that. +On capable systems, modules can use this functionality to +asynchronously send data back to Emacs. + ++++ +*** A new module API 'make_unibyte_string'. +It can be used to create Lisp strings with arbitrary byte sequences +(a.k.a. "raw bytes"). + ++++ +** Shorthands for Lisp symbols. +Shorthands are a general purpose namespacing system to make Emacs +Lisp's symbol-naming etiquette easier to use. A shorthand is any +symbolic form found in Lisp source that "abbreviates" a symbol's print +name. Among other applications, this feature can be used to avoid +name clashes and namespace pollution by renaming an entire file's +worth of symbols with proper and longer prefixes, without actually +touching the Lisp source. For details, see the manual section +"(elisp) Shorthands". + ++++ +** New function 'string-search'. +This function takes two string parameters and returns the position of +the first instance of the former string in the latter. + ++++ +** New function 'string-replace'. +This function works along the line of 'replace-regexp-in-string', but +it matches on fixed strings instead of regexps, and does not change +the global match state. + ++++ +** New function 'ensure-list'. +This function makes a list of its object if it's not a list already. +If it's already a list, the list is returned as is. + ++++ +** New function 'split-string-shell-command'. +This splits a shell command string into separate components, +respecting quoting with single ('like this') and double ("like this") +quotes, as well as backslash quoting (like\ this). + ++++ +** New function 'string-clean-whitespace'. +This removes whitespace from a string. + ++++ +** New function 'string-fill'. +Word-wrap a string so that no lines are longer that a specific length. + ++++ +** New function 'string-limit'. +Return (up to) a specific substring length. + ++++ +** New function 'string-lines'. +Return a list of strings representing the individual lines in a +string. + ++++ +** New function 'string-pad'. +Pad a string to a specific length. + ++++ +** New function 'string-chop-newline'. +Remove a trailing newline from a string. + ++++ +** New function 'replace-regexp-in-region'. + ++++ +** New function 'replace-string-in-region'. + ++++ +** New function 'file-name-with-extension'. +This function allows a canonical way to set/replace the extension of a +file name. + ++++ +** New function 'file-modes-number-to-symbolic' to convert a numeric +file mode specification into symbolic form. + ++++ +** New function 'file-name-concat'. +This appends file name components to a directory name and returns the +result. + ++++ +** New function 'file-backup-file-names'. +This function returns the list of file names of all the backup files +for the specified file. + ++++ +** New function 'directory-empty-p'. +This predicate tests whether a given file name is an accessible +directory and whether it contains no other directories or files. + ++++ +** New function 'buffer-local-boundp'. +This predicate says whether a symbol is bound in a specific buffer. + ++++ +** New function 'always'. +This is identical to 'ignore', but returns t instead. + ++++ +** New function 'sxhash-equal-including-properties'. +This is identical to 'sxhash-equal' but also accounts for string +properties. + +--- +** New function 'buffer-line-statistics'. +This function returns some statistics about the line lengths in a buffer. + +--- +** New function 'color-values-from-color-spec'. +This can be used to parse RGB color specs in several formats and +convert them to a list '(R G B)' of primary color values. + +--- +** New function 'custom-add-choice'. +This function can be used by modes to add elements to the +'choice' customization type of a variable. + +--- +** New function 'decoded-time-period'. +It interprets a decoded time structure as a period and returns the +equivalent period in seconds. + ++++ +** New function 'dom-print'. + ++++ +** New function 'dom-remove-attribute'. + +--- +** New function 'dns-query-asynchronous'. +It takes the same parameters as 'dns-query', but adds a callback +parameter. + +** New function 'garbage-collect-maybe' to trigger GC early. + +--- +** New function 'get-locale-names'. +This utility function returns a list of names of locales available on +the current system. + ++++ +** New function 'insert-into-buffer'. +This inserts the contents of the current buffer into another buffer. + ++++ +** New function 'json-available-p'. +This predicate returns non-nil if Emacs is built with libjansson +support, and it is available on the current system. + +--- +** New function 'mail-header-parse-addresses-lax'. +This takes a comma-separated string and returns a list of mail/name +pairs. + +--- +** New function 'mail-header-parse-address-lax'. +Parse a string as a mail address-like string. + +--- +** New function 'make-separator-line'. +Make a string appropriate for usage as a visual separator line. + ++++ +** New function 'object-intervals'. +This function returns a copy of the list of intervals (i.e., text +properties) in the object in question (which must either be a string +or a buffer). + ++++ +** New function 'process-lines-ignore-status'. +This is like 'process-lines', but does not signal an error if the +return status is non-zero. 'process-lines-handling-status' has also +been added, and takes a callback to handle the return status. + ++++ +** New function 'require-theme'. +This function is like 'require', but searches 'custom-theme-load-path' +instead of 'load-path'. It can be used by Custom themes to load +supporting Lisp files when 'require' is unsuitable. + ++++ +** New function 'seq-union'. +This function takes two sequences and returns a list of all elements +that appear in either of them, with no two elements that compare equal +appearing in the result. + ++++ +** New function 'syntax-class-to-char'. +This does almost the opposite of 'string-to-syntax' -- it returns the +syntax descriptor (a character) given a raw syntax descriptor (an +integer). + ++++ +** New functions 'null-device' and 'path-separator'. +These functions return the connection local value of the respective +variables. This can be used for remote hosts. + ++++ +** New predicate functions 'length<', 'length>' and 'length='. +Using these functions may be more efficient than using 'length' (if +the length of a (long) list is being computed just to compare this +length to a number). + ++++ +** New macro 'dlet' to dynamically bind variables. + ++++ +** New macro 'with-existing-directory'. +This macro binds 'default-directory' to some other existing directory +if 'default-directory' doesn't exist, and then executes the body forms. + ++++ +** New variable 'current-minibuffer-command'. +This is like 'this-command', but it is bound recursively when entering +the minibuffer. + ++++ +** New variable 'inhibit-interaction' to make user prompts signal an error. +If this is bound to something non-nil, functions like +'read-from-minibuffer', 'read-char' (and related) will signal an +'inhibited-interaction' error. + +--- +** New variable 'indent-line-ignored-functions'. +This allows modes to cycle through a set of indentation functions +appropriate for those modes. + ++++ +** New variable 'print-integers-as-characters' modifies integer printing. +If this variable is non-nil, character syntax is used for printing +numbers when this makes sense, such as '?A' for 65. + ++++ +** New variable 'tty-menu-calls-mouse-position-function'. +This controls whether 'mouse-position-function' is called by functions +that retrieve the mouse position when that happens during TTY menu +handling. Lisp programs that set 'mouse-position-function' should +also set this variable non-nil if they are compatible with the tty +menu handling. + ++++ +** New variables that hold default buffer names for shell output. +The new constants 'shell-command-buffer-name' and +'shell-command-buffer-name-async' store the default buffer names +for the output of, respectively, synchronous and async shell +commands. + +--- +** New variables 'read-char-choice-use-read-key' and 'y-or-n-p-use-read-key'. +When non-nil, then functions 'read-char-choice' and 'y-or-n-p' +(respectively) use the function 'read-key' to read a character instead +of using the minibuffer. + ++++ +** New variable 'global-minor-modes'. +This variable holds a list of currently enabled global minor modes (as +a list of symbols). + ++++ +** New buffer-local variable 'local-minor-modes'. +This permanently buffer-local variable holds a list of currently +enabled non-global minor modes in the current buffer (as a list of +symbols). + ++++ +** New completion function 'affixation-function' to add prefix/suffix. +It accepts a list of completions and should return a list where +each element is a list with three elements: a completion, +a prefix string, and a suffix string. + ++++ +** New completion function 'group-function' for grouping candidates. +It takes two arguments: a completion candidate and a 'transform' flag. + ++++ +** New error symbol 'minibuffer-quit'. +Signaling it has almost the same effect as 'quit' except that it +doesn't cause keyboard macro termination. + ++++ +** New error 'remote-file-error', a subcategory of 'file-error'. +It is signaled if a remote file operation fails due to internal +reasons, and could block Emacs. It does not replace 'file-error' +signals for the usual cases. Timers, process filters and process +functions, which run remote file operations, shall protect themselves +against this error. + +If such an error occurs, please report this as bug via 'M-x report-emacs-bug'. +Until it is solved you could ignore such errors by performing + + (setq debug-ignored-errors (cons 'remote-file-error debug-ignored-errors)) + ++++ +** New macro 'named-let' added to subr-x.el. +It provides Scheme's "named let" looping construct. + +--- +** Emacs now attempts to test for high-rate subprocess output more fairly. +When several subprocesses produce output simultaneously at high rate, +Emacs will now by default attempt to service them all in a round-robin +fashion. Set the new variable 'process-prioritize-lower-fds' to a +non-nil value to get back the old behavior, whereby after reading +from a subprocess, Emacs would check for output of other subprocesses +in a way that is likely to read from the same process again. + ++++ +** 'set-process-buffer' now updates the process mark. +The mark will be set to point to the end of the new buffer. + ++++ +** 'unlock-buffer' displays warnings instead of signaling. +Instead of signaling 'file-error' conditions for file system level +errors, the function now calls 'display-warning' and continues as if +the error did not occur. + ++++ +** 'read-char-from-minibuffer' and 'y-or-n-p' support 'help-form'. +If you bind 'help-form' to a non-nil value while calling these functions, +then pressing 'C-h' ('help-char') causes the function to evaluate 'help-form' +and display the result. + ++++ +** 'read-number' now has its own history variable. +Additionally, the function now accepts a HIST argument which can be +used to specify a custom history variable. + ++++ +** 'set-window-configuration' now takes two optional parameters, +'dont-set-frame' and 'dont-set-miniwindow'. The first of these, when +non-nil, instructs the function not to select the frame recorded in +the configuration. The second prevents the current minibuffer being +replaced by the one stored in the configuration. + +--- +** 'count-windows' now takes an optional parameter ALL-FRAMES. +The semantics are as with 'walk-windows'. + ++++ +** 'truncate-string-ellipsis' now uses '…' by default. +Modes that use 'truncate-string-to-width' with non-nil, non-string +argument ELLIPSIS, will now indicate truncation using '…' when +the selected frame can display it, and using "..." otherwise. + ++++ +** 'string-width' now accepts two optional arguments FROM and TO. +This allows calculating the width of a substring without consing a +new string. + ++++ +** 'directory-files' now takes an additional COUNT parameter. +The parameter makes 'directory-files' return COUNT first file names +from a directory. If MATCH is also given, the function will return +first COUNT file names that match the expression. The same COUNT +parameter has been added to 'directory-files-and-attributes'. + ++++ +** 'count-lines' can now ignore invisible lines. +This is controlled by the optional parameter IGNORE-INVISIBLE-LINES. + +--- +** 'count-words' now crosses field boundaries. +Originally, 'count-words' would stop counting at the first field +boundary it encountered; now it keeps counting all the way to the +region's (or buffer's) end. + ++++ +** File-related APIs can optionally follow symlinks. +The functions 'file-modes', 'set-file-modes', and 'set-file-times' now +have an optional argument specifying whether to follow symbolic links. + ++++ +** 'format-seconds' can now be used for sub-second times. +The new optional "," parameter has been added, and +'(format-seconds "%mm %,1ss" 66.4)' will now result in "1m 6.4s". + ++++ +** 'parse-time-string' can now parse ISO 8601 format strings. +These have a format like "2020-01-15T16:12:21-08:00". + +--- +** 'make-network-process', 'make-serial-process' ':coding' behavior change. +Previously, passing ':coding nil' to either of these functions would +override any non-nil binding for 'coding-system-for-read' and +'coding-system-for-write'. For consistency with 'make-process' and +'make-pipe-process', passing ':coding nil' is now ignored. No code in +Emacs depended on the previous behavior; if you really want the +process' coding-system to be nil, use 'set-process-coding-system' +after the process has been created, or pass in ':coding '(nil nil)'. + ++++ +** 'open-network-stream' now accepts a ':coding' argument. +This allows specifying the coding systems used by a network process +for encoding and decoding without having to bind +'coding-system-for-{read,write}' or call 'set-process-coding-system'. + ++++ +** 'open-network-stream' can now take a ':capability-command' that's a function. +The function is called with the greeting from the server as its only +parameter, and allows sending different TLS capability commands to the +server based on that greeting. + ++++ +** 'open-gnutls-stream' now also accepts a ':coding' argument. + +--- +** 'process-attributes' now works under OpenBSD, too. + ++++ +** 'format-spec' now takes an optional SPLIT parameter. +If non-nil, 'format-spec' will split the resulting string into a list +of strings, based on where the format specs (and expansions) were. + +--- +** 'unload-feature' now also tries to undo additions to buffer-local hooks. + +--- +** 'while-no-input-ignore-events' accepts more special events. +The special events 'dbus-event' and 'file-notify' are now ignored in +'while-no-input' when added to this variable. + +--- +** 'start-process-shell-command' and 'start-file-process-shell-command' +do not support the old calling conventions any longer. + ++++ +** 'yes-or-no-p' and 'y-or-n-p' PROMPT parameter no longer needs trailing space. +In other words, the prompt can now end with "?" instead of "? ". This +has been the case since Emacs 24.4 but was not announced or documented +until now. (Checkdoc has also been updated to accept this convention.) + ++++ +** The 'uniquify' argument in 'auto-save-file-name-transforms' can be a symbol. +If this symbol is one of the members of 'secure-hash-algorithms', +Emacs constructs the nondirectory part of the auto-save file name by +applying that 'secure-hash' to the buffer file name. This avoids any +risk of excessively long file names. + ++++ +** New user option 'process-file-return-signal-string'. +It controls, whether 'process-file' returns a string when a remote +process is interrupted by a signal. + +** EIEIO Changes + ++++ +*** The macro 'oref-default' can now be used with 'setf'. +It is now defined as a generalized variable that can be used with +'setf' to modify the value stored in a given class slot. + +--- +*** 'form' in '(eql form)' specializers in 'cl-defmethod' is now evaluated. +This corresponds to the behavior of defmethod in Common Lisp Object System. +For compatibility, '(eql SYMBOL)' does not evaluate SYMBOL, for now. + +** D-Bus + ++++ +*** Property values can be typed explicitly. +'dbus-register-property' and 'dbus-set-property' accept now optional +type symbols. Both functions propagate D-Bus errors. + ++++ +*** Registered properties can have the new access type ':write'. + ++++ +*** In case of problems, handlers can emit proper D-Bus error messages now. + ++++ +*** D-Bus errors, which have been converted from incoming D-Bus error +messages, contain the error name of that message now. + ++++ +*** D-Bus messages can be monitored with the new command 'dbus-monitor'. + ++++ +*** D-Bus events have changed their internal structure. +They carry now the destination and the error-name of an event. They +also keep the type information of their arguments. Use the +'dbus-event-*' accessor functions. + +** Buttons + ++++ +*** New minor mode 'button-mode'. +This minor mode does nothing else than install 'button-buffer-map' as +a minor mode map (which binds the 'TAB' / 'S-TAB' key bindings to navigate +to buttons), and can be used in any view-mode-like buffer that has +buttons in it. + ++++ +*** New utility function 'button-buttonize'. +This function takes a string and returns a string propertized in a way +that makes it a valid button. + +--- +** 'text-scale-mode' can now adjust font size of the header line. +When the new buffer local variable 'text-scale-remap-header-line' +is non-nil, 'text-scale-adjust' will also scale the text in the header +line when displaying that buffer. + +This is useful for major modes that arrange their display in a tabular +form below the header line. It is enabled by default in +'tabulated-list-mode' and its derived modes. + +--- +** 'ascii' is now a coding system alias for 'us-ascii'. + +--- +** New coding-systems for EBCDIC variants. +New coding-systems 'ibm256', 'ibm273', 'ibm274', 'ibm277', 'ibm278', +'ibm280', 'ibm281', 'ibm284', 'ibm285', 'ibm290', 'ibm297'. These are +variants of the EBCDIC encoding tailored to some European and Japanese +locales. They are also available as aliases 'ebcdic-cp-*' (e.g., +'ebcdic-cp-fi' for the Finnish variant 'ibm278'), and 'cp2xx' (e.g., +'cp278' for 'ibm278'). There are also new charsets 'ibm2xx' to +support these coding-systems. + ++++ +** New 'Bindat type expression' description language. +This new system is provided by the new macro 'bindat-type' and +obsoletes the old data layout specifications. It supports +arbitrary-size integers, recursive types, and more. See the Info node +"(elisp) Byte Packing" in the ELisp manual for more details. + ++++ +** New macro 'with-environment-variables'. +This macro allows setting environment variables temporarily when +executing a form. + + +* Changes in Emacs 28.1 on Non-Free Operating Systems + ++++ +** On MS-Windows, Emacs can now use the native image API to display images. +Emacs can now use the MS-Windows GDI+ library to load and display +images in JPEG, PNG, GIF and TIFF formats. This support is available +unless Emacs was configured '--without-native-image-api'. + +This feature is experimental, and needs to be turned on to be used. +To turn this on, set the variable 'w32-use-native-image-API' to a +non-nil value. Please report any bugs you find while using the native +image API via 'M-x report-emacs-bug'. + ++++ +** On MS-Windows, Emacs can now toggle the IME. +A new function 'w32-set-ime-open-status' can now be used to disable +and enable the MS-Windows native Input Method Editor (IME) at run +time. A companion function 'w32-get-ime-open-status' returns the +current IME activation status. + +-- +** On macOS, 's-' and 's-' are now bound to +'move-beginning-of-line' and 'move-end-of-line' respectively. The commands +to select previous/next frame are still bound to 's-~' and 's-`'. + ++++ +** On macOS, Emacs can now load dynamic modules with a ".dylib" suffix. +'module-file-suffix' now has the value ".dylib" on macOS, but the +".so" suffix is supported as well. + +--- +** On macOS, the user option 'make-pointer-invisible' is now honored. + +--- +** On macOS, Xwidget is now supported. +If Emacs was built with xwidget support, you can access the embedded +webkit browser with 'M-x xwidget-webkit-browse-url'. Viewing two +instances of xwidget webkit is not supported. + +--- +*** Downloading files from xwidget-webkit is now supported. +The new user option 'xwidget-webkit-download-dir' says where to download to. + +--- +*** New command 'xwidget-webkit-clone-and-split-below'. +Open a new window below displaying the current URL. + +--- +*** New command 'xwidget-webkit-clone-and-split-right'. +Open a new window to the right displaying the current URL. + +--- +*** New user option 'xwidget-webkit-enable-plugins'. +If non-nil, enable plugins in xwidget. (This is only available on +macOS.) + ++++ +** New macOS Contacts back-end for EUDC. +This backend works on newer versions of macOS and is generally +preferred over the eudcb-mab.el backend. + + +---------------------------------------------------------------------- +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . + + +Local variables: +coding: utf-8 +mode: outline +paragraph-separate: "[ ]*$" +end: diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in index fe52587c1a..a56e4dd12a 100644 --- a/src/emacs-module.h.in +++ b/src/emacs-module.h.in @@ -169,6 +169,19 @@ struct emacs_env_28 @module_env_snippet_28@ }; +struct emacs_env_29 +{ +@module_env_snippet_25@ + +@module_env_snippet_26@ + +@module_env_snippet_27@ + +@module_env_snippet_28@ + +@module_env_snippet_29@ +}; + /* Every module should define a function as follows. */ extern int emacs_module_init (struct emacs_runtime *runtime) EMACS_NOEXCEPT diff --git a/src/module-env-28.h b/src/module-env-28.h index f8820b0606..bea80a5553 100644 --- a/src/module-env-28.h +++ b/src/module-env-28.h @@ -1,7 +1,3 @@ - /* Add module environment functions newly added in Emacs 28 here. - Before Emacs 28 is released, remove this comment and start - module-env-29.h on the master branch. */ - void (*(*EMACS_ATTRIBUTE_NONNULL (1) get_function_finalizer) (emacs_env *env, emacs_value arg)) (void *) EMACS_NOEXCEPT; diff --git a/src/module-env-29.h b/src/module-env-29.h new file mode 100644 index 0000000000..6ca0377318 --- /dev/null +++ b/src/module-env-29.h @@ -0,0 +1,3 @@ + /* Add module environment functions newly added in Emacs 29 here. + Before Emacs 29 is released, remove this comment and start + module-env-30.h on the master branch. */ commit 3478e64c88fe0187f49343ed778d7e9231cf5837 Author: Eli Zaretskii Date: Thu Sep 30 20:11:43 2021 +0300 Bump Emacs version to 29.0.50 * README: * configure.ac: * nt/README.W32: * msdos/sed2v2.inp: * src/msdos.c (internal_terminal_init): * etc/refcards/ru-refcard.tex: * etc/NEWS: Bump Emacs version to 29.0.50. * etc/NEWS.28: New file. * lisp/cus-edit.el (customize-changed-options-previous-release): Update the reference version of Emacs. diff --git a/README b/README index a1d5e2dcef..6329a7775e 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ Copyright (C) 2001-2021 Free Software Foundation, Inc. See the end of the file for license conditions. -This directory tree holds version 28.0.50 of GNU Emacs, the extensible, +This directory tree holds version 29.0.50 of GNU Emacs, the extensible, customizable, self-documenting real-time display editor. The file INSTALL in this directory says how to build and install GNU diff --git a/configure.ac b/configure.ac index f151dd551d..c4509a5859 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ dnl along with GNU Emacs. If not, see . AC_PREREQ(2.65) dnl Note this is parsed by (at least) make-dist and lisp/cedet/ede/emacs.el. -AC_INIT(GNU Emacs, 28.0.50, bug-gnu-emacs@gnu.org, , https://www.gnu.org/software/emacs/) +AC_INIT(GNU Emacs, 29.0.50, bug-gnu-emacs@gnu.org, , https://www.gnu.org/software/emacs/) dnl Set emacs_config_options to the options of 'configure', quoted for the shell, dnl and then quoted again for a C string. Separate options with spaces. diff --git a/etc/NEWS b/etc/NEWS index b9f5830656..d0e41baaeb 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -6,10 +6,10 @@ See the end of the file for license conditions. Please send Emacs bug reports to 'bug-gnu-emacs@gnu.org'. If possible, use 'M-x report-emacs-bug'. -This file is about changes in Emacs version 28. +This file is about changes in Emacs version 29. See file HISTORY for a list of GNU Emacs versions and release dates. -See files NEWS.27, NEWS.26, ..., NEWS.18, and NEWS.1-17 for changes +See files NEWS.28, NEWS.27, ..., NEWS.18, and NEWS.1-17 for changes in older Emacs versions. You can narrow news to a specific version by calling 'view-emacs-news' @@ -22,4528 +22,31 @@ When you add a new item, use the appropriate mark if you are sure it applies, and please also update docstrings as needed. -* Installation Changes in Emacs 28.1 - -** Emacs now optionally supports native compilation of Lisp files. -To enable this, configure Emacs with the '--with-native-compilation' option. -This requires the libgccjit library to be installed and functional, -and also requires GCC and Binutils to be available when Lisp code is -natively compiled. See the Info node "(elisp) Native Compilation" for -more details. - -If you build Emacs with native compilation, but without zlib, be sure -to configure with the '--without-compress-install' option, so that the -installed *.el files are not compressed; otherwise, you will not be -able to use JIT native compilation of the installed *.el files. - -** The Cairo graphics library is now used by default if present. -'--with-cairo' is now the default, if the appropriate development files -are found by 'configure'. Note that building with Cairo means using -Pango instead of libXFT for font support. Since Pango 1.44 has -removed support for bitmapped fonts, this may require you to adjust -your font settings. - -Note also that 'FontBackend' settings in ".Xdefaults" or -".Xresources", or 'font-backend' frame parameter settings in your init -files, may need to be adjusted, as 'xft' is no longer a valid backend -when using Cairo. Use 'ftcrhb' if your Emacs was built with HarfBuzz -text shaping support, and 'ftcr' otherwise. You can determine this by -checking 'system-configuration-features'. The 'ftcr' backend will -still be available when HarfBuzz is supported, but will not be used by -default. We strongly recommend building with HarBuzz support. 'x' is -still a valid backend. - ---- -** 'configure' now warns about building with libXft support. -libXft is unmaintained, and causes a number of problems with modern -fonts including but not limited to crashes; support for it may be -removed in a future version of Emacs. Please consider using -Cairo + HarfBuzz instead. - ---- -** 'configure' now warns about not using HarfBuzz if using Cairo. -We want to encourage people to use the most modern font features -available, and this is the Cairo graphics library + HarfBuzz for font -shaping, so 'configure' now recommends that combination. - ---- -** Building without double buffering support. -'configure --with-xdbe=no' can now be used to disable double buffering -at build time. - ---- -** Support for building with Motif has been removed. - ---- -** The configure option '--without-makeinfo' has been removed. -This was only ever relevant when building from a repository checkout. -This now requires makeinfo, which is part of the texinfo package. - ---- -** Support for building with '-fcheck-pointer-bounds' has been removed. -GCC has withdrawn the '-fcheck-pointer-bounds' option and support for -its implementation has been removed from the Linux kernel. - ---- -** The ftx font backend driver has been removed. -It was declared obsolete in Emacs 27.1. - ---- -** Emacs no longer supports old OpenBSD systems. -OpenBSD 5.3 and older releases are no longer supported, as they lack -proper pty support that Emacs needs. - - -* Startup Changes in Emacs 28.1 - ---- -** In GTK builds, Emacs now supports startup notification. -This means that Emacs won't steal keyboard focus upon startup -(when started via the Desktop) if the user is typing into another -application. - ---- -** Errors in 'kill-emacs-hook' no longer prevent Emacs from shutting down. -If a function in that hook signals an error in an interactive Emacs, -the user will be prompted on whether to continue. If the user doesn't -answer within five seconds, Emacs will continue shutting down anyway. - -** Emacs now supports loading a Secure Computing filter. -This is supported only on capable GNU/Linux systems. To activate, -invoke Emacs with the '--seccomp=FILE' command-line option. FILE must -name a binary file containing an array of 'struct sock_filter' -structures. Emacs will then install that list of Secure Computing -filters into its own process early during the startup process. You -can use this functionality to put an Emacs process in a sandbox to -avoid security issues when executing untrusted code. See the manual -page for 'seccomp' system call, for details about Secure Computing -filters. - -** Emacs can support 24-bit color TTY without terminfo database. -If your text-mode terminal supports 24-bit true color, but your system -lacks the terminfo database, you can instruct Emacs to support 24-bit -true color by setting 'COLORTERM=truecolor' in the environment. This is -useful on systems such as FreeBSD which ships only with "etc/termcap". - ---- -** File names given on the command line are now be pushed onto history. -The file names will be pushed onto 'file-name-history', like the names -of files visited via 'C-x C-f' and other commands. - - -* Changes in Emacs 28.1 - ---- -** Emacs now supports Unicode Standard version 14.0. - -+++ -** New character script 'emoji' has been created. -Various blocks of codepoints have been split out of the 'symbol' -script into their own 'emoji' script to allow easier specification of -their treatment. Which codepoints are treated as emoji is derived -from the Unicode specifications. Also, Emacs will now use "Noto Color -Emoji" by default for that script. Use: - -(set-fontset-font t 'emoji - '("My New Emoji Font" . "iso10646-1") nil 'prepend) - -to change the font used. - -+++ -** Zero Width Joiner (ZWJ) and emoji sequences are now composed. -Emacs can now compose (almost) all the Unicode-14 ZWJ and emoji -sequences (if a suitable font is installed) so that they are displayed -as single glyphs instead of multiple ones. 'Noto Color Emoji' is one -such suitable font. - -+++ -** Composition of emoji has been improved. -If autocomposition is triggered by an emoji character, then the emoji -font is now used to check if composition can be performed, rather than -the font of the first character of the string being composed. This -allows e.g. - -'Emoji codepoint' + VS-16 - -to be displayed using the emoji font even if 'Emoji codepoint' does -not have emoji presentation by default. - -+++ -** 'glyphless-char-display-control' now applies to Variation Selectors. -VS-1 through VS-16 are now displayed as 'thin-space' by default when -not composed. - -+++ -** New command 'execute-extended-command-for-buffer'. -This new command, bound to 'M-S-x', works like -'execute-extended-command', but limits the set of commands to the -commands that have been determined to be particularly useful with the -current mode. - -+++ -** New user option 'read-extended-command-predicate'. -This user option controls how 'M-x' performs completion of commands when -you type 'TAB'. By default, any command that matches what you have -typed is considered a completion candidate, but you can customize this -option to exclude commands that are not applicable to the current -buffer's major and minor modes, and respect the command's completion -predicate (if any). - -+++ -** Completion on 'M-x' shows key bindings for commands. -When 'suggest-key-bindings' is non-nil (as it is by default), the -completion list popped up by 'M-x' shows the key bindings for all the -commands shown in the list of candidate completions that have a key -binding. - -+++ -** New user option 'completions-detailed'. -When non-nil, some commands like 'describe-symbol' show more detailed -completions with more information in completion prefix and suffix. -The default is nil. - ---- -** 'C-s' in 'M-x' now once again searches over completions. -In Emacs 23, typing 'M-x' ('read-extended-command') and then 'C-s' (to -do an interactive search) would search over possible completions. -This was lost in Emacs 24, but is now back again. - ---- -** User option 'completions-format' supports a new value 'one-column'. - -+++ -** New system for displaying documentation for groups of functions. -This can either be used by saying 'M-x shortdoc-display-group' and -choosing a group, or clicking a button in the "*Help*" buffers when -looking at the doc string of a function that belongs to one of these -groups. - -+++ -** New minor mode 'context-menu-mode' for context menus popped by 'mouse-3'. -When this mode is enabled, clicking 'down-mouse-3' anywhere in the buffer -pops up a menu whose contents depends on surrounding context near the -mouse click. You can change the order of the default sub-menus in the -context menu by customizing the user option 'context-menu-functions'. -You can also invoke the context menu by pressing 'S-' or, -on macOS, by clicking 'C-down-mouse-1'. - -+++ -** A new keymap for buffer actions has been added. -The 'C-x x' keymap now holds keystrokes for various buffer-oriented -commands. The new keystrokes are 'C-x x g' ('revert-buffer-quick'), -'C-x x r' ('rename-buffer'), 'C-x x u' ('rename-uniquely'), 'C-x x n' -('clone-buffer'), 'C-x x i' ('insert-buffer'), 'C-x x t' -('toggle-truncate-lines') and 'C-x x f' ('font-lock-update'). - -+++ -** Modifiers now go outside angle brackets in pretty-printed key bindings. -For example, 'RET' 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). - ---- -** 'eval-expression' no longer signals an error on incomplete expressions. -Previously, typing 'M-: ( RET' would result in Emacs saying "End of -file during parsing" and dropping out of the minibuffer. The user -would have to type 'M-: M-p' to edit and redo the expression. Now -Emacs will echo the message and allow the user to continue editing. - -+++ -** 'eval-last-sexp' now handles 'defvar'/'defcustom'/'defface' specially. -This command would previously not redefine values defined by these -forms, but this command has now been changed to work more like -'eval-defun', and reset the values as specified. - ---- -** New user option 'use-short-answers'. -When non-nil, the function 'y-or-n-p' is used instead of -'yes-or-no-p'. This eliminates the need to define an alias that maps -one to another in the init file. The same user option also controls -whether the function 'read-answer' accepts short answers. - -+++ -** New user option 'kill-buffer-delete-auto-save-files'. -If non-nil, killing a buffer that has an auto-save file will prompt -the user for whether that file should be deleted. (Note that -'delete-auto-save-files', if non-nil, was previously documented to -result in deletion of auto-save files when killing a buffer without -unsaved changes, but this has apparently not worked for several -decades, so the documented semantics of this variable has been changed -to match the behavior.) - -+++ -** New user option 'next-error-message-highlight'. -In addition to a fringe arrow, 'next-error' error may now optionally -highlight the current error message in the 'next-error' buffer. -This user option can be also customized to keep highlighting on all -visited errors, so you can have an overview what errors were already visited. - ---- -** New choice 'next-error-quit-window' for 'next-error-found-function'. -When 'next-error-found-function' is customized to 'next-error-quit-window', -then typing the numeric prefix argument 0 before the command 'next-error' -will quit the source window after visiting the next occurrence. - -+++ -** New user option 'file-preserve-symlinks-on-save'. -This controls what Emacs does when saving buffers that visit files via -symbolic links, and 'file-precious-flag' is non-nil. - -+++ -** New user option 'copy-directory-create-symlink'. -If non-nil, will make 'copy-directory' (when used on a symbolic -link) copy the link instead of following the link. The default is -nil, so the default behavior is unchanged. - -+++ -** New user option 'ignored-local-variable-values'. -This is the opposite of 'safe-local-variable-values' -- it's an alist -of variable-value pairs that are to be ignored when reading a -local-variables section of a file. - ---- -** Specific warnings can now be disabled from the warning buffer. -When a warning is displayed to the user, the resulting buffer now has -buttons which allow making permanent changes to the treatment of that -warning. Automatic showing of the warning can be disabled (although -it is still logged to the "*Messages*" buffer), or the warning can be -disabled entirely. - -+++ -** ".dir-locals.el" now supports setting 'auto-mode-alist'. -The new 'auto-mode-alist' specification in ".dir-locals.el" files can -now be used to override the global 'auto-mode-alist' in the current -directory tree. - ---- -** User option 'uniquify-buffer-name-style' can now be a function. -This user option can be one of the predefined styles or a function to -personalize the uniquified buffer name. - ---- -** 'remove-hook' is now an interactive command. - ---- -** 'expand-file-name' now checks for null bytes in filenames. -The function will now check for null bytes in both NAME and -DEFAULT-DIRECTORY arguments, as well as in the 'default-directory' -buffer-local variable, when its value is used. If null bytes are -found, 'expand-file-name' will signal an error. -This means that practically all file-related operations will now check -file names for null bytes, thus avoiding subtle bugs with silently -using only the part of file name up to the first null byte. - ---- -** Frames - -+++ -*** The key prefix 'C-x 5 5' displays next command buffer in a new frame. -It's bound to the command 'other-frame-prefix' that requests the buffer -of the next command to be displayed in a new frame. - -+++ -*** New command 'clone-frame' (bound to 'C-x 5 c'). -This is like 'C-x 5 2', but uses the frame parameters of the current -frame instead of 'default-frame-alist'. - ---- -*** Default values of 'frame-title-format' and 'icon-title-format' have changed. -These variables are used to display the title bar of visible frames -and the title bar of an iconified frame. They now show the name of -the current buffer and the text "GNU Emacs" instead of the value of -'invocation-name'. To get the old behavior back, add the following to -your init file: - - (setq frame-title-format '(multiple-frames "%b" - ("" invocation-name "@" system-name))) - -+++ -*** New frame parameter 'drag-with-tab-line'. -This parameter, similar to 'drag-with-header-line', allows moving frames -by dragging the tab lines of their topmost windows with the mouse. - -+++ -*** New optional behavior of 'delete-other-frames'. -When invoked with a prefix argument, 'delete-other-frames' now -iconifies frames, rather than deleting them. - ---- -*** Commands 'set-frame-width' and 'set-frame-height' now prompt for values. -These commands now prompt for the value via the minibuffer, instead of -requiring the user to specify the value via the prefix argument. - -** Windows - -*** 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. - -*** The key prefix 'C-x 4 4' displays next command buffer in a new window. -It's bound to the command 'other-window-prefix' that requests the buffer -of the next command to be displayed in a new window. - -+++ -*** New command 'recenter-other-window', bound to 'S-M-C-l'. -Like 'recenter-top-bottom' acting on the other window. - -+++ -*** New user option 'delete-window-choose-selected'. -This allows to choose a window that will be the frame's selected -window after deleting the currently selected one. - -+++ -*** New argument NO-OTHER for some window functions. -'get-lru-window', 'get-mru-window' and 'get-largest-window' now accept a -new optional argument NO-OTHER which, if non-nil, avoids returning a -window whose 'no-other-window' parameter is non-nil. - -+++ -*** 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. - -** Minibuffer - -+++ -*** Minibuffer scrolling is now conservative by default. -This is controlled by the new variable 'scroll-minibuffer-conservatively'. -It is t by default; setting it to nil will cause scrolling in the -minibuffer obey the value of 'scroll-conservatively'. - -+++ -*** Improved handling of minibuffers on switching frames. -By default, when you switch to another frame, an active minibuffer now -moves to the newly selected frame. Nevertheless, the effect of what -you type in the minibuffer happens in the frame where the minibuffer -was first activated. An alternative behavior is available by -customizing 'minibuffer-follows-selected-frame' to nil. Here, the -minibuffer stays in the frame where you first opened it, and you must -switch back to this frame to continue or abort its command. The old -behavior, which mixed these two, can be approximated by customizing -'minibuffer-follows-selected-frame' to a value which is neither nil -nor t. - -+++ -*** New user option 'read-minibuffer-restore-windows'. -When customized to nil, it uses 'minibuffer-restore-windows' in -'minibuffer-exit-hook' to remove only the window showing the -"*Completions*" buffer. - ---- -*** New variable 'redisplay-adhoc-scroll-in-resize-mini-windows'. -Customizing it to nil will disable the ad-hoc auto-scrolling of -minibuffer text shown in mini-windows when resizing those windows. -The default heuristics of that scrolling can be counter productive in -some corner cases, though the cure might be worse than the disease. -This said, the effect should be negligible in the vast majority of -cases anyway. - -** Mode Line - -+++ -*** New user option 'mode-line-compact'. -If non-nil, repeating spaces are compressed into a single space. If -'long', this is only done when the mode line is longer than the -current window width (in columns). - -+++ -*** New user options to control format of line/column numbers in the mode line. -'mode-line-position-line-format' is the line number format (when -'line-number-mode' is on), 'mode-line-position-column-format' is -the column number format (when 'column-number-mode' is on), and -'mode-line-position-column-line-format' is the combined format (when -both modes are on). - -** Tab Bars and Tab Lines - -+++ -*** The prefix key 'C-x t t' can be used to display a buffer in a new tab. -Typing 'C-x t t' before a command will cause the buffer shown by that -command to be displayed in a new tab. 'C-x t t" is bound to the -command 'other-tab-prefix'. - -+++ -*** New command 'C-x t C-r' to open file read-only in the other tab. - -*** The tab bar now supports more mouse commands. -Clicking 'mouse-2' closes the tab, 'mouse-3' displays the context menu -with items that operate on the clicked tab. Dragging the tab with -'mouse-1' moves it to another position on the tab bar. Mouse wheel -scrolling switches to the previous/next tab, and holding the Shift key -during scrolling moves the tab to the left/right. - ---- -*** Frame-specific appearance of the tab bar when 'tab-bar-show' is a number. -When 'tab-bar-show' is a number, the tab bar on different frames can -be shown or hidden independently, as determined by the number of tabs -on each frame compared to the numerical value of 'tab-bar-show'. - ---- -*** New command 'toggle-frame-tab-bar'. -It can be used to enable/disable the tab bar on the currently selected -frame regardless of the values of 'tab-bar-mode' and 'tab-bar-show'. -This allows to enable/disable the tab bar independently on different -frames. - ---- -*** New user option 'tab-bar-format' defines a list of tab bar items. -When it contains 'tab-bar-format-global' (possibly appended after -'tab-bar-format-align-right'), then after enabling 'display-time-mode' -(or any other mode that uses 'global-mode-string') it displays time -aligned to the right on the tab bar instead of on the mode line. -When 'tab-bar-format-tabs' is replaced with 'tab-bar-format-tabs-groups', -the tab bar displays tab groups. - ---- -*** New optional key binding for 'tab-last'. -If you customize the user option 'tab-bar-select-tab-modifiers' for -selecting tabs using its index numbers, the '-9' key is -bound to 'tab-last', and switches to the last tab. Here is -any of the modifiers in the list that is the value of -'tab-bar-select-tab-modifiers'. You can also use negative indices, -which count from the last tab: -1 is the last tab, -2 the one before -that, etc. - ---- -*** New command 'tab-duplicate' bound to 'C-x t n'. - ---- -*** 'C-x t N' creates a new tab at the specified absolute position. -The position is provided as prefix arg, and specifies an index that -starts at 1. Negative values count from the end of the tab bar. - ---- -*** 'C-x t M' moves the current tab to the specified absolute position. -The position is provided as prefix arg, whose interpretation is as in -'C-x t N'. - ---- -*** 'C-x t G' assigns a tab to a named group of tabs. -'tab-close-group' closes all tabs that belong to the selected group. -The user option 'tab-bar-new-tab-group' defines the default group of -new tabs. After customizing 'tab-bar-tab-post-change-group-functions' -to 'tab-bar-move-tab-to-group', changing the group of a tab will also -move it closer to other tabs in the same group. - ---- -*** New user option 'tab-bar-tab-name-format-function'. - ---- -*** New user option 'tab-line-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 -the mouse pointer is in the tab line by scrolling left or right. - ---- -*** New tab-line faces and options. -The face 'tab-line-tab-special' is used for tabs whose buffers are -special, i.e. buffers that don't visit a file. The face -'tab-line-tab-modified' is used to display modified, file-backed -buffers. The face 'tab-line-tab-inactive-alternate' is used to -display inactive tabs with an alternating background color, making -them easier to distinguish, especially if the face 'tab-line-tab' is -configured to not display with a box; this alternate face is only -applied when the option 'tab-line-tab-face-functions' is so -configured. That option may also be used to customize tab-line faces -in other ways. - -** Mouse wheel - ---- -*** Mouse wheel scrolling now defaults to one line at a time. - ---- -*** Mouse wheel scrolling now works on more parts of frame's display. -When using 'mwheel-mode', the mouse wheel will now scroll also when -the mouse cursor is on the scroll bars, fringes, margins, header line, -and mode line. ('mwheel-mode' is enabled by default on most graphical -displays.) - -+++ -*** Mouse wheel scrolling with Shift modifier now scrolls horizontally. -This works in text buffers and over images. Typing a numeric prefix arg -(e.g. 'M-5') before starting horizontal scrolling changes its step value. -The value is saved in the user option 'mouse-wheel-scroll-amount-horizontal'. - -** Customize - ---- -*** Customize buffers can now be reverted with 'C-x x g'. - ---- -*** Most customize commands now hide obsolete user options. -Obsolete user options are no longer shown in the listings produced by -the commands 'customize', 'customize-group', 'customize-apropos' and -'customize-changed'. - -To customize obsolete user options, use 'customize-option' or -'customize-saved'. - ---- -*** New SVG icons for checkboxes and arrows. -They will be used automatically instead of the old icons. If Emacs is -built without SVG support, the old icons will be used instead. - -** Help - ---- -*** The order things are displayed in the *Help* buffer has been changed. -The indented "administrative" block (containing the "probably -introduced" and "other relevant functions" (and similar things) has -been moved to after the doc string. - -+++ -*** New command 'describe-command' shows help for a command. -This can be used instead of 'describe-function' for interactive -commands and is globally bound to 'C-h x'. - -+++ -*** New command 'describe-keymap' describes keybindings in a keymap. - ---- -*** New command 'apropos-function'. -This works like 'C-u M-x apropos-command' but is more discoverable. - ---- -*** New keybinding 'C-h R' prompts for an Info manual and displays it. - ---- -*** Keybindings in 'help-mode' use the new 'help-key-binding' face. -This face is added by 'substitute-command-keys' to any "\[command]" -substitution. The return value of that function should consequently -be assumed to be a propertized string. - -Note that the new face will also be used in tooltips. When using the -GTK toolkit, this is only true if 'x-gtk-use-system-tooltips' is t. - -+++ -*** New user option 'help-enable-symbol-autoload'. -If non-nil, displaying help for an autoloaded function whose -'autoload' form provides no documentation string will try to load the -file it's from. This will give more extensive help for such -functions. - ---- -*** The 'help-for-help' ('C-h C-h') screen has been redesigned. - -+++ -*** New convenience commands with short keys in the Help buffer. -New command 'help-view-source' ('s') will view the source file (if -any) of the current help topic. New command 'help-goto-info' ('i') -will look up the current symbol (if any) in Info. New command -'help-customize' ('c') will customize the user option or the face -(if any) whose doc string is being shown in the Help buffer. - ---- -*** New user option 'describe-bindings-outline'. -It enables outlines in the output buffer of 'describe-bindings' that -can provide a better overview in a long list of available bindings. - -+++ -*** New command 'lossage-size'. -It allows users to change the maximum number of keystrokes and -commands recorded for the purpose of 'view-lossage'. - -+++ -*** New commands to describe buttons and widgets. -'widget-describe' (on a widget) will pop up a help buffer and give a -description of the properties. Likewise 'button-describe' does the -same for a button. - ---- -*** Improved "find definition" feature of "*Help*" buffers. -Now clicking on the link to find the definition of functions generated -by 'cl-defstruct', or variables generated by 'define-derived-mode', -for example, will go to the exact place where they are defined. - ---- -*** New commands 'apropos-next-symbol' and 'apropos-previous-symbol'. -These new navigation commands are bound to 'n' and 'p' in -'apropos-mode'. - ---- -*** The command 'view-lossage' can now be invoked from the menu bar. -The menu bar "Help" menu now has a "Show Recent Inputs" item under the -"Describe" sub-menu. - ---- -*** Closing the "*Help*" buffer from the toolbar now buries the buffer. -In previous Emacs versions, the "*Help*" buffer was killed instead when -clicking the "X" icon in the tool bar. - ---- -*** 'g' ('revert-buffer') in 'help-mode' no longer requires confirmation. - -** File Locks - -+++ -*** New user option 'lock-file-name-transforms'. -This option allows controlling where lock files are written. It uses -the same syntax as 'auto-save-file-name-transforms'. - -+++ -*** New user option 'remote-file-name-inhibit-locks'. -When non-nil, this option suppresses lock files for remote files. - -+++ -*** New minor mode 'lock-file-mode'. -This command, called interactively, toggles the local value of -'create-lockfiles' in the current buffer. - -** Emacs Server - -+++ -*** New user option 'server-client-instructions'. -When emacsclient connects, Emacs will (by default) output a message -about how to exit the client frame. If 'server-client-instructions' -is set to nil, this message is inhibited. - -+++ -*** New command 'server-edit-abort'. -This command (not bound to any key by default) can be used to abort -an edit instead of marking it as "Done" (which the 'C-x #' command -does). The 'emacsclient' program exits with an abnormal status as -result of this command. - -+++ -*** New desktop integration for connecting to the server. -If your operating system’s desktop environment is -freedesktop.org-compatible (which is true of most GNU/Linux and other -recent Unix-like desktops), you may use the new "Emacs (Client)" -desktop menu entry to open files in an existing Emacs instance rather -than starting a new one. The daemon starts if it is not already -running. - -** Miscellaneous - -+++ -*** New command 'font-lock-update', bound to 'C-x x f'. -This command updates the syntax highlighting in this buffer. - -+++ -*** New command 'memory-report'. -This command opens a new buffer called "*Memory Report*" and gives a -summary of where Emacs is using memory currently. - -+++ -*** New command 'submit-emacs-patch'. -This works like 'report-emacs-bug', but is more geared towards sending -patches to the Emacs issue tracker. - ---- -*** New face 'apropos-button'. -Applies to buttons that indicate a face. - -+++ -*** New face 'font-lock-doc-markup-face'. -Intended for documentation mark-up syntax and tags inside text that -uses 'font-lock-doc-face', with which it should harmonize. It would -typically be used in structured documentation comments in program -source code by language-specific modes, for mark-up conventions like -Haddock, Javadoc or Doxygen. By default this face inherits from -'font-lock-constant-face'. - -+++ -*** New face 'flat-button'. -This is a plain 2D button, but uses the background color instead of -the foreground color. - ---- -*** New face 'shortdoc-heading'. -Applies to headings of shortdoc sections. - ---- -*** New face 'separator-line'. -This is used by 'make-separator-line' (see below). - -+++ -*** '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. - ---- -*** Obsolete aliases are no longer hidden from command completion. -Completion of command names now considers obsolete aliases as -candidates, if they were marked obsolete in the current major version -of Emacs. Invoking a command via an obsolete alias now mentions the -obsolescence fact and shows the new name of the command. - -+++ -*** Support for '(box . SIZE)' 'cursor-type'. -By default, 'box' cursor always has a filled box shape. But if you -specify 'cursor-type' to be '(box . SIZE)', the cursor becomes a hollow -box if the point is on an image larger than SIZE pixels in any -dimension. - -+++ -*** The user can now customize how "default" values are prompted for. -The new utility function 'format-prompt' has been added which uses the -new 'minibuffer-default-prompt-format' user option to format "default" -prompts. This means that prompts that look like "Enter a number -(default 10)" can be customized to look like, for instance, "Enter a -number [10]", or not have the default displayed at all, like "Enter a -number". (This only affects callers that were altered to use -'format-prompt'.) - ---- -*** New help window when Emacs prompts before opening a large file. -Commands like 'find-file' or 'visit-tags-table' ask to visit a file -normally or literally when the file is larger than a certain size (by -default, 9.5 MiB). Press '?' or 'C-h' in that prompt to read more -about the different options to visit a file, how you can disable the -prompt, and how you can tweak the file size threshold. - -+++ -*** Emacs now defaults to UTF-8 instead of ISO-8859-1. -This is only for the default, where the user has set no 'LANG' (or -similar) variable or environment. This change should lead to no -user-visible changes for normal usage. - ---- -*** 'global-display-fill-column-indicator-mode' skips some buffers. -By default, turning on 'global-display-fill-column-indicator-mode' -doesn't turn on 'display-fill-column-indicator-mode' in special-mode -buffers. This can be controlled by customizing the user option -'global-display-fill-column-indicator-modes'. - -+++ -*** 'nobreak-char-display' now also affects all non-ASCII space characters. -Previously, this was limited only to 'NO-BREAK SPACE' and hyphen -characters. Now it also covers the rest of the non-ASCII Unicode -space characters. - -+++ -*** Improved support for terminal emulators that encode the Meta flag. -Some terminal emulators set the 8th bit of Meta characters, and then -encode the resulting character code as if it were non-ASCII character -above codepoint 127. Previously, the only way of using these in Emacs -was to set up the terminal emulator to use the 'ESC' characters to send -Meta characters to Emacs, e.g., send "ESC x" when the user types -'M-x'. You can now avoid the need for this setup of such terminal -emulators by using the new input-meta-mode with the special value -'encoded' with these terminal emulators. - ---- -*** 'auto-composition-mode' can now be selectively disabled on some TTYs. -Some text-mode terminals produce display glitches trying to compose -characters. The 'auto-composition-mode' can now have a string value -that names a terminal type; if the value returned by the 'tty-type' -function compares equal with that string, automatic composition will -be disabled in windows shown on that terminal. The Linux terminal -sets this up by default. - ---- -*** Support for the 'strike-through' face attribute on TTY frames. -If your terminal's termcap or terminfo database entry has the 'smxx' -capability defined, Emacs will now emit the prescribed escape -sequences necessary to render faces with the 'strike-through' -attribute on TTY frames. - ---- -*** TTY menu navigation is now supported in 'xterm-mouse-mode'. -TTY menus support mouse navigation and selection when 'xterm-mouse-mode' -is active. When run on a terminal, clicking on the menu bar with the -mouse now pops up a TTY menu by default instead of running the command -'tmm-menubar'. To restore the old behavior, set the user option -'tty-menu-open-use-tmm' to non-nil. - ---- -*** 'M-x report-emacs-bug' will no longer include "Recent messages" section. -These were taken from the "*Messages*" buffer, and may inadvertently -leak information from the reporting user. - ---- -*** 'C-u M-x dig' will now prompt for a query type to use. - ---- -*** Rudimentary support for the 'st' terminal emulator. -Emacs now supports 256 color display on the 'st' terminal emulator. - -+++ -*** Update IRC-related references to point to Libera.Chat. -The Free Software Foundation and the GNU Project have moved their -official IRC channels from the Freenode network to Libera.Chat. For the -original announcement and the follow-up update, including more details, -see: - -https://lists.gnu.org/archive/html/info-gnu/2021-06/msg00005.html -https://lists.gnu.org/archive/html/info-gnu/2021-06/msg00007.html - -Given the relocation of GNU and FSF's official IRC channels, as well -as #emacs and various other Emacs-themed channels (see the link below) -to Libera.Chat, IRC-related references in the Emacs repository have -now been updated to point to Libera.Chat. - -https://lists.gnu.org/archive/html/info-gnu-emacs/2021-06/msg00000.html - - -* Editing Changes in Emacs 28.1 - -** Input methods - -+++ -*** Emacs now supports "transient" input methods. -A transient input method is enabled for inserting a single character, -and is then automatically disabled. 'C-x \' temporarily enables the -selected transient input method. Use 'C-u C-x \' to select a -transient input method (which can be different from the input method -enabled by 'C-\'). For example, 'C-u C-x \ compose RET' selects the -'compose' input method; then typing 'C-x \ 1 2' will insert the -character '½', and disable the 'compose' input method afterwards. -You can use 'C-x \' in incremental search to insert a single character -to the search string. - ---- -*** New input method 'compose' based on X Multi_key sequences. - ---- -*** New input method 'iso-transl' with the same keys as 'C-x 8'. -After selecting it as a transient input method with 'C-u C-x \ -iso-transl RET', it supports the same key sequences as 'C-x 8', -so e.g. like 'C-x 8 [' inserts a left single quotation mark, -'C-x \ [' does the same. - ---- -*** New user option 'read-char-by-name-sort'. -It defines the sorting order of characters for completion of 'C-x 8 RET TAB' -and can be customized to sort them by codepoints instead of character names. -Additionally, you can group characters by Unicode blocks after customizing -'completions-group' and 'completions-group-sort'. - ---- -*** Improved language transliteration in Malayalam input methods. -Added a new Mozhi scheme. The inapplicable ITRANS scheme is now -deprecated. Errors in the Inscript method were corrected. - ---- -*** New input method 'cham'. -There's also a Cham greeting in "etc/HELLO". - ---- -*** New input methods for Lakota language orthographies. -Two orthographies are represented here, the Suggested Lakota -Orthography and what is known as the White Hat Orthography. Input -methods 'lakota-slo-prefix', 'lakota-slo-postfix', and -'lakota-white-hat-postfix' have been added. There is also a Lakota -greeting in "etc/HELLO". - -+++ -** Standalone 'M-y' allows interactive selection from previous kills. -'M-y' can now be typed after a command that is not a yank command. -When invoked like that, it prompts in the minibuffer for one of the -previous kills, offering completion and minibuffer-history navigation -through previous kills recorded in the kill ring. A similar feature -in Isearch can be invoked if you bind 'C-s M-y' to the command -'isearch-yank-pop'. When the user option 'yank-from-kill-ring-rotate' -is nil the kill ring is not rotated after 'yank-from-kill-ring'. - -+++ -** New user option 'word-wrap-by-category'. -When word-wrap is enabled, and this option is non-nil, that allows -Emacs to break lines after more characters than just whitespace -characters. In particular, this significantly improves word-wrapping -for CJK text mixed with Latin text. - -+++ -** New command 'undo-redo'. -It undoes previous undo commands, but doesn't record itself as an -undoable command. It is bound to 'C-?' and 'C-M-_', the first binding -works well in graphical mode, and the second one is easy to hit on tty. - -For full conventional undo/redo behavior, you can also customize the -user option 'undo-no-redo' to t. - -+++ -** New commands 'copy-matching-lines' and 'kill-matching-lines'. -These commands are similar to the command 'flush-lines', -but add the matching lines to the kill ring as a single string, -including the newlines that separate the lines. - -+++ -** New user option 'kill-transform-function'. -This can be used to transform (and suppress) strings from entering the -kill ring. - -+++ -** 'save-interprogram-paste-before-kill' can now be a number. -In that case, it's interpreted as a limit on the size of the clipboard -data that will be saved to the 'kill-ring' prior to killing text: if -the size of the clipboard data is greater than or equal to the limit, -it will not be saved. - -+++ -** New user option 'tab-first-completion'. -If 'tab-always-indent' is 'complete', this new user option can be used to -further tweak whether to complete or indent. - ---- -** 'indent-tabs-mode' is now a global minor mode instead of just a variable. - ---- -** New choice 'permanent' for 'shift-select-mode'. -When the mark was activated by shifted motion keys, non-shifted motion -keys don't deactivate the mark after customizing 'shift-select-mode' -to 'permanent'. - -+++ -** The "Edit => Clear" menu item now obeys a rectangular region. - -+++ -** New command 'revert-buffer-with-fine-grain'. -Revert a buffer trying to be as non-destructive as possible, -preserving markers, properties and overlays. The new variable -'revert-buffer-with-fine-grain-max-seconds' specifies the maximum -number of seconds that 'revert-buffer-with-fine-grain' should spend -trying to be non-destructive, with a default value of 2 seconds. - -+++ -** New command 'revert-buffer-quick'. -This is bound to 'C-x x g' and is like 'revert-buffer', but prompts -less. - -+++ -** New user option 'revert-buffer-quick-short-answers'. -This controls how the new 'revert-buffer-quick' ('C-x x g') command -prompts. - -+++ -** New user option 'query-about-changed-file'. -If non-nil (the default), Emacs prompts as before when re-visiting a -file that has changed externally after it was visited the first time. -If nil, Emacs does not prompt, but instead shows the buffer with its -contents before the change, and provides instructions how to revert -the buffer. - ---- -** New value 'save-some-buffers-root' of 'save-some-buffers-default-predicate'. -When using this predicate, only buffers under the current project root -will be considered when saving buffers with 'save-some-buffers'. - ---- -** New user option 'save-place-abbreviate-file-names'. -This can simplify sharing the 'save-place-file' file across -different hosts. - ---- -** New user options 'copy-region-blink-delay' and 'delete-pair-blink-delay'. -'copy-region-blink-delay' specifies a delay to indicate the region -copied by 'kill-ring-save'. 'delete-pair-blink-delay' specifies -a delay to show the paired character to delete. - ---- -** 'zap-up-to-char' now uses 'read-char-from-minibuffer'. -This allows navigating through the history of characters that have -been input. This is mostly useful for characters that have complex -input methods where inputting the character again may involve many -keystrokes. - -+++ -** Input history for 'goto-line' can now be made local to every buffer. -In any event, line numbers used with 'goto-line' are kept in their own -history list. This should help make faster the process of finding -line numbers that were previously jumped to. By default, all buffers -share a single history list. To make every buffer have its own -history list, customize the user option 'goto-line-history-local'. - -+++ -** New command 'goto-line-relative' for use in a narrowed buffer. -It moves point to the line relative to the accessible portion of the -narrowed buffer. 'M-g M-g' in Info is rebound to this command. -When 'widen-automatically' is non-nil, 'goto-line' widens the narrowed -buffer to be able to move point to the inaccessible portion. -'goto-line-relative' is bound to 'C-x n g'. - -+++ -** 'got-char' prompts for the character position. -When called interactively, 'goto-char' now offers the position at -point as the default. - -** Autosaving via 'auto-save-visited-mode' can now be inhibited. -Set the variable 'auto-save-visited-mode' buffer-locally to nil to -achieve that. - -+++ -** New command 'kdb-macro-redisplay' to force redisplay in keyboard macros. -This command is bound to 'C-x C-k d'. - ---- -** 'blink-cursor-mode' is now enabled by default regardless of the UI. -It used to be enabled when Emacs is started in GUI mode but not when started -in text mode. The cursor still only actually blinks in GUI frames. - -** 'show-paren-mode' is now enabled by default. -To go back to the previous behavior, customize the user option by the -same name to nil. - -+++ -** New minor mode 'show-paren-local-mode'. -It serves as a local counterpart for 'show-paren-mode', allowing you -to toggle it separately in different buffers. To use it only in -programming modes, for example, add the following to your init file: - -(add-hook 'prog-mode-hook #'show-paren-local-mode) - - -* Changes in Specialized Modes and Packages in Emacs 28.1 - -** Isearch and Replace - -+++ -*** Interactive regular expression search now uses faces for sub-groups. -E.g., 'C-M-s foo-\([0-9]+\)' will now use the 'isearch-group-1' face -on the part of the regexp that matches the sub-expression "[0-9]+". -By default, there are two faces for sub-group highlighting, but you -can define more faces whose names are of the form 'isearch-group-N', -where N are successive numbers above 2. - -This is controlled by the 'search-highlight-submatches' user option. -This feature is available only on terminals that have enough colors to -distinguish between sub-expression highlighting. - -+++ -*** Interactive regular expression replace now uses faces for sub-groups. -Like 'search-highlight-submatches', this is controlled by the new user option -'query-replace-highlight-submatches'. - -+++ -*** New user option 'isearch-wrap-pause' defines how to wrap the search. -There are choices to disable wrapping completely and to wrap immediately. -When wrapping immediately, it consistently handles the numeric arguments -of 'C-s' ('isearch-repeat-forward') and 'C-r' ('isearch-repeat-backward'), -continuing with the remaining count after wrapping. - -+++ -*** New user option 'isearch-repeat-on-direction-change'. -When this option is set, direction changes in Isearch move to another -search match, if there is one, instead of moving point to the other -end of the current match. - -*** New key 'M-s M-.' starts isearch looking for the thing at point. -This key is bound to the new command 'isearch-forward-thing-at-point'. -The new user option 'isearch-forward-thing-at-point' defines -a list of symbols to try to get the "thing" at point. By default, -the first element of the list is 'region' that tries to yank -the currently active region to the search string. - -+++ -*** New user option 'lazy-highlight-no-delay-length'. -Lazy highlighting of matches in Isearch now starts immediately if the -search string is at least this long. 'lazy-highlight-initial-delay' -still applies for shorter search strings, which avoids flicker in the -search buffer due to too many matches being highlighted. - ---- -*** The default 'search-whitespace-regexp' value has changed. -This used to be "\\s-+", which meant that it was mode-dependent whether -newlines were included in the whitespace set. This has now been -changed to only match spaces and tab characters. - -** Dired - -+++ -*** New user option 'dired-kill-when-opening-new-dired-buffer'. -If non-nil, Dired will kill the current buffer when selecting a new -directory to display. - -+++ -*** Behavior change on 'dired-do-chmod'. -As a security precaution, Dired's M command no longer follows symbolic -links. Instead, it changes the symbolic link's own mode; this always -fails on platforms where such modes are immutable. - ---- -*** Behavior change on 'dired-clean-confirm-killing-deleted-buffers'. -Previously, if 'dired-clean-up-buffers-too' was non-nil, and -'dired-clean-confirm-killing-deleted-buffers' was nil, the buffers -wouldn't be killed. This combination will now kill the buffers. - -+++ -*** New user option 'dired-switches-in-mode-line'. -This user option controls how 'ls' switches are displayed in the mode -line, and allows truncating them (to preserve space on the mode line) -or showing them literally, either instead of, or in addition to, -displaying "by name" or "by date" sort order. - -+++ -*** New user option 'dired-compress-directory-default-suffix'. -This user option controls default suffix for compressing a directory. -If it's nil, ".tar.gz" will be used. Refer to -'dired-compress-files-alist' for a list of supported suffixes. - -+++ -*** New user option 'dired-compress-file-default-suffix'. -This user option controls the default suffix for compressing files. -If it's nil, ".gz" will be used. Refer to 'dired-compress-file-alist' -for a list of supported suffixes. - ---- -*** Broken and circular links are shown with the 'dired-broken-symlink' face. - ---- -*** '=' ('dired-diff') will now put all backup files into the 'M-n' history. -When using '=' on a file with backup files, the default file to use -for diffing is the newest backup file. You can now use 'M-n' to quickly -select a different backup file instead. - -+++ -*** New user option 'dired-maybe-use-globstar'. -If set, enables globstar (recursive globbing) in shells that support -this feature, but turn it off by default. This allows producing -directory listings with files matching a wildcard in all the -subdirectories of a given directory. The new variable -'dired-enable-globstar-in-shell' lists which shells can have globstar -enabled, and how to enable it. - -+++ -*** New user option 'dired-copy-dereference'. -If set to non-nil, Dired will dereference symbolic links when copying. -This can be switched off on a per-usage basis by providing -'dired-do-copy' with a 'C-u' prefix. - ---- -*** New user option 'dired-do-revert-buffer'. -Non-nil reverts the destination Dired buffer after performing one -of these operations: 'dired-do-copy', 'dired-do-rename', -'dired-do-symlink', 'dired-do-hardlink'. - -*** New user option 'dired-mark-region'. -This option affects all Dired commands that mark files. When non-nil -and the region is active in Transient Mark mode, then Dired commands -operate only on files in the active region. The values 'file' and -'line' of this user option define the details of marking the file at -the end of the region. - -*** State changing VC operations are supported in Dired. -These operations are supported on files and directories via the new -command 'dired-vc-next-action'. - -+++ -*** 'dired-jump' and 'dired-jump-other-window' moved from 'dired-x' to 'dired'. -The 'dired-jump' and 'dired-jump-other-window' commands have been -moved from the 'dired-x' package to 'dired'. The user option -'dired-bind-jump' no longer has any effect and is now obsolete. -The commands are now bound to 'C-x C-j' and 'C-x 4 C-j' by default. - -To get the old behavior of 'dired-bind-jump' back and unbind the above -keys, add the following to your init file: - -(global-set-key "\C-x\C-j" nil) -(global-set-key "\C-x4\C-j" nil) - ---- -*** 'dired-query' now uses 'read-char-from-minibuffer'. -Using it instead of 'read-char-choice' allows using 'C-x o' -to switch to the help window displayed after typing 'C-h'. - -+++ -** New user option 'isearch-allow-motion'. -When 'isearch-allow-motion' is set, the commands 'beginning-of-buffer', -'end-of-buffer', 'scroll-up-command' and 'scroll-down-command', when -invoked during I-search, move respectively to the first occurrence of -the current search string in the buffer, the last one, the first one -after the current window, and the last one before the current window. -Additionally, users can change the meaning of other motion commands -during I-search by using their 'isearch-motion' property. The -option 'isearch-motion-changes-direction' controls whether the -direction of the search changes after a motion command. - -+++ -** Emacs 28.1 comes with Org v9.5. -See the file ORG-NEWS for user-visible changes in Org. - -** Outline - -+++ -*** New commands to cycle heading visibility. -Typing 'TAB' on a heading line cycles the current section between -"hide all", "subheadings", and "show all" states. Typing 'S-TAB' -anywhere in the buffer cycles the whole buffer between "only top-level -headings", "all headings and subheadings", and "show all" states. - -+++ -*** New user option 'outline-minor-mode-cycle'. -This user option customizes 'outline-minor-mode', with the difference -that 'TAB' and 'S-TAB' on heading lines cycle heading visibility. -Typing 'TAB' on a heading line cycles the current section between -"hide all", "subheadings", and "show all" states. Typing 'S-TAB' on a -heading line cycles the whole buffer between "only top-level -headings", "all headings and subheadings", and "show all" states. - ---- -*** New user option 'outline-minor-mode-highlight'. -This user option customizes 'outline-minor-mode'. It puts -highlighting on heading lines using standard outline faces. This -works well only when there are no conflicts with faces used by the -major mode. - -** Ispell - -+++ -*** 'ispell-comments-and-strings' now accepts START and END arguments. -These arguments default to active region when used interactively. - -+++ -*** New command 'ispell-comment-or-string-at-point'. - ---- -*** New user option 'ispell-help-timeout'. -This controls how long the ispell help (on the '?' key) is displayed. - -** Flyspell mode - -+++ -*** Corrections and actions menu can be optionally bound to 'mouse-3'. -When Flyspell mode highlights a word as misspelled, you can click on -it to display a menu of possible corrections and actions. You can now -easily bind this menu to 'down-mouse-3' (usually the right mouse button) -instead of 'mouse-2' (the default) by enabling 'context-menu-mode'. - ---- -*** The current dictionary is now displayed in the minor mode lighter. -Clicking the dictionary name changes the current dictionary. - -** Package - -*** The new NonGNU ELPA archive is enabled by default alongside GNU ELPA. -Thus, packages on NonGNU ELPA will appear by default in the list shown -by 'list-packages'. - ---- -*** '/ s' ('package-menu-filter-by-status') changed parameter handling. -The command was documented to take a comma-separated list of statuses -to filter by, but instead it used the parameter as a regexp. The -command has been changed so that it now works as documented, and -checks statuses not as a regexp, but instead an exact match from the -comma-separated list. - -+++ -*** New command 'package-browse-url' and keystroke 'w'. - -+++ -*** New commands to filter the package list. -The filter commands are bound to the following keys: - -key binding ---- ------- -/ a package-menu-filter-by-archive -/ d package-menu-filter-by-description -/ k package-menu-filter-by-keyword -/ N package-menu-filter-by-name-or-description -/ n package-menu-filter-by-name -/ s package-menu-filter-by-status -/ v package-menu-filter-by-version -/ m package-menu-filter-marked -/ u package-menu-filter-upgradable -/ / package-menu-filter-clear - -*** Option to automatically native-compile packages upon installation. -Customize the user option 'package-native-compile' to enable automatic -native compilation of packages when they are installed. That option -is nil by default; if set non-nil, and if your Emacs was built with -native-compilation support, each package will be natively compiled -when it is installed, by invoking an asynchronous Emacs subprocess to -run the native-compilation of the package files. (Be sure to leave -Emacs running until these asynchronous subprocesses exit, or else the -native-compilation will be aborted when you exit Emacs.) - ---- -*** Column widths in 'list-packages' display can now be customized. -See the new user options 'package-name-column-width', -'package-version-column-width', 'package-status-column-width', and -'package-archive-column-width'. - -** Info - ---- -*** New user option 'Info-warn-on-index-alternatives-wrap'. -This option affects what happens when using the ',' command after -looking up an entry with 'i' in info buffers. If non-nil (the -default), the ',' command will now display a warning when proceeding -beyond the final index match, and tapping ',' once more will then take -you to the first match. - -** Abbrev mode - -+++ -*** Emacs can now suggest to use an abbrev based on text you type. -A new user option, 'abbrev-suggest', enables the new abbrev suggestion -feature. When enabled, if a user manually types a piece of text that -could have saved enough typing by using an abbrev, a hint will be -displayed in the echo area, mentioning the abbrev that could have been -used instead. - -** Bookmarks - -*** Bookmarks can now be targets for new tabs. -When the bookmark.el library is loaded, a customize choice is added -to 'tab-bar-new-tab-choice' for new tabs to show the bookmark list. - ---- -*** The 'list-bookmarks' menu is now based on 'tabulated-list-mode'. -The interactive bookmark list will now benefit from features in -'tabulated-list-mode' like sorting columns or changing column width. - -Support for the optional "inline" header line, allowing for a header -without using 'header-line-format', has been dropped. Consequently, -the variables 'bookmark-bmenu-use-header-line' and -'bookmark-bmenu-inline-header-height' are now declared obsolete. - ---- -*** New user option 'bookmark-set-fringe-mark'. -If non-nil, setting a bookmark will set a fringe mark on the current -line, and jumping to a bookmark will also set this mark. - ---- -*** New user option 'bookmark-menu-confirm-deletion'. -In Bookmark Menu mode, Emacs by default does not prompt for -confirmation when you type 'x' to execute the deletion of bookmarks -that have been marked for deletion. However, if this new option is -non-nil then Emacs will require confirmation with 'yes-or-no-p' before -deleting. - -** Recentf - ---- -*** The recentf files are no longer backed up. - ---- -*** 'recentf-auto-cleanup' now repeats daily when set to a time string. -When 'recentf-auto-cleanup' is set to a time string, it now repeats -every day, rather than only running once after the mode is turned on. - -** Calc - ---- -*** The behavior when doing forward-delete has been changed. -Previously, using the 'C-d' command would delete the final number in -the input field, no matter where point was. This has been changed to -work more traditionally, with 'C-d' deleting the next character. -Likewise, point isn't moved to the end of the string before inserting -digits. - -+++ -*** Setting the word size to zero disables word clipping. -The word size normally clips the results of certain bit-oriented -operations such as shifts and bitwise XOR. A word size of zero, set -by 'b w', makes the operation have effect on the whole argument values -and the result is not truncated in any way. - ---- -*** The '/' operator now has higher precedence in (La)TeX input mode. -It no longer has lower precedence than '+' and '-'. - ---- -*** Calc now marks its windows dedicated. -The new user option 'calc-make-windows-dedicated' controls this. It -is t by default; set to nil to get back the old behavior. - -** Calendar - -+++ -*** New user option 'calendar-time-zone-style'. -If 'numeric', calendar functions (eg 'calendar-sunrise-sunset') that display -time zones will use a form like "+0100" instead of "CET". - -** Imenu - -+++ -*** New user option 'imenu-max-index-time'. -If creating the imenu index takes longer than specified by this -option (default 5 seconds), imenu indexing is stopped. - -** ido - ---- -*** Switching on 'ido-mode' now also overrides 'ffap-file-finder'. - ---- -*** Killing virtual ido buffers interactively will make them go away. -Previously, killing a virtual ido buffer with 'ido-kill-buffer' didn't -do anything. This has now been changed, and killing virtual buffers -with that command will remove the buffer from recentf. - -** So Long - ---- -*** New 'so-long-predicate' function 'so-long-statistics-excessive-p'. -It efficiently detects the presence of a long line anywhere in the -buffer using 'buffer-line-statistics' (see above). This is now the -default predicate (replacing 'so-long-detected-long-line-p'). - ---- -*** Default values 'so-long-threshold' and 'so-long-max-lines' increased. -The values of these user options have been raised to 10000 bytes and 500 -lines respectively, to reduce the likelihood of false-positives when -'global-so-long-mode' is enabled. The latter value is now only used -by the old predicate, as the new predicate knows the longest line in -the entire buffer. - ---- -*** 'so-long-target-modes' now includes 'fundamental-mode' by default. -This means that 'global-so-long-mode' will also process files which were -not recognised. (This only has an effect if 'set-auto-mode' chooses -'fundamental-mode'; buffers which are simply in 'fundamental-mode' by -default are unaffected.) - ---- -*** New user options to preserve modes and variables. -The new options 'so-long-mode-preserved-minor-modes' and -'so-long-mode-preserved-variables' allow specified mode and variable -states to be maintained if 'so-long-mode' replaces the original major -mode. By default, these new options support 'view-mode'. - -** Grep - -+++ -*** New user option 'grep-match-regexp' matches grep markers to highlight. -Grep emits SGR ANSI escape sequences to color its output. The new -user option 'grep-match-regexp' holds the regular expression to match -the appropriate markers in order to provide highlighting in the source -buffer. The user option can be customized to accommodate other -grep-like tools. - ---- -*** The 'lgrep' command now ignores directories. -On systems where the grep command supports it, directories will be -skipped. - -*** Commands that use 'grep-find' now follow symlinks for command-line args. -This is because the default value of 'grep-find-template' now includes -the 'find' option '-H'. Commands that use that variable, including -indirectly via a call to 'xref-matches-in-directory', might be -affected. In particular, there should be no need anymore to ensure -any directory names on the 'find' command lines end in a slash. -This change is for better compatibility with old versions of non-GNU -'find', such as the one used on macOS. - ---- -*** New utility function 'grep-file-at-point'. -This returns the name of the file at point (if any) in 'grep-mode' -buffers. - -** Shell - ---- -*** New command in 'shell-mode': 'narrow-to-prompt'. -This is bound to 'C-x n d' in 'shell-mode' buffers, and narrows to the -command line under point (and any following output). - ---- -*** New user option 'shell-has-auto-cd'. -If non-nil, 'shell-mode' handles implicit "cd" commands, changing the -directory if the command is a directory. Useful for shells like "zsh" -that has this feature. - -** term-mode - ---- -*** New user option 'term-scroll-snap-to-bottom'. -By default, 'term' and 'ansi-term' will now recenter the buffer so -that the prompt is on the final line in the window. Setting this new -user option to nil inhibits this behavior. - ---- -*** New user option 'term-set-terminal-size' -If non-nil, the 'LINES' and 'COLUMNS' environment variables will be set -based on the current window size. In previous versions of Emacs, this -was always done (and that could lead to odd displays when resizing the -window after starting). This variable defaults to nil. - ---- -*** 'term-mode' now supports "bright" color codes. -"Bright" ANSI color codes are now displayed using the color values -defined in 'term-color-bright-*'. In addition, bold text with regular -ANSI colors can be displayed as "bright" if 'ansi-color-bold-is-bright' -is non-nil. - -** Eshell - ---- -*** 'eshell-hist-ignoredups' can now also be used to mimic "erasedups" in bash. - ---- -*** Environment variable 'INSIDE_EMACS' is now copied to subprocesses. -Its value contains the result of evaluating '(format "%s,eshell" -emacs-version)'. Other package names, like "tramp", could also be included. - ---- -*** Eshell no longer re-initializes its keymap every call. -This allows users to use (define-key eshell-mode-map ...) as usual. -Some modules have their own minor mode now to account for these -changes. - -*** Support for bookmark.el. -The command `bookmark-set' (bound to `C-x r m') is now supported, and -will create a bookmark that opens the current directory in Eshell. - -** Archive mode - ---- -*** Archive Mode can now parse ".squashfs" files. - -*** Can now modify members of 'ar' archives. - -*** Display of summaries is unified between backends. - -*** New user option and command to control displayed columns. -New user option 'archive-hidden-columns' and new command -'archive-hideshow-column' let you control which columns are displayed -and which are kept hidden. - ---- -*** New command bound to 'C': 'archive-copy-file'. -This command extracts the file at point and writes its data to a -file. - -** browse-url - -*** Added support for custom URL handlers. -There is a new variable 'browse-url-default-handlers' and a user -option 'browse-url-handlers' being alists with '(REGEXP-OR-PREDICATE -. FUNCTION)' entries allowing to define different browsing FUNCTIONs -depending on the URL to be browsed. The variable is for default -handlers provided by Emacs itself or external packages, the user -option is for the user (and allows for overriding the default -handlers). - -Formerly, one could do the same by setting -'browse-url-browser-function' to such an alist. This usage is still -supported but deprecated. - -*** Categorization of browsing commands into internal vs. external. -All standard browsing commands such as 'browse-url-firefox', -'browse-url-mail', or 'eww' have been categorized into internal (URL -is browsed in Emacs) or external (an external application is spawned -with the URL). This is done by adding a 'browse-url-browser-kind' -symbol property to the browsing commands. With a new command -'browse-url-with-browser-kind', an URL can explicitly be browsed with -either an internal or external browser. - ---- -*** Support for browsing of remote files. -If a remote file is specified, a local temporary copy of that file is -passed to the browser. - ---- -*** Support for the conkeror browser is now obsolete. - ---- -*** Support for the Mosaic browser has been removed. -This support has been obsolete since 25.1. - -** Completion List Mode - -*** Improved navigation in the "*Completions*" buffer. -New key bindings have been added to 'completion-list-mode': 'n' and -'p' now navigate completions, and 'M-g M-c' switches to the -minibuffer and back to the completion list buffer. - -+++ -** profiler.el -The results displayed by 'profiler-report' now have the usage figures -at the left hand side followed by the function name. This is intended -to make better use of the horizontal space, in particular eliminating -the truncation of function names. There is no way to get the former -layout back. - -** Icomplete - ---- -*** New user option 'icomplete-matches-format'. -This allows controlling the current/total number of matches for the -prompt prefix. - -+++ -*** New minor modes 'icomplete-vertical-mode' and 'fido-vertical-mode'. -These modes modify Icomplete ('M-x icomplete-mode') and Fido ('M-x -fido-mode'), to display completion candidates vertically instead of -horizontally. In Icomplete, completions are rotated and selection -kept at the top. In Fido, completions scroll like a typical dropdown -widget. Both these new minor modes will turn on their non-vertical -counterparts first, if they are not on already. - ---- -*** Default value of 'icomplete-compute-delay' has been changed to 0.15 s. - ---- -*** Default value of 'icomplete-max-delay-chars' has been changed to 2. - ---- -*** Reduced blinking while completing the next completions set. -Icomplete doesn't hide the hint with the previously computed -completions anymore when compute delay is in effect, or the previous -computation has been aborted by input. Instead it shows the previous -completions until the new ones are ready. - ---- -*** Change in meaning of 'icomplete-show-matches-on-no-input'. -Previously, choosing a different completion with commands like 'C-.' -and then hitting 'RET' would choose the default completion. Doing this -will now choose the completion under point instead. Also when this option -is nil, completions are not shown when the minibuffer reads a file name -with initial input as the default directory. - -** Windmove - -+++ -*** New user options to customize windmove keybindings. -These options include 'windmove-default-keybindings', -'windmove-display-default-keybindings', -'windmove-delete-default-keybindings', -'windmove-swap-states-default-keybindings'. - -** Occur mode - -*** New bindings in occur-mode. -The command 'next-error-no-select' is now bound to 'n' and -'previous-error-no-select' is bound to 'p'. - -*** The new command 'recenter-current-error'. -It is bound to 'l' in Occur or compilation buffers, and recenters the -current displayed occurrence/error. - -*** Matches in target buffers are now highlighted as in 'compilation-mode'. -The method of highlighting is specified by the user options -'next-error-highlight' and 'next-error-highlight-no-select'. - ---- -*** A fringe arrow in the "*Occur*" buffer indicates the selected match. - ---- -*** Occur mode may use a different type for 'occur-target' property values. -The value was previously always a marker set to the start of the first -match on the line but can now also be a list of '(BEGIN . END)' pairs -of markers delimiting each match on the line. -This is a fully compatible change to the internal occur-mode -implementation, and code creating their own occur-mode buffers will -work as before. - -** Emacs Lisp mode - ---- -*** The mode-line now indicates whether we're using lexical or dynamic scoping. - -+++ -*** A space between an open paren and a symbol changes the indentation rule. -The presence of a space between an open paren and a symbol now is -taken as a statement by the programmer that this should be indented -as a data list rather than as a piece of code. - -** Lisp Mode - -*** New minor mode 'cl-font-lock-built-in-mode' for 'lisp-mode'. -The mode provides refined highlighting of built-in functions, types, -and variables. - ---- -*** Lisp mode now uses 'common-lisp-indent-function'. -To revert to the previous behavior, -'(setq lisp-indent-function 'lisp-indent-function)' from 'lisp-mode-hook'. - -** Change Logs and VC - -+++ -*** 'vc-revert-show-diff' now has a third possible value: 'kill'. -If this user option is 'kill', then the diff buffer will be killed -after the 'vc-revert' action instead of buried. - -*** More VC commands can be used from non-file buffers. -The relevant commands are those that don't change the VC state. -The non-file buffers which can use VC commands are those that have -their 'default-directory' under VC. - -*** New command 'vc-dir-root' uses the root directory without asking. - ---- -*** New face 'log-view-commit-body'. -This is used when expanding commit messages from 'vc-print-root-log' -and similar commands. - ---- -*** New faces for 'vc-dir' buffers. -Those are: 'vc-dir-header', 'vc-dir-header-value', 'vc-dir-directory', -'vc-dir-file', 'vc-dir-mark-indicator', 'vc-dir-status-warning', -'vc-dir-status-edited', 'vc-dir-status-up-to-date', -'vc-dir-status-ignored'. - ---- -*** The responsible VC backend is now the most specific one. -'vc-responsible-backend' loops over the backends in -'vc-handled-backends' to determine which backend is responsible for a -specific (unregistered) file. Previously, the first matching backend -was chosen, but now the one with the most specific path is chosen (in -case there's a directory handled by one backend inside another). - -*** New commands 'vc-dir-mark-registered-files' (bound to '* r') and -'vc-dir-mark-unregistered-files'. - -*** Support for bookmark.el. -Bookmark locations can refer to VC directory buffers. - ---- -*** New user option 'vc-hg-create-bookmark'. -It controls whether a bookmark or branch will be created when you -invoke 'C-u C-x v s' ('vc-create-tag'). - ---- -*** 'vc-hg' now uses 'hg summary' to populate extra 'vc-dir' headers. - ---- -*** New user option 'vc-git-revision-complete-only-branches'. -If non-nil, only branches and remotes are considered when doing -completion over Git branch names. The default is nil, which causes -tags to be considered as well. - ---- -*** New user option 'vc-git-log-switches'. -String or list of strings specifying switches for Git log under VC. - -** Gnus - -+++ -*** New user option 'gnus-topic-display-predicate'. -This can be used to inhibit the display of some topics completely. - -+++ -*** nnimap now supports the oauth2.el library. - -+++ -*** New Summary buffer sort options for extra headers. -The extra header sort option ('C-c C-s C-x') prompts for a header -and fails if no sort function has been defined. Sorting by -Newsgroups ('C-c C-s C-u') has been pre-defined. - -+++ -*** The '#' command in the Group and Summary buffer now toggles, -instead of sets, the process mark. - -+++ -*** New user option 'gnus-process-mark-toggle'. -If non-nil (the default), the '#' command in the Group and Summary -buffers will toggle, instead of set, the process mark. - - -+++ -*** New user option 'gnus-registry-register-all'. -If non-nil (the default), create registry entries for all messages. -If nil, don't automatically create entries, they must be created -manually. - -+++ -*** New user options to customise the summary line specs "%[" and "%]". -Four new options introduced in customisation group -'gnus-summary-format'. These are 'gnus-sum-opening-bracket', -'gnus-sum-closing-bracket', 'gnus-sum-opening-bracket-adopted', and -'gnus-sum-closing-bracket-adopted'. Their default values are "[", "]", -"<", ">" respectively. These options control the appearance of "%[" -and "%]" specs in the summary line format. "%[" will normally display -the value of 'gnus-sum-opening-bracket', but can also be -'gnus-sum-opening-bracket-adopted' for the adopted articles. "%]" will -normally display the value of 'gnus-sum-closing-bracket', but can also -be 'gnus-sum-closing-bracket-adopted' for the adopted articles. - -+++ -*** New user option 'gnus-paging-select-next'. -This controls what happens when using commands like 'SPC' and 'DEL' to -page the current article. If non-nil (the default), go to the -next/prev article, but if nil, do nothing at the end/start of the article. - -+++ -*** New gnus-search library. -A new unified search syntax which can be used across multiple -supported search engines. Set 'gnus-search-use-parsed-queries' to -non-nil to enable. - -+++ -*** New value for user option 'smiley-style'. -Smileys can now be rendered with emojis instead of small images when -using the new 'emoji' value in 'smiley-style'. - -+++ -*** New user option 'gnus-agent-eagerly-store-articles'. -If non-nil (which is the default), the Gnus Agent will store all read -articles in the Agent cache. - -+++ -*** New user option 'gnus-global-groups'. -Gnus handles private groups differently from public (i.e., NNTP-like) -groups. Most importantly, Gnus doesn't download external images from -mail-like groups. This can be overridden by putting group names in -'gnus-global-groups': Any group present in that list will be treated -like a public group. - -+++ -*** New scoring types for the Date header. -You can now score based on the relative age of an article with the new -'<' and '>' date scoring types. - -+++ -*** User-defined scoring is now possible. -The new type is 'score-fn'. More information in the Gnus manual node -"(gnus) Score File Format". - -+++ -*** New backend 'nnselect'. -The newly added 'nnselect' backend allows creating groups from an -arbitrary list of articles that may come from multiple groups and -servers. These groups generally behave like any other group: they may -be ephemeral or persistent, and allow article marking, moving, -deletion, etc. 'nnselect' groups may be created like any other group, -but there are three convenience functions for the common case of -obtaining the list of articles as a result of a search: -'gnus-group-make-search-group' ('G g') that will prompt for an 'nnir' -search query and create a persistent group for that search; -'gnus-group-read-ephemeral-search-group' ('G G') that will prompt for -an 'nnir' search query and create an ephemeral group for that search; -and 'gnus-summary-make-group-from-search' ('C-c C-p') that will create -a persistent group with the search parameters of a current ephemeral -search group. - -As part of this addition, the user option 'nnir-summary-line-format' -has been removed; its functionality is now available directly in the -'gnus-summary-line-format' specs '%G' and '%g'. The user option -'gnus-refer-thread-use-nnir' has been renamed to -'gnus-refer-thread-use-search'. - -+++ -*** New user option 'gnus-dbus-close-on-sleep'. -On systems with D-Bus support, it is now possible to register a signal -to close all Gnus servers before the system sleeps. - -+++ -*** The key binding of 'gnus-summary-search-article-forward' has changed. -This command was previously on 'M-s' and shadowed the global 'M-s' -search prefix. The command has now been moved to 'M-s M-s'. (For -consistency, the 'M-s M-r' key binding has been added for the -'gnus-summary-search-article-backward' command.) - ---- -*** The value of "all" in the 'large-newsgroup-initial' group parameter changes. -It was previously nil, which didn't work, because nil is -indistinguishable from not being present. The new value for "all" is -the symbol 'all'. - -+++ -*** The name of dependent Gnus sessions has changed from "slave" to "child". -The names of the commands 'gnus-slave', 'gnus-slave-no-server' and -'gnus-slave-unplugged' have changed to 'gnus-child', -'gnus-child-no-server' and 'gnus-child-unplugged' respectively. - -+++ -*** The 'W Q' summary mode command now takes a numerical prefix to -allow adjusting the fill width. - -+++ -*** New variable 'mm-inline-font-lock'. -This variable is supposed to be bound by callers to determine whether -inline MIME parts (that support it) are supposed to be font-locked or -not. - -** Message - ---- -*** Respect 'message-forward-ignored-headers' more. -Previously, this user option would not be consulted if -'message-forward-show-mml' was nil and forwarding as MIME. - -+++ -*** New user option 'message-forward-included-mime-headers'. -This is used when forwarding messages as MIME, but not using MML. - -+++ -*** Message now supports the OpenPGP header. -To generate these headers, add the new function -'message-add-openpgp-header' to 'message-send-hook'. The header will -be generated according to the new 'message-openpgp-header' user -option. - ---- -*** A change to how "Mail-Copies-To: never" is handled. -If a user has specified "Mail-Copies-To: never", and Message was asked -to do a "wide reply", some other arbitrary recipient would end up in -the resulting "To" header, while the remaining recipients would be put -in the "Cc" header. This is somewhat misleading, as it looks like -you're responding to a specific person in particular. This has been -changed so that all the recipients are put in the "To" header in these -instances. - -+++ -*** New command to start Emacs in Message mode to send an email. -Emacs can be defined as a handler for the "x-scheme-handler/mailto" -MIME type with the following command: "emacs -f message-mailto %u". -An "emacs-mail.desktop" file has been included, suitable for -installing in desktop directories like "/usr/share/applications" or -"~/.local/share/applications". -Clicking on a 'mailto:' link in other applications will then open -Emacs with headers filled out according to the link, e.g. -"mailto:larsi@gnus.org?subject=This+is+a+test". If you prefer -emacsclient, use "emacsclient -e '(message-mailto "%u")'" -or "emacsclient-mail.desktop". - ---- -*** Change to default value of 'message-draft-headers' user option. -The 'Date' symbol has been removed from the default value, meaning that -draft or delayed messages will get a date reflecting when the message -was sent. To restore the original behavior of dating a message -from when it is first saved or delayed, add the symbol 'Date' back to -this user option. - -+++ -*** New command to take screenshots. -In Message mode buffers, the 'C-c C-p' ('message-insert-screenshot') -command has been added. It depends on using an external program to -take the actual screenshot, and defaults to "ImageMagick import". - -** Smtpmail - -+++ -*** smtpmail now supports using the oauth2.el library. - -+++ -*** New user option 'smtpmail-store-queue-variables'. -If non-nil, SMTP variables will be stored together with the queued -messages, and will then be used when sending with -'M-x smtpmail-send-queued-mail'. - -+++ -*** Allow direct selection of smtp authentication mechanism. -A server entry retrieved by auth-source can request a desired smtp -authentication mechanism by setting a value for the key 'smtp-auth'. - -** ElDoc - -+++ -*** New user option 'eldoc-echo-area-display-truncation-message'. -If non-nil (the default), eldoc will display a message saying -something like "(Documentation truncated. Use `M-x eldoc-doc-buffer' -to see rest)" when a message has been truncated. If nil, truncated -messages will be marked with just "..." at the end. - -+++ -*** New hook 'eldoc-documentation-functions'. -This hook is intended to be used for registering doc string functions. -These functions don't need to produce the doc string right away, they -may arrange for it to be produced asynchronously. The results of all -doc string functions are accessible to the user through the user -option 'eldoc-documentation-strategy'. - -*** New hook 'eldoc-display-functions'. -This hook is intended to be used for displaying doc strings. The -functions receive the doc string composed according to -'eldoc-documentation-strategy' and are tasked with displaying it to -the user. Examples of such functions would use the echo area, a -separate buffer, or a tooltip. - -+++ -*** New user option 'eldoc-documentation-strategy'. -The built-in choices available for this user option let users compose -the results of 'eldoc-documentation-functions' in various ways, even -if some of those functions are synchronous and some asynchronous. -The user option replaces 'eldoc-documentation-function', which is now -obsolete. - -*** 'eldoc-echo-area-use-multiline-p' is now handled by ElDoc. -The user option 'eldoc-echo-area-use-multiline-p' is now handled -by the ElDoc library itself. Functions in -'eldoc-documentation-functions' don't need to worry about consulting -it when producing a doc string. - -** Tramp - -+++ -*** New connection method "mtp". -It allows accessing media devices like cell phones, tablets or -cameras. - -+++ -*** New connection method "sshfs". -It allows accessing remote files via a file system mounted with -'sshfs'. - -+++ -*** Tramp supports SSH authentication via a hardware security key now. -This requires at least OpenSSH 8.2, and a FIDO U2F compatible -security key, like yubikey, solokey, or nitrokey. - -+++ -*** Trashed remote files are moved to the local trash directory. -All remote files that are trashed are moved to the local trash -directory, except remote encrypted files, which are always deleted. - -+++ -*** New command 'tramp-crypt-add-directory'. -This command marks a remote directory to contain only encrypted files. -See the "(tramp) Keeping files encrypted" node of the Tramp manual for -details. This feature is experimental. - -+++ -*** Support of direct asynchronous process invocation. -When Tramp connection property "direct-async-process" is set to -non-nil for a given connection, 'make-process' and 'start-file-process' -calls are performed directly as in "ssh ... ". This avoids -initialization performance penalties. See the "(tramp) Improving -performance of asynchronous remote processes" node of the Tramp manual -for details, and also for a discussion or restrictions. This feature -is experimental. - -+++ -*** New user option 'tramp-debug-to-file'. -When non-nil, this user option instructs Tramp to mirror the debug -buffer to a file under the "/tmp/" directory. This is useful, if (in -rare cases) Tramp blocks Emacs, and we need further debug information. - -+++ -*** Tramp supports lock files now. -In order to deactivate this, set user option -'remote-file-name-inhibit-locks' to t. - -+++ -*** Writing sensitive data locally requires confirmation. -Writing auto-save, backup or lock files to the local temporary -directory must be confirmed. In order to suppress this confirmation, -set user option 'tramp-allow-unsafe-temporary-files' to t. - -+++ -*** 'make-directory' of a remote directory honors the default file modes. - -** gdb-mi - -*** New user option 'gdb-registers-enable-filter'. -If non-nil, apply a register filter based on -'gdb-registers-filter-pattern-list'. - -+++ -*** gdb-mi can now save and restore window configurations. -Use 'gdb-save-window-configuration' to save window configuration to a -file and 'gdb-load-window-configuration' to load from a file. These -commands can also be accessed through the menu bar under "Gud => -GDB-Windows". 'gdb-default-window-configuration-file', when non-nil, -is loaded when GDB starts up. - -+++ -*** gdb-mi can now restore window configuration after quitting. -Set 'gdb-restore-window-configuration-after-quit' to non-nil and Emacs -will remember the window configuration before GDB started and restore -it after GDB quits. A toggle button is also provided under "Gud => -GDB-Windows" menu item. - -+++ -*** gdb-mi now has a better logic for displaying source buffers. -Now GDB only uses one source window to display source file by default. -Customize 'gdb-max-source-window-count' to use more than one window. -Control source file display by 'gdb-display-source-buffer-action'. - -+++ -*** The default value of 'gdb-mi-decode-strings' is now t. -This means that the default coding-system is now used to decode strings -and source file names from GDB. - -** Compilation mode - ---- -*** New function 'ansi-color-compilation-filter'. -This function is meant to be used in 'compilation-filter-hook'. - ---- -*** New user option 'ansi-color-for-compilation-mode'. -This controls what 'ansi-color-compilation-filter' does. - -*** Regexp matching of messages is now case-sensitive by default. -The variable 'compilation-error-case-fold-search' can be set for -case-insensitive matching of messages when the old behavior is -required, but the recommended solution is to use a correctly matching -regexp instead. - ---- -*** New user option 'compilation-search-all-directories'. -When doing parallel builds, directories and compilation errors may -arrive in the "*compilation*" buffer out-of-order. If this option is -non-nil (the default), Emacs will now search backwards in the buffer -for any directory the file with errors may be in. If nil, this won't -be done (and this restores how this previously worked). - ---- -*** Messages from ShellCheck are now recognized. - ---- -*** Messages from Visual Studio that mention column numbers are now recognized. - -** Hi Lock mode - ---- -*** Matching in 'hi-lock-mode' can be case-sensitive. -The matching is case-sensitive when a regexp contains upper case -characters and 'search-upper-case' is non-nil. 'highlight-phrase' -also uses 'search-whitespace-regexp' to substitute spaces in regexp -search. - ---- -*** The default value of 'hi-lock-highlight-range' was enlarged. -The new default value is 2000000 (2 megabytes). - -** Whitespace mode - -+++ -*** New style 'missing-newline-at-eof'. -If present in 'whitespace-style' (as it is by default), the final -character in the buffer will be highlighted if the buffer doesn't end -with a newline. - ---- -*** The default 'whitespace-enable-predicate' predicate has changed. -It used to check elements in the list version of -'whitespace-global-modes' with 'eq', but now uses 'derived-mode-p'. - -** Texinfo - ---- -*** New user option 'texinfo-texi2dvi-options'. -This is used when invoking 'texi2dvi' from 'texinfo-tex-buffer'. - ---- -*** New commands for moving in and between environments. -An "environment" is something that ends with '@end'. The commands are -'C-c C-c C-f' (next end), 'C-c C-c C-b' (previous end), -'C-c C-c C-n' (next start) and 'C-c C-c C-p' (previous start), as well -as 'C-c .', which will alternate between the start and the end of the -current environment. - -** Rmail - ---- -*** New user option 'rmail-re-abbrevs'. -Its default value matches localized abbreviations of the "reply" -prefix on the Subject line in various languages. - ---- -*** New user option 'shr-offer-extend-specpdl'. -If this is nil, rendering of HTML in the email message body that -requires to enlarge 'max-specpdl-size', the number of Lisp variable -bindings, will be aborted, and Emacs will not ask you whether to -enlarge 'max-specpdl-size' to complete the rendering. The default is -t, which preserves the original behavior. - ---- -*** New user option 'rmail-show-message-set-modified'. -If set non-nil, showing an unseen message will set the Rmail buffer's -modified flag. The default is nil, to preserve the old behavior. - -** CC Mode - -+++ -*** Added support for Doxygen documentation style. -'doxygen' is now a valid 'c-doc-comment-style' which recognises all -comment styles supported by Doxygen (namely '///', '//!', '/** … */' -and '/*! … */'. 'gtkdoc' remains the default for C and C++ modes; to -use 'doxygen' by default one might evaluate: - - (setq-default c-doc-comment-style - '((java-mode . javadoc) - (pike-mode . autodoc) - (c-mode . doxygen) - (c++-mode . doxygen))) - -or use it in a custom 'c-style'. - -+++ -*** Added support to line up '?' and ':' of a ternary operator. -The new 'c-lineup-ternary-bodies' function can be used as a lineup -function to align question mark and colon which are part of a ternary -operator ('?:'). For example: - - return arg % 2 == 0 ? arg / 2 - : (3 * arg + 1); - -To enable, add it to appropriate entries in 'c-offsets-alist', e.g.: - - (c-set-offset 'arglist-cont '(c-lineup-ternary-bodies - c-lineup-gcc-asm-reg)) - (c-set-offset 'arglist-cont-nonempty '(c-lineup-ternary-bodies - c-lineup-gcc-asm-reg - c-lineup-arglist)) - (c-set-offset 'statement-cont '(c-lineup-ternary-bodies +)) - -** Images - ---- -*** You can explicitly specify base_uri for svg images. -':base-uri' image property can be used to explicitly specify base_uri -for embedded images into svg. ':base-uri' is supported for both file -and data svg images. - -+++ -*** 'svg-embed-base-uri-image' added to embed images. -'svg-embed-base-uri-image' can be used to embed images located -relatively to 'file-name-directory' of the ':base-uri' svg image property. -This works much faster then 'svg-embed'. - -+++ -*** New function 'image-cache-size'. -This function returns the size of the current image cache, in bytes. - ---- -*** Animated images stop automatically under high CPU pressure sooner. -Previously, an animated image would stop animating if any single image -took more than two seconds to display. The new algorithm maintains a -decaying average of delays, and if this number gets too high, the -animation is stopped. - -+++ -*** The 'n' and 'p' commands (next/previous image) now respect Dired order. -These commands would previously display the next/previous image in -lexicographic order, but will now find the "parent" Dired buffer and -select the next/previous image file according to how the files are -sorted there. The commands have also been extended to work when the -"parent" buffer is an archive mode (i.e., zip file or the like) or tar -mode buffer. - ---- -*** 'image-converter' is now restricted to formats in 'auto-mode-alist'. -When using external image converters, the external program is queried -for what formats it supports. This list may contain formats that are -problematic in some contexts (like PDFs), so this list is now filtered -based on 'auto-mode-alist'. Only file names that map to 'image-mode' -are now supported. - ---- -*** The background and foreground of images now default to face colors. -When an image doesn't specify a foreground or background color, Emacs -now uses colors from the face used to draw the surrounding text -instead of the frame's default colors. - -To load images with the default frame colors use the ':foreground' and -':background' image attributes, for example: - - (create-image "filename" nil nil - :foreground (face-attribute 'default :foreground) - :background (face-attribute 'default :background)) - -This change only affects image types that support foreground and -background colors or transparency, such as xbm, pbm, svg, png and gif. - -+++ -*** Image smoothing can now be explicitly enabled or disabled. -Smoothing applies a bilinear filter while scaling or rotating an image -to prevent aliasing and other unwanted effects. The new image -property ':transform-smoothing' can be set to t to force smoothing -and nil to disable smoothing. - -The default behavior of smoothing on down-scaling and not smoothing -on up-scaling remains unchanged. - -+++ -*** New user option 'image-transform-smoothing'. -This controls whether to use smoothing or not for an image. Values -include nil (no smoothing), t (do smoothing) or a predicate function -that's called with the image object and should return nil/t. - -+++ -*** SVG images now support user stylesheets. -The ':css' image attribute can be used to override the default CSS -stylesheet for an image. The default sets 'font-family' and -'font-size' to match the current face, so an image with 'height="1em"' -will match the font size in use where it is embedded. - -This feature relies on librsvg 2.48 or above being available. - -+++ -*** Image properties support 'em' sizes. -Size image properties, for example ':height', ':max-height', etc., can -be given a cons of the form '(SIZE . em)', where SIZE is an integer or -float which is multiplied by the font size to calculate the image -size, and 'em' is a symbol. - -** EWW - -+++ -*** New user option 'eww-use-browse-url'. -This is a regexp that can be set to alter how links are followed in eww. - -+++ -*** New user option 'eww-retrieve-command'. -This can be used to download data via an external command. If nil -(the default), then 'url-retrieve' is used. When 'sync', then -'url-retrieve-synchronously' is used. - -+++ -*** New Emacs command line convenience command. -The 'eww-browse' command has been added, which allows you to register -Emacs as a MIME handler for "text/x-uri", and will call 'eww' on the -supplied URL. Usage example: "emacs -f eww-browse https://gnu.org". - -+++ -*** 'eww-download-directory' will now use the XDG location, if defined. -However, if "~/Downloads/" already exists, that will continue to be -used. - ---- -*** The command 'eww-follow-link' now supports custom mailto handlers. -The function that is invoked when clicking on or otherwise following a -'mailto:' link in an EWW buffer can now be customized. For more -information, see the related entry about 'shr-browse-url' above. - ---- -*** Support for bookmark.el. -The command `bookmark-set' (bound to `C-x r m') is now supported, and -will create a bookmark that opens the current URL in EWW. - -** SHR - ---- -*** The command 'shr-browse-url' now supports custom mailto handlers. -Clicking on or otherwise following a 'mailto:' link in a HTML buffer -rendered by SHR previously invoked the command 'browse-url-mailto'. -This is still the case by default, but if you customize -'browse-url-mailto-function' or 'browse-url-handlers' to call some -other function, it will now be called instead of the default. - -+++ -*** New user option 'shr-max-width'. -If this user option is non-nil, and 'shr-width' is nil, then SHR will -use the value of 'shr-max-width' to limit the width of the rendered -HTML. The default is 120 characters, so even if you have very wide -frames, HTML text will be rendered more narrowly, which usually leads -to a more readable text. Customize it to nil to get the previous -behavior of rendering as wide as the 'window-width' allows. If -'shr-width' is non-nil, it overrides this option. - ---- -*** New faces for heading elements. -Those are 'shr-h1', 'shr-h2', 'shr-h3', 'shr-h4', 'shr-h5', 'shr-h6'. - -** Project - -*** New user option 'project-vc-merge-submodules'. - -*** Project commands now have their own history. -Previously used project directories are now suggested by all commands -that prompt for a project directory. - -+++ -*** New prefix keymap 'project-prefix-map'. -Key sequences that invoke project-related commands start with the -prefix 'C-x p'. Type "C-x p C-h" to show the full list. - -+++ -*** New commands 'project-dired', 'project-vc-dir', 'project-shell', -'project-eshell'. These commands run Dired/VC-Dir and Shell/Eshell in -a project's root directory, respectively. - -+++ -*** New command 'project-compile'. -This command runs compilation in the current project's root -directory. - -+++ -*** New command 'project-switch-project'. -This command lets you "switch" to another project and run a project -command chosen from a dispatch menu. - -+++ -*** New commands 'project-shell-command' and 'project-async-shell-command'. -These commands run 'shell-command' and 'async-shell-command' in a -project's root directory, respectively. - -+++ -*** New user option 'project-list-file'. -This specifies the file in which to save the list of known projects. - -+++ -*** New command 'project-remember-projects-under'. -This command can automatically locate and index projects in a -directory and optionally also its subdirectories, storing them in -'project-list-file'. - -+++ -*** New commands 'project-forget-project' and 'project-forget-projects-under'. -These command lets you interactively remove entries from the list of projects -in 'project-list-file'. - -+++ -*** New command 'project-forget-zombie-projects'. -This command detects indexed projects that have since been deleted, -and removes them from the list of known projects in 'project-list-file'. - ---- -*** 'project-find-file' now accepts non-existent file names. -This is to allow easy creation of files inside some nested -sub-directory. - -+++ -*** 'project-find-file' doesn't use the string at point as default input. -Now it's only suggested as part of the "future history". - -+++ -*** New command 'project-find-dir' runs Dired in a directory inside project. - -** Xref - ---- -*** Prefix arg of 'xref-goto-xref' quits the "*xref*" buffer. -So typing 'C-u RET' in the "*xref*" buffer quits its window -before navigating to the selected location. - -+++ -*** New user options to automatically show the first Xref match. -The new user option 'xref-auto-jump-to-first-definition' controls the -behavior of 'xref-find-definitions' and its variants, like -'xref-find-definitions-other-window': if it's t or 'show', the first -match is automatically displayed; if it's 'move', point in the -"*xref*" buffer is automatically moved to the first match without -displaying it. -The new user option 'xref-auto-jump-to-first-xref' changes the -behavior of Xref commands such as 'xref-find-references', -'xref-find-apropos', and 'project-find-regexp', which are expected to -display many matches that the user would like to -visit. 'xref-auto-jump-to-first-xref' changes their behavior much in -the same way as 'xref-auto-jump-to-first-definition' affects the -"find-definitions" commands. - ---- -*** New user options 'xref-search-program' and 'xref-search-program-alist'. -So far 'grep' and 'ripgrep' are supported. 'ripgrep' seems to offer better -performance in certain cases, in particular for case-insensitive -searches. - -+++ -*** New commands 'xref-prev-group' and 'xref-next-group'. -These commands are bound respectively to 'P' and 'N', and navigate to -the first item of the previous or next group in the "*xref*" buffer. - ---- -*** New alternative value for 'xref-show-definitions-function': -'xref-show-definitions-completing-read'. - ---- -*** The two existing alternatives for 'xref-show-definitions-function' -have been renamed to have "proper" public names and documented -('xref-show-definitions-buffer' and -'xref-show-definitions-buffer-at-bottom'). - -+++ -*** New command 'xref-quit-and-pop-marker-stack'. -This command is bound to 'M-,' in "*xref*" buffers. This combination -is easy to press semi-accidentally if the user wants to go back in the -middle of choosing the exact definition to go to, and this should do -TRT. - ---- -*** New value 'project-relative' for 'xref-file-name-display'. -If chosen, file names in "*xref*" buffers will be displayed relative -to the 'project-root' of the current project, when available. - -+++ -*** The 'TAB' key binding in "*xref*" buffers is obsolete. -Use 'C-u RET' instead. The 'TAB' binding in "*xref*" buffers is still -supported, but we plan on removing it in a future version; at that -time, the command 'xref-quit-and-goto-xref' will no longer have a key -binding in 'xref--xref-buffer-mode-map'. - ---- -*** New user option 'etags-xref-prefer-current-file'. -When non-nil, matches for identifiers in the file visited by the -current buffer will be shown first in the "*xref*" buffer. - -+++ -*** The etags Xref backend now honors 'tags-apropos-additional-actions'. -You can customize it to augment the output of 'xref-find-apropos', -like it affected the output of 'tags-apropos', which is obsolete since -Emacs 25.1. - -** Battery - ---- -*** UPower is now the default battery status backend when available. -UPower support via the function 'battery-upower' was added in Emacs -26.1, but was disabled by default. It is now the default value of -'battery-status-function' when the system provides a UPower D-Bus -service. The user options 'battery-upower-device' and -'battery-upower-subscribe' control which power sources to query and -whether to respond to status change notifications in addition to -polling, respectively. - ---- -*** A richer syntax can be used to format battery status information. -The user options 'battery-mode-line-format' and -'battery-echo-area-format' now support the full formatting syntax of -the function 'format-spec' documented under node "(elisp) Custom Format -Strings". The new syntax includes specifiers for padding and -truncation, amongst other things. - -** bug-reference.el - ---- -*** Bug reference mode uses auto-setup. -If 'bug-reference-mode' or 'bug-reference-prog-mode' have been -activated, their respective hook has been run, and both -'bug-reference-bug-regexp' and 'bug-reference-url-format' are still -not set, it tries to guess appropriate values for those two variables. -There are three guessing mechanisms so far: based on version control -information of the current buffer's file, based on -newsgroup/mail-folder name and several news and mail message headers -in Gnus buffers, and based on IRC channel and network in rcirc and ERC -buffers. All the mechanisms are extensible with custom rules, see the -variables 'bug-reference-setup-from-vc-alist', -'bug-reference-setup-from-mail-alist', and -'bug-reference-setup-from-irc-alist'. - -** HTML Mode - ---- -*** A new skeleton for adding relative URLs has been added. -It's bound to the 'C-c C-c f' keystroke, and prompts for a local file -name. - -** Widget - -+++ -*** 'widget-choose' now supports menus in extended format. - ---- -*** The 'editable-list' widget now supports moving items up and down. -You can now move items up and down by deleting and then reinserting -them, using the 'DEL' and 'INS' buttons respectively. This is useful -in Custom buffers, for example, to change the order of the elements in -a list. - -** Diff - ---- -*** New face 'diff-changed-unspecified'. -This is used to highlight "changed" lines (those marked with '!') in -context diffs, when 'diff-use-changed-face' is non-nil. - ---- -*** New 'diff-mode' font locking face 'diff-error'. -This face is used for error messages from 'diff'. - -+++ -*** New command 'diff-refresh-hunk'. -This new command (bound to 'C-c C-l') regenerates the current hunk. - -** thing-at-point - -+++ -*** New 'thing-at-point' target: 'existing-filename'. -This is like 'filename', but is a full path, and is nil if the file -doesn't exist. - -+++ -*** New 'thing-at-point' target: 'string'. -If point is inside a string, it returns that string. - -+++ -*** New variable 'thing-at-point-provider-alist'. -This allows mode-specific alterations to how 'thing-at-point' works. - ---- -*** thing-at-point now respects fields. -'thing-at-point' (and all functions that use it, like -'symbol-at-point') will narrow to the current field (if any) before -trying to identify the thing at point. - -*** New function 'thing-at-mouse'. - -** image-dired - ---- -*** 'image-dired-mouse-toggle-mark' now toggles files in the active region. - -+++ -*** New user option 'image-dired-thumb-visible-marks'. -If non-nil (the default), use 'image-dired-thumb-mark' to say what -images are marked. - ---- -*** New command 'image-dired-delete-marked'. - -** Flymake mode - -+++ -*** New command 'flymake-show-project-diagnostics' -This lists all diagnostics for buffers in the currently active -project. The listing is similar to the one obtained by -'flymake-show-buffer-diagnostics', but adds a column for the -project-relative file name. For backends which support it, -'flymake-show-project-diagnostics' also lists diagnostics for files -that have not yet been visited. - -+++ -*** New user options to customize Flymake's mode-line. -The new user option 'flymake-mode-line-format' is a mix of strings and -symbols like 'flymake-mode-line-title', 'flymake-mode-line-exception' -and 'flymake-mode-line-counters'. The new user option -'flymake-mode-line-counter-format' is a mix of strings and symbols -like 'flymake-mode-line-error-counter', -'flymake-mode-line-warning-counter' and 'flymake-mode-line-note-counter'. - -** Time - ---- -*** 'display-time-world' has been renamed to 'world-clock'. -'world-clock' creates a buffer with an updating time display using -several time zones. It is hoped that the new names are more -discoverable. - -The following commands have been renamed: - - 'display-time-world' to 'world-clock' - 'display-time-world-mode' to 'world-clock-mode' - 'display-time-world-display' to 'world-clock-display' - 'display-time-world-timer' to 'world-clock-update' - -The following user options have been renamed: - - 'display-time-world-list' to 'world-clock-list' - 'display-time-world-time-format' to 'world-clock-time-format' - 'display-time-world-buffer-name' to 'world-clock-buffer-name' - 'display-time-world-timer-enable' to 'world-clock-timer-enable' - 'display-time-world-timer-second' to 'world-clock-timer-second' - -The old names are now obsolete. - ---- -*** 'world-clock-mode' can no longer be turned on interactively. -Use 'world-clock' to turn on that mode. - -** Python mode - ---- -*** New user option 'python-forward-sexp-function'. -This allows the user easier customization of whether to use block-based -navigation or not. - ---- -*** 'python-shell-interpreter' now defaults to python3 on systems with python3. - ---- -*** 'C-c C-r' can now be used on arbitrary regions. -The command previously extended the start of the region to the start -of the line, but will now actually send the marked region, as -documented. - -** Ruby Mode - ---- -*** 'ruby-use-smie' is declared obsolete. -SMIE is now always enabled and 'ruby-use-smie' only controls whether -indentation is done using SMIE or with the old ad-hoc code. - ---- -*** Indentation has changed when 'ruby-align-chained-calls' is non-nil. -This previously used to align subsequent lines with the last sibling, -but it now aligns with the first sibling (which is the preferred style -in Ruby). - -** 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 -Conway's book "Perl Best Practices" for indentation and formatting -of conditionals. - -** Perl mode - ---- -*** New face 'perl-non-scalar-variable'. -This is used to fontify non-scalar variables. - -** Octave Mode - -+++ -*** Line continuations in double-quoted strings now use a backslash. -Typing 'C-M-j' (bound to 'octave-indent-new-comment-line') now follows -the behavior introduced in Octave 3.8 of using a backslash as a line -continuation marker within double-quoted strings, and an ellipsis -everywhere else. - -+++ -** EasyPG -GPG key servers can now be queried for keys with the -'M-x epa-search-keys' command. Keys can then be added to your -personal key ring. - -** Etags - -+++ -*** Etags now supports the Mercury programming language. -See https://mercurylang.org. - -+++ -*** Etags command line option '--declarations' now has Mercury-specific behavior. -All Mercury declarations are tagged by default. However, for -compatibility with 'etags' support for Prolog, predicates and -functions appearing first in clauses will also be tagged if 'etags' is -invoked with the '--declarations' command-line option. - -** Comint - -+++ -*** Support for OSC escape sequences. -Adding the new 'comint-osc-process-output' to -'comint-output-filter-functions' enables the interpretation of OSC -("Operating System Command") escape sequences in comint buffers. By -default, only OSC 8, for hyperlinks, and OSC 7, for directory -tracking, are acted upon. Adding more entries to -'comint-osc-handlers' allows a customized treatment of further escape -sequences. - -+++ -*** 'comint-delete-output' can now save deleted text in the kill-ring. -Interactively, 'C-u C-c C-o' triggers this new optional behavior. - -** ansi-color.el - ---- -*** Colors are now defined by faces. -ANSI SGR codes now have corresponding faces to describe their -appearance, e.g. 'ansi-color-bold'. - ---- -*** Support for "bright" color codes. -"Bright" ANSI color codes are now displayed when applying ANSI color -filters using the color values defined by the faces -'ansi-color-bright-COLOR'. In addition, bold text with regular ANSI -colors can be displayed as "bright" if 'ansi-color-bold-is-bright' is -non-nil. - -** ERC - ---- -*** NickServ passwords can now be retrieved from auth-source. -The 'erc-use-auth-source-for-nickserv-password' user option enables -querying auth-source for NickServ passwords. To enable this, add the -following to your init file: - - (setq erc-use-auth-source-for-nickserv-password t) - ---- -*** NickServ identification now prompts for password last. -When 'erc-prompt-for-nickserv-password' is non-nil, the user used to -be unconditionally prompted interactively for a password, regardless -of the value of 'erc-nickserv-passwords', which was effectively -ignored (same for the new -'erc-use-auth-source-for-nickserv-password'). This limitation is now -lifted, and the user is interactively prompted last, after the other -identification methods have run. - ---- -*** The '/ignore' command will now ask for a timeout to stop ignoring the user. -Allowed inputs are seconds or ISO8601-like periods like "1h" or "4h30m". - ---- -*** ERC now recognizes 'C-]' for italic text. -Italic text is displayed in the new 'erc-italic-face'. - ---- -*** erc-match.el now supports 'message' highlight type (not including the nick). -The 'erc-current-nick-highlight-type', 'erc-pal-highlight-type', -'erc-fool-highlight-type', 'erc-keyword-highlight-type', and -'erc-dangerous-host-highlight-type' user options now support a -'message' type for highlighting the entire message but not the -sender's nick. - ---- -*** erc-status-sidebar.el is now part of ERC. -The 'erc-status-sidebar' package which provides a HexChat-like -activity overview sidebar for joined IRC channels is now part of ERC. - -+++ -*** erc-tls now supports specifying a TLS client certificate. -The 'erc-tls' function has been updated to allow specifying a TLS -client certificate for authentication, as an alternative to NickServ -password-based authentication. This is referred to as "CertFP" (short -for Certificate Fingerprint) by several IRC networks. See the Info -node "(erc) Connecting" in the ERC manual for more details and -examples on how to specify and use TLS client certificates with -'erc-tls'. - ---- -*** Add 'erc-track-select-mode-line-face' (obsoletes 'erc-track-find-face'). -The 'erc-track-find-face' function of the erc-track module has been -declared obsolete and rewritten as 'erc-track-select-mode-line-face', -with different expected arguments (the current and old faces are now -separated) and clearer documentation. - ---- -*** Add '/opme' and '/deopme' convenience commands. -The new '/opme' convenience command asks ChanServ to set the operator -status for the current nick in the current channel, and '/deopme' -unsets it. - ---- -*** Add '/wii' convenience command for whois with idle time. -The new '/wii' convenience command calls the '/whois' command with the -given nick as both arguments, which is useful for displaying the whois -information for the nick along with idle time, even if the nick is on -a different server than the one the current user is connected to. -Using the given nick itself instead of the server it is connected to -is not standardized, but is widely supported across IRC networks. - -** xwidget-webkit mode - ---- -*** New xwidget commands. -'xwidget-webkit-uri' (return the current URL), 'xwidget-webkit-title' -(return the current title), and 'xwidget-webkit-goto-history' (goto a -point in history). - ---- -*** Pixel-based scrolling. -The 'xwidget-webkit-scroll-up', 'xwidget-webkit-scroll-down' commands -now supports scrolling arbitrary pixel values. It now treats the -optional 2nd argument as the pixel values to scroll. - ---- -*** New commands for scrolling. -The new commands 'xwidget-webkit-scroll-up-line', -'xwidget-webkit-scroll-down-line', 'xwidget-webkit-scroll-forward', -'xwidget-webkit-scroll-backward' can be used to scroll webkit by the -height of lines or width of chars. - ---- -*** New user option 'xwidget-webkit-bookmark-jump-new-session'. -When non-nil, use a new xwidget webkit session after bookmark jump. -Otherwise, it will use 'xwidget-webkit-last-session'. - -** Checkdoc - ---- -*** No longer warns about command substitutions by default. -Checkdoc used to warn about "too many command substitutions" (as in -"\\[foo-command]"), even if you only used ten of them in a docstring. -On modern machines, you can have hundreds or thousands of command -substitutions before it becomes a performance issue, so this warning -is now disabled by default. To re-enable this warning, customize the -user option 'checkdoc-max-keyref-before-warn'. - ---- -*** New user option 'checkdoc-column-zero-backslash-before-paren'. -Checkdoc warns if there is a left parenthesis in column zero of a -documentation string. That warning can now be disabled by customizing -this new user option to nil. This is useful if you don't expect -your code to be edited with an Emacs older than version 27.1. - ---- -*** Now checks the prompt format for 'yes-or-no-p'. -In addition to verifying the format of the prompt for 'y-or-n-p', -checkdoc will now check the format of 'yes-or-no-p'. - ---- -*** New command 'checkdoc-dired'. -This can be used to run checkdoc on files from a Dired buffer. - ---- -*** No longer checks for "A-" modifiers. -Checkdoc recommends usage of command substitutions ("\\[foo-command]") -in favor of writing keybindings like "C-c f". It now no longer warns -about the "A-" modifier as it is not used very much in practice, and -this warning therefore mostly led to false positives. - -** Enriched mode - ---- -*** 'C-a' is by default no longer bound to 'beginning-of-line-text'. -This is so 'C-a' works as in other modes, and in particular holding -Shift while typing 'C-a', i.e. 'C-S-a', will now highlight the text. - -** Gravatar - ---- -*** New user option 'gravatar-service' for host to query for gravatars. -Defaults to 'libravatar', with 'unicornify' and 'gravatar' as options. - -** MH-E mail handler for Emacs - -Functions and variables related to handling junk mail have been -renamed to not associate color with sender quality. - -+++ -*** New names for mh-junk interactive functions. -Function 'mh-junk-whitelist' is renamed 'mh-junk-allowlist'. -Function 'mh-junk-blacklist' is renamed 'mh-junk-blocklist'. - -+++ -*** New binding for 'mh-junk-allowlist'. -The key binding for 'mh-junk-allowlist' is changed from 'J w' to 'J a'. -The old binding is supported but warns that it is obsolete. - -+++ -*** New names for some hooks. -'mh-whitelist-msg-hook' is renamed 'mh-allowlist-msg-hook'. -'mh-blacklist-msg-hook' is renamed 'mh-blocklist-msg-hook'. - -+++ -*** New names for some user options. -User option 'mh-whitelist-preserves-sequences-flag' is renamed -'mh-allowlist-preserves-sequences-flag'. - -+++ -*** New names for some faces. -Face 'mh-folder-blacklisted' is renamed 'mh-folder-blocklisted'. -Face 'mh-folder-whitelisted' is renamed 'mh-folder-allowlisted'. - -** Rcirc - -+++ -*** rcirc now supports SASL authentication. - ---- -*** rcirc connects asynchronously. - ---- -*** Integrate formatting into 'rcirc-send-string'. -The function now accepts a variable number of arguments. - -+++ -*** Deprecate 'defun-rcirc-command' in favour of 'rcirc-define-command'. -The new macro handles multiple and optional arguments. - ---- -*** Add basic IRCv3 support. -This includes support for the capabilities: 'server-time', 'batch', -'message-ids', 'invite-notify', 'multi-prefix' and 'standard-replies'. - ---- -*** Add mouse property support to 'rcirc-track-minor-mode'. - ---- -*** Improve support for IRC markup codes. - ---- -*** Check 'auth-sources' for server passwords. - -+++ -*** Implement repeated reconnection strategy. -See 'rcirc-reconnect-attempts'. - -** MPC - ---- -*** New command 'mpc-goto-playing-song'. -This command, bound to 'o' in any 'mpc-mode' buffer, moves point to -the currently playing song in the "*Songs*" buffer. - ---- -*** New user option 'mpc-cover-image-re'. -If non-nil, it is a regexp that should match a valid cover image. - -** Miscellaneous - ---- -*** 'shell-script-mode' now supports 'outline-minor-mode'. -The outline headings have lines that start with "###". - ---- -*** fileloop will now skip missing files instead of signalling an error. - ---- -*** 'tabulated-list-mode' can now restore original display order. -Many commands (like 'C-x C-b') are derived from 'tabulated-list-mode', -and that mode allows the user to sort on any column. There was -previously no easy way to get back to the original displayed order -after sorting, but giving a -1 numerical prefix to the sorting command -will now restore the original order. - ---- -*** 'M-left' and 'M-right' now move between columns in 'tabulated-list-mode'. - ---- -*** New variable 'hl-line-overlay-priority'. -This can be used to change the priority of the hl-line overlays. - -+++ -*** New command 'mailcap-view-file'. -This command will open a viewer based on the file type, as determined -by "~/.mailcap" and related files and variables. - ---- -*** New user option 'remember-diary-regexp'. - ---- -*** New user option 'remember-text-format-function'. - ---- -*** New user option 'authinfo-hide-elements'. -This can be set to nil to inhibit hiding passwords in ".authinfo" files. - ---- -*** 'hexl-mode' scrolling commands now heed 'next-screen-context-lines'. -Previously, 'hexl-scroll-down' and 'hexl-scroll-up' would scroll -up/down an entire window, but they now work more like the standard -scrolling commands. - ---- -*** New user option 'bibtex-unify-case-function'. -This new option allows the user to customize how case is converted -when unifying entries. - ---- -*** The user option 'bibtex-maintain-sorted-entries' now permits -user-defined sorting schemes. - ---- -*** New user option 'reveal-auto-hide'. -If non-nil (the default), revealed text is automatically hidden when -point leaves the text. If nil, the text is not hidden again. Instead -'M-x reveal-hide-revealed' can be used to hide all the revealed text. - ---- -*** New user option 'ffap-file-name-with-spaces'. -If non-nil, 'find-file-at-point' and friends will try to guess more -expansively to identify a file name with spaces. Default value is -nil. - ---- -*** Two new commands for centering in 'doc-view-mode'. -The new commands 'doc-view-center-page-horizontally' (bound to 'c h') -and 'doc-view-center-page-vertically' (bound to 'c v') center the page -horizontally and vertically, respectively. - ---- -*** 'tempo-define-template' can now re-assign templates to tags. -Previously, assigning a new template to an already defined tag had no -effect. - ---- -*** The width of the buffer-name column in 'list-buffers' is now dynamic. -The width now depends of the width of the window, but will never be -wider than the length of the longest buffer name, except that it will -never be narrower than 19 characters. - -+++ -*** New diary sexp 'diary-offset'. -It offsets another diary sexp by a number of days. This is useful -when for example your organization has a committee meeting two days -after every monthly meeting which takes place on the third Thursday, -or if you would like to attend a virtual meeting scheduled in a -different timezone causing a difference in the date. - ---- -*** The old non-SMIE indentation of 'sh-mode' has been removed. - ---- -*** 'mspools-show' is now autoloaded. - ---- -*** Loading dunnet.el in batch mode doesn't start the game any more. -Instead you need to do "emacs -f dun-batch" to start the game in -batch mode. - - -* New Modes and Packages in Emacs 28.1 - -+++ -** New transient mode 'repeat-mode' to allow shorter key sequences. -You can type 'C-x u u' instead of 'C-x u C-x u' to undo many changes, -'C-x o o' instead of 'C-x o C-x o' to switch several windows, -'C-x { { } } ^ ^ v v' to resize the selected window interactively, -'M-g n n p p' to navigate next-error matches. Any other key exits -transient mode and then is executed normally. 'repeat-exit-key' -defines an additional key to exit mode like 'isearch-exit' ('RET'). -The user option 'repeat-exit-timeout' specifies the number of -seconds of idle time to break the repetition chain automatically. -With 'repeat-keep-prefix' you can keep the prefix arg of the previous -command. For example, this can help to reverse the window navigation -direction with e.g. 'C-x o M-- o o'. Also it can help to set a new -step with e.g. 'C-x { C-5 { { {', which will set the window resizing -step to 5 columns. - ---- -** New themes 'modus-vivendi' and 'modus-operandi'. -These themes are designed to conform with the highest standard for -color-contrast accessibility (WCAG AAA). You can load either of them -using 'M-x customize-themes' or 'load-theme' from your init file. -Consult the Modus Themes Info manual for more information on the user -options they provide. - -** Dictionary mode -This is a mode for searching a RFC 2229 dictionary server. -'dictionary' opens a buffer for starting operations. -'dictionary-search' performs a lookup for a word. It also supports a -'dictionary-tooltip-mode' which performs a lookup of the word under -the mouse in 'dictionary-tooltip-dictionary' (which must be customized -first). - ---- -** Lisp Data mode -The new command 'lisp-data-mode' enables a major mode for buffers -composed of Lisp symbolic expressions that do not form a computer -program. The ".dir-locals.el" file is automatically set to use this -mode, as are other data files produced by Emacs. - -+++ -** New global mode 'global-goto-address-mode'. -This will enable 'goto-address-mode' in all buffers. - -** transient.el -This library implements support for powerful keyboard-driven menus. -Such menus can be used as simple visual command dispatchers. More -complex menus take advantage of infix arguments, which are somewhat -similar to prefix arguments, but are more flexible and discoverable. - -** hierarchy.el -This library can create, query, navigate and display hierarchical -structures. - ---- -** New major mode for displaying the "etc/AUTHORS" file. -This new 'etc-authors-mode' provides font-locking for displaying the -"etc/AUTHORS" file from the Emacs distribution, and not much else. +* Installation Changes in Emacs 29.1 -* Incompatible Editing Changes in Emacs 28.1 - ---- -** 'toggle-truncate-lines' now disables 'visual-line-mode'. -This is for symmetry with 'visual-line-mode', which disables -'truncate-lines'. - ---- -** 'electric-indent-mode' now also indents inside strings and comments. -(This only happens when indentation function also supports this.) - -To recover the previous behavior you can use: - - (add-hook 'electric-indent-functions - (lambda (_) (if (nth 8 (syntax-ppss)) 'no-indent))) - ---- -** The 'M-o' ('facemenu-keymap') global binding has been removed. -To restore the old binding, say something like: - - (require 'facemenu) - (define-key global-map "\M-o" 'facemenu-keymap) - (define-key facemenu-keymap "\es" 'center-line) - (define-key facemenu-keymap "\eS" 'center-paragraph) - -The last two lines are not strictly necessary if you don't care about -having those two commands on the 'M-o' keymap; see the next section. - ---- -** The 'M-o M-s' and 'M-o M-S' global bindings have been removed. -Use 'M-x center-line' and 'M-x center-paragraph' instead. See the -previous section for how to get back the old bindings. Alternatively, -if you only want these two commands to have global bindings they had -before, you can add the following to your init file: - - (define-key global-map "\M-o\M-s" 'center-line) - (define-key global-map "\M-o\M-S" 'center-paragraph) - ---- -** The 'M-o M-o' global binding has been removed. -Use 'M-x font-lock-fontify-block' instead, or the new 'C-x x f' -command, which updates the syntax highlighting in the current buffer. - ---- -** The escape sequence '\e[29~' in Xterm is now mapped to 'menu'. -Xterm sends this sequence for both 'F16' and 'Menu' keys -It used to be mapped to 'print' but we couldn't find a terminal -that uses this sequence for any kind of 'Print' key. -This makes the Menu key (see https://en.wikipedia.org/wiki/Menu_key) -work for 'context-menu-mode' in Xterm. - ---- -** New user option 'xterm-store-paste-on-kill-ring'. -If non-nil (the default), Emacs pushes pasted text onto the kill ring -(if using an xterm-like terminal that supports bracketed paste). -Setting this to nil inhibits that. - ---- -** 'vc-print-branch-log' shows the change log from its root directory. -It previously used to use the default directory. - ---- -** 'project-shell' and 'shell' now use 'pop-to-buffer-same-window'. -This is to keep the same behavior as Eshell. - ---- -** In 'nroff-mode', 'center-line' is no longer bound to a key. -The original key binding was 'M-s', which interfered with I-search, -since the latter uses 'M-s' as a prefix key of the search prefix map. - ---- -** In 'f90-mode', the backslash character ('\') no longer escapes. -For about a decade, the backslash character has no longer had a -special escape syntax in Fortran F90. To get the old behavior back, -say something like: - - (modify-syntax-entry ?\\ "\\" f90-mode-syntax-table) - -+++ -** Setting 'fill-column' to nil is obsolete. -This undocumented use of 'fill-column' is now obsolete. To disable -auto filling, turn off 'auto-fill-mode' instead. - -For instance, you could add something like the following to your init -file: - - (add-hook 'foo-mode-hook (lambda () (auto-fill-mode -1)) +* Startup Changes in Emacs 29.1 -* Incompatible Lisp Changes in Emacs 28.1 - -+++ -** Emacs now prints a backtrace when signaling an error in batch mode. -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. - ---- -** Some floating-point numbers are now handled differently by the Lisp reader. -In previous versions of Emacs, numbers with a trailing dot and an exponent -were read as integers and the exponent ignored: 2.e6 was interpreted as the -integer 2. Such numerals are now read as floats with the exponent included: -2.e6 is now read as the floating-point value 2000000.0. -That is, '(read-from-string "1.e3")' => '(1000.0 . 4)' now. - ---- -** 'equal' no longer examines some contents of window configurations. -Instead, it considers window configurations to be equal only if they -are 'eq'. To compare contents, use 'compare-window-configurations' -instead. This change helps fix a bug in 'sxhash-equal', which returned -incorrect hashes for window configurations and some other objects. - -+++ -** The 'lexical-binding' local variable is always enabled. -Previously, if 'enable-local-variables' was nil, a 'lexical-binding' -local variable would not be heeded. This has now changed, and a file -with a 'lexical-binding' cookie is always heeded. To revert to the -old behavior, set 'permanently-enabled-local-variables' to nil. - -+++ -** '&rest' in argument lists must always be followed by a variable name. -Omitting the variable name after '&rest' was previously tolerated in -some cases but not consistently so; it could lead to crashes or -outright wrong results. Since the utility was marginal at best, it is -now an error to omit the variable. - ---- -** 'kill-all-local-variables' has changed how it handles non-symbol hooks. -The function is documented to eliminate all buffer-local bindings -except variables with a 'permanent-local' property, or hooks that -have elements with a 'permanent-local-hook' property. In addition, it -would also keep lambda expressions in hooks sometimes. The latter has -now been changed: The function will now also remove these. - -+++ -** Temporary buffers no longer run certain buffer hooks. -The macros 'with-temp-buffer' and 'with-temp-file' no longer run the -hooks 'kill-buffer-hook', 'kill-buffer-query-functions', and -'buffer-list-update-hook' for the temporary buffers they create. This -avoids slowing them down when a lot of these hooks are defined. - -+++ -** New face 'child-frame-border' and frame parameter 'child-frame-border-width'. -The face and width of child frames borders can now be determined -separately from those of normal frames. To minimize backward -incompatibility, child frames without a 'child-frame-border-width' -parameter will fall back to using 'internal-border-width'. However, -the new 'child-frame-border' face does constitute a breaking change -since child frames' borders no longer use the 'internal-border' face. - ---- -** 'run-at-time' now tries harder to implement the t TIME parameter. -If TIME is t, the timer runs at an integral multiple of REPEAT. -(I.e., if given a REPEAT of 60, it'll run at 08:11:00, 08:12:00, -08:13:00.) However, when a machine goes to sleep (or otherwise didn't -get a time slot to run when the timer was scheduled), the timer would -then fire every 60 seconds after the time the timer was fired. This -has now changed, and the timer code now recomputes the integral -multiple every time it runs, which means that if the laptop wakes at -08:16:43, it'll fire at that time, but then at 08:17:00, 08:18:00... - ---- -** 'parse-partial-sexp' now signals an error if TO is smaller than FROM. -Previously, this would lead to the function interpreting FROM as TO and -vice versa, which would be confusing when passing in OLDSTATE, which -refers to the old state at FROM. - -+++ -** 'global-mode-string' constructs should end with a space. -This was previously not formalized, which led to combinations of modes -displaying data "smushed together" on the mode line. - -+++ -** 'overlays-in' now handles zero-length overlays slightly differently. -Previously, zero-length overlays at the end of the buffer were included -in the result (if the region queried for stopped at that position). -The same was not the case if the buffer had been narrowed to exclude -the real end of the buffer. This has now been changed, and -zero-length overlays at 'point-max' are always included in the results. - ---- -** 'replace-match' now runs modification hooks slightly later. -The function is documented to leave point after the replacement text, -but this was not always the case if a modification hook inserted text -in front of the replaced text -- 'replace-match' would instead leave -point where the end of the inserted text would have been before the -hook ran. 'replace-match' now always leaves point after the -replacement text. - -+++ -** 'completing-read-default' sets completion variables buffer-locally. -'minibuffer-completion-table' and related variables are now set buffer-locally -in the minibuffer instead of being set via a global let-binding. - ---- -** XML serialization functions now reject invalid characters. -Previously, 'xml-print' would produce invalid XML when given a string -with characters that are not valid in XML (see -https://www.w3.org/TR/xml/#charsets). Now it rejects such strings. - ---- -** JSON - ---- -*** JSON number parsing is now stricter. -Numbers with a leading plus sign, leading zeros, or a missing integer -component are now rejected by 'json-read' and friends. This makes -them more compliant with the JSON specification and consistent with -the native JSON parsing functions. - ---- -*** JSON functions support the semantics of RFC 8259. -The JSON functions 'json-serialize', 'json-insert', -'json-parse-string', and 'json-parse-buffer' now implement some of the -semantics of RFC 8259 instead of the earlier RFC 4627. In particular, -these functions now accept top-level JSON values that are neither -arrays nor objects. - ---- -*** Some JSON encoding functions are now obsolete. -The functions 'json-encode-number', 'json-encode-hash-table', -'json-encode-key', and 'json-encode-list' are now obsolete. - -The first two are kept as aliases of 'json-encode', which should be -used instead. Uses of 'json-encode-list' should be changed to call -one of 'json-encode', 'json-encode-alist', 'json-encode-plist', or -'json-encode-array' instead. - -+++ -*** Native JSON functions now signal an error if libjansson is unavailable. -This affects 'json-serialize', 'json-insert', 'json-parse-string', -and 'json-parse-buffer'. This can happen if Emacs was compiled with -libjansson, but the DLL cannot be found and/or loaded by Emacs at run -time. Previously, Emacs would display a message and return nil in -these cases. - -+++ -** The use of positional arguments in 'define-minor-mode' is obsolete. -These were actually rendered obsolete in Emacs 21 but were never -marked as such. - ---- -** 'pcomplete-ignore-case' is now an obsolete alias of 'completion-ignore-case'. - -+++ -** 'completions-annotations' face is not used when the caller puts own face. -This affects the suffix specified by completion 'annotation-function'. - -+++ -** An active minibuffer now has major mode 'minibuffer-mode'. -This is instead of the erroneous 'minibuffer-inactive-mode' it -formerly had. - ---- -** 'make-text-button' no longer modifies text properties of its first argument. -When its first argument is a string, 'make-text-button' no longer -modifies the string's text properties; instead, it uses and returns -a copy of the string. This helps avoid trouble when strings are -shared or constants. - -+++ -** Some properties from completion tables are now preserved. -If 'minibuffer-allow-text-properties' is non-nil, doing completion -over a table of strings with properties will no longer remove all the -properties before returning. This affects things like 'completing-read'. - ---- -** 'dns-query' now consistently uses Lisp integers to represent integers. -Formerly it made an exception for integer components of SOA records, -because SOA serial numbers can exceed fixnum ranges on 32-bit platforms. -Emacs now supports bignums so this old glitch is no longer needed. - -+++ -** The '&define' keyword in an Edebug specification now disables backtracking. -The implementation was buggy, and multiple '&define' forms in an '&or' -form should be exceedingly rare. See the Info node "(elisp) Backtracking" in -the Emacs Lisp reference manual for background. - -+++ -** The error 'ftp-error' belongs also to category 'remote-file-error'. - -+++ -** 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'. - -+++ -** 'inhibit-nul-byte-detection' is renamed to 'inhibit-null-byte-detection'. - ---- -** Some functions are no longer considered safe by 'unsafep': -'replace-regexp-in-string', 'catch', 'throw', 'error', 'signal' -and 'play-sound-file'. - ---- -** 'sql-*-statement-starters' are no longer user options. -These variables describe facts about the SQL standard and -product-specific additions. There should be no need for users to -customize them. - ---- -** Some locale-related variables have been removed. -The Lisp variables 'previous-system-messages-locale' and -'previous-system-time-locale' have been removed, as they were created -by mistake and were not useful to Lisp code. - ---- -** Function 'lm-maintainer' is replaced with 'lm-maintainers'. -The former is now declared obsolete. - -+++ -** 'facemenu.el' is no longer preloaded. -To use functions/variables from the package, you now have to say -'(require 'facemenu)' or similar. - ---- -** 'facemenu-color-alist' is now obsolete, and is not used. - ---- -** The variable 'keyboard-type' is obsolete and not dynamically scoped any more. - -+++ -** The 'values' variable is now obsolete. -Using it just contributes to the growth of the Emacs memory -footprint. - ---- -** The 'load-dangerous-libraries' variable is now obsolete. -It was used to allow loading Lisp libraries compiled by XEmacs, a -modified version of Emacs which is no longer actively maintained. -This is no longer supported, and setting this variable has no effect. - -+++ -** The macro 'with-displayed-buffer-window' is now obsolete. -Use macro 'with-current-buffer-window' with action alist entry 'body-function'. - ---- -** The rfc2368.el library is now obsolete. -Use rfc6068.el instead. The main difference is that -'rfc2368-parse-mailto-url' and 'rfc2368-unhexify-string' assumed that -the strings were all-ASCII, while 'rfc6068-parse-mailto-url' and -'rfc6068-unhexify-string' parse UTF-8 strings. - ---- -** The inversion.el library is now obsolete. - ---- -** The metamail.el library is now obsolete. - -** Edebug changes - ---- -*** 'get-edebug-spec' is obsolete, replaced by 'edebug-get-spec'. - -+++ -*** The spec operator ':name NAME' is obsolete, use '&name' instead. - -+++ -*** The spec element 'function-form' is obsolete, use 'form' instead. - -+++ -*** New function 'def-edebug-elem-spec' to define Edebug spec elements. -These used to be defined with 'def-edebug-spec' thus conflating the -two name spaces, which lead to name collisions. -The use of 'def-edebug-spec' to define Edebug spec elements is -declared obsolete. - ---- -** The sb-image.el library is now obsolete. -This was a compatibility kludge which is no longer needed. - ---- -** Some libraries obsolete since Emacs 23 have been removed: -ledit.el, lmenu.el, lucid.el and old-whitespace.el. - ---- -** Some functions and variables obsolete since Emacs 23 have been removed: -'GOLD-map', 'advertised-xscheme-send-previous-expression', -'allout-init', 'bookmark-jump-noselect', -'bookmark-read-annotation-text-func', 'buffer-menu-mode-hook', -'c-forward-into-nomenclature', 'char-coding-system-table', -'char-valid-p', 'charset-bytes', 'charset-id', 'charset-list', -'choose-completion-delete-max-match', 'complete-in-turn', -'completion-base-size', 'completion-common-substring', -'crm-minibuffer-complete', 'crm-minibuffer-complete-and-exit', -'crm-minibuffer-completion-help', 'custom-mode', 'custom-mode-hook', -'define-key-rebound-commands', 'define-mode-overload-implementation', -'detect-coding-with-priority', 'dirtrack-debug', -'dirtrack-debug-toggle', 'dynamic-completion-table', -'easy-menu-precalculate-equivalent-keybindings', -'epa-display-verify-result', 'epg-passphrase-callback-function', -'erc-announced-server-name', 'erc-default-coding-system', -'erc-process', 'erc-send-command', 'eshell-report-bug', -'eval-next-after-load', 'exchange-dot-and-mark', 'ffap-bug', -'ffap-submit-bug', 'ffap-version', 'file-cache-mouse-choose-completion', -'forward-point', 'generic-char-p', 'global-highlight-changes', -'hi-lock-face-history', 'hi-lock-regexp-history', -'highlight-changes-active-string', 'highlight-changes-initial-state', -'highlight-changes-passive-string', -'icalendar--datetime-to-noneuropean-date', 'image-mode-maybe', -'imenu-example--name-and-position', 'ispell-aspell-supports-utf8', -'lisp-mode-auto-fill', 'locate-file-completion', 'make-coding-system', -'menu-bar-files-menu', 'minibuffer-local-must-match-filename-map', -'mouse-choose-completion', 'mouse-major-mode-menu', -'mouse-popup-menubar', 'mouse-popup-menubar-stuff', -'newsticker-groups-filename', 'nnir-swish-e-index-file', -'nnmail-fix-eudora-headers', 'non-iso-charset-alist', -'nonascii-insert-offset', 'nonascii-translation-table', -'password-read-and-add', 'pre-abbrev-expand-hook', 'princ-list', -'print-help-return-message', 'process-filter-multibyte-p', -'read-file-name-predicate', 'remember-buffer', 'rmail-highlight-face', -'rmail-message-filter', 'semantic-after-idle-scheduler-reparse-hooks', -'semantic-after-toplevel-bovinate-hook', -'semantic-before-idle-scheduler-reparse-hooks', -'semantic-before-toplevel-bovination-hook', -'semantic-bovinate-from-nonterminal-full', -'semantic-bovinate-region-until-error', 'semantic-bovinate-toplevel', -'semantic-bovination-working-type', -'semantic-decorate-pending-decoration-hooks', -'semantic-edits-incremental-reparse-failed-hooks', -'semantic-eldoc-current-symbol-info', 'semantic-expand-nonterminal', -'semantic-file-token-stream', 'semantic-find-dependency', -'semantic-find-nonterminal', 'semantic-flex', 'semantic-flex-buffer', -'semantic-flex-keyword-get', 'semantic-flex-keyword-p', -'semantic-flex-keyword-put', 'semantic-flex-keywords', -'semantic-flex-list', 'semantic-flex-make-keyword-table', -'semantic-flex-map-keywords', 'semantic-flex-token-end', -'semantic-flex-token-start', 'semantic-flex-token-text', -'semantic-imenu-bucketize-type-parts', -'semantic-imenu-expand-type-parts', 'semantic-imenu-expandable-token', -'semantic-init-db-hooks', 'semantic-init-hooks', -'semantic-init-mode-hooks', 'semantic-java-prototype-nonterminal', -'semantic-nonterminal-abstract', 'semantic-nonterminal-full-name', -'semantic-nonterminal-leaf', 'semantic-nonterminal-protection', -'semantic-something-to-stream', 'semantic-tag-make-assoc-list', -'semantic-token-type-parent', 'semantic-toplevel-bovine-cache', -'semantic-toplevel-bovine-table', 'semanticdb-mode-hooks', -'set-coding-priority', 'set-process-filter-multibyte', -'shadows-compare-text-p', 'shell-dirtrack-toggle', -'speedbar-navigating-speed', 'speedbar-update-speed', 't-mouse-mode', -'term-dynamic-simple-complete', 'tooltip-hook', 'tpu-have-ispell', -'url-generate-unique-filename', 'url-temporary-directory', -'vc-arch-command', 'vc-default-working-revision' (variable), -'vc-mtn-command', 'vc-revert-buffer', 'vc-workfile-version', -'vcursor-toggle-vcursor-map', 'w32-focus-frame', 'w32-select-font', -'wisent-lex-make-token-table'. - ---- -** Some functions and variables obsolete since Emacs 22 have been removed: -'erc-current-network', 'gnus-article-hide-pgp-hook', -'gnus-inews-mark-gcc-as-read', 'gnus-treat-display-xface', -'gnus-treat-strip-pgp', 'nnmail-spool-file'. - ---- -** The obsolete function 'thread-alive-p' has been removed. - ---- -** The variable 'force-new-style-backquotes' has been removed. -This removes the final remaining trace of old-style backquotes. - ---- -** Some obsolete variable and function aliases in dbus.el have been removed. -In Emacs 24.3, the variable 'dbus-event-error-hooks' was renamed to -'dbus-event-error-functions' and the function -'dbus-call-method-non-blocking' was renamed to 'dbus-call-method'. -The old names, which were kept as obsolete aliases of the new names, -have now been removed. - ---- -** 'find-function-source-path' renamed and re-documented. -The 'find-function' command (and various related commands) were -documented to respect 'find-function-source-path', and to search for -objects in files specified by that variable. It's unclear when this -actually changed, but at some point (perhaps decades ago) these -commands started using 'load-history' to determine where symbols had -been defined (which is much faster). The doc strings of all the -affected function has been updated. 'find-function-source-path' was -still being used by 'find-library' and related commands, so the -variable has been renamed to 'find-library-source-path', and -'find-function-source-path' is now an obsolete variable alias. - ---- -** The macro 'vc-call' no longer evaluates its second argument twice. +* Changes in Emacs 29.1 -* Lisp Changes in Emacs 28.1 - -+++ -** The 'interactive' syntax has been extended to allow listing applicable modes. -Forms like '(interactive "p" dired-mode)' can be used to annotate the -commands as being applicable for modes derived from 'dired-mode', -or if the mode is a minor mode, that the current buffer has that -minor mode activated. Note that using this form will create byte code -that is not compatible with byte code in previous Emacs versions. - -+++ -** New forms to declare how completion should happen has been added. -'(declare (completion PREDICATE))' can be used as a general predicate -to say whether the command should be present when completing with -'M-x TAB'. '(declare (modes MODE...))' can be used as a short-hand -way of saying that the command should be present when completing from -buffers in major modes derived from MODE..., or, if it's a minor mode, -whether that minor mode is enabled in the current buffer. - -+++ -** 'define-minor-mode' now takes an ':interactive' argument. -This can be used for specifying which modes this minor mode is meant -for, or to make the new minor mode non-interactive. The default value -is t. - -+++ -** 'define-derived-mode' now takes an ':interactive' argument. -This can be used to control whether the defined mode is a command -or not, and is useful when defining commands that aren't meant to be -used by users directly. - -+++ -** 'define-globalized-minor-mode' now takes a ':predicate' parameter. -This can be used to control which major modes the minor mode should be -used in. - -+++ -** 'condition-case' now allows for a success handler. -It is written as '(:success BODY...)' where BODY is executed -whenever the protected form terminates without error, with the -specified variable bound to the value of the protected form. - -+++ -** New function 'benchmark-call' to measure the execution time of a function. -Additionally, the number of repetitions can be expressed as a minimal duration -in seconds. - -+++ -** The value thrown to the 'exit' label can now be a function. -This is in addition to values t or nil. If the value is a function, -the command loop will call it with zero arguments before returning. - -+++ -** The behavior of 'format-spec' is now closer to that of 'format'. -In order for the two functions to behave more consistently, -'format-spec' now pads and truncates based on string width rather than -length, and also supports format specifications that include a -truncating precision field, such as "%.2a". - ---- -** 'defvar' detects the error of defining a variable currently lexically bound. -Such mixes are always signs that the outer lexical binding was an -error and should have used dynamic binding instead. - ---- -** New variable 'inhibit-mouse-event-check'. -If bound to non-nil, a command with '(interactive "e")' doesn't signal -an error when invoked by input event that is not a mouse click (e.g., -a key sequence). - ---- -** New variable 'redisplay-skip-initial-frame' to enable batch redisplay tests. -Setting it to nil forces the redisplay to do its job even in the -initial frame used in batch mode. - -+++ -** Doc strings can now link to customization groups. -Text like "customization group `whitespace'" will be made into a -button. When clicked, it will open a Custom buffer displaying that -customization group. - -+++ -** Doc strings can now link to man pages. -Text like "man page `chmod(1)'" will be made into a button. When -clicked, it will open a Man mode buffer displaying that man page. - -+++ -** Buffers can now be created with certain hooks disabled. -The functions 'get-buffer-create' and 'generate-new-buffer' accept a -new optional argument INHIBIT-BUFFER-HOOKS. If non-nil, the new -buffer does not run the hooks 'kill-buffer-hook', -'kill-buffer-query-functions', and 'buffer-list-update-hook'. This -avoids slowing down internal or temporary buffers that are never -presented to users or passed on to other applications. - -+++ -** New command 'make-directory-autoloads'. -This does the same as the old command 'update-directory-autoloads', -but has different semantics: Instead of passing in the output file via -the dynamically bound 'generated-autoload-file' variable, the output -file is now a explicit parameter. - ---- -** Dragging a file into Emacs pushes the file name onto 'file-name-history'. - ---- -** The 'easymenu' library is now preloaded. - ---- -** The 'iso-transl' library is now preloaded. -This means that keystrokes like 'Alt-[' are defined by default, -instead of only becoming available after doing (for instance) -'C-x 8 '. - ---- -** ':safe' settings in 'defcustom' are now propagated to the loaddefs files. - -+++ -** New ':type' for 'defcustom' for nonnegative integers. -The new 'natnum' type can be used for options that should be -nonnegative integers. - -+++ -** ERT can now output more verbose test failure reports. -If the 'EMACS_TEST_VERBOSE' environment variable is set, failure -summaries will include the failing condition. - -** Byte compiler changes - -+++ -*** New byte-compiler check for missing dynamic variable declarations. -It is meant as an (experimental) aid for converting Emacs Lisp code -to lexical binding, where dynamic (special) variables bound in one -file can affect code in another. For details, see the manual section -"(elisp) Converting to Lexical Binding". - -+++ -*** 'byte-recompile-directory' can now compile symlinked ".el" files. -This is achieved by giving a non-nil FOLLOW-SYMLINKS parameter. - ---- -*** The byte-compiler now warns about too wide documentation strings. -By default, it will warn if a documentation string is wider than the -largest of 'byte-compile-docstring-max-column' or 'fill-column' -characters. - -+++ -*** 'byte-compile-file' optional argument LOAD is now obsolete. -To load the file after byte-compiling, add a call to 'load' from Lisp -or use 'M-x emacs-lisp-byte-compile-and-load' interactively. - -** Macroexp - ---- -*** New function 'macroexp-file-name' to know the name of the current file. - ---- -*** New function 'macroexp-compiling-p' to know if we're compiling. - ---- -*** New function 'macroexp-warn-and-return' to help emit warnings. -This used to be named 'macroexp--warn-and-return' and has proved useful -and well-behaved enough to lose the "internal" marker. - -** map.el - ---- -*** Alist keys are now consistently compared with 'equal' by default. -Until now, 'map-elt' and 'map-delete' compared alist keys with 'eq' by -default. They now use 'equal' instead, for consistency with -'map-put!' and 'map-contains-key'. - -*** Pcase 'map' pattern added keyword symbols abbreviation. -A pattern like '(map :sym)' binds the map's value for ':sym' to 'sym', -equivalent to '(map (:sym sym))'. - ---- -*** The function 'map-copy' now uses 'copy-alist' on alists. -This is a slightly deeper copy than the previous 'copy-sequence'. - ---- -*** The function 'map-contains-key' now supports plists. - ---- -*** More consistent duplicate key handling in 'map-merge-with'. -Until now, 'map-merge-with' promised to call its function argument -whenever multiple maps contained 'eql' keys. However, this did not -always coincide with the keys that were actually merged, which could -be 'equal' instead. The function argument is now called whenever keys -are merged, for greater consistency with 'map-merge' and 'map-elt'. - -** pcase - -+++ -*** The 'or' pattern now binds the union of the vars of its sub-patterns. -If a variable is not bound by the subpattern that matched, it gets bound -to nil. This was already sometimes the case, but it is now guaranteed. - -+++ -*** The 'pred' pattern can now take the form '(pred (not FUN))'. -This is like '(pred (lambda (x) (not (FUN x))))' but results -in better code. - ---- -*** New function 'pcase-compile-patterns' to write other macros. - -+++ -*** Added 'cl-type' pattern. -The new 'cl-type' pattern compares types using 'cl-typep', which allows -comparing simple types like '(cl-type integer)', as well as forms like -'(cl-type (integer 0 10))'. - -+++ -*** New macro 'pcase-setq'. -This macro is the 'setq' equivalent of 'pcase-let', which allows for -destructuring patterns in a 'setq' form. - -** Edebug - -*** Edebug specification lists can use some new keywords: - -+++ -**** '&interpose SPEC FUN ARGS..' lets FUN control parsing after SPEC. -More specifically, FUN is called with 'HEAD PF ARGS..' where -PF is a parsing function that expects a single argument (the specs to -use) and HEAD is the code that matched SPEC. - -+++ -**** '&error MSG' unconditionally aborts the current edebug instrumentation. - -+++ -**** '&name SPEC FUN' extracts the current name from the code matching SPEC. - -** Dynamic modules changes - -+++ -*** Type aliases for module functions and finalizers. -The module header 'emacs-module.h' now contains type aliases -'emacs_function' and 'emacs_finalizer' for module functions and -finalizers, respectively. - -+++ -*** Module functions can now be made interactive. -Use 'make_interactive' to give a module function an interactive -specification. - -+++ -*** Module functions can now install an optional finalizer. -The finalizer is called when the function object is garbage-collected. -Use 'set_function_finalizer' to set the finalizer and -'get_function_finalizer' to retrieve it. - -+++ -*** Modules can now open a channel to an existing pipe process. -Modules can use the new module function 'open_channel' to do that. -On capable systems, modules can use this functionality to -asynchronously send data back to Emacs. - -+++ -*** A new module API 'make_unibyte_string'. -It can be used to create Lisp strings with arbitrary byte sequences -(a.k.a. "raw bytes"). - -+++ -** Shorthands for Lisp symbols. -Shorthands are a general purpose namespacing system to make Emacs -Lisp's symbol-naming etiquette easier to use. A shorthand is any -symbolic form found in Lisp source that "abbreviates" a symbol's print -name. Among other applications, this feature can be used to avoid -name clashes and namespace pollution by renaming an entire file's -worth of symbols with proper and longer prefixes, without actually -touching the Lisp source. For details, see the manual section -"(elisp) Shorthands". - -+++ -** New function 'string-search'. -This function takes two string parameters and returns the position of -the first instance of the former string in the latter. - -+++ -** New function 'string-replace'. -This function works along the line of 'replace-regexp-in-string', but -it matches on fixed strings instead of regexps, and does not change -the global match state. - -+++ -** New function 'ensure-list'. -This function makes a list of its object if it's not a list already. -If it's already a list, the list is returned as is. - -+++ -** New function 'split-string-shell-command'. -This splits a shell command string into separate components, -respecting quoting with single ('like this') and double ("like this") -quotes, as well as backslash quoting (like\ this). - -+++ -** New function 'string-clean-whitespace'. -This removes whitespace from a string. - -+++ -** New function 'string-fill'. -Word-wrap a string so that no lines are longer that a specific length. - -+++ -** New function 'string-limit'. -Return (up to) a specific substring length. - -+++ -** New function 'string-lines'. -Return a list of strings representing the individual lines in a -string. - -+++ -** New function 'string-pad'. -Pad a string to a specific length. - -+++ -** New function 'string-chop-newline'. -Remove a trailing newline from a string. - -+++ -** New function 'replace-regexp-in-region'. - -+++ -** New function 'replace-string-in-region'. - -+++ -** New function 'file-name-with-extension'. -This function allows a canonical way to set/replace the extension of a -file name. - -+++ -** New function 'file-modes-number-to-symbolic' to convert a numeric -file mode specification into symbolic form. - -+++ -** New function 'file-name-concat'. -This appends file name components to a directory name and returns the -result. - -+++ -** New function 'file-backup-file-names'. -This function returns the list of file names of all the backup files -for the specified file. - -+++ -** New function 'directory-empty-p'. -This predicate tests whether a given file name is an accessible -directory and whether it contains no other directories or files. - -+++ -** New function 'buffer-local-boundp'. -This predicate says whether a symbol is bound in a specific buffer. - -+++ -** New function 'always'. -This is identical to 'ignore', but returns t instead. - -+++ -** New function 'sxhash-equal-including-properties'. -This is identical to 'sxhash-equal' but also accounts for string -properties. - ---- -** New function 'buffer-line-statistics'. -This function returns some statistics about the line lengths in a buffer. - ---- -** New function 'color-values-from-color-spec'. -This can be used to parse RGB color specs in several formats and -convert them to a list '(R G B)' of primary color values. - ---- -** New function 'custom-add-choice'. -This function can be used by modes to add elements to the -'choice' customization type of a variable. - ---- -** New function 'decoded-time-period'. -It interprets a decoded time structure as a period and returns the -equivalent period in seconds. - -+++ -** New function 'dom-print'. - -+++ -** New function 'dom-remove-attribute'. - ---- -** New function 'dns-query-asynchronous'. -It takes the same parameters as 'dns-query', but adds a callback -parameter. - -** New function 'garbage-collect-maybe' to trigger GC early. - ---- -** New function 'get-locale-names'. -This utility function returns a list of names of locales available on -the current system. - -+++ -** New function 'insert-into-buffer'. -This inserts the contents of the current buffer into another buffer. - -+++ -** New function 'json-available-p'. -This predicate returns non-nil if Emacs is built with libjansson -support, and it is available on the current system. - ---- -** New function 'mail-header-parse-addresses-lax'. -This takes a comma-separated string and returns a list of mail/name -pairs. - ---- -** New function 'mail-header-parse-address-lax'. -Parse a string as a mail address-like string. - ---- -** New function 'make-separator-line'. -Make a string appropriate for usage as a visual separator line. - -+++ -** New function 'object-intervals'. -This function returns a copy of the list of intervals (i.e., text -properties) in the object in question (which must either be a string -or a buffer). - -+++ -** New function 'process-lines-ignore-status'. -This is like 'process-lines', but does not signal an error if the -return status is non-zero. 'process-lines-handling-status' has also -been added, and takes a callback to handle the return status. - -+++ -** New function 'require-theme'. -This function is like 'require', but searches 'custom-theme-load-path' -instead of 'load-path'. It can be used by Custom themes to load -supporting Lisp files when 'require' is unsuitable. - -+++ -** New function 'seq-union'. -This function takes two sequences and returns a list of all elements -that appear in either of them, with no two elements that compare equal -appearing in the result. - -+++ -** New function 'syntax-class-to-char'. -This does almost the opposite of 'string-to-syntax' -- it returns the -syntax descriptor (a character) given a raw syntax descriptor (an -integer). - -+++ -** New functions 'null-device' and 'path-separator'. -These functions return the connection local value of the respective -variables. This can be used for remote hosts. - -+++ -** New predicate functions 'length<', 'length>' and 'length='. -Using these functions may be more efficient than using 'length' (if -the length of a (long) list is being computed just to compare this -length to a number). - -+++ -** New macro 'dlet' to dynamically bind variables. - -+++ -** New macro 'with-existing-directory'. -This macro binds 'default-directory' to some other existing directory -if 'default-directory' doesn't exist, and then executes the body forms. - -+++ -** New variable 'current-minibuffer-command'. -This is like 'this-command', but it is bound recursively when entering -the minibuffer. - -+++ -** New variable 'inhibit-interaction' to make user prompts signal an error. -If this is bound to something non-nil, functions like -'read-from-minibuffer', 'read-char' (and related) will signal an -'inhibited-interaction' error. - ---- -** New variable 'indent-line-ignored-functions'. -This allows modes to cycle through a set of indentation functions -appropriate for those modes. - -+++ -** New variable 'print-integers-as-characters' modifies integer printing. -If this variable is non-nil, character syntax is used for printing -numbers when this makes sense, such as '?A' for 65. - -+++ -** New variable 'tty-menu-calls-mouse-position-function'. -This controls whether 'mouse-position-function' is called by functions -that retrieve the mouse position when that happens during TTY menu -handling. Lisp programs that set 'mouse-position-function' should -also set this variable non-nil if they are compatible with the tty -menu handling. - -+++ -** New variables that hold default buffer names for shell output. -The new constants 'shell-command-buffer-name' and -'shell-command-buffer-name-async' store the default buffer names -for the output of, respectively, synchronous and async shell -commands. - ---- -** New variables 'read-char-choice-use-read-key' and 'y-or-n-p-use-read-key'. -When non-nil, then functions 'read-char-choice' and 'y-or-n-p' -(respectively) use the function 'read-key' to read a character instead -of using the minibuffer. - -+++ -** New variable 'global-minor-modes'. -This variable holds a list of currently enabled global minor modes (as -a list of symbols). - -+++ -** New buffer-local variable 'local-minor-modes'. -This permanently buffer-local variable holds a list of currently -enabled non-global minor modes in the current buffer (as a list of -symbols). - -+++ -** New completion function 'affixation-function' to add prefix/suffix. -It accepts a list of completions and should return a list where -each element is a list with three elements: a completion, -a prefix string, and a suffix string. - -+++ -** New completion function 'group-function' for grouping candidates. -It takes two arguments: a completion candidate and a 'transform' flag. - -+++ -** New error symbol 'minibuffer-quit'. -Signaling it has almost the same effect as 'quit' except that it -doesn't cause keyboard macro termination. - -+++ -** New error 'remote-file-error', a subcategory of 'file-error'. -It is signaled if a remote file operation fails due to internal -reasons, and could block Emacs. It does not replace 'file-error' -signals for the usual cases. Timers, process filters and process -functions, which run remote file operations, shall protect themselves -against this error. - -If such an error occurs, please report this as bug via 'M-x report-emacs-bug'. -Until it is solved you could ignore such errors by performing - - (setq debug-ignored-errors (cons 'remote-file-error debug-ignored-errors)) - -+++ -** New macro 'named-let' added to subr-x.el. -It provides Scheme's "named let" looping construct. - ---- -** Emacs now attempts to test for high-rate subprocess output more fairly. -When several subprocesses produce output simultaneously at high rate, -Emacs will now by default attempt to service them all in a round-robin -fashion. Set the new variable 'process-prioritize-lower-fds' to a -non-nil value to get back the old behavior, whereby after reading -from a subprocess, Emacs would check for output of other subprocesses -in a way that is likely to read from the same process again. - -+++ -** 'set-process-buffer' now updates the process mark. -The mark will be set to point to the end of the new buffer. - -+++ -** 'unlock-buffer' displays warnings instead of signaling. -Instead of signaling 'file-error' conditions for file system level -errors, the function now calls 'display-warning' and continues as if -the error did not occur. - -+++ -** 'read-char-from-minibuffer' and 'y-or-n-p' support 'help-form'. -If you bind 'help-form' to a non-nil value while calling these functions, -then pressing 'C-h' ('help-char') causes the function to evaluate 'help-form' -and display the result. - -+++ -** 'read-number' now has its own history variable. -Additionally, the function now accepts a HIST argument which can be -used to specify a custom history variable. - -+++ -** 'set-window-configuration' now takes two optional parameters, -'dont-set-frame' and 'dont-set-miniwindow'. The first of these, when -non-nil, instructs the function not to select the frame recorded in -the configuration. The second prevents the current minibuffer being -replaced by the one stored in the configuration. - ---- -** 'count-windows' now takes an optional parameter ALL-FRAMES. -The semantics are as with 'walk-windows'. - -+++ -** 'truncate-string-ellipsis' now uses '…' by default. -Modes that use 'truncate-string-to-width' with non-nil, non-string -argument ELLIPSIS, will now indicate truncation using '…' when -the selected frame can display it, and using "..." otherwise. - -+++ -** 'string-width' now accepts two optional arguments FROM and TO. -This allows calculating the width of a substring without consing a -new string. - -+++ -** 'directory-files' now takes an additional COUNT parameter. -The parameter makes 'directory-files' return COUNT first file names -from a directory. If MATCH is also given, the function will return -first COUNT file names that match the expression. The same COUNT -parameter has been added to 'directory-files-and-attributes'. - -+++ -** 'count-lines' can now ignore invisible lines. -This is controlled by the optional parameter IGNORE-INVISIBLE-LINES. - ---- -** 'count-words' now crosses field boundaries. -Originally, 'count-words' would stop counting at the first field -boundary it encountered; now it keeps counting all the way to the -region's (or buffer's) end. - -+++ -** File-related APIs can optionally follow symlinks. -The functions 'file-modes', 'set-file-modes', and 'set-file-times' now -have an optional argument specifying whether to follow symbolic links. - -+++ -** 'format-seconds' can now be used for sub-second times. -The new optional "," parameter has been added, and -'(format-seconds "%mm %,1ss" 66.4)' will now result in "1m 6.4s". - -+++ -** 'parse-time-string' can now parse ISO 8601 format strings. -These have a format like "2020-01-15T16:12:21-08:00". - ---- -** 'make-network-process', 'make-serial-process' ':coding' behavior change. -Previously, passing ':coding nil' to either of these functions would -override any non-nil binding for 'coding-system-for-read' and -'coding-system-for-write'. For consistency with 'make-process' and -'make-pipe-process', passing ':coding nil' is now ignored. No code in -Emacs depended on the previous behavior; if you really want the -process' coding-system to be nil, use 'set-process-coding-system' -after the process has been created, or pass in ':coding '(nil nil)'. - -+++ -** 'open-network-stream' now accepts a ':coding' argument. -This allows specifying the coding systems used by a network process -for encoding and decoding without having to bind -'coding-system-for-{read,write}' or call 'set-process-coding-system'. - -+++ -** 'open-network-stream' can now take a ':capability-command' that's a function. -The function is called with the greeting from the server as its only -parameter, and allows sending different TLS capability commands to the -server based on that greeting. - -+++ -** 'open-gnutls-stream' now also accepts a ':coding' argument. - ---- -** 'process-attributes' now works under OpenBSD, too. - -+++ -** 'format-spec' now takes an optional SPLIT parameter. -If non-nil, 'format-spec' will split the resulting string into a list -of strings, based on where the format specs (and expansions) were. - ---- -** 'unload-feature' now also tries to undo additions to buffer-local hooks. - ---- -** 'while-no-input-ignore-events' accepts more special events. -The special events 'dbus-event' and 'file-notify' are now ignored in -'while-no-input' when added to this variable. - ---- -** 'start-process-shell-command' and 'start-file-process-shell-command' -do not support the old calling conventions any longer. - -+++ -** 'yes-or-no-p' and 'y-or-n-p' PROMPT parameter no longer needs trailing space. -In other words, the prompt can now end with "?" instead of "? ". This -has been the case since Emacs 24.4 but was not announced or documented -until now. (Checkdoc has also been updated to accept this convention.) - -+++ -** The 'uniquify' argument in 'auto-save-file-name-transforms' can be a symbol. -If this symbol is one of the members of 'secure-hash-algorithms', -Emacs constructs the nondirectory part of the auto-save file name by -applying that 'secure-hash' to the buffer file name. This avoids any -risk of excessively long file names. - -+++ -** New user option 'process-file-return-signal-string'. -It controls, whether 'process-file' returns a string when a remote -process is interrupted by a signal. - -** EIEIO Changes - -+++ -*** The macro 'oref-default' can now be used with 'setf'. -It is now defined as a generalized variable that can be used with -'setf' to modify the value stored in a given class slot. - ---- -*** 'form' in '(eql form)' specializers in 'cl-defmethod' is now evaluated. -This corresponds to the behavior of defmethod in Common Lisp Object System. -For compatibility, '(eql SYMBOL)' does not evaluate SYMBOL, for now. - -** D-Bus - -+++ -*** Property values can be typed explicitly. -'dbus-register-property' and 'dbus-set-property' accept now optional -type symbols. Both functions propagate D-Bus errors. - -+++ -*** Registered properties can have the new access type ':write'. - -+++ -*** In case of problems, handlers can emit proper D-Bus error messages now. - -+++ -*** D-Bus errors, which have been converted from incoming D-Bus error -messages, contain the error name of that message now. - -+++ -*** D-Bus messages can be monitored with the new command 'dbus-monitor'. - -+++ -*** D-Bus events have changed their internal structure. -They carry now the destination and the error-name of an event. They -also keep the type information of their arguments. Use the -'dbus-event-*' accessor functions. - -** Buttons - -+++ -*** New minor mode 'button-mode'. -This minor mode does nothing else than install 'button-buffer-map' as -a minor mode map (which binds the 'TAB' / 'S-TAB' key bindings to navigate -to buttons), and can be used in any view-mode-like buffer that has -buttons in it. - -+++ -*** New utility function 'button-buttonize'. -This function takes a string and returns a string propertized in a way -that makes it a valid button. - ---- -** 'text-scale-mode' can now adjust font size of the header line. -When the new buffer local variable 'text-scale-remap-header-line' -is non-nil, 'text-scale-adjust' will also scale the text in the header -line when displaying that buffer. - -This is useful for major modes that arrange their display in a tabular -form below the header line. It is enabled by default in -'tabulated-list-mode' and its derived modes. - ---- -** 'ascii' is now a coding system alias for 'us-ascii'. - ---- -** New coding-systems for EBCDIC variants. -New coding-systems 'ibm256', 'ibm273', 'ibm274', 'ibm277', 'ibm278', -'ibm280', 'ibm281', 'ibm284', 'ibm285', 'ibm290', 'ibm297'. These are -variants of the EBCDIC encoding tailored to some European and Japanese -locales. They are also available as aliases 'ebcdic-cp-*' (e.g., -'ebcdic-cp-fi' for the Finnish variant 'ibm278'), and 'cp2xx' (e.g., -'cp278' for 'ibm278'). There are also new charsets 'ibm2xx' to -support these coding-systems. - -+++ -** New 'Bindat type expression' description language. -This new system is provided by the new macro 'bindat-type' and -obsoletes the old data layout specifications. It supports -arbitrary-size integers, recursive types, and more. See the Info node -"(elisp) Byte Packing" in the ELisp manual for more details. - -+++ -** New macro 'with-environment-variables'. -This macro allows setting environment variables temporarily when -executing a form. +* Editing Changes in Emacs 29.1 -* Changes in Emacs 28.1 on Non-Free Operating Systems - -+++ -** On MS-Windows, Emacs can now use the native image API to display images. -Emacs can now use the MS-Windows GDI+ library to load and display -images in JPEG, PNG, GIF and TIFF formats. This support is available -unless Emacs was configured '--without-native-image-api'. - -This feature is experimental, and needs to be turned on to be used. -To turn this on, set the variable 'w32-use-native-image-API' to a -non-nil value. Please report any bugs you find while using the native -image API via 'M-x report-emacs-bug'. - -+++ -** On MS-Windows, Emacs can now toggle the IME. -A new function 'w32-set-ime-open-status' can now be used to disable -and enable the MS-Windows native Input Method Editor (IME) at run -time. A companion function 'w32-get-ime-open-status' returns the -current IME activation status. - --- -** On macOS, 's-' and 's-' are now bound to -'move-beginning-of-line' and 'move-end-of-line' respectively. The commands -to select previous/next frame are still bound to 's-~' and 's-`'. +* Changes in Specialized Modes and Packages in Emacs 29.1 -+++ -** On macOS, Emacs can now load dynamic modules with a ".dylib" suffix. -'module-file-suffix' now has the value ".dylib" on macOS, but the -".so" suffix is supported as well. - ---- -** On macOS, the user option 'make-pointer-invisible' is now honored. - ---- -** On macOS, Xwidget is now supported. -If Emacs was built with xwidget support, you can access the embedded -webkit browser with 'M-x xwidget-webkit-browse-url'. Viewing two -instances of xwidget webkit is not supported. - ---- -*** Downloading files from xwidget-webkit is now supported. -The new user option 'xwidget-webkit-download-dir' says where to download to. - ---- -*** New command 'xwidget-webkit-clone-and-split-below'. -Open a new window below displaying the current URL. + +* New Modes and Packages in Emacs 29.1 ---- -*** New command 'xwidget-webkit-clone-and-split-right'. -Open a new window to the right displaying the current URL. + +* Incompatible Lisp Changes in Emacs 29.1 ---- -*** New user option 'xwidget-webkit-enable-plugins'. -If non-nil, enable plugins in xwidget. (This is only available on -macOS.) + +* Lisp Changes in Emacs 29.1 -+++ -** New macOS Contacts back-end for EUDC. -This backend works on newer versions of macOS and is generally -preferred over the eudcb-mab.el backend. + +* Changes in Emacs 29.1 on Non-Free Operating Systems ---------------------------------------------------------------------- diff --git a/etc/refcards/ru-refcard.tex b/etc/refcards/ru-refcard.tex index 179be0af88..018be36eb4 100644 --- a/etc/refcards/ru-refcard.tex +++ b/etc/refcards/ru-refcard.tex @@ -40,7 +40,7 @@ \newlength{\ColThreeWidth} \setlength{\ColThreeWidth}{25mm} -\newcommand{\versionemacs}[0]{28} % version of Emacs this is for +\newcommand{\versionemacs}[0]{29} % version of Emacs this is for \newcommand{\cyear}[0]{2021} % copyright year \newcommand\shortcopyrightnotice[0]{\vskip 1ex plus 2 fill diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 69baf17f5e..814003587b 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -1205,7 +1205,7 @@ Show the buffer in another window, but don't select it." (unless (eq symbol basevar) (message "`%s' is an alias for `%s'" symbol basevar)))) -(defvar customize-changed-options-previous-release "26.3" +(defvar customize-changed-options-previous-release "28.1" "Version for `customize-changed' to refer back to by default.") ;; Packages will update this variable, so make it available. diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp index ce45a7c80e..ef4bc24fe4 100644 --- a/msdos/sed2v2.inp +++ b/msdos/sed2v2.inp @@ -66,7 +66,7 @@ /^#undef PACKAGE_NAME/s/^.*$/#define PACKAGE_NAME ""/ /^#undef PACKAGE_STRING/s/^.*$/#define PACKAGE_STRING ""/ /^#undef PACKAGE_TARNAME/s/^.*$/#define PACKAGE_TARNAME ""/ -/^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION "28.0.50"/ +/^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION "29.0.50"/ /^#undef SYSTEM_TYPE/s/^.*$/#define SYSTEM_TYPE "ms-dos"/ /^#undef HAVE_DECL_GETENV/s/^.*$/#define HAVE_DECL_GETENV 1/ /^#undef SYS_SIGLIST_DECLARED/s/^.*$/#define SYS_SIGLIST_DECLARED 1/ diff --git a/nt/README.W32 b/nt/README.W32 index ed5673334a..495af0baed 100644 --- a/nt/README.W32 +++ b/nt/README.W32 @@ -1,7 +1,7 @@ Copyright (C) 2001-2021 Free Software Foundation, Inc. See the end of the file for license conditions. - Emacs version 28.0.50 for MS-Windows + Emacs version 29.0.50 for MS-Windows This README file describes how to set up and run a precompiled distribution of the latest version of GNU Emacs for MS-Windows. You diff --git a/src/msdos.c b/src/msdos.c index 5da01c9e7c..bf058c8aff 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -1794,7 +1794,7 @@ internal_terminal_init (void) } Vinitial_window_system = Qpc; - Vwindow_system_version = make_fixnum (28); /* RE Emacs version */ + Vwindow_system_version = make_fixnum (29); /* RE Emacs version */ tty->terminal->type = output_msdos_raw; /* If Emacs was dumped on DOS/V machine, forget the stale VRAM commit 2750d97543bce12e99a650d748a4d85343d7d229 Author: Eli Zaretskii Date: Thu Sep 30 20:05:09 2021 +0300 Cut the emacs-28 release branch * README: * configure.ac: * nt/README.W32: * msdos/sed2v2.inp: Bump Emacs version to 28.0.60. * lisp/cus-edit.el (customize-changed-options-previous-release): Update the last released version of Emacs. diff --git a/README b/README index a1d5e2dcef..3677e88940 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ Copyright (C) 2001-2021 Free Software Foundation, Inc. See the end of the file for license conditions. -This directory tree holds version 28.0.50 of GNU Emacs, the extensible, +This directory tree holds version 28.0.60 of GNU Emacs, the extensible, customizable, self-documenting real-time display editor. The file INSTALL in this directory says how to build and install GNU diff --git a/configure.ac b/configure.ac index f151dd551d..92b222545d 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ dnl along with GNU Emacs. If not, see . AC_PREREQ(2.65) dnl Note this is parsed by (at least) make-dist and lisp/cedet/ede/emacs.el. -AC_INIT(GNU Emacs, 28.0.50, bug-gnu-emacs@gnu.org, , https://www.gnu.org/software/emacs/) +AC_INIT(GNU Emacs, 28.0.60, bug-gnu-emacs@gnu.org, , https://www.gnu.org/software/emacs/) dnl Set emacs_config_options to the options of 'configure', quoted for the shell, dnl and then quoted again for a C string. Separate options with spaces. diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 69baf17f5e..a0bde39673 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -1205,7 +1205,7 @@ Show the buffer in another window, but don't select it." (unless (eq symbol basevar) (message "`%s' is an alias for `%s'" symbol basevar)))) -(defvar customize-changed-options-previous-release "26.3" +(defvar customize-changed-options-previous-release "27.2" "Version for `customize-changed' to refer back to by default.") ;; Packages will update this variable, so make it available. diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp index ce45a7c80e..ff3d4f2064 100644 --- a/msdos/sed2v2.inp +++ b/msdos/sed2v2.inp @@ -66,7 +66,7 @@ /^#undef PACKAGE_NAME/s/^.*$/#define PACKAGE_NAME ""/ /^#undef PACKAGE_STRING/s/^.*$/#define PACKAGE_STRING ""/ /^#undef PACKAGE_TARNAME/s/^.*$/#define PACKAGE_TARNAME ""/ -/^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION "28.0.50"/ +/^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION "28.0.60"/ /^#undef SYSTEM_TYPE/s/^.*$/#define SYSTEM_TYPE "ms-dos"/ /^#undef HAVE_DECL_GETENV/s/^.*$/#define HAVE_DECL_GETENV 1/ /^#undef SYS_SIGLIST_DECLARED/s/^.*$/#define SYS_SIGLIST_DECLARED 1/ diff --git a/nt/README.W32 b/nt/README.W32 index ed5673334a..a37695ecb1 100644 --- a/nt/README.W32 +++ b/nt/README.W32 @@ -1,7 +1,7 @@ Copyright (C) 2001-2021 Free Software Foundation, Inc. See the end of the file for license conditions. - Emacs version 28.0.50 for MS-Windows + Emacs version 28.0.60 for MS-Windows This README file describes how to set up and run a precompiled distribution of the latest version of GNU Emacs for MS-Windows. You commit bd3a1c3134a130ca8edf4c13c44a8c2323ef2c90 Author: Michael Albinus Date: Thu Sep 30 18:28:31 2021 +0200 ; Still working on emba CI * test/infra/Dockerfile.emba (emacs-base): Install also acl. * test/infra/gitlab-ci.yml (.test-template): Move 'allow_failure' clause level up. diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba index f7cd183e53..71b4e76865 100644 --- a/test/infra/Dockerfile.emba +++ b/test/infra/Dockerfile.emba @@ -29,7 +29,7 @@ FROM debian:stretch as emacs-base RUN apt-get update && \ apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \ libc-dev gcc g++ make autoconf automake libncurses-dev gnutls-dev \ - libdbus-1-dev libacl1-dev git texinfo \ + libdbus-1-dev libacl1-dev acl git texinfo \ && rm -rf /var/lib/apt/lists/* FROM emacs-base as emacs-inotify diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index a004705ec6..b233c0fbc5 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -48,10 +48,12 @@ variables: # # Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled # DOCKER_HOST: tcp://docker:2376 # DOCKER_TLS_CERTDIR: "/certs" - # Put the configuration for each run in a separate directory to avoid conflicts + # Put the configuration for each run in a separate directory to + # avoid conflicts. DOCKER_CONFIG: "/.docker-config-${CI_COMMIT_SHA}" DOCKER_BUILDKIT: 1 - # We don't use ${CI_COMMIT_SHA} to be able to do one bootstrap across multiple builds + # We don't use ${CI_COMMIT_SHA} to be able to do one bootstrap + # across multiple builds. BUILD_TAG: ${CI_COMMIT_REF_SLUG} default: @@ -90,19 +92,20 @@ default: - src/ns*.{h,m} - src/macfont.{h,m} when: never - # these will be cached across builds + # These will be cached across builds. cache: key: ${CI_COMMIT_SHA} paths: [] policy: pull-push - # these will be saved for followup builds + # These will be saved for followup builds. artifacts: expire_in: 24 hrs paths: [] - # using the variables for each job + # Using the variables for each job. script: - docker pull ${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} - # TODO: with make -j4 several of the tests were failing, for example shadowfile-tests, but passed without it + # TODO: with make -j4 several of the tests were failing, for + # example shadowfile-tests, but passed without it. - 'export PWD=$(pwd)' - 'docker run -i -e EMACS_EMBA_CI=${EMACS_EMBA_CI} --volumes-from $(docker ps -q -f "label=com.gitlab.gitlab-runner.job.id=${CI_JOB_ID}"):ro --name ${test_name} ${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} /bin/bash -c "git fetch ${PWD} HEAD && echo checking out these updated files && git diff --name-only FETCH_HEAD && ( git diff --name-only FETCH_HEAD | xargs git checkout -f FETCH_HEAD ) && make -j4 && make ${make_params}"' after_script: @@ -142,12 +145,13 @@ default: - docker push ${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} .test-template: - # Do not run fast and normal test jobs when scheduled + # Do not block later stages. + allow_failure: true + # Do not run fast and normal test jobs when scheduled. rules: - if: '$CI_JOB_STAGE =~ "fast|normal" && $CI_PIPELINE_SOURCE == "schedule"' when: never - when: always - allow_failure: true artifacts: name: ${test_name} public: true @@ -258,7 +262,7 @@ test-filenotify-gio: make_params: "-k -C test autorevert-tests.log filenotify-tests.log" test-gnustep: - # This tests the GNUstep build process + # This tests the GNUstep build process. stage: platforms needs: [build-image-gnustep] extends: [.job-template, .gnustep-template] @@ -310,7 +314,7 @@ test-all-inotify: needs: [build-image-inotify] extends: [.job-template, .test-template] rules: - # note there's no "changes" section, so this always runs on a schedule + # Note there's no "changes" section, so this always runs on a schedule. - if: '$CI_PIPELINE_SOURCE == "web"' - if: '$CI_PIPELINE_SOURCE == "schedule"' variables: commit 8477d3b339218cd2092728b55ef49c242b32b4ed Author: Nikolay Kudryavtsev Date: Wed Sep 29 22:33:49 2021 +0300 Make checkdoc's docstring substitution consistent with other docs * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine): In error text, say "mapvar" instead of "keymap", and "command" instead of "function", to be consistent with the ELisp manual. (Bug#50903) diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 5ea2f59ee6..e03ddc4c66 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -254,7 +254,7 @@ with these words enabled." (defcustom checkdoc-max-keyref-before-warn nil "If non-nil, number of \\\\=[command-to-keystroke] tokens allowed in a doc string. Any more than this and a warning is generated suggesting that the construct -\\\\={keymap} be used instead. If the value is nil, never warn. +\\\\={mapvar} be used instead. If the value is nil, never warn. It used to not be practical to use `\\\\=[...]' very many times, because display of the documentation string would become slow. @@ -1626,7 +1626,7 @@ mouse-[0-3]\\)\\)\\>")) (checkdoc-create-error (concat "Keycode " (match-string 1) - " embedded in doc string. Use \\\\ & \\\\[function] " + " embedded in doc string. Use \\\\ & \\\\[command] " "instead") (match-beginning 1) (match-end 1) t)))) ;; Optionally warn about too many command substitutions. @@ -1636,7 +1636,7 @@ mouse-[0-3]\\)\\)\\>")) (1+ checkdoc-max-keyref-before-warn)) (not (re-search-forward "\\\\\\\\{\\w+}" e t))) (checkdoc-create-error - "Too many occurrences of \\[function]. Use \\{keymap} instead" + "Too many occurrences of \\[command]. Use \\{mapvar} instead" s (marker-position e))))) ;; Ambiguous quoted symbol. When a symbol is both bound and fbound, ;; and is referred to in documentation, it should be prefixed with commit 4f24dee67573832e55b8fced8a5ed71f7a5da774 Author: Mattias Engdegård Date: Thu Sep 30 17:22:29 2021 +0200 ; Mark cl-flet indentation test as failing (bug#9622) diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index a2bd1b8b27..bc94aaac1f 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -1096,6 +1096,7 @@ evaluation of BODY." (should (unintern "f-test4---")))) (ert-deftest test-cl-flet-indentation () + :expected-result :failed ; FIXME: bug#9622 (should (equal (with-temp-buffer (emacs-lisp-mode) commit 2075411edbad954c0fdf2aa141757d834a6708b7 Author: Mattias Engdegård Date: Thu Sep 30 17:13:12 2021 +0200 Fix regexp snags in org * lisp/org/org-element.el (org-element-citation-key-re): * lisp/org/ox-org.el (org-org-identity): Remove repeated chars in alternatives. * lisp/org/ob-java.el (org-babel-execute:java): Remove superfluous backslash. * lisp/org/ob-java.el (org-babel-java--main-re) (org-babel-java--any-method-re): Remove (0+ space) expressions subsumed by adjacent expressions. diff --git a/lisp/org/ob-java.el b/lisp/org/ob-java.el index 60ef33bc6e..dd3538743d 100644 --- a/lisp/org/ob-java.el +++ b/lisp/org/ob-java.el @@ -96,27 +96,29 @@ like javac -verbose." (group (1+ (in alnum ?_))) ; capture the class name (0+ space) ?{) "Regexp for the class declaration.") -(defconst org-babel-java--main-re (rx line-start (0+ space) "public" - (1+ space) "static" - (1+ space) "void" - (1+ space) "main" - (0+ space) ?\( - (0+ space) "String" - (0+ space) (1+ (in alnum ?_ ?\[ ?\] space)) ; "[] args" or "args[]" - (0+ space) ?\) - (0+ space) (opt "throws" (1+ (in alnum ?_ ?, ?. space))) - ?{) +(defconst org-babel-java--main-re + (rx line-start (0+ space) "public" + (1+ space) "static" + (1+ space) "void" + (1+ space) "main" + (0+ space) ?\( + (0+ space) "String" + (1+ (in alnum ?_ ?\[ ?\] space)) ; "[] args" or "args[]" + ?\) + (0+ space) (opt "throws" (1+ (in alnum ?_ ?, ?. space))) + ?{) "Regexp for the main method declaration.") -(defconst org-babel-java--any-method-re (rx line-start - (0+ space) (opt (seq (1+ alnum) (1+ space))) ; visibility - (opt (seq "static" (1+ space))) ; binding - (1+ (in alnum ?_ ?\[ ?\])) ; return type - (1+ space) (1+ (in alnum ?_)) ; method name - (0+ space) ?\( - (0+ space) (0+ (in alnum ?_ ?\[ ?\] ?, space)) ; params - (0+ space) ?\) - (0+ space) (opt "throws" (1+ (in alnum ?_ ?, ?. space))) - ?{) +(defconst org-babel-java--any-method-re + (rx line-start + (0+ space) (opt (seq (1+ alnum) (1+ space))) ; visibility + (opt (seq "static" (1+ space))) ; binding + (1+ (in alnum ?_ ?\[ ?\])) ; return type + (1+ space) (1+ (in alnum ?_)) ; method name + (0+ space) ?\( + (0+ (in alnum ?_ ?\[ ?\] ?, space)) ; params + ?\) + (0+ space) (opt "throws" (1+ (in alnum ?_ ?, ?. space))) + ?{) "Regexp for any method.") (defconst org-babel-java--result-wrapper "\n public static String __toString(Object val) { if (val instanceof String) { @@ -192,7 +194,7 @@ replaced in this string.") ;; the dir to write the source file (packagedir (if (and (not run-from-temp) packagename) (file-name-as-directory - (concat basedir (replace-regexp-in-string "\\\." "/" packagename))) + (concat basedir (replace-regexp-in-string "\\." "/" packagename))) basedir)) ;; the filename of the source file (src-file (concat packagedir classname ".java")) diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el index ed684df17b..f8334ccbc6 100644 --- a/lisp/org/org-element.el +++ b/lisp/org/org-element.el @@ -118,7 +118,7 @@ ;; to current setup. (defconst org-element-citation-key-re - (rx "@" (group (one-or-more (any word "-.:?!`'/*@+|(){}<>&_^$#%&~")))) + (rx "@" (group (one-or-more (any word "-.:?!`'/*@+|(){}<>&_^$#%~")))) "Regexp matching a citation key. Key is located in match group 1.") diff --git a/lisp/org/ox-org.el b/lisp/org/ox-org.el index 11d9c09ebf..fcf876854f 100644 --- a/lisp/org/ox-org.el +++ b/lisp/org/ox-org.el @@ -141,7 +141,7 @@ CONTENTS and INFO are ignored." CONTENTS is its contents, as a string or nil. INFO is ignored." (let ((case-fold-search t)) (replace-regexp-in-string - "^[ \t]*#\\+attr_[-_a-za-z0-9]+:\\(?: .*\\)?\n" "" + "^[ \t]*#\\+attr_[-_a-z0-9]+:\\(?: .*\\)?\n" "" (org-export-expand blob contents t)))) (defun org-org-headline (headline contents info) commit 58102466e32d4dd9c7d816cdc3f4595a2145f332 Author: Mattias Engdegård Date: Thu Sep 30 17:10:41 2021 +0200 org-element: use correct function * lisp/org/org-element.el (org-element-headline-parser): Pretty sure this one should be `skip-chars-backward`, not `skip-syntax-backward`, since \t isn't a valid syntax code. diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el index 1c971b2f8a..ed684df17b 100644 --- a/lisp/org/org-element.el +++ b/lisp/org/org-element.el @@ -1024,7 +1024,7 @@ Assume point is at beginning of the headline." (title-start (prog1 (point) (unless (or todo priority commentedp) ;; Headline like "* :tag:" - (skip-syntax-backward " \t")))) + (skip-chars-backward " \t")))) (tags (when (re-search-forward "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$" (line-end-position) commit 6374943581830937c7404c06bd873901a8896300 Author: Mattias Engdegård Date: Thu Sep 30 17:08:46 2021 +0200 ; * test/lisp/emacs-lisp/bytecomp-tests.el: remove ineffective \ diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 448c7be621..a6e224b3d2 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -1484,7 +1484,7 @@ INFO INFO-CALLBACK &optional PROGRESS-CALLBACK)" fill-column)) \(fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] \ [:tags \\='(TAG...)] BODY...)" fill-column)) (should-not (byte-compile--wide-docstring-p "\ -(make-soap-xs-element &key NAME NAMESPACE-TAG ID TYPE^ OPTIONAL\? MULTIPLE\? \ +(make-soap-xs-element &key NAME NAMESPACE-TAG ID TYPE^ OPTIONAL? MULTIPLE? \ REFERENCE SUBSTITUTION-GROUP ALTERNATIVES IS-GROUP)" fill-column)) (should-not (byte-compile--wide-docstring-p "\ (fn NAME FIXTURE INPUT &key SKIP-PAIR-STRING EXPECTED-STRING \ commit 41723a329e5dc7e6d0c0bf07add8852bffcc8f81 Author: Mattias Engdegård Date: Thu Sep 30 15:14:05 2021 +0200 Revert "Indent bodies of local function definitions properly in elisp-mode" This reverts commit 38037e04cb05cb1f2b604f0b1602d36b0bcf6985. diff --git a/etc/NEWS b/etc/NEWS index 36ad63e0f3..b9f5830656 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3294,14 +3294,6 @@ file: (add-hook 'foo-mode-hook (lambda () (auto-fill-mode -1)) ---- -** Indentation of 'cl-flet' and 'cl-labels' has changed. -These forms now indent like this: - - (cl-flet ((bla (x) - (* x x))) - (bla 42)) - * Incompatible Lisp Changes in Emacs 28.1 diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 7ce857e990..eac3c03cd1 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -29,7 +29,6 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) -(eval-when-compile (require 'subr-x)) (defvar font-lock-comment-face) (defvar font-lock-doc-face) @@ -1106,27 +1105,6 @@ is the buffer position of the start of the containing expression." (t normal-indent)))))) -(defun lisp--local-defform-body (state) - "Return non-nil if at local definition body according to STATE. -STATE is the `parse-partial-sexp' state for current position." - (when-let ((start-of-innermost-containing-list (nth 1 state))) - (let* ((parents (nth 9 state)) - (second-cons-after (cddr parents)) - second-order-parent) - (while second-cons-after - (when (= start-of-innermost-containing-list - (car second-cons-after)) - (setq second-order-parent (car parents) - ;; Leave the loop. - second-cons-after nil)) - (pop second-cons-after) - (pop parents)) - (and second-order-parent - (save-excursion - (goto-char (1+ second-order-parent)) - (memq (read (current-buffer)) - '(cl-flet cl-labels))))))) - (defun lisp-indent-function (indent-point state) "This function is the normal value of the variable `lisp-indent-function'. The function `calculate-lisp-indent' calls this to determine @@ -1160,17 +1138,16 @@ Lisp function does not specify a special indentation." (if (and (elt state 2) (not (looking-at "\\sw\\|\\s_"))) ;; car of form doesn't seem to be a symbol - (if (lisp--local-defform-body state) - (lisp-indent-defform state indent-point) + (progn (if (not (> (save-excursion (forward-line 1) (point)) calculate-lisp-indent-last-sexp)) - (progn (goto-char calculate-lisp-indent-last-sexp) - (beginning-of-line) - (parse-partial-sexp (point) - calculate-lisp-indent-last-sexp 0 t))) - ;; Indent under the list or under the first sexp on the same - ;; line as calculate-lisp-indent-last-sexp. Note that first - ;; thing on that line has to be complete sexp since we are + (progn (goto-char calculate-lisp-indent-last-sexp) + (beginning-of-line) + (parse-partial-sexp (point) + calculate-lisp-indent-last-sexp 0 t))) + ;; Indent under the list or under the first sexp on the same + ;; line as calculate-lisp-indent-last-sexp. Note that first + ;; thing on that line has to be complete sexp since we are ;; inside the innermost containing sexp. (backward-prefix-chars) (current-column)) @@ -1183,15 +1160,13 @@ Lisp function does not specify a special indentation." (cond ((or (eq method 'defun) (and (null method) (> (length function) 3) - (string-match "\\`def" function)) - ;; Check whether we are in flet or labels. - (lisp--local-defform-body state)) + (string-match "\\`def" function))) (lisp-indent-defform state indent-point)) ((integerp method) (lisp-indent-specform method state indent-point normal-indent)) (method - (funcall method indent-point state))))))) + (funcall method indent-point state))))))) (defcustom lisp-body-indent 2 "Number of columns to indent the second line of a `(def...)' form." commit be493ea67acdc9367e29025382b534ec4339302f Author: Mattias Engdegård Date: Thu Sep 30 15:13:52 2021 +0200 Revert "Fix regressions in cl-flet indentation" This reverts commit c42af5aee74f310bdcd63aac96b1c02ec07a1c50. diff --git a/etc/NEWS b/etc/NEWS index 8b601c0a2d..36ad63e0f3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3302,9 +3302,6 @@ These forms now indent like this: (* x x))) (bla 42)) -This change also affects 'cl-macrolet', 'cl-flet*' and -'cl-symbol-macrolet'. - * Incompatible Lisp Changes in Emacs 28.1 diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index cd054801bc..7ce857e990 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1106,8 +1106,8 @@ is the buffer position of the start of the containing expression." (t normal-indent)))))) -(defun lisp--local-defform-body-p (state) - "Return non-nil when at local definition body according to STATE. +(defun lisp--local-defform-body (state) + "Return non-nil if at local definition body according to STATE. STATE is the `parse-partial-sexp' state for current position." (when-let ((start-of-innermost-containing-list (nth 1 state))) (let* ((parents (nth 9 state)) @@ -1121,42 +1121,11 @@ STATE is the `parse-partial-sexp' state for current position." second-cons-after nil)) (pop second-cons-after) (pop parents)) - (when second-order-parent - (save-excursion - (goto-char (1+ second-order-parent)) - (and (memq (read (current-buffer)) - '( cl-flet cl-labels cl-macrolet cl-flet* - cl-symbol-macrolet)) - ;; Now we must check that we are - ;; in the second element of the flet-like form. - ;; It would be easier if `parse-partial-sexp' also recorded - ;; relative positions of subsexps in supersexps - ;; but it doesn't so we check manually. - ;; - ;; First, we must be looking at list now. - (ignore-errors (when (= (scan-lists (point) 1 0) - (scan-sexps (point) 1)) - ;; Looking at list; descend into it: - (down-list 1) - t)) - ;; In Wishful Lisp, the following form would be - ;; (cl-member start-of-innermost-containing-list - ;; (points-at-beginning-of-lists-at-this-level) - ;; :test #'=) - (cl-loop - with pos = (ignore-errors - ;; The first local definition may be indented - ;; with whitespace following open paren. - (goto-char (scan-lists (point) 1 0)) - (goto-char (scan-lists (point) -1 0)) - (point)) - while pos - do (if (= start-of-innermost-containing-list pos) - (cl-return t) - (setq pos (ignore-errors - (goto-char (scan-lists (point) 2 0)) - (goto-char (scan-lists (point) -1 0)) - (point))))))))))) + (and second-order-parent + (save-excursion + (goto-char (1+ second-order-parent)) + (memq (read (current-buffer)) + '(cl-flet cl-labels))))))) (defun lisp-indent-function (indent-point state) "This function is the normal value of the variable `lisp-indent-function'. @@ -1191,9 +1160,7 @@ Lisp function does not specify a special indentation." (if (and (elt state 2) (not (looking-at "\\sw\\|\\s_"))) ;; car of form doesn't seem to be a symbol - (if (lisp--local-defform-body-p state) - ;; We nevertheless check whether we are in flet-like form - ;; as we presume local function names could be non-symbols. + (if (lisp--local-defform-body state) (lisp-indent-defform state indent-point) (if (not (> (save-excursion (forward-line 1) (point)) calculate-lisp-indent-last-sexp)) @@ -1217,8 +1184,8 @@ Lisp function does not specify a special indentation." (and (null method) (> (length function) 3) (string-match "\\`def" function)) - ;; Check whether we are in flet-like form. - (lisp--local-defform-body-p state)) + ;; Check whether we are in flet or labels. + (lisp--local-defform-body state)) (lisp-indent-defform state indent-point)) ((integerp method) (lisp-indent-specform method state commit a1789fd67b2dd67d891b6c7181aee885a9ab9447 Author: Philip Kaludercic Date: Thu Sep 30 16:25:48 2021 +0200 Add rcirc-omit-unless-requested option * doc/misc/rcirc.texi (Notices): Update documentation * lisp/net/rcirc.el (rcirc-pending-requests): Add local variable (rcirc-omit-unless-requested): Add user option (rcirc-print): Respect rcirc-omit-unless-requested (rcirc-define-command): Update rcirc-pending-requests diff --git a/doc/misc/rcirc.texi b/doc/misc/rcirc.texi index 20971293ed..a4ca54a8b0 100644 --- a/doc/misc/rcirc.texi +++ b/doc/misc/rcirc.texi @@ -823,6 +823,19 @@ active and only omits a message if the nick has not been active. The window @code{rcirc} considers is controlled by the @code{rcirc-omit-threshold} variable. +@vindex rcirc-omit-unless-requested +Certain messages can be omitted by default, unless the user manual +requests them. For example, if you don't want to display @code{TOPIC} +and @code{NAMES} messages, after reconnecting, you can configure +@code{rcirc-omit-unless-requested} to hide: + +@example +(setq rcirc-omit-unless-requested '("TOPIC" "NAMES")) +@end example + +Now NAMES will only be displayed, after it has been requested via the +@code{rcirc-cmd-name} command. + @node Hacking and Tweaking @chapter Hacking and Tweaking @cindex hacking and tweaking diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index ba7fbbf6b7..c18748ae09 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -190,6 +190,19 @@ If nil, no maximum is applied." (defvar-local rcirc-low-priority-flag nil "Non-nil means activity in this buffer is considered low priority.") +(defvar-local rcirc-pending-requests '() + "List of pending requests. +See `rcirc-omit-unless-requested'.") + +(defcustom rcirc-omit-unless-requested '() + "List of commands to only be requested if preceded by a command. +For example, if \"TOPIC\" is added to this list, TOPIC commands +will only be displayed if `rcirc-cmd-TOPIC' was previously +invoked. Commands will only be hidden if `rcirc-omit-mode' is +enabled." + :version "28.1" + :type '(repeat string)) + (defcustom rcirc-omit-responses '("JOIN" "PART" "QUIT" "NICK") "Responses which will be hidden when `rcirc-omit-mode' is enabled." @@ -1958,9 +1971,15 @@ connection." ;; make text omittable (let ((last-activity-lines (rcirc-elapsed-lines process sender target))) (if (and (not (string= (rcirc-nick process) sender)) - (member response rcirc-omit-responses) - (or (not last-activity-lines) - (< rcirc-omit-threshold last-activity-lines))) + (or (member response rcirc-omit-responses) + (and (member response rcirc-omit-unless-requested) + (if (member response rcirc-pending-requests) + (ignore (setq rcirc-pending-requests + (delete response rcirc-pending-requests))) + t))) + (or (member response rcirc-omit-unless-requested) + (not last-activity-lines) + (< rcirc-omit-threshold last-activity-lines))) (put-text-property (point-min) (point-max) 'invisible 'rcirc-omit) ;; otherwise increment the line count @@ -2569,6 +2588,7 @@ that, an interactive form can specified." (<= ,required (length ,argument) ,total) (string-match ,regexp ,argument)) (user-error "Malformed input (%s): %S" ',command ,argument)) + (push ,(upcase (symbol-name command)) rcirc-pending-requests) (let ((process (or process (rcirc-buffer-process))) (target (or target rcirc-target))) (ignore target process) commit b5e3cc3bc597d56dfe09ee500717344649ea0354 Author: Stefan Monnier Date: Thu Sep 30 10:02:29 2021 -0400 * lisp/org/ob-julia.el: Use lexical-binding (ess-eval-visibly-p): Declare. (org-babel-julia-assign-elisp): Remove unused vars `header` and `row-names` and corespondingly remove now unused args `colnames-p` and `rownames-p`. (org-babel-variable-assignments:julia): Adjust call to `org-babel-julia-assign-elisp` accordingly. (org-babel-julia-initiate-session): Use `bound-and-true-p`. (org-babel-julia-evaluate-external-process) (org-babel-julia-evaluate-session, org-babel-julia-evaluate): Remove unused arg `row-names-p`. (org-babel-execute:julia): Adjust call to `org-babel-julia-evaluate` accordingly. diff --git a/lisp/org/ob-julia.el b/lisp/org/ob-julia.el index 2f051a5c2b..5ff6a7ca0a 100644 --- a/lisp/org/ob-julia.el +++ b/lisp/org/ob-julia.el @@ -1,4 +1,4 @@ -;;; ob-julia.el --- org-babel functions for julia code evaluation +;;; ob-julia.el --- org-babel functions for julia code evaluation -*- lexical-binding: t; -*- ;; Copyright (C) 2013-2021 Free Software Foundation, Inc. ;; Authors: G. Jay Kerns, based on ob-R.el by Eric Schulte and Dan Davison @@ -44,7 +44,7 @@ (raw org html latex code pp wrap) (replace silent append prepend) (output value graphics)))) - "julia-specific header arguments.") + "Julia-specific header arguments.") (add-to-list 'org-babel-tangle-lang-exts '("julia" . "jl")) @@ -58,7 +58,8 @@ :type 'string) (defvar ess-current-process-name) ; dynamically scoped -(defvar ess-local-process-name) ; dynamically scoped +(defvar ess-local-process-name) ; dynamically scoped +(defvar ess-eval-visibly-p) ; dynamically scoped (defun org-babel-edit-prep:julia (info) (let ((session (cdr (assq :session (nth 2 info))))) (when (and session @@ -68,7 +69,7 @@ (defun org-babel-expand-body:julia (body params &optional _graphics-file) "Expand BODY according to PARAMS, return the expanded body." - (mapconcat 'identity + (mapconcat #'identity (append (when (cdr (assq :prologue params)) (list (cdr (assq :prologue params)))) @@ -89,7 +90,7 @@ This function is called by `org-babel-execute-src-block'." (graphics-file (and (member "graphics" (assq :result-params params)) (org-babel-graphical-output-file params))) (colnames-p (unless graphics-file (cdr (assq :colnames params)))) - (rownames-p (unless graphics-file (cdr (assq :rownames params)))) + ;; (rownames-p (unless graphics-file (cdr (assq :rownames params)))) (full-body (org-babel-expand-body:julia body params graphics-file)) (result (org-babel-julia-evaluate @@ -97,9 +98,10 @@ This function is called by `org-babel-execute-src-block'." (or (equal "yes" colnames-p) (org-babel-pick-name (cdr (assq :colname-names params)) colnames-p)) - (or (equal "yes" rownames-p) - (org-babel-pick-name - (cdr (assq :rowname-names params)) rownames-p))))) + ;; (or (equal "yes" rownames-p) + ;; (org-babel-pick-name + ;; (cdr (assq :rowname-names params)) rownames-p)) + ))) (if graphics-file nil result)))) (defun org-babel-normalize-newline (result) @@ -136,8 +138,9 @@ This function is called by `org-babel-execute-src-block'." (lambda (pair) (org-babel-julia-assign-elisp (car pair) (cdr pair) - (equal "yes" (cdr (assq :colnames params))) - (equal "yes" (cdr (assq :rownames params))))) + ;; (equal "yes" (cdr (assq :colnames params))) + ;; (equal "yes" (cdr (assq :rownames params))) + )) (mapcar (lambda (i) (cons (car (nth i vars)) @@ -150,21 +153,22 @@ This function is called by `org-babel-execute-src-block'." (defun org-babel-julia-quote-csv-field (s) "Quote field S for export to julia." (if (stringp s) - (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\"") + (concat "\"" (mapconcat #'identity (split-string s "\"") "\"\"") "\"") (format "%S" s))) -(defun org-babel-julia-assign-elisp (name value colnames-p rownames-p) +(defun org-babel-julia-assign-elisp (name value) ;; colnames-p rownames-p "Construct julia code assigning the elisp VALUE to a variable named NAME." (if (listp value) - (let* ((lengths (mapcar 'length (cl-remove-if-not 'sequencep value))) - (max (if lengths (apply 'max lengths) 0)) - (min (if lengths (apply 'min lengths) 0))) + (let* ((lengths (mapcar #'length (cl-remove-if-not #'sequencep value))) + (max (if lengths (apply #'max lengths) 0)) + (min (if lengths (apply #'min lengths) 0))) ;; Ensure VALUE has an orgtbl structure (depth of at least 2). (unless (listp (car value)) (setq value (list value))) (let ((file (orgtbl-to-csv value '(:fmt org-babel-julia-quote-csv-field))) - (header (if (or (eq (nth 1 value) 'hline) colnames-p) - "TRUE" "FALSE")) - (row-names (if rownames-p "1" "NULL"))) + ;; (header (if (or (eq (nth 1 value) 'hline) colnames-p) + ;; "TRUE" "FALSE")) + ;; (row-names (if rownames-p "1" "NULL")) + ) (if (= max min) (format "%s = begin using CSV @@ -183,11 +187,15 @@ end" (unless (string= session "none") (let ((session (or session "*Julia*")) (ess-ask-for-ess-directory - (and (boundp 'ess-ask-for-ess-directory) - ess-ask-for-ess-directory + (and (bound-and-true-p ess-ask-for-ess-directory) (not (cdr (assq :dir params)))))) (if (org-babel-comint-buffer-livep session) session + ;; FIXME: Depending on `display-buffer-alist', (julia) may end up + ;; popping up a new frame which `save-window-excursion' won't be able + ;; to "undo", so we really should call a kind of + ;; `julia-no-select' instead so we don't need to undo any + ;; window-changes afterwards. (save-window-excursion (when (get-buffer session) ;; Session buffer exists, but with dead process @@ -251,16 +259,16 @@ end" end") (defun org-babel-julia-evaluate - (session body result-type result-params column-names-p row-names-p) + (session body result-type result-params column-names-p) ;; row-names-p "Evaluate julia code in BODY." (if session (org-babel-julia-evaluate-session - session body result-type result-params column-names-p row-names-p) + session body result-type result-params column-names-p) ;; row-names-p (org-babel-julia-evaluate-external-process - body result-type result-params column-names-p row-names-p))) + body result-type result-params column-names-p))) ;; row-names-p (defun org-babel-julia-evaluate-external-process - (body result-type result-params column-names-p row-names-p) + (body result-type result-params column-names-p) ;; row-names-p "Evaluate BODY in external julia process. If RESULT-TYPE equals 'output then return standard output as a string. If RESULT-TYPE equals 'value then return the value of the @@ -284,7 +292,7 @@ last statement in BODY, as elisp." (output (org-babel-eval org-babel-julia-command body)))) (defun org-babel-julia-evaluate-session - (session body result-type result-params column-names-p row-names-p) + (session body result-type result-params column-names-p) ;; row-names-p "Evaluate BODY in SESSION. If RESULT-TYPE equals 'output then return standard output as a string. If RESULT-TYPE equals 'value then return the value of the @@ -314,7 +322,7 @@ last statement in BODY, as elisp." column-names-p))) (output (mapconcat - 'org-babel-chomp + #'org-babel-chomp (butlast (delq nil (mapcar @@ -327,13 +335,14 @@ last statement in BODY, as elisp." (substring line (match-end 1)) line)) (org-babel-comint-with-output (session org-babel-julia-eoe-output) - (insert (mapconcat 'org-babel-chomp + (insert (mapconcat #'org-babel-chomp (list body org-babel-julia-eoe-indicator) "\n")) - (inferior-ess-send-input)))))) "\n")))) + (inferior-ess-send-input)))))) + "\n")))) (defun org-babel-julia-process-value-result (result column-names-p) - "julia-specific processing of return value. + "Julia-specific processing of return value. Insert hline if column names in output have been requested." (if column-names-p (cons (car result) (cons 'hline (cdr result))) commit a5b761ec334cded8252e81c3887142a46752ec6a Author: Stefan Monnier Date: Thu Sep 30 09:58:04 2021 -0400 * lisp/org/ox-koma-letter.el: Use lexical-binding And remove redundant `:group` args. diff --git a/lisp/org/ox-koma-letter.el b/lisp/org/ox-koma-letter.el index 3bd2f684a6..96704dbb98 100644 --- a/lisp/org/ox-koma-letter.el +++ b/lisp/org/ox-koma-letter.el @@ -1,4 +1,4 @@ -;;; ox-koma-letter.el --- KOMA Scrlttr2 Back-End for Org Export Engine +;;; ox-koma-letter.el --- KOMA Scrlttr2 Back-End for Org Export Engine -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. @@ -184,7 +184,6 @@ (defcustom org-koma-letter-class-option-file "NF" "Letter Class Option File. This option can also be set with the LCO keyword." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-author 'user-full-name @@ -196,7 +195,6 @@ Alternatively a string, nil or a function may be given. Functions must return a string. This option can also be set with the AUTHOR keyword." - :group 'org-export-koma-letter :type '(radio (function-item user-full-name) (string) (function) @@ -210,7 +208,6 @@ returns `user-mail-address'. Alternatively a string, nil or a function may be given. Functions must return a string. This option can also be set with the EMAIL keyword." - :group 'org-export-koma-letter :type '(radio (function-item org-koma-letter-email) (string) (function) @@ -220,33 +217,28 @@ This option can also be set with the EMAIL keyword." "Sender's address, as a string. This option can also be set with one or more FROM_ADDRESS keywords." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-phone-number "" "Sender's phone number, as a string. This option can also be set with the PHONE_NUMBER keyword." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-url "" "Sender's URL, e. g., the URL of her homepage. This option can also be set with the URL keyword." - :group 'org-export-koma-letter :type 'string :safe #'stringp) (defcustom org-koma-letter-from-logo "" "Commands for inserting the sender's logo, e. g., \\includegraphics{logo}. This option can also be set with the FROM_LOGO keyword." - :group 'org-export-koma-letter :type 'string :safe #'stringp) (defcustom org-koma-letter-place "" "Place from which the letter is sent, as a string. This option can also be set with the PLACE keyword." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-location "" @@ -264,7 +256,6 @@ special heading. The location field is typically printed right of the address field (See Figure 4.9. in the English manual of 2015-10-03)." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-opening "" @@ -278,7 +269,6 @@ when: (3) the letter contains a headline without a special tag (e.g. \"to\" or \"ps\"); then the opening will be implicitly set as the untagged headline title." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-closing "" @@ -292,7 +282,6 @@ when: tag \"closing\"; then the opening will be set as the title of the closing special heading title." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-signature "" @@ -308,14 +297,12 @@ then the signature will be set as the content of the closing special heading. Note if the content is empty the signature will not be set." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-prefer-special-headings nil "Non-nil means prefer headlines over keywords for TO and FROM. This option can also be set with the OPTIONS keyword, e.g.: \"special-headings:t\"." - :group 'org-export-koma-letter :type 'boolean) (defcustom org-koma-letter-subject-format t @@ -353,14 +340,12 @@ This option can also be set with the OPTIONS keyword, e.g.: (const :tag "Subject right-justified" right) (const :tag "Add title or description to subject" underlined) (const :tag "Set subject underlined" titled) - (const :tag "Do not add title or description to subject" untitled))) - :group 'org-export-koma-letter) + (const :tag "Do not add title or description to subject" untitled)))) (defcustom org-koma-letter-use-backaddress nil "Non-nil prints return address in line above to address. This option can also be set with the OPTIONS keyword, e.g.: \"backaddress:t\"." - :group 'org-export-koma-letter :type 'boolean) (defcustom org-koma-letter-use-foldmarks t @@ -393,7 +378,6 @@ following ones: This option can also be set with the OPTIONS keyword, e.g.: \"foldmarks:(b l m t)\"." - :group 'org-export-koma-letter :type '(choice (const :tag "Activate default folding marks" t) (const :tag "Deactivate folding marks" nil) @@ -418,14 +402,12 @@ This option can also be set with the OPTIONS keyword, e.g.: "Non-nil prints sender's phone number. This option can also be set with the OPTIONS keyword, e.g.: \"phone:t\"." - :group 'org-export-koma-letter :type 'boolean) (defcustom org-koma-letter-use-url nil "Non-nil prints sender's URL. This option can also be set with the OPTIONS keyword, e.g.: \"url:t\"." - :group 'org-export-koma-letter :type 'boolean :safe #'booleanp) @@ -433,7 +415,6 @@ This option can also be set with the OPTIONS keyword, e.g.: "Non-nil prints sender's FROM_LOGO. This option can also be set with the OPTIONS keyword, e.g.: \"from-logo:t\"." - :group 'org-export-koma-letter :type 'boolean :safe #'booleanp) @@ -441,34 +422,29 @@ This option can also be set with the OPTIONS keyword, e.g.: "Non-nil prints sender's email address. This option can also be set with the OPTIONS keyword, e.g.: \"email:t\"." - :group 'org-export-koma-letter :type 'boolean) (defcustom org-koma-letter-use-place t "Non-nil prints the letter's place next to the date. This option can also be set with the OPTIONS keyword, e.g.: \"place:nil\"." - :group 'org-export-koma-letter :type 'boolean) (defcustom org-koma-letter-default-class "default-koma-letter" "Default class for `org-koma-letter'. The value must be a member of `org-latex-classes'." - :group 'org-export-koma-letter :type 'string) (defcustom org-koma-letter-headline-is-opening-maybe t "Non-nil means a headline may be used as an opening and closing. See also `org-koma-letter-opening' and `org-koma-letter-closing'." - :group 'org-export-koma-letter :type 'boolean) (defcustom org-koma-letter-prefer-subject nil "Non-nil means title should be interpreted as subject if subject is missing. This option can also be set with the OPTIONS keyword, e.g. \"title-subject:t\"." - :group 'org-export-koma-letter :type 'boolean) (defconst org-koma-letter-special-tags-in-letter '(to from closing location) commit 6e3017d7de707cef8682f7f8d9b754db1c1db40a Author: Eli Zaretskii Date: Thu Sep 30 14:32:58 2021 +0300 Fix a recent change of 'undo-redo' binding * lisp/bindings.el (global-map): Fix the binding of 'undo-redo'. (Bug#50911) diff --git a/lisp/bindings.el b/lisp/bindings.el index ded5e27dbd..1cd22167c5 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -994,7 +994,7 @@ if `inhibit-field-text-motion' is non-nil." "Keymap to repeat undo key sequences `C-x u u'. Used in `repeat-mode'.") (put 'undo 'repeat-map 'undo-repeat-map) -(define-key global-map "\C-?" 'undo-redo) +(define-key global-map '[(control ??)] 'undo-redo) (define-key global-map [?\C-\M-_] 'undo-redo) (define-key esc-map "!" 'shell-command) commit b9464a92376573e41e8134d225dbdc8ee2847aaf Merge: c006286780 164aac0a99 Author: Eli Zaretskii Date: Thu Sep 30 13:26:50 2021 +0300 Merge Org 9.5 from branch 'origin/scratch/org-sync'. commit c0062867803f9f120272fb2efbb9c5b25b89fff3 Author: Mattias Engdegård Date: Thu Sep 30 10:56:26 2021 +0200 ; * src/nsterm.h: Use objc-mode. diff --git a/src/nsterm.h b/src/nsterm.h index 8cbc663651..46733e6949 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -1,3 +1,4 @@ +/* -*- objc -*- */ /* Definitions and headers for communication with NeXT/Open/GNUstep API. Copyright (C) 1989, 1993, 2005, 2008-2021 Free Software Foundation, Inc. commit a20e013d56fc6ab6e63fea84e48af873cb1cf1c9 Author: Juri Linkov Date: Thu Sep 30 10:04:20 2021 +0300 ; * lisp/help.el (help--analyze-key): Add comment. diff --git a/lisp/help.el b/lisp/help.el index 02e9b9e8e4..eaca33795a 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -695,6 +695,10 @@ Returns a list of the form (BRIEF-DESC DEFN EVENT MOUSE-MSG)." (mouse-msg (if (or (memq 'click modifiers) (memq 'down modifiers) (memq 'drag modifiers)) " at that spot" "")) + ;; Use mouse-set-point to handle the case when a menu item + ;; is selected from the context menu that should describe KEY + ;; at the position of mouse click that opened the context menu. + ;; When no mouse was involved, it defaults to window-point. (defn (save-excursion (mouse-set-point event) (key-binding key t)))) ;; Handle the case where we faked an entry in "Select and Paste" menu. (when (and (eq defn nil) commit ad27c4c66344f2a61bee8fbf2db3bf721894e38f Author: Lars Ingebrigtsen Date: Thu Sep 30 09:04:11 2021 +0200 Fix previous `newline' patch * lisp/simple.el (newline): Signal an error earlier to avoid peculiar behaviour after getting a backtrace (bug#50900). diff --git a/lisp/simple.el b/lisp/simple.el index 11a6a4f1fd..3695415163 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -589,7 +589,8 @@ text-property `hard'. A non-nil INTERACTIVE argument means to run the `post-self-insert-hook'." (interactive "*P\np") (barf-if-buffer-read-only) - (when (< arg 0) + (when (and arg + (< arg 0)) (error "Repetition argument has to be non-negative")) ;; Call self-insert so that auto-fill, abbrev expansion etc. happen. ;; Set last-command-event to tell self-insert what to insert. commit d1aacceae939318f419e0c265358e041c53f1eea Author: Lars Ingebrigtsen Date: Thu Sep 30 09:03:18 2021 +0200 Make `newline' check the argument earlier * lisp/simple.el (newline): Signal an error earlier to avoid peculiar behaviour after getting a backtrace (bug#50900). diff --git a/lisp/simple.el b/lisp/simple.el index 7eba33116d..11a6a4f1fd 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -589,6 +589,8 @@ text-property `hard'. A non-nil INTERACTIVE argument means to run the `post-self-insert-hook'." (interactive "*P\np") (barf-if-buffer-read-only) + (when (< arg 0) + (error "Repetition argument has to be non-negative")) ;; Call self-insert so that auto-fill, abbrev expansion etc. happen. ;; Set last-command-event to tell self-insert what to insert. (let* ((was-page-start (and (bolp) (looking-at page-delimiter))) commit c42af5aee74f310bdcd63aac96b1c02ec07a1c50 Author: akater Date: Thu Sep 30 08:33:14 2021 +0200 Fix regressions in cl-flet indentation * lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p): Rename (from -p-less form) and fix indentation regression introduced by 38037e04cb05cb1f2b604f0b1602d36b0bcf6985 (bug#9622). Also add cl-macrolet cl-flet* cl-symbol-macrolet. diff --git a/etc/NEWS b/etc/NEWS index c75ec35ff1..a5c61e8b2e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3298,6 +3298,9 @@ These forms now indent like this: (* x x))) (bla 42)) +This change also affects 'cl-macrolet', 'cl-flet*' and +'cl-symbol-macrolet'. + * Incompatible Lisp Changes in Emacs 28.1 diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 7ce857e990..cd054801bc 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1106,8 +1106,8 @@ is the buffer position of the start of the containing expression." (t normal-indent)))))) -(defun lisp--local-defform-body (state) - "Return non-nil if at local definition body according to STATE. +(defun lisp--local-defform-body-p (state) + "Return non-nil when at local definition body according to STATE. STATE is the `parse-partial-sexp' state for current position." (when-let ((start-of-innermost-containing-list (nth 1 state))) (let* ((parents (nth 9 state)) @@ -1121,11 +1121,42 @@ STATE is the `parse-partial-sexp' state for current position." second-cons-after nil)) (pop second-cons-after) (pop parents)) - (and second-order-parent - (save-excursion - (goto-char (1+ second-order-parent)) - (memq (read (current-buffer)) - '(cl-flet cl-labels))))))) + (when second-order-parent + (save-excursion + (goto-char (1+ second-order-parent)) + (and (memq (read (current-buffer)) + '( cl-flet cl-labels cl-macrolet cl-flet* + cl-symbol-macrolet)) + ;; Now we must check that we are + ;; in the second element of the flet-like form. + ;; It would be easier if `parse-partial-sexp' also recorded + ;; relative positions of subsexps in supersexps + ;; but it doesn't so we check manually. + ;; + ;; First, we must be looking at list now. + (ignore-errors (when (= (scan-lists (point) 1 0) + (scan-sexps (point) 1)) + ;; Looking at list; descend into it: + (down-list 1) + t)) + ;; In Wishful Lisp, the following form would be + ;; (cl-member start-of-innermost-containing-list + ;; (points-at-beginning-of-lists-at-this-level) + ;; :test #'=) + (cl-loop + with pos = (ignore-errors + ;; The first local definition may be indented + ;; with whitespace following open paren. + (goto-char (scan-lists (point) 1 0)) + (goto-char (scan-lists (point) -1 0)) + (point)) + while pos + do (if (= start-of-innermost-containing-list pos) + (cl-return t) + (setq pos (ignore-errors + (goto-char (scan-lists (point) 2 0)) + (goto-char (scan-lists (point) -1 0)) + (point))))))))))) (defun lisp-indent-function (indent-point state) "This function is the normal value of the variable `lisp-indent-function'. @@ -1160,7 +1191,9 @@ Lisp function does not specify a special indentation." (if (and (elt state 2) (not (looking-at "\\sw\\|\\s_"))) ;; car of form doesn't seem to be a symbol - (if (lisp--local-defform-body state) + (if (lisp--local-defform-body-p state) + ;; We nevertheless check whether we are in flet-like form + ;; as we presume local function names could be non-symbols. (lisp-indent-defform state indent-point) (if (not (> (save-excursion (forward-line 1) (point)) calculate-lisp-indent-last-sexp)) @@ -1184,8 +1217,8 @@ Lisp function does not specify a special indentation." (and (null method) (> (length function) 3) (string-match "\\`def" function)) - ;; Check whether we are in flet or labels. - (lisp--local-defform-body state)) + ;; Check whether we are in flet-like form. + (lisp--local-defform-body-p state)) (lisp-indent-defform state indent-point)) ((integerp method) (lisp-indent-specform method state commit d94ab4949cdfda67cbd0d1aad9cadb030038b2b2 Author: dickmao Date: Thu Sep 30 06:59:10 2021 +0200 Fix bootstrap after recent undo-redo change * lisp/bindings.el (global-map): Don't use `kbd' here -- it breaks bootstrap (bug#50911). diff --git a/lisp/bindings.el b/lisp/bindings.el index 9a3505058c..ded5e27dbd 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -994,7 +994,7 @@ if `inhibit-field-text-motion' is non-nil." "Keymap to repeat undo key sequences `C-x u u'. Used in `repeat-mode'.") (put 'undo 'repeat-map 'undo-repeat-map) -(define-key global-map (kbd "C-?") 'undo-redo) +(define-key global-map "\C-?" 'undo-redo) (define-key global-map [?\C-\M-_] 'undo-redo) (define-key esc-map "!" 'shell-command) commit 164aac0a9919fb34896ddd824394a65802343a50 (refs/remotes/origin/scratch/org-sync) Author: Kyle Meyer Date: Wed Sep 29 20:42:46 2021 -0400 * etc/NEWS: Announce Org update. diff --git a/etc/NEWS b/etc/NEWS index c75ec35ff1..36ad63e0f3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1257,6 +1257,10 @@ during I-search by using their 'isearch-motion' property. The option 'isearch-motion-changes-direction' controls whether the direction of the search changes after a motion command. ++++ +** Emacs 28.1 comes with Org v9.5. +See the file ORG-NEWS for user-visible changes in Org. + ** Outline +++ commit bf9ec3d91a79414deac039f7bf83352a9b0a9a85 Author: Kyle Meyer Date: Wed Sep 29 18:48:59 2021 -0400 Update to Org 9.5 diff --git a/doc/misc/org.org b/doc/misc/org.org index f072b5e00e..7b1277c7a2 100644 --- a/doc/misc/org.org +++ b/doc/misc/org.org @@ -82,11 +82,8 @@ probably do not need to install it. Most users will simply activate Org and begin exploring its many features. If, for one reason or another, you want to install Org on top of this -pre-packaged version, there are three ways to do it: - -- by using the Emacs package system; -- by downloading Org as an archive; or -- by using Org's git repository. +pre-packaged version, you can use the Emacs package system or clone +Org's git repository. We *strongly recommend* sticking to a single installation method. @@ -106,32 +103,6 @@ visited, i.e., where no Org built-in function have been loaded. Otherwise autoload Org functions will mess up the installation. #+end_quote -If you want to use Org's package repository, check out the [[https://orgmode.org/elpa.html][Org ELPA -page]]. - -*** Downloading Org as an archive -:PROPERTIES: -:UNNUMBERED: notoc -:END: - -You can download Org latest release from [[https://orgmode.org/][Org's website]]. In this case, -make sure you set the load path correctly in your Emacs init file: - -#+begin_src emacs-lisp -(add-to-list 'load-path "~/path/to/orgdir/lisp") -#+end_src - -The downloaded archive contains contributed libraries that are not -included in Emacs. If you want to use them, add the =contrib/= -directory to your load path: - -#+begin_src emacs-lisp -(add-to-list 'load-path "~/path/to/orgdir/contrib/lisp" t) -#+end_src - -Optionally, you can compile the files and/or install them in your -system. Run =make help= to list compilation and installation options. - *** Using Org's git repository :PROPERTIES: :UNNUMBERED: notoc @@ -141,7 +112,7 @@ You can clone Org's repository and install Org like this: #+begin_example $ cd ~/src/ -$ git clone https://code.orgmode.org/bzg/org-mode.git +$ git clone https://git.savannah.gnu.org/git/emacs/org-mode.git $ cd org-mode/ $ make autoloads #+end_example @@ -161,6 +132,16 @@ list of compilation/installation options. For more detailed explanations on Org's build system, please check the Org Build System page on [[https://orgmode.org/worg/dev/org-build-system.html][Worg]]. +*** Installing Org's contributed packages +:PROPERTIES: +:UNNUMBERED: notoc +:END: + +Org's repository used to contain =contrib/= directory for add-ons +contributed by others. As of Org 9.5, the directory has bee moved to +this new dedicated [[https://git.sr.ht/~bzg/org-contrib][org-contrib]] repository, which you can install +separately. + ** Activation :PROPERTIES: :DESCRIPTION: How to activate Org for certain buffers. @@ -189,9 +170,9 @@ to globally available keys, like the ones reserved for users (see please modify the keys to your own liking. #+begin_src emacs-lisp -(global-set-key (kbd "C-c l") 'org-store-link) -(global-set-key (kbd "C-c a") 'org-agenda) -(global-set-key (kbd "C-c c") 'org-capture) +(global-set-key (kbd "C-c l") #'org-store-link) +(global-set-key (kbd "C-c a") #'org-agenda) +(global-set-key (kbd "C-c c") #'org-capture) #+end_src #+cindex: Org mode, turning on @@ -273,7 +254,6 @@ shown below. ;; Add latest Org mode to load path. (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp")) -(add-to-list 'load-path (expand-file-name "/path/to/org-mode/contrib/lisp" t)) #+end_src If an error occurs, a "backtrace" can be very useful---see below on @@ -344,7 +324,7 @@ conventions: - =boss=, =ARCHIVE= :: - Tags are case-sensitive. User-defined tags are written in + Tags are case-sensitive. User-defined tags are usually written in lowercase; built-in tags with special meaning are written as they should appear in the document, usually with all capitals. @@ -577,6 +557,10 @@ buffer: ,#+STARTUP: overview ,#+STARTUP: content ,#+STARTUP: showall +,#+STARTUP: show2levels +,#+STARTUP: show3levels +,#+STARTUP: show4levels +,#+STARTUP: show5levels ,#+STARTUP: showeverything #+end_example @@ -656,10 +640,10 @@ The following commands jump to other headlines in the buffer. where you can use the following keys to find your destination: #+attr_texinfo: :columns 0.3 0.7 - | {{{kbd(TAB)}}} | Cycle visibility. | + | {{{kbd(TAB)}}} | Cycle visibility. | | {{{kbd(DOWN)}}} / {{{kbd(UP)}}} | Next/previous visible headline. | - | {{{kbd(RET)}}} | Select this location. | - | {{{kbd(/)}}} | Do a Sparse-tree search | + | {{{kbd(RET)}}} | Select this location. | + | {{{kbd(/)}}} | Do a Sparse-tree search | #+texinfo: @noindent The following keys work if you turn off ~org-goto-auto-isearch~ @@ -667,9 +651,9 @@ The following commands jump to other headlines in the buffer. #+attr_texinfo: :columns 0.3 0.7 | {{{kbd(n)}}} / {{{kbd(p)}}} | Next/previous visible headline. | | {{{kbd(f)}}} / {{{kbd(b)}}} | Next/previous headline same level. | - | {{{kbd(u)}}} | One level up. | + | {{{kbd(u)}}} | One level up. | | {{{kbd(0)}}} ... {{{kbd(9)}}} | Digit argument. | - | {{{kbd(q)}}} | Quit. | + | {{{kbd(q)}}} | Quit. | #+vindex: org-goto-interface #+texinfo: @noindent @@ -932,16 +916,16 @@ commands can be accessed through a dispatcher: #+kindex: C-c / / #+findex: org-occur #+vindex: org-remove-highlights-with-change - Prompts for a regexp and shows a sparse tree with all matches. If - the match is in a headline, the headline is made visible. If the - match is in the body of an entry, headline and body are made - visible. In order to provide minimal context, also the full - hierarchy of headlines above the match is shown, as well as the - headline following the match. Each match is also highlighted; the - highlights disappear when the buffer is changed by an editing - command, or by pressing {{{kbd(C-c C-c)}}}[fn:8]. When called with - a {{{kbd(C-u)}}} prefix argument, previous highlights are kept, so - several calls to this command can be stacked. + Prompts for a regexp (see [[*Regular Expressions]]) and shows a sparse + tree with all matches. If the match is in a headline, the headline + is made visible. If the match is in the body of an entry, headline + and body are made visible. In order to provide minimal context, + also the full hierarchy of headlines above the match is shown, as + well as the headline following the match. Each match is also + highlighted; the highlights disappear when the buffer is changed by + an editing command, or by pressing {{{kbd(C-c C-c)}}}[fn:8]. When + called with a {{{kbd(C-u)}}} prefix argument, previous highlights + are kept, so several calls to this command can be stacked. - {{{kbd(M-g n)}}} or {{{kbd(M-g M-n)}}} (~next-error~) :: @@ -1805,7 +1789,7 @@ mode with {{{kbd(M-x orgtbl-mode)}}}. To turn it on by default, for example in Message mode, use #+begin_src emacs-lisp -(add-hook 'message-mode-hook 'turn-on-orgtbl) +(add-hook 'message-mode-hook #'turn-on-orgtbl) #+end_src Furthermore, with some special setup, it is possible to maintain @@ -2074,6 +2058,14 @@ variable ~org-calc-default-modes~. Fraction and symbolic modes of Calc. +- =u= :: + + Units simplification mode of Calc. Calc is also a symbolic + calculator and is capable of working with values having a unit, + represented with numerals followed by a unit string in Org table + cells. This mode instructs Calc to simplify the units in the + computed expression before returning the result. + - =T=, =t=, =U= :: Duration computations in Calc or Lisp, [[*Durations and time values]]. @@ -2169,38 +2161,54 @@ It is also possible to write a formula in Emacs Lisp. This can be useful for string manipulation and control structures, if Calc's functionality is not enough. -If a formula starts with a single-quote followed by an opening -parenthesis, then it is evaluated as a Lisp form. The evaluation -should return either a string or a number. Just as with Calc -formulas, you can specify modes and a ~printf~ format after -a semicolon. +A formula is evaluated as a Lisp form when it starts with a +single-quote followed by an opening parenthesis. Cell table +references are interpolated into the Lisp form before execution. The +evaluation should return either a string or a number. Evaluation +modes and a ~printf~ format used to render the returned values can be +specified after a semicolon. -With Emacs Lisp forms, you need to be conscious about the way field -references are interpolated into the form. By default, a reference is -interpolated as a Lisp string (in double-quotes) containing the field. -If you provide the =N= mode switch, all referenced elements are -numbers---non-number fields will be zero---and interpolated as Lisp -numbers, without quotes. If you provide the =L= flag, all fields are -interpolated literally, without quotes. For example, if you want a -reference to be interpreted as a string by the Lisp form, enclose the -reference operator itself in double-quotes, like ="$3"=. Ranges are -inserted as space-separated fields, so you can embed them in list or -vector syntax. +By default, references are interpolated as literal Lisp strings: the +field content is replaced in the Lisp form stripped of leading and +trailing white space and surrounded in double-quotes. For example: -Here are a few examples---note how the =N= mode is used when we do -computations in Lisp: +: '(concat $1 $2) -- ='(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))= :: +#+texinfo: @noindent +concatenates the content of columns 1 and column 2. + +When the =N= flag is used, all referenced elements are parsed as +numbers and interpolated as Lisp numbers, without quotes. Fields that +cannot be parsed as numbers are interpolated as zeros. For example: - Swap the first two characters of the content of column 1. +: '(+ $1 $2);N -- ='(+ $1 $2);N= :: +#+texinfo: @noindent +adds columns 1 and 2, equivalent to Calc's =$1+$2=. Ranges are +inserted as space-separated fields, so they can be embedded in list or +vector syntax. For example: - Add columns 1 and 2, equivalent to Calc's =$1+$2=. +: '(apply '+ '($1..$4));N -- ='(apply '+ '($1..$4));N= :: +#+texinfo: @noindent +computes the sum of columns 1 to 4, like Calc's =vsum($1..$4)=. + +When the =L= flag is used, all fields are interpolated literally: the +cell content is replaced in the Lisp form stripped of leading and +trailing white space and without quotes. If a reference is intended +to be interpreted as a string by the Lisp form, the reference operator +itself should be enclosed in double-quotes, like ="$3"=. The =L= flag +is useful when strings and numbers are used in the same Lisp form. For +example: - Compute the sum of columns 1 to 4, like Calc's =vsum($1..$4)=. +: '(substring "$1" $2 $3);L + +#+texinfo: @noindent +extracts the part of the string in column 1 between the character +positions specified in the integers in column 2 and 3 and it is easier +to read than the equivalent: + +: '(substring $1 (string-to-number $2) (string-to-number $3)) *** Durations and time values :PROPERTIES: @@ -2797,7 +2805,7 @@ either graphically or in ASCII art. #+cindex: @samp{PLOT}, keyword Org Plot can produce 2D and 3D graphs of information stored in Org -tables using [[http://www.gnuplot.info/][Gnuplot]] and [[http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html][Gnuplot mode]]. To see this in action, ensure +tables using [[https://www.gnuplot.info/][Gnuplot]] and [[http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html][Gnuplot mode]]. To see this in action, ensure that you have both Gnuplot and Gnuplot mode installed on your system, then call {{{kbd(C-c \quot g)}}} or {{{kbd(M-x org-plot/gnuplot)}}} on the following table. @@ -2813,6 +2821,19 @@ following table. | Morelia | 257.56 | 17.67 | #+end_example +Org Plot supports a range of plot types, and provides the ability to add more. +For example, a radar plot can be generated like so: +#+begin_example +,#+PLOT: title:"An evaluation of plaintext document formats" transpose:yes type:radar min:0 max:4 +| Format | Fine-grained-control | Initial Effort | Syntax simplicity | Editor Support | Integrations | Ease-of-referencing | Versatility | +|-------------------+----------------------+----------------+-------------------+----------------+--------------+---------------------+-------------| +| Word | 2 | 4 | 4 | 2 | 3 | 2 | 2 | +| LaTeX | 4 | 1 | 1 | 3 | 2 | 4 | 3 | +| Org Mode | 4 | 2 | 3.5 | 1 | 4 | 4 | 4 | +| Markdown | 1 | 3 | 3 | 4 | 3 | 3 | 1 | +| Markdown + Pandoc | 2.5 | 2.5 | 2.5 | 3 | 3 | 3 | 2 | +#+end_example + Notice that Org Plot is smart enough to apply the table's headers as labels. Further control over the labels, type, content, and appearance of plots can be exercised through the =PLOT= keyword @@ -2843,9 +2864,15 @@ For more information and examples see the [[https://orgmode.org/worg/org-tutoria the third and fourth columns. Defaults to graphing all other columns aside from the =ind= column. +- transpose :: + + When =y=, =yes=, or =t= attempt to transpose the table data before + plotting. Also recognises the shorthand option =trans=. + - =type= :: - Specify whether the plot is =2d=, =3d=, or =grid=. + Specify the type of the plot, by default one of =2d=, =3d=, =radar=, or =grid=. + Available types can be customised with ~org-plot/preset-plot-types~. - =with= :: @@ -2872,6 +2899,27 @@ For more information and examples see the [[https://orgmode.org/worg/org-tutoria When plotting =3d= or =grid= types, set this to =t= to graph a flat mapping rather than a =3d= slope. +- min :: + + Provides a minimum axis value that may be used by a plot type. + Implicitly assumes the =y= axis is being referred to. Can + explicitly provide a value for a either the =x= or =y= axis with + =xmin= and =ymin=. + +- max :: + + Provides a maximum axis value that may be used by a plot type. + Implicitly assumes the =y= axis is being referred to. Can + explicitly provide a value for a either the =x= or =y= axis with + =xmax= and =ymax=. + +- ticks :: + + Provides a desired number of axis ticks to display, that may be used + by a plot type. If none is given a plot type that requires ticks + will use ~org--plot/sensible-tick-num~ to try to determine a good + value. + - =timefmt= :: Specify format of Org mode timestamps as they will be parsed by @@ -3113,14 +3161,14 @@ Here is the full set of built-in link types: - =file= :: - File links. File name may be remote, absolute, or relative. + File links. File name may be remote, absolute, or relative. - Additionally, you can specify a line number, or a text search. - In Org files, you may link to a headline name, a custom ID, or a - code reference instead. + Additionally, you can specify a line number, or a text search. + In Org files, you may link to a headline name, a custom ID, or a + code reference instead. - As a special case, "file" prefix may be omitted if the file name - is complete, e.g., it starts with =./=, or =/=. + As a special case, "file" prefix may be omitted if the file name + is complete, e.g., it starts with =./=, or =/=. - =attachment= :: @@ -3224,9 +3272,10 @@ options: #+cindex: VM links #+cindex: Wanderlust links On top of these built-in link types, additional ones are available -through the =contrib/= directory (see [[*Installation]]). For example, -these links to VM or Wanderlust messages are available when you load -the corresponding libraries from the =contrib/= directory: +through the =org-contrib= repository (see [[*Installation]]). For +example, these links to VM or Wanderlust messages are available when +you load the corresponding libraries from the =org-contrib= +repository: | =vm:folder= | VM folder link | | =vm:folder#id= | VM message link | @@ -3291,8 +3340,9 @@ current buffer: =ID= property for the link[fn:29]. So using this command in Org buffers potentially creates two links: a human-readable link from the custom ID, and one that is globally unique and works even if the - entry is moved from file to file. Later, when inserting the link, - you need to decide which one to use. + entry is moved from file to file. The =ID= property can be either a + UUID (default) or a timestamp, depending on ~org-id-method~. Later, + when inserting the link, you need to decide which one to use. - /Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus/ :: @@ -3474,8 +3524,8 @@ generally, act on links. #+begin_src emacs-lisp (with-eval-after-load 'org - (define-key org-mode-map (kbd "M-n") 'org-next-link) - (define-key org-mode-map (kbd "M-p") 'org-previous-link)) + (define-key org-mode-map (kbd "M-n") #'org-next-link) + (define-key org-mode-map (kbd "M-p") #'org-previous-link)) #+end_src ** Using Links Outside Org @@ -3516,7 +3566,7 @@ replacement text. Here is an example: #+begin_src emacs-lisp (setq org-link-abbrev-alist '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=") - ("Nu Html Checker" . "https://validator.w3.org/nu/?doc=%h") + ("Nu Html Checker" . "https://validator.w3.org/nu/?doc=%h") ("duckduckgo" . "https://duckduckgo.com/?q=%s") ("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1") ("ads" . "https://ui.adsabs.harvard.edu/search/q=%20author%3A\"%s\""))) @@ -3616,10 +3666,10 @@ link, together with explanations for each: - =/REGEXP/= :: - Do a regular expression search for {{{var(REGEXP)}}}. This uses the - Emacs command ~occur~ to list all matches in a separate window. If - the target file is in Org mode, ~org-occur~ is used to create - a sparse tree with the matches. + Do a regular expression search for {{{var(REGEXP)}}} (see [[*Regular + Expressions]]). This uses the Emacs command ~occur~ to list all + matches in a separate window. If the target file is in Org mode, + ~org-occur~ is used to create a sparse tree with the matches. As a degenerate case, a file link with an empty file name can be used to search the current file. For example, =[[file:::find me]]= does @@ -3944,9 +3994,9 @@ interpretation, but it means the same as =#+TODO=, or A setup for using several sets in parallel would be: #+begin_example -,#+TODO: TODO | DONE -,#+TODO: REPORT BUG KNOWNCAUSE | FIXED -,#+TODO: | CANCELED +,#+TODO: TODO(t) | DONE(d) +,#+TODO: REPORT(r) BUG(b) KNOWNCAUSE(k) | FIXED(f) +,#+TODO: | CANCELED(c) #+end_example #+cindex: completion, of option keywords @@ -4070,7 +4120,7 @@ checkboxes is blocked from switching to DONE. If you need more complex dependency structures, for example dependencies between entries in different trees or files, check out -the contributed module =org-depend.el=. +the module =org-depend.el= in the =org-contrib= repository. ** Progress Logging :PROPERTIES: @@ -4158,10 +4208,6 @@ example, with the setting '((sequence "TODO(t)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELED(c@)"))) #+end_src -#+texinfo: @noindent -To record a timestamp without a note for TODO keywords configured with -=@=, just type {{{kbd(C-c C-c)}}} to enter a blank note when prompted. - #+vindex: org-log-done You not only define global TODO keywords and fast access keys, but also request that a time is recorded when the entry is set to =DONE=, @@ -4181,6 +4227,9 @@ to a buffer: : #+TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@) +To record a timestamp without a note for TODO keywords configured with +=@=, just type {{{kbd(C-c C-c)}}} to enter a blank note when prompted. + #+cindex: @samp{LOGGING}, property In order to define logging settings that are local to a subtree or a single item, define a =LOGGING= property in this entry. Any @@ -4443,7 +4492,7 @@ all children are done, you can use the following setup: (let (org-log-done org-log-states) ; turn off logging (org-todo (if (= n-not-done 0) "DONE" "TODO")))) -(add-hook 'org-after-todo-statistics-hook 'org-summary-todo) +(add-hook 'org-after-todo-statistics-hook #'org-summary-todo) #+end_src Another possibility is the use of checkboxes to identify (a hierarchy @@ -4794,9 +4843,10 @@ In this interface, you can also use the following special keys: #+kindex: TAB Enter a tag in the minibuffer, even if the tag is not in the - predefined list. You can complete on all tags present in the - buffer. You can also add several tags: just separate them with - a comma. + predefined list. You can complete on all tags present in the buffer + and globally pre-defined tags from ~org-tag-alist~ and + ~org-tag-persistent-alist~. You can also add several tags: just + separate them with a comma. - {{{kbd(SPC)}}} :: @@ -4931,8 +4981,9 @@ mutually exclusive. Furthermore, the members of a group tag can also be regular expressions, creating the possibility of a more dynamic and rule-based -tag structure. The regular expressions in the group must be specified -within curly brackets. Here is an expanded example: +tag structure (see [[*Regular Expressions]]). The regular expressions in +the group must be specified within curly brackets. Here is an +expanded example: #+begin_example ,#+TAGS: [ Vision : {V@.+} ] @@ -5274,7 +5325,7 @@ single property: tree is created with all entries that define this property with the given value. If you enclose the value in curly braces, it is interpreted as a regular expression and matched against the property - values. + values (see [[*Regular Expressions]]). ** Property Inheritance :PROPERTIES: @@ -5737,8 +5788,8 @@ block. If there is a =TBLFM= keyword after the table, the table is recalculated automatically after an update. An alternative way to capture and process property values into a table -is provided by Eric Schulte's =org-collector.el=, which is -a contributed package[fn:58]. It provides a general API to collect +is provided by Eric Schulte's =org-collector.el=, which is a package +in =org-contrib=[fn:58]. It provides a general API to collect properties from entries in a certain scope, and arbitrary Lisp expressions to process these values before inserting them into a table or a dynamic block. @@ -6022,6 +6073,7 @@ dash(es) as the separator in the former case and use =+= as the separator in the latter case, e.g.: | =11am-1:15pm= | \rArr{} 11:00-13:15 | +| =11h-13h15= | \rArr{} same as above | | =11am--1:15pm= | \rArr{} same as above | | =11am+2:15= | \rArr{} same as above | @@ -7197,6 +7249,16 @@ special command: Copying works like refiling, except that the original note is not deleted. +- {{{kbd(C-c C-M-w)}}} (~org-refile-reverse~) :: + + #+kindex: C-c C-M-w + #+findex: org-refile-reverse + Works like refiling, except that it temporarily toggles how the + value of ~org-reverse-note-order~ applies to the current buffer. So + if ~org-refile~ would append the entry as the last entry under the + target header, ~org-refile-reverse~ will prepend it as the first + entry, and vice-versa. + ** Archiving :PROPERTIES: :DESCRIPTION: What to do with finished products. @@ -7746,6 +7808,9 @@ Now lets look at the elements of a template definition. Each entry in Do not save the target file after finishing the capture. + - ~:refile-targets :: Temporarily set ~org-refile-targets~ to the + value of this property. + **** Template expansion :PROPERTIES: :DESCRIPTION: Filling in information about time and context. @@ -7804,6 +7869,10 @@ here: Like =%a=, but only insert the literal link. +- =%L= :: + + Like =%l=, but without brackets (the link content itself). + - =%c= :: Current kill ring head. @@ -7859,7 +7928,8 @@ here: - =%^{PROP}p= :: - Prompt the user for a value for property {{{var(PROP)}}}. + Prompt the user for a value for property {{{var(PROP)}}}. You may + specify a default value with =%^{PROP|default}=. - =%^{PROMPT}= :: @@ -8199,7 +8269,7 @@ To make Org mode take care of versioning of attachments for you, add the following to your Emacs config: #+begin_src emacs-lisp - (require 'org-attach-git) +(require 'org-attach-git) #+end_src *** Attach from Dired @@ -8259,7 +8329,7 @@ variable has detailed information. With the following #+begin_src emacs-lisp (setq org-feed-alist '(("Slashdot" - "http://rss.slashdot.org/Slashdot/slashdot" + "https://rss.slashdot.org/Slashdot/slashdot" "~/txt/org/feeds.org" "Slashdot Entries"))) #+end_src @@ -8847,8 +8917,9 @@ only tags. #+cindex: regular expressions, with tags search Instead of a tag, you may also specify a regular expression enclosed -in curly braces. For example, =work+{^boss.*}= matches headlines that -contain the tag =:work:= and any tag /starting/ with =boss=. +in curly braces (see [[*Regular Expressions]]). For example, +=work+{^boss.*}= matches headlines that contain the tag =:work:= and +any tag /starting/ with =boss=. #+cindex: group tags, as regular expressions Group tags (see [[*Tag Hierarchy]]) are expanded as regular expressions. @@ -8888,7 +8959,7 @@ to test the value of a property. Here is a complex example: #+begin_example +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2 - +With={Sarah|Denny}+SCHEDULED>="<2008-10-11>" + +With={Sarah\|Denny}+SCHEDULED>="<2008-10-11>" #+end_example #+texinfo: @noindent @@ -8918,7 +8989,7 @@ So the search string in the example finds entries tagged =work= but not =boss=, which also have a priority value =A=, a =Coffee= property with the value =unlimited=, an =EFFORT= property that is numerically smaller than 2, a =With= property that is matched by the regular -expression =Sarah|Denny=, and that are scheduled on or after October +expression =Sarah\|Denny=, and that are scheduled on or after October 11, 2008. You can configure Org mode to use property inheritance during @@ -9296,16 +9367,16 @@ filter elements are accumulated. selects entries with category =work= and effort estimates below 10 minutes, and deselects entries with tag =John= or matching the - regexp =plot=. You can leave =+= out if that does not lead to - ambiguities. The sequence of elements is arbitrary. The filter - syntax assumes that there is no overlap between categories and tags. - Otherwise, tags take priority. If you reply to the prompt with the - empty string, all filtering is removed. If a filter is specified, - it replaces all current filters. But if you call the command with - a double prefix argument, or if you add an additional =+= (e.g., - =++work=) to the front of the string, the new filter elements are - added to the active ones. A single prefix argument applies the - entire filter in a negative sense. + regexp =plot= (see [[*Regular Expressions]]). You can leave =+= out if + that does not lead to ambiguities. The sequence of elements is + arbitrary. The filter syntax assumes that there is no overlap + between categories and tags. Otherwise, tags take priority. If you + reply to the prompt with the empty string, all filtering is removed. + If a filter is specified, it replaces all current filters. But if + you call the command with a double prefix argument, or if you add an + additional =+= (e.g., =++work=) to the front of the string, the new + filter elements are added to the active ones. A single prefix + argument applies the entire filter in a negative sense. - {{{kbd(|)}}} (~org-agenda-filter-remove-all~) :: @@ -10863,7 +10934,7 @@ pretty output for a number of export back-ends. Org mode can contain LaTeX math fragments, and it supports ways to process these for several export back-ends. When exporting to LaTeX, the code is left as it is. When exporting to HTML, Org can use either -[[http://www.mathjax.org][MathJax]] (see [[*Math formatting in HTML export]]) or transcode the math +[[https://www.mathjax.org][MathJax]] (see [[*Math formatting in HTML export]]) or transcode the math into images (see [[*Previewing LaTeX fragments]]). LaTeX fragments do not need any special marking at all. The following @@ -10968,7 +11039,7 @@ current buffer with {{{kbd(M-x org-cdlatex-mode)}}}, or for all Org files with #+begin_src emacs-lisp -(add-hook 'org-mode-hook 'turn-on-org-cdlatex) +(add-hook 'org-mode-hook #'turn-on-org-cdlatex) #+end_src When this mode is enabled, the following features are present (for @@ -11304,7 +11375,7 @@ The following command handles footnotes: #+attr_texinfo: :columns 0.1 0.9 | {{{kbd(s)}}} | Sort the footnote definitions by reference sequence. | | {{{kbd(r)}}} | Renumber the simple =fn:N= footnotes. | - | {{{kbd(S)}}} | Short for first {{{kbd(r)}}}, then {{{kbd(s)}}} action. | + | {{{kbd(S)}}} | Short for first {{{kbd(r)}}}, then {{{kbd(s)}}} action. | | {{{kbd(n)}}} | Rename all footnotes into a =fn:1= ... =fn:n= sequence. | | {{{kbd(d)}}} | Delete the footnote at point, including definition and references. | @@ -11361,7 +11432,7 @@ Users can install libraries for additional formats from the Emacs packaging system. For easy discovery, these packages have a common naming scheme: ~ox-NAME~, where {{{var(NAME)}}} is a format. For example, ~ox-koma-letter~ for /koma-letter/ back-end. More libraries -can be found in the =contrib/= directory (see [[*Installation]]). +can be found in the =org-contrib= repository (see [[*Installation]]). #+vindex: org-export-backends Org only loads back-ends for the following formats by default: ASCII, @@ -11452,7 +11523,7 @@ further alter what is exported, and how. Toggle visible-only export. This is useful for exporting only certain parts of an Org document by adjusting the visibility of - particular headings. + particular headings. See also [[*Sparse Trees]]. ** Export Settings :PROPERTIES: @@ -11961,7 +12032,7 @@ example #+texinfo: @noindent becomes -: Rose is red, violet's blue. Life's ordered: Org assists you. +: Rose is red, violet's blue. Life's ordered: Org assists you. As a special case, Org parses any replacement text starting with =(eval= as an Emacs Lisp expression and evaluates it accordingly. @@ -12527,7 +12598,7 @@ compatible with XHTML 1.0 strict standard. #+findex: org-html-export-to-html Export as HTML file with a =.html= extension. For =myfile.org=, Org - exports to =myfile.html=, overwriting without warning. {{{kbd{C-c + exports to =myfile.html=, overwriting without warning. {{{kbd(C-c C-e h o)}}} exports to HTML and opens it in a web browser. - {{{kbd(C-c C-e h H)}}} (~org-html-export-as-html~) :: @@ -12552,6 +12623,9 @@ settings described in [[*Export Settings]]. multiple =DESCRIPTION= lines. The exporter takes care of wrapping the lines properly. + The exporter includes a number of other meta tags, which can be customized + by modifying ~org-html-meta-tags~. + - =HTML_DOCTYPE= :: #+cindex: @samp{HTML_DOCTYPE}, keyword @@ -12693,8 +12767,8 @@ exports to: #+begin_src html #+end_src @@ -12925,7 +12999,7 @@ as-is. #+vindex: org-html-mathjax-options~ LaTeX math snippets (see [[*LaTeX fragments]]) can be displayed in two -different ways on HTML pages. The default is to use the [[http://www.mathjax.org][MathJax]], +different ways on HTML pages. The default is to use the [[https://www.mathjax.org][MathJax]], which should work out of the box with Org[fn:129][fn:130]. Some MathJax display options can be configured via ~org-html-mathjax-options~, or in the buffer. For example, with the following settings, @@ -13621,7 +13695,7 @@ placement. #+cindex: image, centering in LaTeX export The LaTeX export back-end centers all images by default. Setting =:center= to =nil= disables centering. To disable centering globally, -set ~org-latex-images-centered~ to =t=. +set ~org-latex-images-centered~ to =nil=. Set the =:comment-include= attribute to non-~nil~ value for the LaTeX export back-end to comment out the =\includegraphics= macro. @@ -13698,7 +13772,7 @@ objects through the attributes =:float= and =:options=. For =:float=: The LaTeX export back-end passes string values in =:options= to LaTeX packages for customization of that specific source block. In the example below, the =:options= are set for Minted. Minted is a source -code highlighting LaTeX package with many configurable options. +code highlighting LaTeX package with many configurable options[fn:134]. #+begin_example ,#+ATTR_LATEX: :options commentstyle=\bfseries @@ -13801,6 +13875,95 @@ The LaTeX export back-end converts horizontal rules by the specified ----- #+end_example +*** Verse blocks in LaTeX export +:PROPERTIES: +:DESCRIPTION: Attributes specific to special blocks. +:END: + +#+cindex: verse blocks, in @LaTeX{} export +#+cindex: @samp{ATTR_LATEX}, keyword + +The LaTeX export back-end accepts four attributes for verse blocks: +=:lines=, =:center=, =:versewidth= and =:latexcode=. The three first +require the external LaTeX package =verse.sty=, which is an extension +of the standard LaTeX environment. + +- =:lines= :: To add marginal verse numbering. Its value is an + integer, the sequence in which the verses should be numbered. +- =:center= :: With value =t= all the verses on the page are optically + centered (a typographic convention for poetry), taking as a + reference the longest verse, which must be indicated by the + attribute =:versewidth=. +- =:versewidth= :: Its value is a literal text string with the longest + verse. +- =:latexcode= :: It accepts any arbitrary LaTeX code that can be + included within a LaTeX =verse= environment. + +A complete example with Shakespeare's first sonnet: + +#+begin_src org +,#+ATTR_LATEX: :center t :latexcode \color{red} :lines 5 +,#+ATTR_LATEX: :versewidth Feed’st thy light’s flame with self-substantial fuel, +,#+BEGIN_VERSE +From fairest creatures we desire increase, +That thereby beauty’s rose might never die, +But as the riper should by time decease +His tender heir might bear his memory +But thou, contracted to thine own bright eyes, +Feed’st thy light’s flame with self-substantial fuel, +Making a famine where abundance lies, +Thyself thy foe, to thy sweet self too cruel. +Thou that art now the world’s fresh ornament, +And only herald to the gaudy spring, +Within thine own bud buriest thy content, +And, tender churl, mak’st waste in niggardly. +Pity the world, or else this glutton be, +To eat the world’s due, by the grave and thee. +,#+END_VERSE +#+end_src + +*** Quote blocks in LaTeX export +:PROPERTIES: +:DESCRIPTION: Attributes specific to quote blocks. +:END: + +#+cindex: quote blocks, in @LaTeX{} export +#+cindex: @samp{ATTR_LATEX}, keyword +#+cindex: org-latex-default-quote-environment + +The LaTeX export back-end accepts two attributes for quote blocks: +=:environment=, for an arbitrary quoting environment (the default +value is that of ~org-latex-default-quote-environment~: ~"quote"~) and +=:options=. For example, to choose the environment =quotation=, +included as an alternative to =quote= in standard LaTeX classes: + +#+begin_example +,#+ATTR_LATEX: :environment quotation +,#+BEGIN_QUOTE +some text... +,#+END_QUOTE +#+end_example + +To choose the =foreigndisplayquote= environment, included in the LaTeX +package =csquotes=, with the =german= option, use this syntax: + +#+begin_example +,#+LATEX_HEADER:\usepackage[autostyle=true]{csquotes} +,#+ATTR_LATEX: :environment foreigndisplayquote :options {german} +,#+BEGIN_QUOTE +some text in German... +,#+END_QUOTE +#+end_example + +#+texinfo: @noindent +which is exported to LaTeX as + +#+begin_example +\begin{foreigndisplayquote}{german} +some text in German... +\end{foreigndisplayquote} +#+end_example + ** Markdown Export :PROPERTIES: :DESCRIPTION: Exporting to Markdown. @@ -13860,7 +14023,7 @@ a limit to a level before the absolute limit (see [[*Export Settings]]). The ODT export back-end handles creating of OpenDocument Text (ODT) format. Documents created by this exporter use the -{{{cite(OpenDocument-v1.2 specification)}}}[fn:134] and are compatible +{{{cite(OpenDocument-v1.2 specification)}}}[fn:135] and are compatible with LibreOffice 3.4. *** Pre-requisites for ODT export @@ -14261,7 +14424,7 @@ document in one of the following ways: variables ~org-latex-to-mathml-convert-command~ and ~org-latex-to-mathml-jar-file~. - If you prefer to use MathToWeb[fn:135] as your converter, you can + If you prefer to use MathToWeb[fn:136] as your converter, you can configure the above variables as shown below. #+begin_src emacs-lisp @@ -14272,7 +14435,7 @@ document in one of the following ways: #+end_src #+texinfo: @noindent - or, to use LaTeX​ML[fn:136] instead, + or, to use LaTeX​ML[fn:137] instead, #+begin_src emacs-lisp (setq org-latex-to-mathml-convert-command @@ -14591,7 +14754,7 @@ with the =#+ATTR_ODT= line. For a discussion on default formatting of tables, see [[*Tables in ODT export]]. This feature closely mimics the way table templates are defined in the -OpenDocument-v1.2 specification[fn:137]. +OpenDocument-v1.2 specification[fn:138]. #+vindex: org-odt-table-styles For quick preview of this feature, install the settings below and export the @@ -14625,7 +14788,7 @@ templates, define new styles there. To use this feature proceed as follows: -1. Create a table template[fn:138]. +1. Create a table template[fn:139]. A table template is set of =table-cell= and =paragraph= styles for each of the following table cell categories: @@ -14664,7 +14827,7 @@ To use this feature proceed as follows: == element of the content template file (see [[x-orgodtcontenttemplate-xml][Factory styles]]). -2. Define a table style[fn:139]. +2. Define a table style[fn:140]. #+vindex: org-odt-table-styles To define a table style, create an entry for the style in the @@ -15159,7 +15322,7 @@ To specify the author of the quotation, use the =:author= attribute. ,#+BEGIN_QUOTE The Lady of the Lake, her arm clad in the purest shimmering samite, held aloft Excalibur from the bosom of the water, signifying by divine -providence that I, Arthur, was to carry Excalibur. That is why I am +providence that I, Arthur, was to carry Excalibur. That is why I am your king. ,#+END_QUOTE #+end_example @@ -15422,7 +15585,7 @@ BACKEND is the export back-end being used, as a symbol." (org-map-entries (lambda () (delete-region (point) (line-beginning-position 2))))) -(add-hook 'org-export-before-parsing-hook 'my-headline-removal) +(add-hook 'org-export-before-parsing-hook #'my-headline-removal) #+end_src *** Filters @@ -15768,17 +15931,17 @@ following properties Publishing means that a file is copied to the destination directory and possibly transformed in the process. The default transformation is to export Org files as HTML files, and this is done by the function -~org-publish-org-to-html~ which calls the HTML exporter (see [[*HTML +~org-html-publish-to-html~ which calls the HTML exporter (see [[*HTML Export]]). But you can also publish your content as PDF files using -~org-publish-org-to-pdf~, or as ASCII, Texinfo, etc., using the +~org-latex-publish-to-pdf~, or as ASCII, Texinfo, etc., using the corresponding functions. If you want to publish the Org file as an =.org= file but with /archived/, /commented/, and /tag-excluded/ trees removed, use -~org-publish-org-to-org~. This produces =file.org= and put it in the +~org-org-publish-to-org~. This produces =file.org= and puts it in the publishing directory. If you want a htmlized version of this file, set the parameter ~:htmlized-source~ to ~t~. It produces -=file.org.html= in the publishing directory[fn:140]. +=file.org.html= in the publishing directory[fn:141]. Other files like images only need to be copied to the publishing destination; for this you can use ~org-publish-attachment~. For @@ -16247,12 +16410,13 @@ directory on the local machine. (setq org-publish-project-alist '(("org" :base-directory "~/org/" + :publishing-function org-html-publish-to-html :publishing-directory "~/public_html" :section-numbers nil - :table-of-contents nil - :style ""))) + :with-toc nil + :html-head ""))) #+end_src *** Example: complex publishing configuration @@ -16347,6 +16511,129 @@ of the commands above, or by customizing the variable particular if files include other files via =SETUPFILE= or =INCLUDE= keywords. +* Citation handling +:PROPERTIES: +:DESCRIPTION: create, follow and export citations. +:END: +#+cindex: citation + +As of Org 9.5, a new library =oc.el= provides tooling to handle +citations in Org via "citation processors" that offer some or all of +the following capabilities: + +- "activate" :: Fontification, tooltip preview, etc. +- "follow" :: At-point actions on citations via ~org-open-at-point~. +- "insert" :: Add and edit citations via ~org-cite-insert~. +- "export" :: Via different libraries for different target formats. + +The user can configure these with ~org-cite-active-processor~, +~org-cite-follow-processor~, ~org-cite-insert-processor~, and +~org-cite-export-processors~ respectively. + +The included "basic" processor provides all four capabilities. + +** Citations + +Before adding citations, first set one-or-more bibliographies, either +globally with ~org-cite-global-bibliography~, or locally using one or +more "bibliography" keywords. + +#+begin_example +#+bibliography: SomeFile.bib +#+bibliography: /some/other/file.json +#+bibliography: "/some/file/with spaces/in its name.bib" +#+end_example + +One can then insert and edit citations using ~org-cite-insert~, called +with {{{kbd(M-x org-cite-insert)}}}. + +A /citation/ requires one or more citation /key(s)/, elements +identifying a reference in the bibliography. + +- Each citation is surrounded by brackets and uses the =cite= type. + +- Each key starts with the character =@=. + +- Each key can be qualified by a /prefix/ (e.g. "see ") and/or a + /suffix/ (e.g. "p. 123"), giving informations useful or necessary fo + the comprehension of the citation but not included in the reference. + +- A single citation can cite more than one reference ; the keys are + separated by semicolons ; the formatting of such citation groups is + specified by the style. + +- One can also specify a stylistic variation for the citations by + inserting a =/= and a style name between the =cite= keyword and the + colon ; this usially makes sense only for the author-year styles. + +#+begin_example +[cite/style:common prefix ;prefix @key suffix; ... ; common suffix] +#+end_example + +The only mandatory elements are: + +- The =cite= keyword and the colon. +- The =@= character immediately preceding each key. +- The brackets surrounding the citation(s) (group). + +** Citation export processors + +Org currently includes the following export processors: + +- Two processors can export to a variety of formats, including =latex= + (and therefore =pdf=), =html=, =odt= and plain (UTF8) text: + + - basic :: a basic export processors, well adapted to situations + where backward compatibility is not a requirement and formatting + needs are minimal; + + - csl :: this export processor uses format files written in [[https://en.wikipedia.org/wiki/Citation_Style_Language][Citation + Style Language]] via [[https://github.com/andras-simonyi/citeproc-el][citeproc-el]]; + +- In contrast, two other processors target LaTeX and LaTeX-derived + formats exclusively: + + - natbib :: this export processor uses =bibtex=, the historical + bibliographic processor used with LaTeX, thus allowing the use of + data and style files compatible with this processor (including a + large number of publishers' styles). It uses citation commands + implemented in the LaTeX package =natbib=, allowing more stylistic + variants that LaTeX's =\cite= command. + + - biblatex :: this backend allows the use of data and formats + prepared for =biblatex=, an alternate bibliographic processor used + with LaTeX, which overcomes some serious =bibtex= limitations, but + has not (yet?) been widely adopted by publishers. + +The =#+cite_export:= keyword specifies the export processor and the +citation (and possibly reference) style(s); for example (all arguments +are optional) + +#+begin_example +#+cite_export: basic author author-year +#+end_example + +specifies the "basic" export processor with citations inserted as +author's name and references indexed by author's names and year; + +#+begin_example +#+cite_export: csl /some/path/to/vancouver-brackets.csl +#+end_example + +specifies the "csl" processor and CSL style, which in this case +defines numeric citations and numeric references according to the +=Vancouver= specification (as style used in many medical journals), +following a typesetting variation putting citations between brackets; + +#+begin_example +#+cite_export: natbib kluwer +#+end_example + +specifies the "natbib" export processor with a label citation style +conformant to the Harvard style and the specification of the +Wolkers-Kluwer publisher; since it relies on the =bibtex= processor of +your LaTeX installation, it won't export to anything but PDF. + * Working with Source Code :PROPERTIES: :DESCRIPTION: Export, evaluate, and tangle code blocks. @@ -16393,7 +16680,7 @@ extract, export, and publish source code blocks. Org can also compile and execute a source code block, then capture the results. The Org mode literature sometimes refers to source code blocks as /live code/ blocks because they can alter the content of the Org document or the -material that it exports. Users can control how live they want each +material that it exports. Users can control the "liveliness" of each source code block by tweaking the header arguments (see [[*Using Header Arguments]]) for compiling, execution, extraction, and exporting. @@ -16736,7 +17023,11 @@ the =var= header argument. body. {{{var(ASSIGN)}}} is a literal value, such as a string, a number, a reference to a table, a list, a literal example, another code block---with or without arguments---or the results of evaluating -a code block. +a code block. {{{var(ASSIGN)}}} may specify a filename for references +to elements in a different file, using a =:= to separate the filename +from the reference. + +: :var NAME=FILE:REFERENCE Here are examples of passing values by reference: @@ -16815,6 +17106,9 @@ Here are examples of passing values by reference: | two | 16 | 17 | 18 | 19 | 20 | #+end_example +To refer to a table in another file, join the filename and table name with +a colon, for example: =:var table=other-file.org:example-table=. + - list :: A simple named list. @@ -17156,13 +17450,13 @@ See [[*Languages]] to enable other languages. #+kindex: C-c C-v e #+findex: org-babel-execute-src-block Org provides many ways to execute code blocks. {{{kbd(C-c C-c)}}} or -{{{kbd(C-c C-v e)}}} with the point on a code block[fn:141] calls the +{{{kbd(C-c C-v e)}}} with the point on a code block[fn:142] calls the ~org-babel-execute-src-block~ function, which executes the code in the block, collects the results, and inserts them in the buffer. #+cindex: @samp{CALL}, keyword #+vindex: org-babel-inline-result-wrap -By calling a named code block[fn:142] from an Org mode buffer or +By calling a named code block[fn:143] from an Org mode buffer or a table. Org can call the named code blocks from the current Org mode buffer or from the "Library of Babel" (see [[*Library of Babel]]). @@ -17363,7 +17657,7 @@ they are mutually exclusive. - =value= :: - Default for most Babel libraries[fn:142]. Functional mode. Org + Default for most Babel libraries[fn:143]. Functional mode. Org gets the value by wrapping the code in a function definition in the language of the source block. That is why when using =:results value=, code should execute like a function and return a value. For @@ -17488,10 +17782,12 @@ default behavior is to automatically determine the result type. #+end_example #+cindex: @samp{file-desc}, header argument - The =file-desc= header argument defines the description (see - [[*Link Format]]) for the link. If =file-desc= is present but has no value, + The =file-desc= header argument defines the description (see [[*Link + Format]]) for the link. If =file-desc= is present but has no value, the =file= value is used as the link description. When this - argument is not present, the description is omitted. + argument is not present, the description is omitted. If you want to + provide the =file-desc= argument but omit the description, you can + provide it with an empty vector (i.e., :file-desc []). #+cindex: @samp{sep}, header argument By default, Org assumes that a table written to a file has @@ -17549,7 +17845,7 @@ follows from the type specified above. #+begin_example ,#+begin_src shell :results file link :file "download.tar.gz" - wget -c "http://example.com/download.tar.gz" + wget -c "https://example.com/download.tar.gz" ,#+end_src #+end_example @@ -17595,15 +17891,20 @@ value listed above. E.g., Handling options after collecting the results. +- =replace= :: + + Default. Insert results in the Org buffer. Remove previous + results. Usage example: =:results output replace=. + - =silent= :: Do not insert results in the Org mode buffer, but echo them in the minibuffer. Usage example: =:results output silent=. -- =replace= :: +- =none= :: - Default. Insert results in the Org buffer. Remove previous - results. Usage example: =:results output replace=. + Do not process results at all. No inserting in the Org mode buffer + nor echo them in the minibuffer. Usage example: =:results none=. - =append= :: @@ -17929,35 +18230,8 @@ code block header arguments: #+cindex: source code, languages #+cindex: code block, languages -Code blocks in the following languages are supported. - -#+attr_texinfo: :columns 0.25 0.25 0.25 0.20 -| Language | Identifier | Language | Identifier | -|------------+---------------+----------------+--------------| -| Asymptote | =asymptote= | Lisp | =lisp= | -| Awk | =awk= | Lua | =lua= | -| C | =C= | MATLAB | =matlab= | -| C++ | =C++=[fn:143] | Mscgen | =mscgen= | -| Clojure | =clojure= | Objective Caml | =ocaml= | -| CSS | =css= | Octave | =octave= | -| D | =D=[fn:144] | Org mode | =org= | -| ditaa | =ditaa= | Oz | =oz= | -| Emacs Calc | =calc= | Perl | =perl= | -| Emacs Lisp | =emacs-lisp= | Plantuml | =plantuml= | -| Eshell | =eshell= | Processing.js | =processing= | -| Fortran | =fortran= | Python | =python= | -| Gnuplot | =gnuplot= | R | =R= | -| GNU Screen | =screen= | Ruby | =ruby= | -| Graphviz | =dot= | Sass | =sass= | -| Haskell | =haskell= | Scheme | =scheme= | -| Java | =java= | Sed | =sed= | -| Javascript | =js= | shell | =sh= | -| LaTeX | =latex= | SQL | =sql= | -| Ledger | =ledger= | SQLite | =sqlite= | -| Lilypond | =lilypond= | Vala | =vala= | - -Additional documentation for some languages is at -https://orgmode.org/worg/org-contrib/babel/languages.html. +Code blocks in dozens of languages are supported. See Worg for +[[https://orgmode.org/worg/org-contrib/babel/languages/index.html][language specific documentation]]. #+vindex: org-babel-load-languages By default, only Emacs Lisp is enabled for evaluation. To enable or @@ -18071,7 +18345,7 @@ for Python and Emacs Lisp languages. #+cindex: @samp{noweb-ref}, header argument Source code blocks can include references to other source code blocks, -using a noweb[fn:145] style syntax: +using a noweb[fn:144] style syntax: : <> @@ -18582,14 +18856,14 @@ Org Tempo expands snippets to structures defined in ~org-structure-template-alist~ and ~org-tempo-keywords-alist~. For example, {{{kbd(< s TAB)}}} creates a code block. Enable it by customizing ~org-modules~ or add =(require 'org-tempo)= to your Emacs -init file[fn:146]. +init file[fn:145]. #+attr_texinfo: :columns 0.1 0.9 | {{{kbd(a)}}} | =#+BEGIN_EXPORT ascii= ... =#+END_EXPORT= | | {{{kbd(c)}}} | =#+BEGIN_CENTER= ... =#+END_CENTER= | | {{{kbd(C)}}} | =#+BEGIN_COMMENT= ... =#+END_COMMENT= | | {{{kbd(e)}}} | =#+BEGIN_EXAMPLE= ... =#+END_EXAMPLE= | -| {{{kbd(E)}}} | =#+BEGIN_EXPORT= ... =#+END_EXPORT= | +| {{{kbd(E)}}} | =#+BEGIN_EXPORT= ... =#+END_EXPORT= | | {{{kbd(h)}}} | =#+BEGIN_EXPORT html= ... =#+END_EXPORT= | | {{{kbd(l)}}} | =#+BEGIN_EXPORT latex= ... =#+END_EXPORT= | | {{{kbd(q)}}} | =#+BEGIN_QUOTE= ... =#+END_QUOTE= | @@ -18616,14 +18890,14 @@ the variable ~org-use-speed-commands~ to a non-~nil~ value. To trigger a Speed Key, point must be at the beginning of an Org headline, before any of the stars. -#+vindex: org-speed-commands-user +#+vindex: org-speed-commands #+findex: org-speed-command-help Org comes with a pre-defined list of Speed Keys. To add or modify -Speed Keys, customize the variable, ~org-speed-commands-user~. For -more details, see the variable's docstring. With Speed Keys -activated, {{{kbd(M-x org-speed-command-help)}}}, or {{{kbd(?)}}} when -point is at the beginning of an Org headline, shows currently active -Speed Keys, including the user-defined ones. +Speed Keys, customize the option ~org-speed-commands~. For more +details, see the variable's docstring. With Speed Keys activated, +{{{kbd(M-x org-speed-command-help)}}}, or {{{kbd(?)}}} when point is at the +beginning of an Org headline, shows currently active Speed Keys, +including the user-defined ones. ** A Cleaner Outline View :PROPERTIES: @@ -18662,7 +18936,7 @@ in the desired amount with hard spaces and hiding leading stars. To display the buffer in the indented view, activate Org Indent minor mode, using {{{kbd(M-x org-indent-mode)}}}. Text lines that are not headlines are prefixed with virtual spaces to vertically align with -the headline text[fn:147]. +the headline text[fn:146]. #+vindex: org-indent-indentation-per-level To make more horizontal space, the headlines are shifted by two @@ -18690,15 +18964,15 @@ use =STARTUP= keyword as follows: It is possible to use hard spaces to achieve the indentation instead, if the bare ASCII file should have the indented look also outside -Emacs[fn:148]. With Org's support, you have to indent all lines to +Emacs[fn:147]. With Org's support, you have to indent all lines to line up with the outline headers. You would use these -settings[fn:149]: +settings[fn:148]: - #+begin_src emacs-lisp - (setq org-adapt-indentation t - org-hide-leading-stars t - org-odd-levels-only t) - #+end_src +#+begin_src emacs-lisp +(setq org-adapt-indentation t + org-hide-leading-stars t + org-odd-levels-only t) +#+end_src - /Indentation of text below headlines/ (~org-adapt-indentation~) :: @@ -18955,11 +19229,15 @@ changes. | =overview= | Top-level headlines only. | | =content= | All headlines. | | =showall= | No folding on any entry. | + | =show2levels= | Headline levels 1-2. | + | =show3levels= | Headline levels 1-3. | + | =show4levels= | Headline levels 1-4. | + | =show5levels= | Headline levels 1-5. | | =showeverything= | Show even drawer contents. | #+vindex: org-startup-indented Dynamic virtual indentation is controlled by the variable - ~org-startup-indented~[fn:150]. + ~org-startup-indented~[fn:149]. | =indent= | Start with Org Indent mode turned on. | | =noindent= | Start with Org Indent mode turned off. | @@ -19095,6 +19373,22 @@ changes. These lines set the TODO keywords and their interpretation in the current file. The corresponding variable is ~org-todo-keywords~. +** Regular Expressions +:PROPERTIES: +:DESCRIPTION: Elisp regular expressions. +:END: +#+cindex: regular expressions syntax +#+cindex: regular expressions, in searches + +Org, as an Emacs mode, makes use of Elisp regular expressions for +searching, matching and filtering. Elisp regular expressions have a +somewhat different syntax then some common standards. Most notably, +alternation is indicated using =\|= and matching groups are denoted by +=\(...\)=. For example the string =home\|work= matches either =home= +or =work=. + +For more information, see [[info:emacs::Regexps][Regular Expressions in Emacs]]. + ** Org Syntax :PROPERTIES: :DESCRIPTION: Formal description of Org's syntax. @@ -19533,7 +19827,7 @@ passed to Emacs through the =emacsclient= command, so you also need to ensure an Emacs server is running. More precisely, when the application calls -: emacsclient org-protocol://PROTOCOL?key1=val1&key2=val2 +: emacsclient "org-protocol://PROTOCOL?key1=val1&key2=val2" #+texinfo: @noindent Emacs calls the handler associated to {{{var(PROTOCOL)}}} with @@ -19556,7 +19850,7 @@ Using the ~store-link~ handler, you can copy links, to that they can be inserted using {{{kbd(M-x org-insert-link)}}} or yanking. More precisely, the command -: emacsclient org-protocol://store-link?url=URL&title=TITLE +: emacsclient "org-protocol://store-link?url=URL&title=TITLE" #+texinfo: @noindent stores the following link: @@ -19570,11 +19864,20 @@ slashes, and probably quote those for the shell. To use this feature from a browser, add a bookmark with an arbitrary name, e.g., =Org: store-link= and enter this as /Location/: +#+begin_example +javascript:location.href='org-protocol://store-link?' + + new URLSearchParams({url:location.href, title:document.title}); +#+end_example + +Title is an optional parameter. Another expression was recommended earlier: + #+begin_example javascript:location.href='org-protocol://store-link?url='+ encodeURIComponent(location.href); #+end_example +The latter form is compatible with older Org versions from 9.0 to 9.4. + *** The ~capture~ protocol :PROPERTIES: :DESCRIPTION: Fill a buffer with external information. @@ -19585,11 +19888,20 @@ javascript:location.href='org-protocol://store-link?url='+ Activating the "capture" handler pops up a =Capture= buffer in Emacs, using acapture template. -: emacsclient org-protocol://capture?template=X?url=URL?title=TITLE?body=BODY +: emacsclient "org-protocol://capture?template=X&url=URL&title=TITLE&body=BODY" To use this feature, add a bookmark with an arbitrary name, e.g., =Org: capture=, and enter this as =Location=: +#+begin_example +javascript:location.href='org-protocol://capture?' + + new URLSearchParams({ + template: 'x', url: window.location.href, + title: document.title, body: window.getSelection()}); +#+end_example + +You might have seen another expression: + #+begin_example javascript:location.href='org-protocol://capture?template=x'+ '&url='+encodeURIComponent(window.location.href)+ @@ -19597,6 +19909,10 @@ javascript:location.href='org-protocol://capture?template=x'+ '&body='+encodeURIComponent(window.getSelection()); #+end_example +It is a bit more cluttered than the former one, but it is compatible +with previous Org versions 9.0-9.4. In these versions encoding of +space as "+" character was not supported by URI decoder. + #+vindex: org-protocol-default-template-key The capture template to be used can be specified in the bookmark (like =X= above). If unspecified, the template key is set in the variable @@ -19652,13 +19968,13 @@ click the bookmark and start editing. #+cindex: rewritten URL in open-source protocol #+cindex: protocol, open-source rewritten URL However, such mapping may not always yield the desired results. -Suppose you maintain an online store located at =http://example.com/=. +Suppose you maintain an online store located at =https://example.com/=. The local sources reside in =/home/user/example/=. It is common practice to serve all products in such a store through one file and rewrite URLs that do not match an existing file on the server. That -way, a request to =http://example.com/print/posters.html= might be +way, a request to =https://example.com/print/posters.html= might be rewritten on the server to something like -=http://example.com/shop/products.php/posters.html.php=. The +=https://example.com/shop/products.php/posters.html.php=. The ~open-source~ handler probably cannot find a file named =/home/user/example/print/posters.html.php= and fails. @@ -19673,7 +19989,7 @@ adding ~:rewrites~ rules like this: #+begin_src emacs-lisp (setq org-protocol-project-alist '(("example.com" - :base-url "http://example.com/" + :base-url "https://example.com/" :working-directory "/home/user/example/" :online-suffix ".php" :working-suffix ".php" @@ -19704,8 +20020,8 @@ an Org file that is part of a publishing project. :END: Org Crypt encrypts the text of an entry, but not the headline, or -properties. Behind the scene, it uses the Emacs EasyPG library to -encrypt and decrypt files. +properties. Behind the scene, it uses the [[info:epa][Emacs EasyPG Library]] to +encrypt and decrypt files, and EasyPG needs a correct [[info:gnupg][GnuPG]] setup. #+vindex: org-crypt-tag-matcher Any text below a headline that has a =crypt= tag is automatically @@ -19778,7 +20094,7 @@ Tags]]) only for those set in these variables. #+vindex: org-mobile-directory The mobile application needs access to a file directory on -a server[fn:151] to interact with Emacs. Pass its location through +a server[fn:150] to interact with Emacs. Pass its location through the ~org-mobile-directory~ variable. If you can mount that directory locally just set the variable to point to that directory: @@ -19799,7 +20115,7 @@ With a public server, consider encrypting the files. Org also requires OpenSSL installed on the local computer. To turn on encryption, set the same password in the mobile application and in Emacs. Set the password in the variable -~org-mobile-use-encryption~[fn:152]. Note that even after the mobile +~org-mobile-use-encryption~[fn:151]. Note that even after the mobile application encrypts the file contents, the file name remains visible on the file systems of the local computer, the server, and the mobile device. @@ -19815,15 +20131,15 @@ The command ~org-mobile-push~ copies files listed in ~org-mobile-files~ into the staging area. Files include agenda files (as listed in ~org-agenda-files~). Customize ~org-mobile-files~ to add other files. File names are staged with paths relative to -~org-directory~, so all files should be inside this directory[fn:153]. +~org-directory~, so all files should be inside this directory[fn:152]. Push creates a special Org file =agendas.org= with custom agenda views -defined by the user[fn:154]. +defined by the user[fn:153]. Finally, Org writes the file =index.org=, containing links to other files. The mobile application reads this file first from the server to determine what other files to download for agendas. For faster -downloads, it is expected to only read files whose checksums[fn:155] +downloads, it is expected to only read files whose checksums[fn:154] have changed. *** Pulling from the mobile application @@ -19840,7 +20156,7 @@ data in an inbox file format, through the following steps: 1. #+vindex: org-mobile-inbox-for-pull - Org moves all entries found in =mobileorg.org=[fn:156] and appends + Org moves all entries found in =mobileorg.org=[fn:155] and appends them to the file pointed to by the variable ~org-mobile-inbox-for-pull~. It should reside neither in the staging area nor on the server. Each captured entry and each @@ -19904,12 +20220,10 @@ https://orgmode.org/worg/doc.html#hooks. :END: #+cindex: add-on packages -Various authors wrote a large number of add-on packages for Org. - -These packages are not part of Emacs, but they are distributed as -contributed packages with the separate release available at -https://orgmode.org. See the =contrib/README= file in the source code -directory for a list of contributed files. Worg page with more +Various authors wrote a large number of add-on packages for Org. Some +of these packages used to be part of the =org-mode= repository but are +now hosted in a separate =org-contrib= repository +[[https://git.sr.ht/~bzg/org-contrib][here]]. A Worg page with more information is at: https://orgmode.org/worg/org-contrib/. ** Adding Hyperlink Types @@ -20136,9 +20450,9 @@ of these strategies: #+cindex: @LaTeX{}, and Orgtbl mode To wrap a source table in LaTeX, use the =comment= environment -provided by =comment.sty=[fn:157]. To activate it, put +provided by =comment.sty=[fn:156]. To activate it, put ~\usepackage{comment}~ in the document header. Orgtbl mode inserts -a radio table skeleton[fn:158] with the command {{{kbd(M-x +a radio table skeleton[fn:157] with the command {{{kbd(M-x orgtbl-insert-radio-table)}}}, which prompts for a table name. For example, if =salesfigures= is the name, the template inserts: @@ -20157,7 +20471,7 @@ The line =#+ORGTBL: SEND= tells Orgtbl mode to use the function ~orgtbl-to-latex~ to convert the table to LaTeX format, then insert the table at the target (receive) location named =salesfigures=. Now the table is ready for data entry. It can even use spreadsheet -features[fn:159]: +features[fn:158]: #+begin_example % BEGIN RECEIVE ORGTBL salesfigures @@ -20373,7 +20687,7 @@ Dynamic blocks, like any other block, can be narrowed with #+vindex: org-agenda-skip-function #+vindex: org-agenda-skip-function-global Org provides a special hook to further limit items in agenda views: -~agenda~, ~agenda*~[fn:160], ~todo~, ~alltodo~, ~tags~, ~tags-todo~, +~agenda~, ~agenda*~[fn:159], ~todo~, ~alltodo~, ~tags~, ~tags-todo~, ~tags-tree~. Specify a custom function that tests inclusion of every matched item in the view. This function can also skip as much as is needed. @@ -20416,7 +20730,7 @@ meaningful string suitable for the agenda view. #+vindex: org-agenda-skip-function Search for entries with a limit set on levels for the custom search. This is a general approach to creating custom searches in Org. To -include all levels, use =LEVEL>0=[fn:161]. Then to selectively pick +include all levels, use =LEVEL>0=[fn:160]. Then to selectively pick the matched entries, use ~org-agenda-skip-function~, which also accepts Lisp forms, such as ~org-agenda-skip-entry-if~ and ~org-agenda-skip-subtree-if~. For example: @@ -21017,6 +21331,9 @@ be complete if the ones above were not mentioned in this manual. - Charles Cave's suggestion sparked the implementation of templates for Remember, which are now templates for capture. +- Timothy E Chapman worked on a complete overhaul of the orgmode.org + website in 2020 and helped fixing various bugs. + - Pavel Chalmoviansky influenced the agenda treatment of items with specified time. @@ -21106,6 +21423,9 @@ be complete if the ones above were not mentioned in this manual. - Jason\nbsp{}F.\nbsp{}McBrayer suggested agenda export to CSV format. +- Kyle Meyer helped setting up the [[https://public-inbox.org/][public-inbox]] archive of the [[https://orgmode.org/list/][Org + mailing list]] and has been fixing many bugs. + - Max Mikhanosha came up with the idea of refiling. - Dmitri Minaev sent a patch to set priority limits on a per-file @@ -21143,6 +21463,9 @@ be complete if the ones above were not mentioned in this manual. - Martin Pohlack provided the code snippet to bundle character insertion into bundles of 20 for undo. +- Ihor Radchenko helped with fixing bugs and improving the user + experience regarding Org's speed. + - T.\nbsp{}V.\nbsp{}Raman reported bugs and suggested improvements. - Matthias Rempe (Oelde) provided ideas, Windows support, and quality @@ -21173,7 +21496,7 @@ be complete if the ones above were not mentioned in this manual. literal examples, and remote highlighting for referenced code lines. - Stathis Sideris wrote the =ditaa.jar= ASCII to PNG converter that is - now packaged into Org's =contrib/= directory. + now packaged into the [[https://git.sr.ht/~bzg/org-contrib][org-contrib]] repository. - Daniel Sinder came up with the idea of internal archiving by locking subtrees. @@ -21296,7 +21619,7 @@ modify this GNU manual." * Footnotes [fn:1] If you do not use Font Lock globally turn it on in Org buffer -with =(add-hook 'org-mode-hook 'turn-on-font-lock)=. +with =(add-hook 'org-mode-hook #'turn-on-font-lock)=. [fn:2] Please consider subscribing to the mailing list in order to minimize the work the mailing list moderators have to do. @@ -21597,12 +21920,12 @@ lognoteclock-out=. line---the line is broken here only to fit it into the manual. [fn:81] On computers using macOS, idleness is based on actual user -idleness, not just Emacs' idle time. For X11, you can install -a utility program =x11idle.c=, available in the =contrib/scripts/= -directory of the Org Git distribution, or install the xprintidle -package and set it to the variable ~org-clock-x11idle-program-name~ if -you are running Debian, to get the same general treatment of idleness. -On other systems, idle time refers to Emacs idle time only. +idleness, not just Emacs' idle time. For X11, you can install a +utility program =x11idle.c=, available in the =org-contrib/= +repository, or install the xprintidle package and set it to the +variable ~org-clock-x11idle-program-name~ if you are running Debian, +to get the same general treatment of idleness. On other systems, idle +time refers to Emacs idle time only. [fn:82] Please note the pitfalls of summing hierarchical data in a flat list (see [[*Using Column View in the Agenda]]). @@ -21733,7 +22056,7 @@ a fragment, see the documentation of the function version 1.34 of the =htmlize.el= package, which you need to install). Fontified code chunks in LaTeX can be achieved using either the [[https://www.ctan.org/pkg/listings][listings]] package or the [[https://www.ctan.org/pkg/minted][minted]] package. Refer to -~org-export-latex-listings~ for details. +~org-latex-listings~ for details. [fn:115] Source code in code blocks may also be evaluated either interactively or on export. See [[*Working with Source Code]] for more @@ -21762,7 +22085,9 @@ and =#+STARTUP: nofnadjust=. [fn:122] The variable ~org-export-date-timestamp-format~ defines how this timestamp are exported. -[fn:123] DEFINITION NOT FOUND. +[fn:123] For export to LaTeX format---or LaTeX-related formats such as +Beamer---, the =org-latex-package-alist= variable needs further +configuration. See [[LaTeX specific export settings]]. [fn:124] At the moment, some export back-ends do not obey this specification. For example, LaTeX export excludes every unnumbered @@ -21785,7 +22110,7 @@ to make it visible. The tag serves as a visual aid and has no semantic relevance. [fn:129] By default Org loads MathJax from [[https://cdnjs.com][cdnjs.com]] as recommended by -[[http://www.mathjax.org][MathJax]]. +[[https://www.mathjax.org][MathJax]]. [fn:130] Please note that exported formulas are part of an HTML document, and that signs such as =<=, =>=, or =&= have special @@ -21802,93 +22127,89 @@ use the variables ~org-html-todo-kwd-class-prefix~ and for different files. However, "smart" LaTeX compilation systems, such as latexmk, can select the correct bibliography compiler. -[fn:134] See [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open Document Format for Office Applications +[fn:134] Minted uses an external Python package for code highlighting, +which requires the flag =-shell-escape= to be added to +~org-latex-pdf-process~. + +[fn:135] See [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open Document Format for Office Applications (OpenDocument) Version 1.2]]. -[fn:135] See [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]]. +[fn:136] See [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]]. -[fn:136] See [[http://dlmf.nist.gov/LaTeXML/]]. +[fn:137] See [[http://dlmf.nist.gov/LaTeXML/]]. -[fn:137] [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2 Specification]] +[fn:138] [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2 Specification]] -[fn:138] See the == element of the +[fn:139] See the == element of the OpenDocument-v1.2 specification. -[fn:139] See the attributes =table:template-name=, +[fn:140] See the attributes =table:template-name=, =table:use-first-row-styles=, =table:use-last-row-styles=, =table:use-first-column-styles=, =table:use-last-column-styles=, =table:use-banding-rows-styles=, and =table:use-banding-column-styles= of the == element in the OpenDocument-v1.2 specification. -[fn:140] If the publishing directory is the same as the source +[fn:141] If the publishing directory is the same as the source directory, =file.org= is exported as =file.org.org=, so you probably do not want to do this. -[fn:141] The option ~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used +[fn:142] The option ~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used to remove code evaluation from the {{{kbd(C-c C-c)}}} key binding. -[fn:142] Actually, the constructs =call_()= and =src_{}= +[fn:143] Actually, the constructs =call_()= and =src_{}= are not evaluated when they appear in a keyword (see [[*Summary of In-Buffer Settings]]). -[fn:143] C++ language is handled in =ob-C.el=. Even though the -identifier for such source blocks is =C++=, you activate it by loading -the C language. - -[fn:144] D language is handled in =ob-C.el=. Even though the -identifier for such source blocks is =D=, you activate it by loading -the C language. - -[fn:145] For noweb literate programming details, see +[fn:144] For noweb literate programming details, see http://www.cs.tufts.edu/~nr/noweb/. -[fn:146] For more information, please refer to the commentary section +[fn:145] For more information, please refer to the commentary section in =org-tempo.el=. -[fn:147] Org Indent mode also sets ~wrap-prefix~ correctly for +[fn:146] Org Indent mode also sets ~wrap-prefix~ correctly for indenting and wrapping long lines of headlines or text. This minor mode also handles Visual Line mode and directly applied settings through ~word-wrap~. -[fn:148] This works, but requires extra effort. Org Indent mode is +[fn:147] This works, but requires extra effort. Org Indent mode is more convenient for most applications. -[fn:149] ~org-adapt-indentation~ can also be set to ='headline-data=, +[fn:148] ~org-adapt-indentation~ can also be set to ='headline-data=, in which case only data lines below the headline will be indented. -[fn:150] Note that Org Indent mode also sets the ~wrap-prefix~ +[fn:149] Note that Org Indent mode also sets the ~wrap-prefix~ property, such that Visual Line mode (or purely setting ~word-wrap~) wraps long lines, including headlines, correctly indented. -[fn:151] For a server to host files, consider using a WebDAV server, +[fn:150] For a server to host files, consider using a WebDAV server, such as [[https://nextcloud.com][Nextcloud]]. Additional help is at this [[https://orgmode.org/worg/org-faq.html#mobileorg_webdav][FAQ entry]]. -[fn:152] If Emacs is configured for safe storing of passwords, then +[fn:151] If Emacs is configured for safe storing of passwords, then configure the variable ~org-mobile-encryption-password~; please read the docstring of that variable. -[fn:153] Symbolic links in ~org-directory~ need to have the same name +[fn:152] Symbolic links in ~org-directory~ need to have the same name as their targets. -[fn:154] While creating the agendas, Org mode forces =ID= properties +[fn:153] While creating the agendas, Org mode forces =ID= properties on all referenced entries, so that these entries can be uniquely identified if Org Mobile flags them for further action. To avoid setting properties configure the variable ~org-mobile-force-id-on-agenda-items~ to ~nil~. Org mode then relies on outline paths, assuming they are unique. -[fn:155] Checksums are stored automatically in the file +[fn:154] Checksums are stored automatically in the file =checksums.dat=. -[fn:156] The file will be empty after this operation. +[fn:155] The file will be empty after this operation. -[fn:157] https://www.ctan.org/pkg/comment +[fn:156] https://www.ctan.org/pkg/comment -[fn:158] By default this works only for LaTeX, HTML, and Texinfo. +[fn:157] By default this works only for LaTeX, HTML, and Texinfo. Configure the variable ~orgtbl-radio-table-templates~ to install templates for other modes. -[fn:159] If the =TBLFM= keyword contains an odd number of dollar +[fn:158] If the =TBLFM= keyword contains an odd number of dollar characters, this may cause problems with Font Lock in LaTeX mode. As shown in the example you can fix this by adding an extra line inside the =comment= environment that is used to balance the dollar @@ -21896,9 +22217,9 @@ expressions. If you are using AUCTeX with the font-latex library, a much better solution is to add the =comment= environment to the variable ~LaTeX-verbatim-environments~. -[fn:160] The ~agenda*~ view is the same as ~agenda~ except that it +[fn:159] The ~agenda*~ view is the same as ~agenda~ except that it only considers /appointments/, i.e., scheduled and deadline items that have a time specification =[h]h:mm= in their time-stamps. -[fn:161] Note that, for ~org-odd-levels-only~, a level number +[fn:160] Note that, for ~org-odd-levels-only~, a level number corresponds to order in the hierarchy, not to the number of stars. diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 2b9cbf37c4..cbb0d38a2a 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -3,13 +3,574 @@ ORG NEWS -- history of user-visible changes. -*- mode: org; coding: utf-8 -*- #+STARTUP: overview #+LINK: doc https://orgmode.org/worg/doc.html#%s -#+LINK: git https://code.orgmode.org/bzg/org-mode/commit/%s +#+LINK: msg https://list.orgmode.org/%s/ +#+LINK: git https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=%s Copyright (C) 2012-2021 Free Software Foundation, Inc. See the end of the file for license conditions. Please send Org bug reports to mailto:emacs-orgmode@gnu.org. +* Version 9.5 + +** Important announcements and breaking changes + +*** The =contrib/= now lives in a separate repository + +Org's repository has been trimmed from the =contrib/= directory. + +The old contents of the =contrib/= directory now lives in a separate +repository at https://git.sr.ht/~bzg/org-contrib. + +You can install this repository by cloning it and updating your +~load-path~ accordingly. You can also install =org-contrib= as a +[[https://elpa.nongnu.org/nongnu/][NonGNU ELPA]] package. + +*** Org ELPA and Org archives won't be available for Org > 9.5 + +[[https://orgmode.org/elpa.html][Org ELPA]] is still available for installing Org 9.5, either with or +without contributed packages, but future versions won't be available +via Org ELPA, as we are deprecating this installation method. + +Also, Org 9.5 is available as =tar.gz= and =zip= archives, but this +installation method is also deprecated. + +If you want to install the latest stable versions of Org, please use +the GNU ELPA package. If you want to install the contributed files, +please use the NonGNU ELPA package. If you want to keep up with the +latest unstable Org, please install from the Git repository. + +See https://orgmode.org/org.html#Installation for the details. + +*** =ditaa.jar= is not bundled with Org anymore + +=ditaa.jar= used to be bundled with Org but it is not anymore. +See [[https://github.com/stathissideris/ditaa][the ditaa repository]] on how to install it. + +*** ~org-adapt-indentation~ now defaults to =nil= + +If you want to automatically indent headlines' metadata, set it to +=headline-data=. + +If you want to automatically indent every line to the headline's +current indentation, set it to =t=. + +Indent added by =RET= and =C-j= also depends on the value of +~electric-indent-mode~. Enabling this mode by default in 9.4 revealed +some bugs caused confusing behavior. If you disabled +~electric-indent-mode~ for this reason, it is time to try it again. +Hopefully problems have been fixed. See [[https://orgmode.org/worg/org-faq.html#indentation][this FAQ]] for more details. + +*** ~org-speed-commands-user~ is obsolete, use ~org-speed-commands~ + +Setting ~org-speed-commands-user~ in your configuration won't have any +effect. Please set ~org-speed-commands~ instead, which see. + +*** Some =ob-*.el= files have been moved to the org-contrib repo + +These files have been moved to https://git.sr.ht/~bzg/org-contrib: + +- ob-abc.el +- ob-asymptote.el +- ob-coq.el +- ob-ebnf.el +- ob-hledger.el +- ob-io.el +- ob-J.el +- ob-ledger.el +- ob-mscgen.el +- ob-picolisp.el +- ob-shen.el +- ob-stan.el +- ob-vala.el + +See the discussion [[msg::87bl9rq29m.fsf@gnu.org][here]]. + +*** Compatibility with Emacs versions + +We made it explicit that we aim at keeping the latest stable version +of Org compatible with at least Emacs V, V-1 and V-2, where V is the +stable major version of Emacs. + +For example, if the current major version of Emacs is 28.x, then the +latest stable version of Org should be compatible with Emacs 28.x, +27.x and 26.x – but not with Emacs 25.x. + +See [[https://orgmode.org/worg/org-maintenance.html#emacs-compatibility][this note on Worg]] and [[git::519947e508e081e71bf67db99e27b1c171ba4dfe][this commit]]. + +** New features + +*** New citation engine + +Org 9.5 provides a new library =oc.el= which provides tooling to +handle citations in Org, e.g., activate, follow, insert, and export +them, respectively called "activate", "follow", "insert" and "export" +capabilities. Libraries responsible for providing some, or all, of +these capabilities are called "citation processors". + +The manual contains a few pointers to let you start and you may want +to check [[https://blog.tecosaur.com/tmio/2021-07-31-citations.html][this blog post]]. If you need help using this new features, +please ask on the mailing list. + +Thanks to Nicolas Goaziou for implementing this, to Bruce D’Arcus for +helping him and to John Kitchin for paving the way with =org-ref.el=. + +*** Async session evaluation + +The =:async= header argument can be used for asynchronous evaluation +in session blocks for certain languages. + +Currently, async evaluation is supported in Python. There is also +functionality to implement async evaluation in other languages that +use comint, but this needs to be done on a per-language basis. + +By default, async evaluation is disabled unless the =:async= header +argument is present. You can also set =:async no= to force it off +(for example if you've set =:async= in a property drawer). + +Async evaluation is disabled during export. +*** ~ox-koma-letter.el~ is now part of Org's core + +~ox-koma-letter.el~ provides a KOMA scrlttr2 back-end for the Org +export engine. It used to be in the =contrib/= directory but it is +now part of Org's core. + +*** Support exporting DOI links + +Org now supports export for DOI links, through its new =ol-doi.el= +library. For backward compatibility, it is loaded by default. + +*** Add a new ~:refile-targets~ template option + +When exiting capture mode via ~org-capture-refile~, the variable +~org-refile-targets~ will be temporarily bound to the value of this +template option. + +*** New startup options =#+startup: showlevels= + +These startup options complement the existing =overview=, =content=, +=showall=, =showeverything= with a way to start the document with n +levels shown, where n goes from 2 to 5. + +Example: + +: #+startup: show3levels + +*** New =u= table formula flag to enable Calc units simplification mode + +A new =u= mode flag for Calc formulas in Org tables has been added to +enable Calc units simplification mode. + +*** Support fontification of inline export snippets + +See [[msg:87im57fh8j.fsf@gmail.com][this thread]]. + +*** New command =org-refile-reverse= bound to =C-c C-M-w= + +You can now use =C-c C-M-w= to run ~org-refile-reverse~. + +It is almost identical to ~org-refile~, except that it temporarily +toggles how ~org-reverse-note-order~ applies to the current buffer. +So if ~org-refile~ would append the entry as the last entry under the +target heading, ~org-refile-reverse~ will prepend it as the first +entry, and vice-versa. + +*** LaTeX attribute ~:float~ now passes through arbitrary values + +LaTeX users are able to define arbitrary float types, e.g. with the +float package. The Org mode LaTeX exporter is now able to process and +export arbitrary float types. The user is responsible for ensuring +that Org mode configures LaTeX to process any new float type. + +*** Support verse and quote blocks in LaTeX export + +The LaTeX export back-end accepts four attributes for verse blocks: +=:lines=, =:center=, =:versewidth= and =:latexcode=. The three first +require the external LaTeX package =verse.sty=, which is an extension +of the standard LaTeX environment. + +The LaTeX export back-end accepts two attributes for quote blocks: +=:environment=, for an arbitrary quoting environment (the default +value is that of =org-latex-default-quote-environment=: ="quote"=) and +=:options=. + +*** =org-set-tags-command= selects tags from ~org-global-tags-completion-table~ + +Let ~org-set-tags-command~ TAB fast tag completion interface complete +tags including from both buffer local and user defined persistent +global list (~org-tag-alist~ and ~org-tag-persistent-alist~). Now +option ~org-complete-tags-always-offer-all-agenda-tags~ is honored. + +*** Clocktable option =:formula %= now shows the per-file time percentages + +This change only has an effect when multiple files are contributing to +a given clocktable (such as when =:scope agenda= has been specified). +The existing behavior is that such tables have an extra 'File' column, +and each individual file that contributes has its own summary line +with the headline value '*File time*'. Those summary rows also +produce a rollup time value for the file in the 'Time' column. + +Prior to this change, the built-in =%= formula did not produce a +calculation for those per-file times in the '%' column (the relevant +cells in the '%' column were blank). With this change, the percentage +contribution of each individual file time to the total time is shown. + +The more agenda files you have, the more useful this behavior becomes. + +*** =ob-python.el= improvements to =:return= header argument + +The =:return= header argument in =ob-python= now works for session +blocks as well as non-session blocks. Also, it now works with the +=:epilogue= header argument -- previously, setting the =:return= +header would cause the =:epilogue= to be ignored. + +This change allows more easily moving boilerplate out of the main code +block and into the header. For example, for plotting, we need to add +boilerplate to save the figure to a file and return the +filename. Instead of doing this within the code block, we can now +handle it through the header arguments as follows: + +#+BEGIN_SRC org +,#+header: :var fname="/home/jack/tmp/plot.svg" +,#+header: :epilogue plt.savefig(fname) +,#+header: :return fname +,#+begin_src python :results value file + import matplotlib, numpy + import matplotlib.pyplot as plt + fig=plt.figure(figsize=(4,2)) + x=numpy.linspace(-15,15) + plt.plot(numpy.sin(x)/x) + fig.tight_layout() +,#+end_src + +,#+RESULTS: +[[file:/home/jack/tmp/plot.svg]] +#+END_SRC + +As another example, we can use =:return= with the external [[https://pypi.org/project/tabulate/][tabulate]] +package, to convert pandas Dataframes into orgmode tables: + +#+begin_src org +,#+header: :prologue from tabulate import tabulate +,#+header: :return tabulate(table, headers=table.columns, tablefmt="orgtbl") +,#+begin_src python :results value raw :session + import pandas as pd + table = pd.DataFrame({ + "a": [1,2,3], + "b": [4,5,6] + }) +,#+end_src + +,#+RESULTS: +| | a | b | +|---+---+---| +| 0 | 1 | 4 | +| 1 | 2 | 5 | +| 2 | 3 | 6 | +#+end_src + +*** Display images with width proportional to the buffer text width + +Previously, if you used a =:width= attribute like =#+attr_html: :width 70%= or +=#+attr_latex: :width 0.7\linewidth= this would be interpreted as a 70px wide and +0.7px wide width specification respectively. + +Now, percentages are transformed into floats (i.e. 70% becomes 0.7), +and float width specifications between 0.0 and 2.0 are now interpreted +as that portion of the text width in the buffer. For instance, the +above examples of =70%= and =0.7\linewidth= will result in an image +with width equal to the pixel-width of the buffer text multiplied by 0.7. + +This functionality is implemented in a new function, +~org-display-inline-image--width~ which contains the width +determination logic previously in ~org-display-inline-images~ and the +new behaviour. + +** New options +*** Option ~org-hidden-keywords~ now also applies to #+SUBTITLE: + +The option ~org-hidden-keywords~ previously applied +to #+TITLE:, #+AUTHOR:, #+DATE:, and #+EMAIL:. Now it can also be +used to hide the #+SUBTITLE: keyword. + +*** New formatting directive ~%L~ for org-capture + +The new ~%L~ formatting directive contains the bare link target, and +may be used to create links with programmatically generated +descriptions. + +*** New option ~org-id-ts-format~ + +Earlier, IDs generated using =ts= method had a hard-coded format (i.e. =20200923T160237.891616=). +The new option allows user to customise the format. +Defaults are unchanged. + +*** New argument for ~file-desc~ babel header + +It is now possible to provide the =file-desc= header argument for a +babel source block but omit the description by passing an empty vector +as an argument (i.e., :file-desc []). This can be useful because +providing =file-desc= without an argument results in the result of +=file= being used in the description. Previously, the only way to +omit a file description was to omit the header argument entirely, +which made it difficult/impossible to provide a default value for +=file-desc=. + +*** New option to set ~org-link-file-path-type~ to a function + +~org-link-file-path-type~ can now be set to a function that takes the +full filename as an argument and returns the path to link to. + +For example, if you use ~project.el~, you can set this function to use +relative links within a project as follows: + +#+begin_src emacs-lisp +(setq (org-link-file-path-type + (lambda (path) + (let* ((proj (project-current)) + (root (if proj (project-root proj) default-directory))) + (if (string-prefix-p (expand-file-name root) path) + (file-relative-name path) + (abbreviate-file-name path)))))) +#+end_src + +*** New options and new behavior for babel LaTeX SVG image files + +Org babel now uses a two-stage process for converting latex source +blocks to SVG image files (when the extension of the output file is +~.svg~). The first stage in the process converts the latex block into +a PDF file, which is then converted into an SVG file in the second +stage. The TeX->PDF part uses the existing infrastructure for +~org-babel-latex-tex-to-pdf~. The PDF->SVG part uses a command +specified in a new customization, +~org-babel-latex-pdf-svg-process~. By default, this uses inkscape for +conversion, but since it is fully customizable, any other command can +be used in its place. For instance, dvisvgm might be used here. This +two-part processing replaces the previous use of htlatex to process +LaTeX directly to SVG (htlatex is still used for HTML conversion). + +Conversion to SVG exposes a number of additional customizations that +give the user full control over the contents of the latex source +block. ~org-babel-latex-preamble~, ~org-babel-latex-begin-env~ and +~org-babel-latex-end-env~ are new customization options added to allow +the user to specify the preamble and code that preceedes and proceeds +the contents of the source block. + +*** New option ~org-html-meta-tags~ allows for HTML meta tags customization + +New variable ~org-html-meta-tags~ makes it possible to customize the +== tags used in an HTML export. Accepts either a static list of +values, or a function that generates such a list (see +~org-html-meta-tags-default~ as an example of the latter). + +*** Option ~org-agenda-bulk-custom-functions~ now supports collecting bulk arguments + +When specifying a custom agenda bulk option, you can now also specify +a function which collects the arguments to be used with each call to +the custom function. + +*** New faces to improve the contextuality of Org agenda views + +Four new faces improve certain styles and offer more flexibility for +some Org agenda views: ~org-agenda-date-weekend-today~, +~org-imminent-deadline~, ~org-agenda-structure-secondary~, +~org-agenda-structure-filter~. They inherit from existing faces in +order to remain backward-compatible. + +Quoting from [[https://list.orgmode.org/87lf7q7gpq.fsf@protesilaos.com/][this thread]]: + +#+begin_quote ++ The 'org-imminent-deadline' is useful to disambiguate generic + warnings from deadlines. For example, a warning could be rendered + in a yellow colored text and have a bold weight, whereas a deadline + might be red and styled with italics. + ++ The 'org-agenda-structure-filter' applies to all tag/term filters + in agenda views that search for keywords or patterns. It is + designed to inherit from 'org-agenda-structure' in addition to the + 'org-warning' face that was present before (and removes the + generic 'warning' face from one place). This offers the benefit + of consistency, as, say, an increase in font height or a change in + font family in 'org-agenda-structure' will propagate to the filter + as well. The whole header line thus looks part of a singular + design. + ++ The 'org-agenda-structure-secondary' complements the above for those + same views where a description follows the header. For instance, the + tags view provides information to "Press N r" to filter by a + numbered tag. Themes/users may prefer to disambiguate this line + from the header above it, such as by using a less intense color or by + reducing its height relative to the 'org-agenda-structure'. + ++ The 'org-agenda-date-weekend-today' provides the option to + differentiate the current date on a weekend from the current date on + weekdays. +#+end_quote + +*** New option ~org-clock-ask-before-exiting~ + +By default, a function is now added to ~kill-emacs-query-functions~ +that asks whether to clock out and save when there's a running clock. +Customize ~org-clock-ask-before-exiting~~ to nil to disable this new +behavior. + +*** Option ~org-html-inline-image-rules~ now includes .webp + +By default ox-html now inlines webp images. + +*** ~org-html-head-include-scripts~ is now =nil= by default + +See [[msg:498dbe2e-0cd2-c81e-7960-4a26c566a1f7@memebeam.org][this thread]]. + +*** New option ~org-html-content-class~ + +This is the CSS class name to use for the top level content wrapper. + +*** New option ~org-babel-plantuml-svg-text-to-path~ + +This option, nil by default, allows to add a SVG-specific post-export +step that runs inkscape text-to-path replacement over the output file. + +*** You can now configure ~org-html-scripts~ and ~org-html-style-default~ + +~org-html-scripts~ and ~org-html-style-default~ used to be constants, +you can now configure them. + +*** New option ~org-attach-git-dir~ + +~org-attach-git-dir~ will decide whether to use ~org-attach-git-dir~ +(the default) or use the attachment directory of the current node, if +it is correctly configured as a Git repository. + +*** Some faces now use fixed-pitch + +See [[msg:875z8njaol.fsf@protesilaos.com][this thread]]. + +*** New option ~org-attach-sync-delete-empty-dir~ + +~org-attach-sync-delete-empty-dir~ controls the deletion of an empty +attachment directory at calls of ~org-attach-sync~. There is +Never delete, Always delete and Query the user (default). + +*** ~org-babel-default-header-args~ can now be specified as closures or strings + +~org-babel-default-header-args~ now also accepts closures that +evaluate to a string. Previously, only direct strings were +supported. These closures are evaluated when point is at the source +block, which allows them to make use of contextual information at the +relevant source block. One example that illustrates the usefulness of +this addition (also given in the documentation for +~org-babel-default-header-args~) is: + +#+begin_src elisp +(defun org-src-sha () + (let ((elem (org-element-at-point))) + (concat (sha1 (org-element-property :value elem)) \".svg\"))) + +(setq org-babel-default-header-args:latex + `((:results . \"file link replace\") + (:file . (lambda () (org-src-sha))))) +#+end_src + +This will set the ~:file~ header argument to the sha1 checksum of the +contents of the current latex source block. + +Finally, the closures are only evaluated if they're not overridden for +a source block. This improves efficiency in cases where the result of +a compute-expensive closure would otherwise be discarded. + +** Miscellaneous +*** =org-bibtex= includes =doi= and =url= entries when exporting to BiBTeX +=doi= and =url= entries have been made optional for some publication +types and will be exported if present for those types. +*** Missing or empty placeholders in "eval" macros are now =nil= +They used to be the empty string. +*** =org-goto-first-child= now works before first heading + +When point is before first heading =org-goto-first-child= will move +point to the first child heading, or return nil if no heading exist +in buffer. This is in line with the fact that everything before first +heading is regarded as outline level 0, i.e. the parent level of all +headings in the buffer. + +Previously =org-goto-first-child= would do nothing before first +heading, except return nil. + +*** Faces of all the heading text elements now conform to the headline face + +In the past, faces of todo keywords, emphasised text, tags, and +priority cookies inherited =default= face. The resulting headline +fontification was not always consistent, as discussed in [[https://lists.gnu.org/archive/html/emacs-orgmode/2020-09/msg00331.html][this bug +report]]. Now, the relevant faces adapt to face used to fontify the +current headline level. + +Users who prefer to keep the old behaviour should change their face +customisation explicitly stating that =default= face is inherited. + +Example of old face customisation: + +#+begin_src emacs-lisp +(setq org-todo-keyword-faces '(("TODO" + :background "chocolate" + :height 0.75))) +#+end_src + +To preserve the old behaviour the above customisation should be +changed to + +#+begin_src emacs-lisp +(setq org-todo-keyword-faces '(("TODO" + :inherit default + :background "chocolate" + :height 0.75))) +#+end_src + +*** Storing ID-links before first heading uses title as description + +Storing links to files using ~org-store-link~ (==) when +~org-id-link-to-org-use-id~ is not nil will now store the title as +description of the link, if available. If no title exists it falls +back to the filename as before. + +*** Change in =org-tags-expand= signature + +The function does not allow for a third optional parameter anymore. +*** LaTeX environment =#+results= are now removed + +If a babel src block produces a raw LaTeX environment, it will now be +recognised as a result, and so replaced when re-evaluated. + +*** Tag completion now uses =completing-read-multiple= + +Tag completion now uses =completing-read-multiple= with a simple +completion table, which should allow better interoperability with +custom completion functions. + +*** Providing =directory-empty-p= from Emacs 28 as =org-directory-empty-p= + +*** =org-get-last-sibling= marked as obsolete + +Use =org-get-previous-sibling= instead. This is just a rename to have +a more consistent naming. E.g. recall the pair of funtctions +=next-line= / =previous-line=. + +*** Make org-protocol compatible with =URLSearchParams= JavaScript class + +Decoder of query part of org-protocol URI recognizes "+" as an encoded +space characters now, so it is possible to avoid call to =encodeURIComponent= +for each parameter and use more readable expression in bookmarklet: + +#+begin_example +'org-protocol://store-link?' + new URLSearchParams({ + url: location.href, title: document.title}) +#+end_example + +*** Remove obsolete LaTeX packages from ~org-latex-default-packages-alist~ + +The LaTeX packages =grffile= and =textcomp= are redundant, with their +capabilities being merged into =graphicx= and the LaTeX core +respectively a while ago. + * Version 9.4 ** Incompatible changes *** Possibly broken internal file links: please check and fix @@ -101,6 +662,40 @@ Also, ~org-startup-folded~ now defaults to ~showeverything~. ** New features +*** =RET= and =C-j= now obey ~electric-indent-mode~ + +Since Emacs 24.4, ~electric-indent-mode~ is enabled by default. In +most major modes, this causes =RET= to reindent the current line and +indent the new line, and =C-j= to insert a newline without indenting. + +Org mode now obeys this minor mode: when ~electric-indent-mode~ is +enabled, and point is neither in a table nor on a timestamp or a link: + +- =RET= (bound to ~org-return~) reindents the current line and indents + the new line; +- =C-j= (bound to the new command ~org-return-and-maybe-indent~) + merely inserts a newline. + +To get the previous behaviour back, disable ~electric-indent-mode~ +explicitly: + +#+begin_src emacs-lisp +(add-hook 'org-mode-hook (lambda () (electric-indent-local-mode -1))) +#+end_src + +Alternatively, if you wish to keep =RET= as the "smart-return" key, +but dislike Org's default indentation of sections, you may prefer to +customize ~org-adapt-indentation~ to either nil or =headline-data=. + +*** New allowed value for ~org-adapt-indentation~ + +~org-adapt-indentation~ now accepts a new value, =headline-data=. + +When set to this value, Org will only adapt indentation of headline +data lines, such as planning/clock lines and property/logbook drawers. +Also, with this setting, =org-indent-mode= will keep these data lines +correctly aligned with the headline above. + *** Looping agenda commands over headlines ~org-agenda-loop-over-headlines-in-active-region~ allows you to loop @@ -134,15 +729,6 @@ call ~org-toggle-radio-button~. You can also add =#+ATTR_ORG: :radio t= right before the list to tell Org to use radio buttons for this list only. -*** New allowed value for ~org-adapt-indentation~ - -~org-adapt-indentation~ now accepts a new value, ='headline-data=. - -When set to this value, Org will only adapt indentation of headline -data lines, such as planning/clock lines and property/logbook drawers. -Also, with this setting, =org-indent-mode= will keep these data lines -correctly aligned with the headline above. - *** Numeric priorities are now allowed (up to 65) You can now set ~org-priority-highest/lowest/default~ to integers to @@ -212,31 +798,6 @@ can now be inserted with this prefix argument. Source code block header argument =:file-mode= can set file permissions if =:file= argument is provided. -*** =RET= and =C-j= now obey ~electric-indent-mode~ - -Since Emacs 24.4, ~electric-indent-mode~ is enabled by default. In -most major modes, this causes =RET= to reindent the current line and -indent the new line, and =C-j= to insert a newline without indenting. - -Org mode now obeys this minor mode: when ~electric-indent-mode~ is -enabled, and point is neither in a table nor on a timestamp or a link: - -- =RET= (bound to ~org-return~) reindents the current line and indents - the new line; -- =C-j= (bound to the new command ~org-return-and-maybe-indent~) - merely inserts a newline. - -To get the previous behaviour back, disable ~electric-indent-mode~ -explicitly: - -#+begin_src emacs-lisp -(add-hook 'org-mode-hook (lambda () (electric-indent-local-mode -1))) -#+end_src - -Alternatively, if you wish to keep =RET= as the "smart-return" key, -but dislike Org's default indentation of sections, you may prefer to -customize ~org-adapt-indentation~ to either =nil= or ='headline-data=. - *** =ob-C.el= allows the inclusion of non-system header files In C and C++ blocks, ~:includes~ arguments that do not start with a @@ -353,7 +914,7 @@ source buffers are displayed by modifying ~display-buffer-alist~ or *** New option ~org-archive-subtree-save-file-p~ Archiving a subtree used to always save the target archive buffer. -Commit [[https://code.orgmode.org/bzg/org-mode/commit/b186d1d7][b186d1d7]] changed this behavior by always not saving the target +Commit [[git::b186d1d7][b186d1d7]] changed this behavior by always not saving the target buffer, because batch archiving from agenda could take too much time. This new option ~org-archive-subtree-save-file-p~ defaults to the @@ -380,14 +941,14 @@ The value of a shell script's execution is its exit code. But most users expect the results of executing a shell script to be its output, not its exit code. -So we introduced this option, that you can set to =nil= if you want -to stick using ~:results value~ as the implicit header. +So we introduced this option, that you can set to nil if you want to +stick using ~:results value~ as the implicit header. In all Babel libraries, the absence of a ~:results~ header should produce the same result than setting ~:results value~, unless there is an option to explicitly create an exception. -See [[https://orgmode.org/list/CA+A2iZaziAfMeGpBqL6qGrzrWEVvLvC0DUw++T4gCF3NGuW-DQ@mail.gmail.com/][this thread]] for more context. +See [[msg:CA+A2iZaziAfMeGpBqL6qGrzrWEVvLvC0DUw++T4gCF3NGuW-DQ@mail.gmail.com][this thread]] for more context. *** New option in ~org-attach-store-link-p~ @@ -1197,7 +1758,7 @@ With this output format, create a link to the file specified in #+begin_example ,#+begin_src shell :dir "data/tmp" :results link :file "crackzor_1.0.c.gz" -wget -c "http://ben.akrin.com/crackzor/crackzor_1.0.c.gz" +wget -c "https://ben.akrin.com/crackzor/crackzor_1.0.c.gz" ,#+end_src ,#+results: @@ -1537,7 +2098,9 @@ Use "/!" markup when filtering TODO keywords to get only not-done TODO keywords. *** ~org-split-string~ returns ~("")~ when called on an empty string + It used to return nil. + *** Removal of =ob-scala.el= See [[https://github.com/ensime/emacs-scala-mode/issues/114][this github issue]]. @@ -1605,7 +2168,8 @@ before this let form. Creation of a new setting to specify the Cider timeout. By setting the =org-babel-clojure-sync-nrepl-timeout= setting option. The value -is in seconds and if set to =nil= then no timeout will occur. +is in seconds and if set to nil then no timeout will occur. + **** Clojure: new header ~:show-process~ A new block code header has been created for Org Babel that enables @@ -1648,7 +2212,7 @@ this ~:prologue "fpprintprec: 2; linel: 50;"~ for presenting Maxima results in a beamer presentation. **** PlantUML: add support for header arguments -[[http://plantuml.com/][Plantuml]] source blocks now support the [[https://orgmode.org/manual/prologue.html#prologue][~:prologue~]], [[https://orgmode.org/manual/epilogue.html#epilogue][~:epilogue~]] and +[[https://plantuml.com/][Plantuml]] source blocks now support the [[https://orgmode.org/manual/prologue.html#prologue][~:prologue~]], [[https://orgmode.org/manual/epilogue.html#epilogue][~:epilogue~]] and [[https://orgmode.org/manual/var.html#var][~:var~]] header arguments. **** SQL: new engine added ~sqsh~ @@ -1821,9 +2385,8 @@ removed from Gnus circa September 2010. *** ~org-agenda-repeating-timestamp-show-all~ is removed. -For an equivalent to a =nil= value, set -~org-agenda-show-future-repeats~ to nil and -~org-agenda-prefer-last-repeat~ to =t=. +For an equivalent to a nil value, set ~org-agenda-show-future-repeats~ +to nil and ~org-agenda-prefer-last-repeat~ to =t=. *** ~org-gnus-nnimap-query-article-no-from-file~ is removed. @@ -1841,7 +2404,7 @@ equivalent to the removed format string. *** ~org-enable-table-editor~ is removed. -Setting it to a =nil= value broke some other features (e.g., speed +Setting it to a nil value broke some other features (e.g., speed keys). *** ~org-export-use-babel~ cannot be set to ~inline-only~ @@ -2284,7 +2847,7 @@ The postgresql engine in a sql code block supports now ~:dbport~ nd **** Support for additional plantuml output formats -The support for output formats of [[http://plantuml.com/][plantuml]] has been extended to now +The support for output formats of [[https://plantuml.com/][plantuml]] has been extended to now include: All Diagrams: @@ -2317,7 +2880,7 @@ Alice <-- Bob: another authentication Response #+end_src Please note that *pdf* *does not work out of the box* and needs additional -setup in addition to plantuml. See [[http://plantuml.com/pdf.html]] for +setup in addition to plantuml. See [[https://plantuml.com/pdf.html]] for details and setup information. *** Rewrite of radio lists @@ -3447,11 +4010,11 @@ then inline code snippets will be wrapped into the formatting string. ** New contributed packages - =ox-bibtex.el= by Nicolas Goaziou :: an utility to handle BibTeX - export to both LaTeX and HTML exports. It uses the [[http://www.lri.fr/~filliatr/bibtex2html/][bibtex2html]] + export to both LaTeX and HTML exports. It uses the [[https://www.lri.fr/~filliatr/bibtex2html/][bibtex2html]] software. - =org-screenshot.el= by Max Mikhanosha :: an utility to handle - screenshots easily from Org, using the external tool [[http://freecode.com/projects/scrot][scrot]]. + screenshots easily from Org, using the external tool [[https://freecode.com/projects/scrot][scrot]]. ** Miscellaneous @@ -3602,7 +4165,7 @@ manual for details and check [[https://orgmode.org/worg/org-8.0.html][this Worg *** ~ox-md.el~ by Nicolas Goaziou =ox-md.el= allows you to export Org files to Markdown files, using the - vanilla [[http://daringfireball.net/projects/markdown/][Markdown syntax]]. + vanilla [[https://daringfireball.net/projects/markdown/][Markdown syntax]]. *** ~ox-texinfo.el~ by Jonathan Leech-Pepin @@ -3612,14 +4175,14 @@ manual for details and check [[https://orgmode.org/worg/org-8.0.html][this Worg *** ~ob-julia.el~ by G. Jay Kerns - [[http://julialang.org/][Julia]] is a new programming language. + [[https://julialang.org/][Julia]] is a new programming language. =ob-julia.el= provides Org Babel support for evaluating Julia source code. *** ~ob-mathomatic.el~ by Luis Anaya - [[http://www.mathomatic.org/][mathomatic]] a portable, command-line, educational CAS and calculator + [[https://www.mathomatic.org/][mathomatic]] a portable, command-line, educational CAS and calculator software, written entirely in the C programming language. ~ob-mathomatic.el~ provides Org Babel support for evaluating mathomatic @@ -3627,7 +4190,7 @@ manual for details and check [[https://orgmode.org/worg/org-8.0.html][this Worg *** ~ob-tcl.el~ by Luis Anaya - ~ob-tcl.el~ provides Org Babel support for evaluating [[http://www.tcl.tk/][Tcl]] source code. + ~ob-tcl.el~ provides Org Babel support for evaluating [[https://www.tcl.tk/][Tcl]] source code. *** ~org-bullets.el~ by Evgeni Sabof @@ -3653,7 +4216,7 @@ manual for details and check [[https://orgmode.org/worg/org-8.0.html][this Worg presentations. ~ox-deck.el~ exports Org files to HTML presentations using =deck.js=. - [[http://meyerweb.com/eric/tools/s5/][s5]] is a set of scripts which also allows to display HTML pages as + [[https://meyerweb.com/eric/tools/s5/][s5]] is a set of scripts which also allows to display HTML pages as presentations. ~ox-s5.el~ exports Org files to HTML presentations using =s5=. @@ -3760,13 +4323,13 @@ forward and backward. Now Org will sort this list -: - [[http://abc.org][B]] -: - [[http://def.org][A]] +: - [[https://abc.org][B]] +: - [[https://def.org][A]] like this: -: - [[http://def.org][A]] -: - [[http://abc.org][B]] +: - [[https://def.org][A]] +: - [[https://abc.org][B]] by comparing the descriptions, not the links. Same when sorting headlines instead of list items. @@ -4270,8 +4833,8 @@ found here: https://orgmode.org/worg/org-tutorials/org-outside-org.html Here are two screencasts demonstrating Thorsten's tools: -- [[http://youtu.be/nqE6YxlY0rw]["Modern conventions for Emacs Lisp files"]] -- [[http://www.youtube.com/watch?v%3DII-xYw5VGFM][Exploring Bernt Hansen's Org-mode tutorial with 'navi-mode']] +- [[https://youtu.be/nqE6YxlY0rw]["Modern conventions for Emacs Lisp files"]] +- [[https://www.youtube.com/watch?v%3DII-xYw5VGFM][Exploring Bernt Hansen's Org-mode tutorial with 'navi-mode']] *** MobileOrg for iOS @@ -4301,7 +4864,7 @@ lines even if `org-use-tag-inheritance' was nil. The default is now to *never* display inherited tags in agenda lines, but to /know/ about them when the agenda type is listed in [[doc::org-agenda-use-tag-inheritance][org-agenda-use-tag-inheritance]]. -** New default value nil for [[doc::org-agenda-dim-blocked-tasks][org-agenda-dim-blocked-tasks]] +** New default value =nil= for [[doc::org-agenda-dim-blocked-tasks][org-agenda-dim-blocked-tasks]] Using `nil' as the default value speeds up the agenda generation. You can hit `#' (or `C-u #') in agenda buffers to temporarily dim (or turn @@ -5130,7 +5693,7 @@ that Calc formulas can operate on them. The new system has a technically cleaner implementation and more possibilities for capturing different types of data. See - [[https://orgmode.org/list/C46F10DC-DE51-43D4-AFFE-F71E440D1E1F@gmail.com][Carsten's announcement]] for more details. + [[msg:C46F10DC-DE51-43D4-AFFE-F71E440D1E1F@gmail.com][Carsten's announcement]] for more details. To switch over to the new system: @@ -5261,7 +5824,7 @@ that Calc formulas can operate on them. **** Modified link escaping - David Maus worked on `org-link-escape'. See [[https://orgmode.org/list/87k4gysacq.wl%dmaus@ictsoc.de][his message]]: + David Maus worked on `org-link-escape'. See [[msg:87k4gysacq.wl%dmaus@ictsoc.de][his message]]: : Percent escaping is used in Org mode to escape certain characters : in links that would either break the parser (e.g. square brackets diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex index dc28587b47..d3715948d6 100644 --- a/etc/refcards/orgcard.tex +++ b/etc/refcards/orgcard.tex @@ -1,6 +1,6 @@ % Reference Card for Org Mode -\def\orgversionnumber{9.4.2} -\def\versionyear{2019} % latest update +\def\orgversionnumber{9.5} +\def\versionyear{2021} % latest update \input emacsver.tex %**start of header diff --git a/lisp/org/ob-C.el b/lisp/org/ob-C.el index 6e33901793..842e0d3e8e 100644 --- a/lisp/org/ob-C.el +++ b/lisp/org/ob-C.el @@ -4,6 +4,7 @@ ;; Author: Eric Schulte ;; Thierry Banel +;; Maintainer: Thierry Banel ;; Keywords: literate programming, reproducible research ;; Homepage: https://orgmode.org @@ -94,8 +95,7 @@ This function calls `org-babel-execute:C++'." (org-babel-execute:C++ body params)) (defun org-babel-expand-body:cpp (body params) - "Expand a block of C++ code with org-babel according to its -header arguments." + "Expand a block of C++ code with org-babel according to its header arguments." (org-babel-expand-body:C++ body params)) (defun org-babel-execute:C++ (body params) @@ -104,8 +104,7 @@ This function is called by `org-babel-execute-src-block'." (let ((org-babel-c-variant 'cpp)) (org-babel-C-execute body params))) (defun org-babel-expand-body:C++ (body params) - "Expand a block of C++ code with org-babel according to its -header arguments." + "Expand a block of C++ code with org-babel according to its header arguments." (let ((org-babel-c-variant 'cpp)) (org-babel-C-expand-C++ body params))) (defun org-babel-execute:D (body params) @@ -114,8 +113,7 @@ This function is called by `org-babel-execute-src-block'." (let ((org-babel-c-variant 'd)) (org-babel-C-execute body params))) (defun org-babel-expand-body:D (body params) - "Expand a block of D code with org-babel according to its -header arguments." + "Expand a block of D code with org-babel according to its header arguments." (let ((org-babel-c-variant 'd)) (org-babel-C-expand-D body params))) (defun org-babel-execute:C (body params) @@ -124,8 +122,7 @@ This function is called by `org-babel-execute-src-block'." (let ((org-babel-c-variant 'c)) (org-babel-C-execute body params))) (defun org-babel-expand-body:C (body params) - "Expand a block of C code with org-babel according to its -header arguments." + "Expand a block of C code with org-babel according to its header arguments." (let ((org-babel-c-variant 'c)) (org-babel-C-expand-C body params))) (defun org-babel-C-execute (body params) @@ -196,13 +193,11 @@ or `org-babel-execute:C++' or `org-babel-execute:D'." ))) (defun org-babel-C-expand-C++ (body params) - "Expand a block of C or C++ code with org-babel according to -its header arguments." + "Expand a block of C/C++ code with org-babel according to its header arguments." (org-babel-C-expand-C body params)) (defun org-babel-C-expand-C (body params) - "Expand a block of C or C++ code with org-babel according to -its header arguments." + "Expand a block of C/C++ code with org-babel according to its header arguments." (let ((vars (org-babel--get-vars params)) (colnames (cdr (assq :colname-names params))) (main-p (not (string= (cdr (assq :main params)) "no"))) @@ -257,15 +252,21 @@ its header arguments." (when colnames (org-babel-C-utility-header-to-C)) ;; tables headers - (mapconcat 'org-babel-C-header-to-C colnames "\n") + (mapconcat (lambda (head) + (let* ((tblnm (car head)) + (tbl (cdr (car (let* ((el vars)) + (while (not (or (equal tblnm (caar el)) (not el))) + (setq el (cdr el))) + el)))) + (type (org-babel-C-val-to-base-type tbl))) + (org-babel-C-header-to-C head type))) colnames "\n") ;; body (if main-p (org-babel-C-ensure-main-wrap body) body) "\n") "\n"))) (defun org-babel-C-expand-D (body params) - "Expand a block of D code with org-babel according to -its header arguments." + "Expand a block of D code with org-babel according to its header arguments." (let ((vars (org-babel--get-vars params)) (colnames (cdr (assq :colname-names params))) (main-p (not (string= (cdr (assq :main params)) "no"))) @@ -289,7 +290,14 @@ its header arguments." (when colnames (org-babel-C-utility-header-to-C)) ;; tables headers - (mapconcat 'org-babel-C-header-to-C colnames "\n") + (mapconcat (lambda (head) + (let* ((tblnm (car head)) + (tbl (cdr (car (let* ((el vars)) + (while (not (or (equal tblnm (caar el)) (not el))) + (setq el (cdr el))) + el)))) + (type (org-babel-C-val-to-base-type tbl))) + (org-babel-C-header-to-C head type))) colnames "\n") ;; body (if main-p (org-babel-C-ensure-main-wrap body) @@ -333,7 +341,7 @@ FORMAT can be either a format string or a function which is called with VAL." (list (if (eq org-babel-c-variant 'd) "string" "const char*") "\"%s\"")) - (_ (error "unknown type %S" basetype))))) + (_ (error "Unknown type %S" basetype))))) (cond ((integerp val) type) ;; an integer declared in the #+begin_src line ((floatp val) type) ;; a numeric declared in the #+begin_src line @@ -341,7 +349,9 @@ FORMAT can be either a format string or a function which is called with VAL." `(,(car type) (lambda (val) (cons - (format "[%d][%d]" (length val) (length (car val))) + (pcase org-babel-c-variant + ((or `c `cpp) (format "[%d][%d]" (length val) (length (car val)))) + (`d (format "[%d][%d]" (length (car val)) (length val)))) (concat (if (eq org-babel-c-variant 'd) "[\n" "{\n") (mapconcat @@ -388,8 +398,7 @@ FORMAT can be either a format string or a function which is called with VAL." (t 'stringp))) (defun org-babel-C-var-to-C (pair) - "Convert an elisp val into a string of C code specifying a var -of the same value." + "Convert an elisp val into a string of C code specifying a var of the same value." ;; TODO list support (let ((var (car pair)) (val (cdr pair))) @@ -402,11 +411,19 @@ of the same value." (formatted (org-babel-C-format-val type-data val)) (suffix (car formatted)) (data (cdr formatted))) - (format "%s %s%s = %s;" - type - var - suffix - data)))) + (pcase org-babel-c-variant + ((or `c `cpp) + (format "%s %s%s = %s;" + type + var + suffix + data)) + (`d + (format "%s%s %s = %s;" + type + suffix + var + data)))))) (defun org-babel-C-table-sizes-to-C (pair) "Create constants of table dimensions, if PAIR is a table." @@ -421,11 +438,15 @@ of the same value." (format "const int %s_cols = %d;" (car pair) (length (cdr pair))))))) (defun org-babel-C-utility-header-to-C () - "Generate a utility function to convert a column name -into a column number." + "Generate a utility function to convert a column name into a column number." (pcase org-babel-c-variant ((or `c `cpp) - "int get_column_num (int nbcols, const char** header, const char* column) + (concat + " +#ifndef _STRING_H +#include +#endif +int get_column_num (int nbcols, const char** header, const char* column) { int c; for (c=0; c -;; Keywords: literate programming, reproducible research -;; Homepage: https://orgmode.org - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - -;;; Commentary: - -;; Org-Babel support for evaluating J code. -;; -;; Session interaction depends on `j-console' from package `j-mode' -;; (available in MELPA). - -;;; Code: - -(require 'ob) -(require 'org-macs) - -(declare-function j-console-ensure-session "ext:j-console" ()) - -(defcustom org-babel-J-command "jconsole" - "Command to call J." - :group 'org-babel - :version "26.1" - :package-version '(Org . "9.0") - :type 'string) - -(defun org-babel-expand-body:J (body _params &optional _processed-params) - "Expand BODY according to PARAMS, return the expanded body. -PROCESSED-PARAMS isn't used yet." - (org-babel-J-interleave-echos-except-functions body)) - -(defun org-babel-J-interleave-echos (body) - "Interleave echo',' between each source line of BODY." - (mapconcat #'identity (split-string body "\n") "\necho','\n")) - -(defun org-babel-J-interleave-echos-except-functions (body) - "Interleave echo',' between source lines of BODY that aren't functions." - (if (obj-string-match-m "\\(?:^\\|\n\\)[^\n]*\\(?:0\\|1\\|2\\|3\\|4\\|dyad\\) : 0\n.*\n)\\(?:\n\\|$\\)" body) - (let ((s1 (substring body 0 (match-beginning 0))) - (s2 (match-string 0 body)) - (s3 (substring body (match-end 0)))) - (concat - (if (string= s1 "") - "" - (concat (org-babel-J-interleave-echos s1) - "\necho','\n")) - s2 - "\necho','\n" - (org-babel-J-interleave-echos-except-functions s3))) - (org-babel-J-interleave-echos body))) - -(defalias 'org-babel-execute:j 'org-babel-execute:J) - -(defun org-babel-execute:J (body params) - "Execute a block of J code BODY. -PARAMS are given by org-babel. -This function is called by `org-babel-execute-src-block'." - (message "executing J source code block") - (let* ((processed-params (org-babel-process-params params)) - (sessionp (cdr (assq :session params))) - (sit-time (let ((sit (assq :sit params))) - (if sit (cdr sit) .1))) - (full-body (org-babel-expand-body:J - body params processed-params)) - (tmp-script-file (org-babel-temp-file "J-src"))) - (org-babel-j-initiate-session sessionp) - (org-babel-J-strip-whitespace - (if (string= sessionp "none") - (progn - (with-temp-file tmp-script-file - (insert full-body)) - (org-babel-eval (format "%s < %s" org-babel-J-command tmp-script-file) "")) - (org-babel-J-eval-string full-body sit-time))))) - -(defun org-babel-J-eval-string (str sit-time) - "Sends STR to the `j-console-cmd' session and executes it." - (let ((session (j-console-ensure-session))) - (with-current-buffer (process-buffer session) - (goto-char (point-max)) - (insert (format "\n%s\n" str)) - (let ((beg (point))) - (comint-send-input) - (sit-for sit-time) - (buffer-substring-no-properties - beg (point-max)))))) - -(defun org-babel-J-strip-whitespace (str) - "Remove whitespace from jconsole output STR." - (mapconcat - #'identity - (delete "" (mapcar - #'org-babel-J-print-block - (split-string str "^ *,\n" t))) - "\n\n")) - -(defun obj-get-string-alignment (str) - "Return a number to describe STR alignment. -STR represents a table. -Positive/negative/zero result means right/left/undetermined. -Don't trust first line." - (let* ((str (org-trim str)) - (lines (split-string str "\n" t)) - n1 n2) - (cond ((<= (length lines) 1) - 0) - ((= (length lines) 2) - ;; numbers are right-aligned - (if (and - (numberp (read (car lines))) - (numberp (read (cadr lines))) - (setq n1 (obj-match-second-space-right (nth 0 lines))) - (setq n2 (obj-match-second-space-right (nth 1 lines)))) - n2 - 0)) - ((not (obj-match-second-space-left (nth 0 lines))) - 0) - ((and - (setq n1 (obj-match-second-space-left (nth 1 lines))) - (setq n2 (obj-match-second-space-left (nth 2 lines))) - (= n1 n2)) - n1) - ((and - (setq n1 (obj-match-second-space-right (nth 1 lines))) - (setq n2 (obj-match-second-space-right (nth 2 lines))) - (= n1 n2)) - (- n1)) - (t 0)))) - -(defun org-babel-J-print-block (x) - "Prettify jconsole output X." - (let* ((x (org-trim x)) - (a (obj-get-string-alignment x)) - (lines (split-string x "\n" t)) - b) - (cond ((< a 0) - (setq b (obj-match-second-space-right (nth 0 lines))) - (concat (make-string (+ a b) ? ) x)) - ((> a 0) - (setq b (obj-match-second-space-left (nth 0 lines))) - (concat (make-string (- a b) ? ) x)) - (t x)))) - -(defun obj-match-second-space-left (s) - "Return position of leftmost space in second space block of S or nil." - (and (string-match "^ *[^ ]+\\( \\)" s) - (match-beginning 1))) - -(defun obj-match-second-space-right (s) - "Return position of rightmost space in second space block of S or nil." - (and (string-match "^ *[^ ]+ *\\( \\)[^ ]" s) - (match-beginning 1))) - -(defun obj-string-match-m (regexp string &optional start) - "Call (string-match REGEXP STRING START). -REGEXP is modified so that .* matches newlines as well." - (string-match - (replace-regexp-in-string "\\.\\*" "[\0-\377[:nonascii:]]*" regexp) - string - start)) - -(defun org-babel-j-initiate-session (&optional session) - "Initiate a J session. -SESSION is a parameter given by org-babel." - (unless (string= session "none") - (require 'j-console) - (j-console-ensure-session))) - -(provide 'ob-J) - -;;; ob-J.el ends here diff --git a/lisp/org/ob-R.el b/lisp/org/ob-R.el index 309a0acf7e..169e1d6d6c 100644 --- a/lisp/org/ob-R.el +++ b/lisp/org/ob-R.el @@ -4,6 +4,7 @@ ;; Author: Eric Schulte ;; Dan Davison +;; Maintainer: Jeremie Juste ;; Keywords: literate programming, reproducible research, R, statistics ;; Homepage: https://orgmode.org @@ -39,6 +40,13 @@ (declare-function ess-wait-for-process "ext:ess-inf" (&optional proc sec-prompt wait force-redisplay)) +;; FIXME: Temporary declaration to silence the byte-compiler +(defvar user-inject-src-param) +(defvar ess-eval-visibly-tmp) +(defvar ess-eval-visibly) +(defvar ess-inject-source) +(defvar user-inject-src-param) + (defconst org-babel-header-args:R '((width . :any) (height . :any) @@ -157,6 +165,7 @@ This function is called by `org-babel-execute-src-block'." (save-excursion (let* ((result-params (cdr (assq :result-params params))) (result-type (cdr (assq :result-type params))) + (async (org-babel-comint-use-async params)) (session (org-babel-R-initiate-session (cdr (assq :session params)) params)) (graphics-file (and (member "graphics" (assq :result-params params)) @@ -183,7 +192,8 @@ This function is called by `org-babel-execute-src-block'." (cdr (assq :colname-names params)) colnames-p)) (or (equal "yes" rownames-p) (org-babel-pick-name - (cdr (assq :rowname-names params)) rownames-p))))) + (cdr (assq :rowname-names params)) rownames-p)) + async))) (if graphics-file nil result)))) (defun org-babel-prep-session:R (session params) @@ -321,7 +331,7 @@ Each member of this list is a list with three members: (device-info (or (assq (intern (concat ":" device)) org-babel-R-graphics-devices) (assq :png org-babel-R-graphics-devices))) - (extra-args (cdr (assq :R-dev-args params))) filearg args) + (extra-args (cdr (assq :R-dev-args params))) filearg args) (setq device (nth 1 device-info)) (setq filearg (nth 2 device-info)) (setq args (mapconcat @@ -348,7 +358,7 @@ Each member of this list is a list with three members: { tfile<-tempfile() write.table(object, file=tfile, sep=\"\\t\", - na=\"nil\",row.names=%s,col.names=%s, + na=\"\",row.names=%s,col.names=%s, quote=FALSE) file.rename(tfile,transfer.file) }, @@ -370,11 +380,14 @@ Has four %s escapes to be filled in: 4. The name of the file to write to") (defun org-babel-R-evaluate - (session body result-type result-params column-names-p row-names-p) + (session body result-type result-params column-names-p row-names-p async) "Evaluate R code in BODY." (if session - (org-babel-R-evaluate-session - session body result-type result-params column-names-p row-names-p) + (if async + (ob-session-async-org-babel-R-evaluate-session + session body result-type result-params column-names-p row-names-p) + (org-babel-R-evaluate-session + session body result-type result-params column-names-p row-names-p)) (org-babel-R-evaluate-external-process body result-type result-params column-names-p row-names-p))) @@ -450,11 +463,13 @@ last statement in BODY, as elisp." (car (split-string line "\n"))) (substring line (match-end 1)) line)) - (org-babel-comint-with-output (session org-babel-R-eoe-output) - (insert (mapconcat 'org-babel-chomp - (list body org-babel-R-eoe-indicator) - "\n")) - (inferior-ess-send-input)))))) "\n")))) + (with-current-buffer session + (let ((comint-prompt-regexp (concat "^" comint-prompt-regexp))) + (org-babel-comint-with-output (session org-babel-R-eoe-output) + (insert (mapconcat 'org-babel-chomp + (list body org-babel-R-eoe-indicator) + "\n")) + (inferior-ess-send-input)))))))) "\n")))) (defun org-babel-R-process-value-result (result column-names-p) "R-specific processing of return value. @@ -465,6 +480,91 @@ Insert hline if column names in output have been requested." (error "Could not parse R result")) result)) + +;;; async evaluation + +(defconst ob-session-async-R-indicator "'ob_comint_async_R_%s_%s'") + +(defun ob-session-async-org-babel-R-evaluate-session + (session body result-type _ column-names-p row-names-p) + "Asynchronously evaluate BODY in SESSION. +Returns a placeholder string for insertion, to later be replaced +by `org-babel-comint-async-filter'." + (org-babel-comint-async-register + session (current-buffer) + "^\\(?:[>.+] \\)*\\[1\\] \"ob_comint_async_R_\\(.+?\\)_\\(.+\\)\"$" + 'org-babel-chomp + 'ob-session-async-R-value-callback) + (cl-case result-type + (value + (let ((tmp-file (org-babel-temp-file "R-"))) + (with-temp-buffer + (insert + (org-babel-chomp body)) + (let ((ess-local-process-name + (process-name (get-buffer-process session)))) + (ess-eval-buffer nil))) + (with-temp-buffer + (insert + (mapconcat + 'org-babel-chomp + (list (format org-babel-R-write-object-command + (if row-names-p "TRUE" "FALSE") + (if column-names-p + (if row-names-p "NA" "TRUE") + "FALSE") + ".Last.value" + (org-babel-process-file-name tmp-file 'noquote)) + (format ob-session-async-R-indicator + "file" tmp-file)) + "\n")) + (let ((ess-local-process-name + (process-name (get-buffer-process session)))) + (ess-eval-buffer nil))) + tmp-file)) + (output + (let ((uuid (md5 (number-to-string (random 100000000)))) + (ess-local-process-name + (process-name (get-buffer-process session)))) + (with-temp-buffer + (insert (format ob-session-async-R-indicator + "start" uuid)) + (insert "\n") + (insert body) + (insert "\n") + (insert (format ob-session-async-R-indicator + "end" uuid)) + (setq ess-eval-visibly-tmp ess-eval-visibly) + (setq user-inject-src-param ess-inject-source) + (setq ess-eval-visibly nil) + (setq ess-inject-source 'function-and-buffer) + (ess-eval-buffer nil)) + (setq ess-eval-visibly ess-eval-visibly-tmp) + (setq ess-inject-source user-inject-src-param) + uuid)))) + +(defun ob-session-async-R-value-callback (params tmp-file) + "Callback for async value results. +Assigned locally to `ob-session-async-file-callback' in R +comint buffers used for asynchronous Babel evaluation." + (let* ((graphics-file (and (member "graphics" (assq :result-params params)) + (org-babel-graphical-output-file params))) + (colnames-p (unless graphics-file (cdr (assq :colnames params))))) + (org-babel-R-process-value-result + (org-babel-result-cond (assq :result-params params) + (with-temp-buffer + (insert-file-contents tmp-file) + (org-babel-chomp (buffer-string) "\n")) + (org-babel-import-elisp-from-file tmp-file '(16))) + (or (equal "yes" colnames-p) + (org-babel-pick-name + (cdr (assq :colname-names params)) colnames-p))))) + + + +;;; ob-session-async-R.el ends here + + (provide 'ob-R) ;;; ob-R.el ends here diff --git a/lisp/org/ob-abc.el b/lisp/org/ob-abc.el deleted file mode 100644 index 404e39fc27..0000000000 --- a/lisp/org/ob-abc.el +++ /dev/null @@ -1,90 +0,0 @@ -;;; ob-abc.el --- Org Babel Functions for ABC -*- lexical-binding: t; -*- - -;; Copyright (C) 2013-2021 Free Software Foundation, Inc. - -;; Author: William Waites -;; Keywords: literate programming, music -;; Homepage: https://www.tardis.ed.ac.uk/~wwaites - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - -;;; Commentary: - -;;; This file adds support to Org Babel for music in ABC notation. -;;; It requires that the abcm2ps program is installed. -;;; See http://moinejf.free.fr/ - -(require 'ob) - -;; optionally define a file extension for this language -(add-to-list 'org-babel-tangle-lang-exts '("abc" . "abc")) - -;; optionally declare default header arguments for this language -(defvar org-babel-default-header-args:abc - '((:results . "file") (:exports . "results")) - "Default arguments to use when evaluating an ABC source block.") - -(defun org-babel-expand-body:abc (body params) - "Expand BODY according to PARAMS, return the expanded body." - (let ((vars (org-babel--get-vars params))) - (mapc - (lambda (pair) - (let ((name (symbol-name (car pair))) - (value (cdr pair))) - (setq body - (replace-regexp-in-string - (concat "\\$" (regexp-quote name)) - (if (stringp value) value (format "%S" value)) - body)))) - vars) - body)) - -(defun org-babel-execute:abc (body params) - "Execute a block of ABC code with org-babel. This function is - called by `org-babel-execute-src-block'" - (message "executing Abc source code block") - (let* ((cmdline (cdr (assq :cmdline params))) - (out-file (let ((file (cdr (assq :file params)))) - (if file (replace-regexp-in-string "\\.pdf$" ".ps" file) - (error "abc code block requires :file header argument")))) - (in-file (org-babel-temp-file "abc-")) - (render (concat "abcm2ps" " " cmdline - " -O " (org-babel-process-file-name out-file) - " " (org-babel-process-file-name in-file)))) - (with-temp-file in-file (insert (org-babel-expand-body:abc body params))) - (org-babel-eval render "") - ;;; handle where abcm2ps changes the file name (to support multiple files - (when (or (string= (file-name-extension out-file) "eps") - (string= (file-name-extension out-file) "svg")) - (rename-file (concat - (file-name-sans-extension out-file) "001." - (file-name-extension out-file)) - out-file t)) - ;;; if we were asked for a pdf... - (when (string= (file-name-extension (cdr (assq :file params))) "pdf") - (org-babel-eval (concat "ps2pdf" " " out-file " " (cdr (assq :file params))) "")) - ;;; indicate that the file has been written - nil)) - -;; This function should be used to assign any variables in params in -;; the context of the session environment. -(defun org-babel-prep-session:abc (_session _params) - "Return an error because abc does not support sessions." - (error "ABC does not support sessions")) - -(provide 'ob-abc) - -;;; ob-abc.el ends here diff --git a/lisp/org/ob-asymptote.el b/lisp/org/ob-asymptote.el deleted file mode 100644 index bfb5b79145..0000000000 --- a/lisp/org/ob-asymptote.el +++ /dev/null @@ -1,137 +0,0 @@ -;;; ob-asymptote.el --- Babel Functions for Asymptote -*- lexical-binding: t; -*- - -;; Copyright (C) 2009-2021 Free Software Foundation, Inc. - -;; Author: Eric Schulte -;; Keywords: literate programming, reproducible research -;; Homepage: https://orgmode.org - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - -;;; Commentary: - -;; Org-Babel support for evaluating asymptote source code. -;; -;; This differs from most standard languages in that -;; -;; 1) there is no such thing as a "session" in asymptote -;; -;; 2) we are generally only going to return results of type "file" -;; -;; 3) we are adding the "file" and "cmdline" header arguments, if file -;; is omitted then the -V option is passed to the asy command for -;; interactive viewing - -;;; Requirements: - -;; - The asymptote program :: http://asymptote.sourceforge.net/ -;; -;; - asy-mode :: Major mode for editing asymptote files - -;;; Code: -(require 'ob) - -(defvar org-babel-tangle-lang-exts) -(add-to-list 'org-babel-tangle-lang-exts '("asymptote" . "asy")) - -(defvar org-babel-default-header-args:asymptote - '((:results . "file") (:exports . "results")) - "Default arguments when evaluating an Asymptote source block.") - -(defun org-babel-execute:asymptote (body params) - "Execute a block of Asymptote code. -This function is called by `org-babel-execute-src-block'." - (let* ((out-file (cdr (assq :file params))) - (format (or (file-name-extension out-file) - "pdf")) - (cmdline (cdr (assq :cmdline params))) - (in-file (org-babel-temp-file "asymptote-")) - (cmd - (concat "asy " - (if out-file - (concat - "-globalwrite -f " format - " -o " (org-babel-process-file-name out-file)) - "-V") - " " cmdline - " " (org-babel-process-file-name in-file)))) - (with-temp-file in-file - (insert (org-babel-expand-body:generic - body params - (org-babel-variable-assignments:asymptote params)))) - (message cmd) (shell-command cmd) - nil)) ;; signal that output has already been written to file - -(defun org-babel-prep-session:asymptote (_session _params) - "Return an error if the :session header argument is set. -Asymptote does not support sessions." - (error "Asymptote does not support sessions")) - -(defun org-babel-variable-assignments:asymptote (params) - "Return list of asymptote statements assigning the block's variables." - (mapcar #'org-babel-asymptote-var-to-asymptote - (org-babel--get-vars params))) - -(defun org-babel-asymptote-var-to-asymptote (pair) - "Convert an elisp value into an Asymptote variable. -The elisp value PAIR is converted into Asymptote code specifying -a variable of the same value." - (let ((var (car pair)) - (val (let ((v (cdr pair))) - (if (symbolp v) (symbol-name v) v)))) - (cond - ((integerp val) - (format "int %S=%S;" var val)) - ((floatp val) - (format "real %S=%S;" var val)) - ((stringp val) - (format "string %S=\"%s\";" var val)) - ((and (listp val) (not (listp (car val)))) - (let* ((type (org-babel-asymptote-define-type val)) - (fmt (if (eq 'string type) "\"%s\"" "%s")) - (vect (mapconcat (lambda (e) (format fmt e)) val ", "))) - (format "%s[] %S={%s};" type var vect))) - ((listp val) - (let* ((type (org-babel-asymptote-define-type val)) - (fmt (if (eq 'string type) "\"%s\"" "%s")) - (array (mapconcat (lambda (row) - (concat "{" - (mapconcat (lambda (e) (format fmt e)) - row ", ") - "}")) - val ","))) - (format "%S[][] %S={%s};" type var array)))))) - -(defun org-babel-asymptote-define-type (data) - "Determine type of DATA. - -DATA is a list. Return type as a symbol. - -The type is `string' if any element in DATA is a string. -Otherwise, it is either `real', if some elements are floats, or -`int'." - (letrec ((type 'int) - (find-type - (lambda (row) - (dolist (e row type) - (cond ((listp e) (setq type (funcall find-type e))) - ((stringp e) (throw 'exit 'string)) - ((floatp e) (setq type 'real))))))) - (catch 'exit (funcall find-type data)) type)) - -(provide 'ob-asymptote) - -;;; ob-asymptote.el ends here diff --git a/lisp/org/ob-awk.el b/lisp/org/ob-awk.el index b41d70f12c..28e9d32757 100644 --- a/lisp/org/ob-awk.el +++ b/lisp/org/ob-awk.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2011-2021 Free Software Foundation, Inc. ;; Author: Eric Schulte +;; Maintainer: Tyler Smith ;; Keywords: literate programming, reproducible research ;; Homepage: https://orgmode.org @@ -58,12 +59,12 @@ This function is called by `org-babel-execute-src-block'." (code-file (let ((file (org-babel-temp-file "awk-"))) (with-temp-file file (insert full-body)) file)) (stdin (let ((stdin (cdr (assq :stdin params)))) - (when stdin - (let ((tmp (org-babel-temp-file "awk-stdin-")) - (res (org-babel-ref-resolve stdin))) - (with-temp-file tmp - (insert (org-babel-awk-var-to-awk res))) - tmp)))) + (when stdin + (let ((tmp (org-babel-temp-file "awk-stdin-")) + (res (org-babel-ref-resolve stdin))) + (with-temp-file tmp + (insert (org-babel-awk-var-to-awk res))) + tmp)))) (cmd (mapconcat #'identity (append (list org-babel-awk-command diff --git a/lisp/org/ob-calc.el b/lisp/org/ob-calc.el index 39ebce1002..5962d38761 100644 --- a/lisp/org/ob-calc.el +++ b/lisp/org/ob-calc.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2010-2021 Free Software Foundation, Inc. ;; Author: Eric Schulte +;; Maintainer: Tom Gillespie ;; Keywords: literate programming, reproducible research ;; Homepage: https://orgmode.org @@ -90,7 +91,7 @@ (save-excursion (with-current-buffer (get-buffer "*Calculator*") (prog1 - (calc-eval (calc-top 1)) + (calc-eval (calc-top 1)) (calc-pop 1))))) (defun org-babel-calc-maybe-resolve-var (el) diff --git a/lisp/org/ob-clojure.el b/lisp/org/ob-clojure.el index 9834509fb0..3b995d94ce 100644 --- a/lisp/org/ob-clojure.el +++ b/lisp/org/ob-clojure.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2009-2021 Free Software Foundation, Inc. ;; Author: Joel Boehland, Eric Schulte, Oleh Krehel, Frederick Giasson +;; Maintainer: Bastien Guerry ;; ;; Keywords: literate programming, reproducible research ;; Homepage: https://orgmode.org diff --git a/lisp/org/ob-comint.el b/lisp/org/ob-comint.el index b14849df69..20ae76fadc 100644 --- a/lisp/org/ob-comint.el +++ b/lisp/org/ob-comint.el @@ -93,12 +93,7 @@ or user `keyboard-quit' during execution of body." (regexp-quote ,eoe-indicator) nil t) (re-search-forward comint-prompt-regexp nil t))))) - (accept-process-output (get-buffer-process (current-buffer))) - ;; thought the following this would allow async - ;; background running, but I was wrong... - ;; (run-with-timer .5 .5 'accept-process-output - ;; (get-buffer-process (current-buffer))) - ) + (accept-process-output (get-buffer-process (current-buffer)))) ;; replace cut dangling text (goto-char (process-mark (get-buffer-process (current-buffer)))) (insert dangling-text) @@ -135,7 +130,7 @@ statement (not large blocks of code)." (accept-process-output (get-buffer-process buffer))))) (defun org-babel-comint-eval-invisibly-and-wait-for-file - (buffer file string &optional period) + (buffer file string &optional period) "Evaluate STRING in BUFFER invisibly. Don't return until FILE exists. Code in STRING must ensure that FILE exists at end of evaluation." @@ -147,6 +142,171 @@ FILE exists at end of evaluation." (if (= (aref string (1- (length string))) ?\n) string (concat string "\n"))) (while (not (file-exists-p file)) (sit-for (or period 0.25)))) + +;;; Async evaluation + +(defvar-local org-babel-comint-async-indicator nil + "Regular expression that `org-babel-comint-async-filter' scans for. +It should have 2 parenthesized expressions, +e.g. \"org_babel_async_\\(start\\|end\\|file\\)_\\(.*\\)\". The +first parenthesized expression determines whether the token is +delimiting a result block, or whether the result is in a file. +If delimiting a block, the second expression gives a UUID for the +location to insert the result. Otherwise, the result is in a tmp +file, and the second expression gives the file name.") + +(defvar-local org-babel-comint-async-buffers nil + "List of Org mode buffers to check for Babel async output results.") + +(defvar-local org-babel-comint-async-file-callback nil + "Callback to clean and insert Babel async results from a temp file. +The callback function takes two arguments: the alist of params of the Babel +source block, and the name of the temp file.") + +(defvar-local org-babel-comint-async-chunk-callback nil + "Callback function to clean Babel async output results before insertion. +Its single argument is a string consisting of output from the +comint process. It should return a string that will be be passed +to `org-babel-insert-result'.") + +(defvar-local org-babel-comint-async-dangling nil + "Dangling piece of the last process output, in case +`org-babel-comint-async-indicator' is spread across multiple +comint outputs due to buffering.") + +(defun org-babel-comint-use-async (params) + "Determine whether to use session async evaluation. +PARAMS are the header arguments as passed to +`org-babel-execute:lang'." + (let ((async (assq :async params)) + (session (assq :session params))) + (and async + (not org-babel-exp-reference-buffer) + (not (equal (cdr async) "no")) + (not (equal (cdr session) "none"))))) + +(defun org-babel-comint-async-filter (string) + "Captures Babel async output from comint buffer back to Org mode buffers. +This function is added as a hook to `comint-output-filter-functions'. +STRING contains the output originally inserted into the comint buffer." + ;; Remove outdated Org mode buffers + (setq org-babel-comint-async-buffers + (cl-loop for buf in org-babel-comint-async-buffers + if (buffer-live-p buf) + collect buf)) + (let* ((indicator org-babel-comint-async-indicator) + (org-buffers org-babel-comint-async-buffers) + (file-callback org-babel-comint-async-file-callback) + (combined-string (concat org-babel-comint-async-dangling string)) + (new-dangling combined-string) + ;; list of UUID's matched by `org-babel-comint-async-indicator' + uuid-list) + (with-temp-buffer + (insert combined-string) + (goto-char (point-min)) + (while (re-search-forward indicator nil t) + ;; update dangling + (setq new-dangling (buffer-substring (point) (point-max))) + (cond ((equal (match-string 1) "end") + ;; save UUID for insertion later + (push (match-string 2) uuid-list)) + ((equal (match-string 1) "file") + ;; insert results from tmp-file + (let ((tmp-file (match-string 2))) + (cl-loop for buf in org-buffers + until + (with-current-buffer buf + (save-excursion + (goto-char (point-min)) + (when (search-forward tmp-file nil t) + (org-babel-previous-src-block) + (let* ((info (org-babel-get-src-block-info)) + (params (nth 2 info)) + (result-params + (cdr (assq :result-params params)))) + (org-babel-insert-result + (funcall file-callback + (nth + 2 (org-babel-get-src-block-info)) + tmp-file) + result-params info)) + t)))))))) + ;; Truncate dangling to only the most recent output + (when (> (length new-dangling) (length string)) + (setq new-dangling string))) + (setq-local org-babel-comint-async-dangling new-dangling) + (when uuid-list + ;; Search for results in the comint buffer + (save-excursion + (goto-char (point-max)) + (while uuid-list + (re-search-backward indicator) + (when (equal (match-string 1) "end") + (let* ((uuid (match-string-no-properties 2)) + (res-str-raw + (buffer-substring + ;; move point to beginning of indicator + (- (match-beginning 0) 1) + ;; find the matching start indicator + (cl-loop + do (re-search-backward indicator) + until (and (equal (match-string 1) "start") + (equal (match-string 2) uuid)) + finally return (+ 1 (match-end 0))))) + ;; Apply callback to clean up the result + (res-str (funcall org-babel-comint-async-chunk-callback + res-str-raw))) + ;; Search for uuid in associated org-buffers to insert results + (cl-loop for buf in org-buffers + until (with-current-buffer buf + (save-excursion + (goto-char (point-min)) + (when (search-forward uuid nil t) + (org-babel-previous-src-block) + (let* ((info (org-babel-get-src-block-info)) + (params (nth 2 info)) + (result-params + (cdr (assq :result-params params)))) + (org-babel-insert-result + res-str result-params info)) + t)))) + ;; Remove uuid from the list to search for + (setq uuid-list (delete uuid uuid-list))))))))) + +(defun org-babel-comint-async-register + (session-buffer org-buffer indicator-regexp + chunk-callback file-callback) + "Set local org-babel-comint-async variables in SESSION-BUFFER. +ORG-BUFFER is added to `org-babel-comint-async-buffers' if not +present. `org-babel-comint-async-indicator', +`org-babel-comint-async-chunk-callback', and +`org-babel-comint-async-file-callback' are set to +INDICATOR-REGEXP, CHUNK-CALLBACK, and FILE-CALLBACK +respectively." + (org-babel-comint-in-buffer session-buffer + (setq org-babel-comint-async-indicator indicator-regexp + org-babel-comint-async-chunk-callback chunk-callback + org-babel-comint-async-file-callback file-callback) + (unless (memq org-buffer org-babel-comint-async-buffers) + (setq org-babel-comint-async-buffers + (cons org-buffer org-babel-comint-async-buffers))) + (add-hook 'comint-output-filter-functions + 'org-babel-comint-async-filter nil t))) + +(defmacro org-babel-comint-async-delete-dangling-and-eval + (session-buffer &rest body) + "Remove dangling text in SESSION-BUFFER and evaluate BODY. +This is analogous to `org-babel-comint-with-output', but meant +for asynchronous output, and much shorter because inserting the +result is delegated to `org-babel-comint-async-filter'." + (declare (indent 1) (debug t)) + `(org-babel-comint-in-buffer ,session-buffer + (goto-char (process-mark (get-buffer-process (current-buffer)))) + (delete-region (point) (point-max)) + ,@body)) + (provide 'ob-comint) + + ;;; ob-comint.el ends here diff --git a/lisp/org/ob-coq.el b/lisp/org/ob-coq.el deleted file mode 100644 index c77e8c9af6..0000000000 --- a/lisp/org/ob-coq.el +++ /dev/null @@ -1,80 +0,0 @@ -;;; ob-coq.el --- Babel Functions for Coq -*- lexical-binding: t; -*- - -;; Copyright (C) 2010-2021 Free Software Foundation, Inc. - -;; Author: Eric Schulte -;; Keywords: literate programming, reproducible research -;; Homepage: https://orgmode.org - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - -;;; Commentary: - -;; Rudimentary support for evaluating Coq code blocks. Currently only -;; session evaluation is supported. Requires both coq.el and -;; coq-inferior.el, both of which are distributed with Coq. -;; -;; https://coq.inria.fr/ - -;;; Code: -(require 'ob) - -(declare-function run-coq "ext:coq-inferior.el" (cmd)) -(declare-function coq-proc "ext:coq-inferior.el" ()) - -(defvar coq-program-name "coqtop" - "Name of the coq toplevel to run.") - -(defvar org-babel-coq-buffer "*coq*" - "Buffer in which to evaluate coq code blocks.") - -(defun org-babel-coq-clean-prompt (string) - (if (string-match "^[^[:space:]]+ < " string) - (substring string 0 (match-beginning 0)) - string)) - -(defun org-babel-execute:coq (body params) - (let ((full-body (org-babel-expand-body:generic body params)) - (session (org-babel-coq-initiate-session)) - (pt (lambda () - (marker-position - (process-mark (get-buffer-process (current-buffer))))))) - (org-babel-coq-clean-prompt - (org-babel-comint-in-buffer session - (let ((start (funcall pt))) - (with-temp-buffer - (insert full-body) - (comint-send-region (coq-proc) (point-min) (point-max)) - (comint-send-string (coq-proc) - (if (string= (buffer-substring (- (point-max) 1) (point-max)) ".") - "\n" - ".\n"))) - (while (equal start (funcall pt)) (sleep-for 0.1)) - (buffer-substring start (funcall pt))))))) - -(defun org-babel-coq-initiate-session () - "Initiate a coq session. -If there is not a current inferior-process-buffer in SESSION then -create one. Return the initialized session." - (unless (fboundp 'run-coq) - (error "`run-coq' not defined, load coq-inferior.el")) - (save-window-excursion (run-coq coq-program-name)) - (sit-for 0.1) - (get-buffer org-babel-coq-buffer)) - -(provide 'ob-coq) - -;;; ob-coq.el ends here diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el index b1fd694371..06a2a88cd4 100644 --- a/lisp/org/ob-core.el +++ b/lisp/org/ob-core.el @@ -290,9 +290,9 @@ environment, to override this check." (format "Evaluate this %s code block%son your system? " lang name-string))) (progn - (message "Evaluation of this %s code block%sis aborted." - lang name-string) - nil))) + (message "Evaluation of this %s code block%sis aborted." + lang name-string) + nil))) (x (error "Unexpected value `%s' from `org-babel-check-confirm-evaluate'" x))))) ;;;###autoload @@ -472,7 +472,35 @@ For the format of SAFE-LIST, see `org-babel-safe-header-args'." (defvar org-babel-default-header-args '((:session . "none") (:results . "replace") (:exports . "code") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no")) - "Default arguments to use when evaluating a source block.") + "Default arguments to use when evaluating a source block. + +This is a list in which each element is an alist. Each key +corresponds to a header argument, and each value to that header's +value. The value can either be a string or a closure that +evaluates to a string. The closure is evaluated when the source +block is being evaluated (e.g. during execution or export), with +point at the source block. It is not possible to use an +arbitrary function symbol (e.g. 'some-func), since org uses +lexical binding. To achieve the same functionality, call the +function within a closure (e.g. (lambda () (some-func))). + +To understand how closures can be used as default header +arguments, imagine you'd like to set the file name output of a +latex source block to a sha1 of its contents. We could achieve +this with: + +(defun org-src-sha () + (let ((elem (org-element-at-point))) + (concat (sha1 (org-element-property :value elem)) \".svg\"))) + +(setq org-babel-default-header-args:latex + `((:results . \"file link replace\") + (:file . (lambda () (org-src-sha))))) + +Because the closure is evaluated with point at the source block, +the call to `org-element-at-point' above will always retrieve +information about the current source block.") + (put 'org-babel-default-header-args 'safe-local-variable (org-babel-header-args-safe-fn org-babel-safe-header-args)) @@ -538,7 +566,7 @@ to raise errors for all languages.") "Number of initial characters to show of a hidden results hash.") (defvar org-babel-after-execute-hook nil - "Hook for functions to be called after `org-babel-execute-src-block'") + "Hook for functions to be called after `org-babel-execute-src-block'.") (defun org-babel-named-src-block-regexp-for-name (&optional name) "Generate a regexp used to match a source block named NAME. @@ -581,7 +609,17 @@ multiple blocks are being executed (e.g., in chained execution through use of the :var header argument) this marker points to the outer-most code block.") -(defvar *this*) +(defun org-babel-eval-headers (headers) + "Compute header list set with HEADERS. + +Evaluate all header arguments set to functions prior to returning +the list of header arguments." + (let ((lst nil)) + (dolist (elem headers) + (if (and (cdr elem) (functionp (cdr elem))) + (push `(,(car elem) . ,(funcall (cdr elem))) lst) + (push elem lst))) + (reverse lst))) (defun org-babel-get-src-block-info (&optional light datum) "Extract information from a source block or inline source block. @@ -646,6 +684,16 @@ a list with the following pattern: (replace-regexp-in-string (org-src-coderef-regexp coderef) "" expand nil nil 1)))) +(defun org-babel--file-desc (params result) + "Retrieve file description." + (pcase (assq :file-desc params) + (`nil nil) + (`(:file-desc) result) + (`(:file-desc . ,(and (pred stringp) val)) val))) + +(defvar *this*) ; Dynamically bound in `org-babel-execute-src-block' + ; and `org-babel-read' + ;;;###autoload (defun org-babel-execute-src-block (&optional arg info params) "Execute the current source code block. @@ -749,8 +797,7 @@ block." (let ((*this* (if (not file) result (org-babel-result-to-file file - (let ((desc (assq :file-desc params))) - (and desc (or (cdr desc) result))))))) + (org-babel--file-desc params result))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" result-params)))))) @@ -802,27 +849,6 @@ arguments and pop open the results in a preview buffer." expanded (concat "*Org-Babel Preview " (buffer-name) "[ " lang " ]*")) expanded))) -(defun org-babel-edit-distance (s1 s2) - "Return the edit (levenshtein) distance between strings S1 S2." - (let* ((l1 (length s1)) - (l2 (length s2)) - (dist (vconcat (mapcar (lambda (_) (make-vector (1+ l2) nil)) - (number-sequence 1 (1+ l1))))) - (in (lambda (i j) (aref (aref dist i) j)))) - (setf (aref (aref dist 0) 0) 0) - (dolist (j (number-sequence 1 l2)) - (setf (aref (aref dist 0) j) j)) - (dolist (i (number-sequence 1 l1)) - (setf (aref (aref dist i) 0) i) - (dolist (j (number-sequence 1 l2)) - (setf (aref (aref dist i) j) - (min - (1+ (funcall in (1- i) j)) - (1+ (funcall in i (1- j))) - (+ (if (equal (aref s1 (1- i)) (aref s2 (1- j))) 0 1) - (funcall in (1- i) (1- j))))))) - (funcall in l1 l2))) - (defun org-babel-combine-header-arg-lists (original &rest others) "Combine a number of lists of header argument names and arguments." (let ((results (copy-sequence original))) @@ -851,7 +877,7 @@ arguments and pop open the results in a preview buffer." (match-string 4)))))) (dolist (name names) (when (and (not (string= header name)) - (<= (org-babel-edit-distance header name) too-close) + (<= (org-string-distance header name) too-close) (not (member header names))) (error "Supplied header \"%S\" is suspiciously close to \"%S\"" header name)))) @@ -1446,7 +1472,7 @@ portions of results lines." ;; Remove overlays when changing major mode (add-hook 'org-mode-hook (lambda () (add-hook 'change-major-mode-hook - #'org-babel-show-result-all 'append 'local))) + #'org-babel-show-result-all 'append 'local))) (defun org-babel-params-from-properties (&optional lang no-eval) "Retrieve source block parameters specified as properties. @@ -1550,11 +1576,11 @@ balanced instances of \"[ \t]:\", set ALTS to ((32 9) . 58)." (first= (lambda (str) (= ch (aref str 0))))) (reverse (cl-reduce (lambda (acc el) - (let ((head (car acc))) - (if (and head (or (funcall last= head) (funcall first= el))) - (cons (concat head el) (cdr acc)) - (cons el acc)))) - list :initial-value nil)))) + (let ((head (car acc))) + (if (and head (or (funcall last= head) (funcall first= el))) + (cons (concat head el) (cdr acc)) + (cons el acc)))) + list :initial-value nil)))) (defun org-babel-parse-header-arguments (string &optional no-eval) "Parse header arguments in STRING. @@ -1628,7 +1654,7 @@ shown below. (t 'value)))) (cl-remove-if (lambda (x) (memq (car x) '(:colname-names :rowname-names :result-params - :result-type :var))) + :result-type :var))) params)))) ;; row and column names @@ -1698,9 +1724,12 @@ of the vars, cnames and rnames." (list (mapcar (lambda (var) - (when (listp (cdr var)) + (when (proper-list-p (cdr var)) (when (and (not (equal colnames "no")) - (or colnames (and (eq (nth 1 (cdr var)) 'hline) + ;; Compatibility note: avoid `length>', which + ;; isn't available until Emacs 28. + (or colnames (and (> (length (cdr var)) 1) + (eq (nth 1 (cdr var)) 'hline) (not (member 'hline (cddr (cdr var))))))) (let ((both (org-babel-get-colnames (cdr var)))) (setq cnames (cons (cons (car var) (cdr both)) @@ -1720,7 +1749,7 @@ of the vars, cnames and rnames." (defun org-babel-reassemble-table (table colnames rownames) "Add column and row names to a table. Given a TABLE and set of COLNAMES and ROWNAMES add the names -to the table for reinsertion to org-mode." +to the table for reinsertion to `org-mode'." (if (listp table) (let ((table (if (and rownames (= (length table) (length rownames))) (org-babel-put-rownames table rownames) table))) @@ -1755,7 +1784,7 @@ If the point is not on a source block then return nil." "Go to the beginning of the current code block." (interactive) (let ((head (org-babel-where-is-src-block-head))) - (if head (goto-char head) (error "Not currently in a code block")))) + (if head (goto-char head) (error "Not currently in a code block")))) ;;;###autoload (defun org-babel-goto-named-src-block (name) @@ -2199,6 +2228,10 @@ silent -- no results are inserted into the Org buffer but ingested by Emacs (a potentially time consuming process). +none ---- no results are inserted into the Org buffer nor + echoed to the minibuffer. they are not processed into + Emacs-lisp objects at all. + file ---- the results are interpreted as a file path, and are inserted into the buffer using the Org file syntax. @@ -2256,9 +2289,8 @@ INFO may provide the values of these header arguments (in the (setq result (org-no-properties result)) (when (member "file" result-params) (setq result (org-babel-result-to-file - result (when (assq :file-desc (nth 2 info)) - (or (cdr (assq :file-desc (nth 2 info))) - result)))))) + result + (org-babel--file-desc (nth 2 info) result))))) ((listp result)) (t (setq result (format "%S" result)))) (if (and result-params (member "silent" result-params)) @@ -2324,7 +2356,7 @@ INFO may provide the values of these header arguments (in the (if results-switches (concat " " results-switches) "")) (let ((wrap (lambda (start finish &optional no-escape no-newlines - inline-start inline-finish) + inline-start inline-finish) (when inline (setq start inline-start) (setq finish inline-finish) @@ -2553,8 +2585,9 @@ in the buffer." (let ((element (org-element-at-point))) (if (memq (org-element-type element) ;; Possible results types. - '(drawer example-block export-block fixed-width item - plain-list special-block src-block table)) + '(drawer example-block export-block fixed-width + special-block src-block item plain-list table + latex-environment)) (save-excursion (goto-char (min (point-max) ;for narrowed buffers (org-element-property :end element))) @@ -2570,9 +2603,9 @@ file's directory then expand relative links." (let ((same-directory? (and (buffer-file-name (buffer-base-buffer)) (not (string= (expand-file-name default-directory) - (expand-file-name - (file-name-directory - (buffer-file-name (buffer-base-buffer))))))))) + (expand-file-name + (file-name-directory + (buffer-file-name (buffer-base-buffer))))))))) (format "[[file:%s]%s]" (if (and default-directory (buffer-file-name (buffer-base-buffer)) same-directory?) @@ -2706,12 +2739,17 @@ parameters when merging lists." results-exclusive-groups results (split-string - (if (stringp value) value (eval value t)))))) + (cond ((stringp value) value) + ((functionp value) (funcall value)) + (t (eval value t))))))) (`(:exports . ,value) (setq exports (funcall merge exports-exclusive-groups exports - (split-string (or value ""))))) + (split-string + (cond ((and value (functionp value)) (funcall value)) + (value value) + (t "")))))) ;; Regular keywords: any value overwrites the previous one. (_ (setq params (cons pair (assq-delete-all (car pair) params))))))) ;; Handle `:var' and clear out colnames and rownames for replaced @@ -2726,14 +2764,14 @@ parameters when merging lists." (cdr (assq param params)))) (setq params (cl-remove-if (lambda (pair) (and (equal (car pair) param) - (null (cdr pair)))) + (null (cdr pair)))) params))))) ;; Handle other special keywords, which accept multiple values. (setq params (nconc (list (cons :results (mapconcat #'identity results " ")) (cons :exports (mapconcat #'identity exports " "))) params)) ;; Return merged params. - params)) + (org-babel-eval-headers params))) (defun org-babel-noweb-p (params context) "Check if PARAMS require expansion in CONTEXT. @@ -2842,8 +2880,6 @@ block but are passed literally to the \"example-block\"." (setq cache nil) (let ((raw (org-babel-ref-resolve id))) (if (stringp raw) raw (format "%S" raw)))) - ;; Retrieve from the Library of Babel. - ((nth 2 (assoc-string id org-babel-library-of-babel))) ;; Return the contents of headlines literally. ((org-babel-ref-goto-headline-id id) (org-babel-ref-headline-body)) @@ -2856,6 +2892,8 @@ block but are passed literally to the \"example-block\"." (not (org-in-commented-heading-p)) (funcall expand-body (org-babel-get-src-block-info t)))))) + ;; Retrieve from the Library of Babel. + ((nth 2 (assoc-string id org-babel-library-of-babel))) ;; All Noweb references were cached in a previous ;; run. Extract the information from the cache. ((hash-table-p cache) @@ -2976,7 +3014,7 @@ block but are passed literally to the \"example-block\"." (defun org-babel-read (cell &optional inhibit-lisp-eval) "Convert the string value of CELL to a number if appropriate. -Otherwise if CELL looks like lisp (meaning it starts with a +Otherwise if CELL looks like Lisp (meaning it starts with a \"(\", \"\\='\", \"\\=`\" or a \"[\") then read and evaluate it as lisp, otherwise return it unmodified as a string. Optional argument INHIBIT-LISP-EVAL inhibits lisp evaluation for @@ -3148,7 +3186,7 @@ For the format of SAFE-LIST, see `org-babel-safe-header-args'." (and entry (consp entry) (cond ((functionp (cdr entry)) - (funcall (cdr entry) (cdr pair))) + (funcall (cdr entry) (cdr pair))) ((listp (cdr entry)) (member (cdr pair) (cdr entry))) (t nil))))))) @@ -3168,10 +3206,10 @@ Otherwise, the :file parameter is treated as a full file name, and the output file name is the directory (as calculated above) plus the parameter value." (let* ((file-cons (assq :file params)) - (file-ext-cons (assq :file-ext params)) - (file-ext (cdr-safe file-ext-cons)) - (dir (cdr-safe (assq :output-dir params))) - fname) + (file-ext-cons (assq :file-ext params)) + (file-ext (cdr-safe file-ext-cons)) + (dir (cdr-safe (assq :output-dir params))) + fname) ;; create the output-dir if it does not exist (when dir (make-directory dir t)) diff --git a/lisp/org/ob-dot.el b/lisp/org/ob-dot.el index d13261b340..8e05a59f20 100644 --- a/lisp/org/ob-dot.el +++ b/lisp/org/ob-dot.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2009-2021 Free Software Foundation, Inc. ;; Author: Eric Schulte +;; Maintainer: Justin Abrahms ;; Keywords: literate programming, reproducible research ;; Homepage: https://orgmode.org @@ -25,7 +26,7 @@ ;; Org-Babel support for evaluating dot source code. ;; -;; For information on dot see http://www.graphviz.org/ +;; For information on dot see https://www.graphviz.org/ ;; ;; This differs from most standard languages in that ;; diff --git a/lisp/org/ob-ebnf.el b/lisp/org/ob-ebnf.el deleted file mode 100644 index 58666a4ded..0000000000 --- a/lisp/org/ob-ebnf.el +++ /dev/null @@ -1,81 +0,0 @@ -;;; ob-ebnf.el --- Babel Functions for EBNF -*- lexical-binding: t; -*- - -;; Copyright (C) 2013-2021 Free Software Foundation, Inc. - -;; Author: Michael Gauland -;; Keywords: literate programming, reproducible research -;; Homepage: https://orgmode.org - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - -;;; Commentary: - -;; Org-Babel support for using ebnf2ps to generate encapsulated postscript -;; railroad diagrams. It recognizes these arguments: -;; -;; :file is required; it must include the extension '.eps.' All the rules -;; in the block will be drawn in the same file. This is done by -;; inserting a '[' comment at the start of the block (see the -;; documentation for ebnf-eps-buffer for more information). -;; -;; :style specifies a value in ebnf-style-database. This provides the -;; ability to customize the output. The style can also specify the -;; grammar syntax (by setting ebnf-syntax); note that only ebnf, -;; iso-ebnf, and yacc are supported by this file. - -;;; Requirements: - -;;; Code: -(require 'ob) -(require 'ebnf2ps) - -;; optionally declare default header arguments for this language -(defvar org-babel-default-header-args:ebnf '((:style . nil))) - -;; Use ebnf-eps-buffer to produce an encapsulated postscript file. -;; -(defun org-babel-execute:ebnf (body params) - "Execute a block of Ebnf code with org-babel. -This function is called by `org-babel-execute-src-block'." - (save-excursion - (let* ((dest-file (cdr (assq :file params))) - (dest-dir (file-name-directory dest-file)) - (dest-root (file-name-sans-extension - (file-name-nondirectory dest-file))) - (style (cdr (assq :style params))) - (result nil)) - (with-temp-buffer - (when style (ebnf-push-style style)) - (let ((comment-format - (cond ((string= ebnf-syntax 'yacc) "/*%s*/") - ((string= ebnf-syntax 'ebnf) ";%s") - ((string= ebnf-syntax 'iso-ebnf) "(*%s*)") - (t (setq result - (format "EBNF error: format %s not supported." - ebnf-syntax)))))) - (setq ebnf-eps-prefix dest-dir) - (insert (format comment-format (format "[%s" dest-root))) - (newline) - (insert body) - (newline) - (insert (format comment-format (format "]%s" dest-root))) - (ebnf-eps-buffer) - (when style (ebnf-pop-style)))) - result))) - -(provide 'ob-ebnf) - -;;; ob-ebnf.el ends here diff --git a/lisp/org/ob-eshell.el b/lisp/org/ob-eshell.el index 6ae0fc613d..d74c4fc43f 100644 --- a/lisp/org/ob-eshell.el +++ b/lisp/org/ob-eshell.el @@ -3,8 +3,9 @@ ;; Copyright (C) 2018-2021 Free Software Foundation, Inc. ;; Author: stardiviner +;; Maintainer: stardiviner +;; Homepage: https://github.com/stardiviner/ob-eshell ;; Keywords: literate programming, reproducible research -;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-eval.el b/lisp/org/ob-eval.el index b0fca7bd95..cfd8022255 100644 --- a/lisp/org/ob-eval.el +++ b/lisp/org/ob-eval.el @@ -41,20 +41,22 @@ (display-buffer buf)) (message "Babel evaluation exited with code %S" exit-code)) -(defun org-babel-eval (cmd body) - "Run CMD on BODY. -If CMD succeeds then return its results, otherwise display -STDERR with `org-babel-eval-error-notify'." - (let ((err-buff (get-buffer-create " *Org-Babel Error*")) exit-code) - (with-current-buffer err-buff (erase-buffer)) +(defun org-babel-eval (command query) + "Run COMMAND on QUERY. +Writes QUERY into a temp-buffer that is processed with +`org-babel--shell-command-on-region'. If COMMAND succeeds then return +its results, otherwise display STDERR with +`org-babel-eval-error-notify'." + (let ((error-buffer (get-buffer-create " *Org-Babel Error*")) exit-code) + (with-current-buffer error-buffer (erase-buffer)) (with-temp-buffer - (insert body) + (insert query) (setq exit-code (org-babel--shell-command-on-region - (point-min) (point-max) cmd err-buff)) + command error-buffer)) (if (or (not (numberp exit-code)) (> exit-code 0)) (progn - (with-current-buffer err-buff + (with-current-buffer error-buffer (org-babel-eval-error-notify exit-code (buffer-string))) (save-excursion (when (get-buffer org-babel-error-buffer-name) @@ -71,26 +73,19 @@ STDERR with `org-babel-eval-error-notify'." (with-temp-buffer (insert-file-contents file) (buffer-string))) -(defun org-babel--shell-command-on-region (start end command error-buffer) +(defun org-babel--shell-command-on-region (command error-buffer) "Execute COMMAND in an inferior shell with region as input. +Stripped down version of `shell-command-on-region' for internal use in +Babel only. This lets us work around errors in the original function +in various versions of Emacs. This expects the query to be run to be +in the current temp buffer. This is written into +input-file. ERROR-BUFFER is the name of the file which +`org-babel-eval' has created to use for any error messages that are +returned." -Stripped down version of shell-command-on-region for internal use -in Babel only. This lets us work around errors in the original -function in various versions of Emacs. -" (let ((input-file (org-babel-temp-file "ob-input-")) (error-file (if error-buffer (org-babel-temp-file "ob-error-") nil)) - ;; Unfortunately, `executable-find' does not support file name - ;; handlers. Therefore, we could use it in the local case - ;; only. - (shell-file-name - (cond ((and (not (file-remote-p default-directory)) - (executable-find shell-file-name)) - shell-file-name) - ((file-executable-p - (concat (file-remote-p default-directory) shell-file-name)) - shell-file-name) - ("/bin/sh"))) + (shell-file-name (org-babel--get-shell-file-name)) exit-status) ;; There is an error in `process-file' when `error-file' exists. ;; This is fixed in Emacs trunk as of 2012-12-21; let's use this @@ -99,18 +94,13 @@ function in various versions of Emacs. (delete-file error-file)) ;; we always call this with 'replace, remove conditional ;; Replace specified region with output from command. - (let ((swap (< start end))) - (goto-char start) - (push-mark (point) 'nomsg) - (write-region start end input-file) - (delete-region start end) - (setq exit-status - (process-file shell-file-name input-file - (if error-file - (list t error-file) - t) - nil shell-command-switch command)) - (when swap (exchange-point-and-mark))) + (org-babel--write-temp-buffer-input-file input-file) + (setq exit-status + (process-file shell-file-name input-file + (if error-file + (list t error-file) + t) + nil shell-command-switch command)) (when (and input-file (file-exists-p input-file) ;; bind org-babel--debug-input around the call to keep @@ -135,6 +125,16 @@ function in various versions of Emacs. (delete-file error-file)) exit-status)) +(defun org-babel--write-temp-buffer-input-file (input-file) + "Write the contents of the current temp buffer into INPUT-FILE." + (let ((start (point-min)) + (end (point-max))) + (goto-char start) + (push-mark (point) 'nomsg) + (write-region start end input-file) + (delete-region start end) + (exchange-point-and-mark))) + (defun org-babel-eval-wipe-error-buffer () "Delete the contents of the Org code block error buffer. This buffer is named by `org-babel-error-buffer-name'." @@ -142,6 +142,19 @@ This buffer is named by `org-babel-error-buffer-name'." (with-current-buffer org-babel-error-buffer-name (delete-region (point-min) (point-max))))) +(defun org-babel--get-shell-file-name () + "Return system `shell-file-name', defaulting to /bin/sh. +Unfortunately, `executable-find' does not support file name +handlers. Therefore, we could use it in the local case only." + ;; FIXME: This is generic enough that it should probably be in emacs, not org-mode + (cond ((and (not (file-remote-p default-directory)) + (executable-find shell-file-name)) + shell-file-name) + ((file-executable-p + (concat (file-remote-p default-directory) shell-file-name)) + shell-file-name) + ("/bin/sh"))) + (provide 'ob-eval) ;;; ob-eval.el ends here diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el index e851ff624a..d10d228eba 100644 --- a/lisp/org/ob-exp.el +++ b/lisp/org/ob-exp.el @@ -216,8 +216,11 @@ this template." (delete-region begin end) (insert replacement))))) ((or `babel-call `inline-babel-call) - (org-babel-exp-do-export (org-babel-lob-get-info element) - 'lob) + (org-babel-exp-do-export + (or (org-babel-lob-get-info element) + (user-error "Unknown Babel reference: %s" + (org-element-property :call element))) + 'lob) (let ((rep (org-fill-template org-babel-exp-call-line-template @@ -289,11 +292,11 @@ this template." "Return a string with the exported content of a code block. The function respects the value of the :exports header argument." (let ((silently (lambda () (let ((session (cdr (assq :session (nth 2 info))))) - (unless (equal "none" session) - (org-babel-exp-results info type 'silent))))) + (unless (equal "none" session) + (org-babel-exp-results info type 'silent))))) (clean (lambda () (if (eq type 'inline) - (org-babel-remove-inline-result) - (org-babel-remove-result info))))) + (org-babel-remove-inline-result) + (org-babel-remove-result info))))) (pcase (or (cdr (assq :exports (nth 2 info))) "code") ("none" (funcall silently) (funcall clean) "") ("code" (funcall silently) (funcall clean) (org-babel-exp-code info type)) @@ -357,9 +360,12 @@ replaced with its value." (org-fill-template (if (eq type 'inline) org-babel-exp-inline-code-template - org-babel-exp-code-template) + org-babel-exp-code-template) `(("lang" . ,(nth 0 info)) - ("body" . ,(org-escape-code-in-string (nth 1 info))) + ;; Inline source code should not be escaped. + ("body" . ,(let ((body (nth 1 info))) + (if (eq type 'inline) body + (org-escape-code-in-string body)))) ("switches" . ,(let ((f (nth 3 info))) (and (org-string-nw-p f) (concat " " f)))) ("flags" . ,(let ((f (assq :flags (nth 2 info)))) @@ -390,10 +396,10 @@ inhibit insertion of results into the buffer." (setf (nth 1 info) body) (setf (nth 2 info) (org-babel-exp--at-source - (org-babel-process-params - (org-babel-merge-params - (nth 2 info) - `((:results . ,(if silent "silent" "replace"))))))) + (org-babel-process-params + (org-babel-merge-params + (nth 2 info) + `((:results . ,(if silent "silent" "replace"))))))) (pcase type (`block (org-babel-execute-src-block nil info)) (`inline diff --git a/lisp/org/ob-forth.el b/lisp/org/ob-forth.el index 3b521bc4d9..74dbc02170 100644 --- a/lisp/org/ob-forth.el +++ b/lisp/org/ob-forth.el @@ -75,8 +75,8 @@ This function is called by `org-babel-execute-src-block'." ((string= "\n:" case) ;; Report errors. (org-babel-eval-error-notify 1 - (buffer-substring - (+ (match-beginning 0) 1) (point-max))) + (buffer-substring + (+ (match-beginning 0) 1) (point-max))) nil)))) (split-string (org-trim (org-babel-expand-body:generic body params)) diff --git a/lisp/org/ob-fortran.el b/lisp/org/ob-fortran.el index 99afa0d963..2e55498003 100644 --- a/lisp/org/ob-fortran.el +++ b/lisp/org/ob-fortran.el @@ -40,9 +40,11 @@ (defvar org-babel-default-header-args:fortran '()) -(defvar org-babel-fortran-compiler "gfortran" - "fortran command used to compile a fortran source code file into an - executable.") +(defcustom org-babel-fortran-compiler "gfortran" + "Fortran command used to compile Fortran source code file." + :group 'org-babel + :package-version '(Org . "9.5") + :type 'string) (defun org-babel-execute:fortran (body params) "This function should only be called by `org-babel-execute:fortran'." @@ -155,7 +157,7 @@ of the same value." (format "real, parameter :: %S(%d) = %s\n" var (length val) (org-babel-fortran-transform-list val))) (t - (error "the type of parameter %s is not supported by ob-fortran" var))))) + (error "The type of parameter %s is not supported by ob-fortran" var))))) (defun org-babel-fortran-transform-list (val) "Return a fortran representation of enclose syntactic lists." diff --git a/lisp/org/ob-gnuplot.el b/lisp/org/ob-gnuplot.el index 6489c23f57..3c84e4da14 100644 --- a/lisp/org/ob-gnuplot.el +++ b/lisp/org/ob-gnuplot.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2009-2021 Free Software Foundation, Inc. ;; Author: Eric Schulte +;; Maintainer: Ihor Radchenko ;; Keywords: literate programming, reproducible research ;; Homepage: https://orgmode.org @@ -33,7 +34,7 @@ ;;; Requirements: -;; - gnuplot :: http://www.gnuplot.info/ +;; - gnuplot :: https://www.gnuplot.info/ ;; ;; - gnuplot-mode :: you can search the web for the latest active one. @@ -47,6 +48,8 @@ (declare-function gnuplot-send-string-to-gnuplot "ext:gnuplot-mode" (str txt)) (declare-function gnuplot-send-buffer-to-gnuplot "ext:gnuplot-mode" ()) +(defvar org-babel-temporary-directory) + (defvar org-babel-default-header-args:gnuplot '((:results . "file") (:exports . "results") (:session . nil)) "Default arguments to use when evaluating a gnuplot source block.") @@ -85,14 +88,29 @@ code." (cons (car pair) ;; variable name (let* ((val (cdr pair)) ;; variable value - (lp (listp val))) + (lp (proper-list-p val))) (if lp (org-babel-gnuplot-table-to-data (let* ((first (car val)) (tablep (or (listp first) (symbolp first)))) (if tablep val (mapcar 'list val))) (org-babel-temp-file "gnuplot-") params) - val)))) + (if (and (stringp val) + (file-remote-p val) ;; check if val is a remote file + (file-exists-p val)) ;; call to file-exists-p is slow, maybe remove it + (let* ((local-name (concat ;; create a unique filename to avoid multiple downloads + org-babel-temporary-directory + "/gnuplot/" + (file-remote-p val 'host) + (org-babel-local-file-name val)))) + (if (and (file-exists-p local-name) ;; only download file if remote is newer + (file-newer-than-file-p local-name val)) + local-name + (make-directory (file-name-directory local-name) t) + (copy-file val local-name t) + )) + val + ))))) (org-babel--get-vars params)))) (defun org-babel-expand-body:gnuplot (body params) diff --git a/lisp/org/ob-groovy.el b/lisp/org/ob-groovy.el index fa847dd0a2..b3ff34aac3 100644 --- a/lisp/org/ob-groovy.el +++ b/lisp/org/ob-groovy.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2013-2021 Free Software Foundation, Inc. ;; Author: Miro Bezjak +;; Maintainer: Palak Mathur ;; Keywords: literate programming, reproducible research ;; Homepage: https://orgmode.org @@ -25,7 +26,7 @@ ;; Currently only supports the external execution. No session support yet. ;;; Requirements: -;; - Groovy language :: http://groovy.codehaus.org +;; - Groovy language :: https://groovy-lang.org ;; - Groovy major mode :: Can be installed from MELPA or ;; https://github.com/russel/Emacs-Groovy-Mode diff --git a/lisp/org/ob-haskell.el b/lisp/org/ob-haskell.el index d7ac1b04b3..971e1ce6af 100644 --- a/lisp/org/ob-haskell.el +++ b/lisp/org/ob-haskell.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2009-2021 Free Software Foundation, Inc. ;; Author: Eric Schulte +;; Maintainer: Lawrence Bottorff ;; Keywords: literate programming, reproducible research ;; Homepage: https://orgmode.org @@ -33,9 +34,9 @@ ;;; Requirements: -;; - haskell-mode: http://www.iro.umontreal.ca/~monnier/elisp/#haskell-mode -;; - inf-haskell: http://www.iro.umontreal.ca/~monnier/elisp/#haskell-mode -;; - (optionally) lhs2tex: http://people.cs.uu.nl/andres/lhs2tex/ +;; - haskell-mode: https://www.iro.umontreal.ca/~monnier/elisp/#haskell-mode +;; - inf-haskell: https://www.iro.umontreal.ca/~monnier/elisp/#haskell-mode +;; - (optionally) lhs2tex: https://people.cs.uu.nl/andres/lhs2tex/ ;;; Code: (require 'ob) @@ -69,11 +70,11 @@ a parameter, such as \"ghc -v\"." :package-version '(Org "9.4") :type 'string) -(defconst org-babel-header-args:haskell '(compile . :any) +(defconst org-babel-header-args:haskell '((compile . :any)) "Haskell-specific header arguments.") (defun org-babel-haskell-execute (body params) - "This function should only be called by `org-babel-execute:haskell'" + "This function should only be called by `org-babel-execute:haskell'." (let* ((tmp-src-file (org-babel-temp-file "Haskell-src-" ".hs")) (tmp-bin-file (org-babel-process-file-name diff --git a/lisp/org/ob-hledger.el b/lisp/org/ob-hledger.el deleted file mode 100644 index 48dcb8cea1..0000000000 --- a/lisp/org/ob-hledger.el +++ /dev/null @@ -1,69 +0,0 @@ -;;; ob-hledger.el --- Babel Functions for hledger -*- lexical-binding: t; -*- - -;; Copyright (C) 2010-2021 Free Software Foundation, Inc. - -;; Author: Simon Michael -;; Keywords: literate programming, reproducible research, plain text accounting -;; Homepage: https://orgmode.org - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - -;;; Commentary: - -;; Babel support for evaluating hledger entries. -;; -;; Based on ob-ledger.el. -;; If the source block is empty, hledger will use a default journal file, -;; probably ~/.hledger.journal (it may not notice your $LEDGER_FILE env var). -;; So make ~/.hledger.journal a symbolic link to the real file if necessary. - -;; TODO Unit tests are more than welcome, too. - -;;; Code: -(require 'ob) - -(defvar org-babel-default-header-args:hledger - '((:results . "output") (:exports . "results") (:cmdline . "bal")) - "Default arguments to use when evaluating a hledger source block.") - -(defun org-babel-execute:hledger (body params) - "Execute a block of hledger entries with org-babel. -This function is called by `org-babel-execute-src-block'." - (message "executing hledger source code block") - (letrec ( ;(result-params (split-string (or (cdr (assq :results params)) ""))) - (cmdline (cdr (assq :cmdline params))) - (in-file (org-babel-temp-file "hledger-")) - (out-file (org-babel-temp-file "hledger-output-")) - (hledgercmd (concat "hledger" - (if (> (length body) 0) - (concat " -f " (org-babel-process-file-name in-file)) - "") - " " cmdline))) - (with-temp-file in-file (insert body)) -;; TODO This is calling for some refactoring: -;; (concat "hledger" (if ...) " " cmdline) -;; could be built only once and bound to a symbol. - (message "%s" hledgercmd) - (with-output-to-string - (shell-command (concat hledgercmd " > " (org-babel-process-file-name out-file)))) - (with-temp-buffer (insert-file-contents out-file) (buffer-string)))) - -(defun org-babel-prep-session:hledger (_session _params) - (error "hledger does not support sessions")) - -(provide 'ob-hledger) - -;;; ob-hledger.el ends here diff --git a/lisp/org/ob-io.el b/lisp/org/ob-io.el deleted file mode 100644 index 63d2b6cf35..0000000000 --- a/lisp/org/ob-io.el +++ /dev/null @@ -1,105 +0,0 @@ -;;; ob-io.el --- Babel Functions for Io -*- lexical-binding: t; -*- - -;; Copyright (C) 2012-2021 Free Software Foundation, Inc. - -;; Author: Andrzej Lichnerowicz -;; Keywords: literate programming, reproducible research -;; Homepage: https://orgmode.org - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - -;;; Commentary: -;; Currently only supports the external execution. No session support yet. -;; :results output -- runs in scripting mode -;; :results output repl -- runs in repl mode - -;;; Requirements: -;; - Io language :: http://iolanguage.org/ -;; - Io major mode :: Can be installed from Io sources -;; https://github.com/stevedekorte/io/blob/master/extras/SyntaxHighlighters/Emacs/io-mode.el - -;;; Code: -(require 'ob) - -(defvar org-babel-tangle-lang-exts) ;; Autoloaded -(add-to-list 'org-babel-tangle-lang-exts '("io" . "io")) -(defvar org-babel-default-header-args:io '()) -(defvar org-babel-io-command "io" - "Name of the command to use for executing Io code.") - -(defun org-babel-execute:io (body params) - "Execute a block of Io code with org-babel. -This function is called by `org-babel-execute-src-block'." - (message "executing Io source code block") - (let* ((processed-params (org-babel-process-params params)) - (session (org-babel-io-initiate-session (nth 0 processed-params))) - (result-params (nth 2 processed-params)) - (result-type (cdr (assq :result-type params))) - (full-body (org-babel-expand-body:generic - body params)) - (result (org-babel-io-evaluate - session full-body result-type result-params))) - - (org-babel-reassemble-table - result - (org-babel-pick-name - (cdr (assq :colname-names params)) (cdr (assq :colnames params))) - (org-babel-pick-name - (cdr (assq :rowname-names params)) (cdr (assq :rownames params)))))) - -(defvar org-babel-io-wrapper-method - "( -%s -) asString print -") - - -(defun org-babel-io-evaluate (session body &optional result-type result-params) - "Evaluate BODY in external Io process. -If RESULT-TYPE equals `output' then return standard output as a string. -If RESULT-TYPE equals `value' then return the value of the last statement -in BODY as elisp." - (when session (error "Sessions are not (yet) supported for Io")) - (pcase result-type - (`output - (if (member "repl" result-params) - (org-babel-eval org-babel-io-command body) - (let ((src-file (org-babel-temp-file "io-"))) - (progn (with-temp-file src-file (insert body)) - (org-babel-eval - (concat org-babel-io-command " " src-file) ""))))) - (`value (let* ((src-file (org-babel-temp-file "io-")) - (wrapper (format org-babel-io-wrapper-method body))) - (with-temp-file src-file (insert wrapper)) - (let ((raw (org-babel-eval - (concat org-babel-io-command " " src-file) ""))) - (org-babel-result-cond result-params - raw - (org-babel-script-escape raw))))))) - -(defun org-babel-prep-session:io (_session _params) - "Prepare SESSION according to the header arguments specified in PARAMS." - (error "Sessions are not (yet) supported for Io")) - -(defun org-babel-io-initiate-session (&optional _session) - "If there is not a current inferior-process-buffer in SESSION -then create. Return the initialized session. Sessions are not -supported in Io." - nil) - -(provide 'ob-io) - -;;; ob-io.el ends here diff --git a/lisp/org/ob-java.el b/lisp/org/ob-java.el index b1d517e94a..60ef33bc6e 100644 --- a/lisp/org/ob-java.el +++ b/lisp/org/ob-java.el @@ -1,8 +1,10 @@ -;;; ob-java.el --- Babel Functions for Java -*- lexical-binding: t; -*- +;;; ob-java.el --- org-babel functions for java evaluation -*- lexical-binding: t -*- ;; Copyright (C) 2011-2021 Free Software Foundation, Inc. -;; Author: Eric Schulte +;; Authors: Eric Schulte +;; Dan Davison +;; Maintainer: Ian Martins ;; Keywords: literate programming, reproducible research ;; Homepage: https://orgmode.org @@ -23,8 +25,7 @@ ;;; Commentary: -;; Currently this only supports the external compilation and execution -;; of java code blocks (i.e., no session support). +;; Org-Babel support for evaluating java source code. ;;; Code: (require 'ob) @@ -32,52 +33,455 @@ (defvar org-babel-tangle-lang-exts) (add-to-list 'org-babel-tangle-lang-exts '("java" . "java")) +(defvar org-babel-temporary-directory) ; from ob-core + +(defvar org-babel-default-header-args:java '((:results . "output") + (:dir . ".")) + "Default header args for java source blocks. +The docs say functional mode should be the default [1], but +ob-java didn't originally support functional mode, so we keep +scripting mode as the default for now to maintain previous +behavior. + +Most languages write tempfiles to babel's temporary directory, +but ob-java originally had to write them to the current +directory, so we keep that as the default behavior. + +[1] https://orgmode.org/manual/Results-of-Evaluation.html") + +(defconst org-babel-header-args:java '((imports . :any)) + "Java-specific header arguments.") + (defcustom org-babel-java-command "java" "Name of the java command. -May be either a command in the path, like java -or an absolute path name, like /usr/local/bin/java -parameters may be used, like java -verbose" +May be either a command in the path, like java or an absolute +path name, like /usr/local/bin/java. Parameters may be used, +like java -verbose." :group 'org-babel - :version "24.3" + :package-version '(Org . "9.5") :type 'string) (defcustom org-babel-java-compiler "javac" "Name of the java compiler. -May be either a command in the path, like javac -or an absolute path name, like /usr/local/bin/javac -parameters may be used, like javac -verbose" +May be either a command in the path, like javac or an absolute +path name, like /usr/local/bin/javac. Parameters may be used, +like javac -verbose." + :group 'org-babel + :package-version '(Org . "9.5") + :type 'string) + +(defcustom org-babel-java-hline-to "null" + "Replace hlines in incoming tables with this when translating to java." :group 'org-babel - :version "24.3" + :package-version '(Org . "9.5") :type 'string) +(defcustom org-babel-java-null-to 'hline + "Replace `null' in java tables with this before returning." + :group 'org-babel + :package-version '(Org . "9.5") + :type 'symbol) + +(defconst org-babel-java--package-re (rx line-start (0+ space) "package" + (1+ space) (group (1+ (in alnum ?_ ?.))) ; capture the package name + (0+ space) ?\; line-end) + "Regexp for the package statement.") +(defconst org-babel-java--imports-re (rx line-start (0+ space) "import" + (opt (1+ space) "static") + (1+ space) (group (1+ (in alnum ?_ ?. ?*))) ; capture the fully qualified class name + (0+ space) ?\; line-end) + "Regexp for import statements.") +(defconst org-babel-java--class-re (rx line-start (0+ space) (opt (seq "public" (1+ space))) + "class" (1+ space) + (group (1+ (in alnum ?_))) ; capture the class name + (0+ space) ?{) + "Regexp for the class declaration.") +(defconst org-babel-java--main-re (rx line-start (0+ space) "public" + (1+ space) "static" + (1+ space) "void" + (1+ space) "main" + (0+ space) ?\( + (0+ space) "String" + (0+ space) (1+ (in alnum ?_ ?\[ ?\] space)) ; "[] args" or "args[]" + (0+ space) ?\) + (0+ space) (opt "throws" (1+ (in alnum ?_ ?, ?. space))) + ?{) + "Regexp for the main method declaration.") +(defconst org-babel-java--any-method-re (rx line-start + (0+ space) (opt (seq (1+ alnum) (1+ space))) ; visibility + (opt (seq "static" (1+ space))) ; binding + (1+ (in alnum ?_ ?\[ ?\])) ; return type + (1+ space) (1+ (in alnum ?_)) ; method name + (0+ space) ?\( + (0+ space) (0+ (in alnum ?_ ?\[ ?\] ?, space)) ; params + (0+ space) ?\) + (0+ space) (opt "throws" (1+ (in alnum ?_ ?, ?. space))) + ?{) + "Regexp for any method.") +(defconst org-babel-java--result-wrapper "\n public static String __toString(Object val) { + if (val instanceof String) { + return \"\\\"\" + val + \"\\\"\"; + } else if (val == null) { + return \"null\"; + } else if (val.getClass().isArray()) { + StringBuffer sb = new StringBuffer(); + Object[] vals = (Object[])val; + sb.append(\"[\"); + for (int ii=0; ii%s" uri (or desc uri))) + (`latex + (if desc (format "\\href{%s}{%s}" uri desc) + (format "\\url{%s}" uri))) + (`ascii + (if (not desc) (format "<%s>" uri) + (concat (format "[%s]" desc) + (and (not (plist-get info :ascii-links-to-notes)) + (format " (<%s>)" uri))))) + (`texinfo + (if (not desc) (format "@uref{%s}" uri) + (format "@uref{%s, %s}" uri desc))) + (_ uri)))) + +(org-link-set-parameters "doi" + :follow #'org-link-doi-open + :export #'org-link-doi-export) + + +(provide 'org-link-doi) +(provide 'ol-doi) +;;; ol-doi.el ends here diff --git a/lisp/org/ol-eshell.el b/lisp/org/ol-eshell.el index 8920e0afb0..a7550e3769 100644 --- a/lisp/org/ol-eshell.el +++ b/lisp/org/ol-eshell.el @@ -35,9 +35,9 @@ (defun org-eshell-open (link _) "Switch to an eshell buffer and execute a command line. - The link can be just a command line (executed in the default - eshell buffer) or a command line prefixed by a buffer name - followed by a colon." +The link can be just a command line (executed in the default +eshell buffer) or a command line prefixed by a buffer name +followed by a colon." (let* ((buffer-and-command (if (string-match "\\([A-Za-z0-9+*-]+\\):\\(.*\\)" link) (list (match-string 1 link) @@ -55,7 +55,7 @@ (defun org-eshell-store-link () "Store a link that, when opened, switches back to the current eshell buffer - and the current working directory." +and the current working directory." (when (eq major-mode 'eshell-mode) (let* ((command (concat "cd " (eshell/pwd))) (link (concat (buffer-name) ":" command))) diff --git a/lisp/org/ol-gnus.el b/lisp/org/ol-gnus.el index 2d51447e0c..72bdd7310a 100644 --- a/lisp/org/ol-gnus.el +++ b/lisp/org/ol-gnus.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Tassilo Horn ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org @@ -194,7 +194,7 @@ If `org-store-link' was called with a prefix arg the meaning of (message-tokenize-header (mail-fetch-field "gcc" nil t) " ,")))) (id (org-unbracket-string "<" ">" - (mail-fetch-field "Message-ID"))) + (mail-fetch-field "Message-ID"))) (to (mail-fetch-field "To")) (from (mail-fetch-field "From")) (subject (mail-fetch-field "Subject")) diff --git a/lisp/org/ol-info.el b/lisp/org/ol-info.el index 8b1e5da516..a535ea581a 100644 --- a/lisp/org/ol-info.el +++ b/lisp/org/ol-info.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; @@ -56,7 +56,7 @@ "#" Info-current-node))) (org-link-store-props :type "info" :file Info-current-file :node Info-current-node - :link link :desc desc) + :link link :description desc) link))) (defun org-info-open (path _) @@ -91,7 +91,7 @@ "pgg" "rcirc" "reftex" "remember" "sasl" "sc" "semantic" "ses" "sieve" "smtpmail" "speedbar" "srecode" "todo-mode" "tramp" "url" "vip" "viper" "widget" "wisent" "woman") - "List of emacs documents available. + "List of Emacs documents available. Taken from ") (defconst org-info-other-documents diff --git a/lisp/org/ol-rmail.el b/lisp/org/ol-rmail.el index a73060b50f..2593ebdf02 100644 --- a/lisp/org/ol-rmail.el +++ b/lisp/org/ol-rmail.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; diff --git a/lisp/org/ol-w3m.el b/lisp/org/ol-w3m.el index ebb11ce3d5..9e03269e11 100644 --- a/lisp/org/ol-w3m.el +++ b/lisp/org/ol-w3m.el @@ -82,26 +82,41 @@ so that it can be yanked into an Org buffer with links working correctly." (setq temp-position (point)) ;; move to next anchor when current point is not at anchor (or (get-text-property (point) 'w3m-href-anchor) (org-w3m-get-next-link-start)) - (if (<= (point) transform-end) ; if point is inside transform bound - (progn - ;; get content between two links. - (when (> (point) temp-position) - (setq return-content (concat return-content - (buffer-substring - temp-position (point))))) - ;; get link location at current point. - (setq link-location (get-text-property (point) 'w3m-href-anchor)) - ;; get link title at current point. - (setq link-title (buffer-substring (point) - (org-w3m-get-anchor-end))) - ;; concat Org style url to `return-content'. - (setq return-content - (concat return-content - (if (org-string-nw-p link-location) - (org-link-make-string link-location link-title) - link-title)))) + (cond + ((<= (point) transform-end) ; point is inside transform bound + ;; get content between two links. + (when (> (point) temp-position) + (setq return-content (concat return-content + (buffer-substring + temp-position (point))))) + (cond + ((setq link-location (get-text-property (point) 'w3m-href-anchor)) + ;; current point is a link + ;; (we thus also got link location at current point) + ;; get link title at current point. + (setq link-title (buffer-substring (point) + (org-w3m-get-anchor-end))) + ;; concat Org style url to `return-content'. + (setq return-content + (concat return-content + (if (org-string-nw-p link-location) + (org-link-make-string link-location link-title) + link-title)))) + ((setq link-location (get-text-property (point) 'w3m-image)) + ;; current point is an image + ;; (we thus also got image link location at current point) + ;; get link title at current point. + (setq link-title (buffer-substring (point) (org-w3m-get-image-end))) + ;; concat Org style url to `return-content'. + (setq return-content + (concat return-content + (if (org-string-nw-p link-location) + (org-link-make-string link-location link-title) + link-title)))) + (t nil))); current point is neither a link nor an image + (t ; point is NOT inside transform bound (goto-char temp-position) ; reset point before jump next anchor - (setq out-bound t))) ; for break out `while' loop + (setq out-bound t)))) ; for break out `while' loop ;; add the rest until end of the region to be copied (when (< (point) transform-end) (setq return-content @@ -114,6 +129,7 @@ so that it can be yanked into an Org buffer with links working correctly." (defun org-w3m-get-anchor-start () "Move cursor to the start of current anchor. Return point." ;; get start position of anchor or current point + ;; NOTE: This function seems never to be used. Should it be removed? (goto-char (or (previous-single-property-change (point) 'w3m-anchor-sequence) (point)))) @@ -123,26 +139,46 @@ so that it can be yanked into an Org buffer with links working correctly." (goto-char (or (next-single-property-change (point) 'w3m-anchor-sequence) (point)))) +(defun org-w3m-get-image-end () + "Move cursor to the end of current image. Return point." + ;; get end position of image or point + ;; NOTE: Function `org-w3m-get-image-start' was not created because + ;; function `org-w3m-get-anchor-start' is never used. + (goto-char (or (next-single-property-change (point) 'w3m-image) + (point)))) + (defun org-w3m-get-next-link-start () - "Move cursor to the start of next link. Return point." - (catch 'reach - (while (next-single-property-change (point) 'w3m-anchor-sequence) - ;; jump to next anchor - (goto-char (next-single-property-change (point) 'w3m-anchor-sequence)) - (when (get-text-property (point) 'w3m-href-anchor) - ;; return point when current is valid link - (throw 'reach nil)))) - (point)) + "Move cursor to the start of next link or image. Return point." + (let (pos start-pos anchor-pos image-pos) + (setq pos (setq start-pos (point))) + (setq anchor-pos + (catch 'reach + (while (setq pos (next-single-property-change pos 'w3m-anchor-sequence)) + (when (get-text-property pos 'w3m-href-anchor) + (throw 'reach pos))))) + (setq pos start-pos) + (setq image-pos + (catch 'reach + (while (setq pos (next-single-property-change pos 'w3m-image)) + (when (get-text-property pos 'w3m-image) + (throw 'reach pos))))) + (goto-char (min (or anchor-pos (point-max)) (or image-pos (point-max)))))) (defun org-w3m-get-prev-link-start () "Move cursor to the start of previous link. Return point." + ;; NOTE: This function is only called by `org-w3m-no-prev-link-p', + ;; which itself seems never to be used. Should it be removed? + ;; + ;; WARNING: This function has not been updated to account for + ;; `w3m-image'. See `org-w3m-get-next-link-start'. (catch 'reach - (while (previous-single-property-change (point) 'w3m-anchor-sequence) - ;; jump to previous anchor - (goto-char (previous-single-property-change (point) 'w3m-anchor-sequence)) - (when (get-text-property (point) 'w3m-href-anchor) - ;; return point when current is valid link - (throw 'reach nil)))) + (let ((pos (point))) + (while (setq pos (previous-single-property-change pos 'w3m-anchor-sequence)) + (when (get-text-property pos 'w3m-href-anchor) + ;; jump to previous anchor + (goto-char pos) + ;; return point when current is valid link + (throw 'reach nil))))) (point)) (defun org-w3m-no-next-link-p () @@ -154,6 +190,7 @@ Return t if there is no next link; otherwise, return nil." (defun org-w3m-no-prev-link-p () "Whether there is no previous link after the cursor. Return t if there is no previous link; otherwise, return nil." + ;; NOTE: This function seems never to be used. Should it be removed? (save-excursion (equal (point) (org-w3m-get-prev-link-start)))) diff --git a/lisp/org/ol.el b/lisp/org/ol.el index 4b7f2081a8..e4a5a278dd 100644 --- a/lisp/org/ol.el +++ b/lisp/org/ol.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2018-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; This file is part of GNU Emacs. @@ -214,13 +214,18 @@ relative Relative to the current directory, i.e. the directory of the file absolute Absolute path, if possible with ~ for home directory. noabbrev Absolute path, no abbreviation of home directory. adaptive Use relative path for files in the current directory and sub- - directories of it. For other files, use an absolute path." + directories of it. For other files, use an absolute path. + +Alternatively, users may supply a custom function that takes the +full filename as an argument and returns the path." :group 'org-link :type '(choice (const relative) (const absolute) (const noabbrev) - (const adaptive)) + (const adaptive) + (function)) + :package-version '(Org . "9.5") :safe #'symbolp) (defcustom org-link-abbrev-alist nil @@ -277,13 +282,6 @@ links created by planner." :type '(choice (const nil) (function)) :safe #'null) -(defcustom org-link-doi-server-url "https://doi.org/" - "The URL of the DOI server." - :group 'org-link-follow - :version "24.3" - :type 'string - :safe #'stringp) - (defcustom org-link-frame-setup '((vm . vm-visit-folder-other-frame) (vm-imap . vm-visit-imap-folder-other-frame) @@ -508,13 +506,16 @@ links more efficient." "Regular expression matching radio targets in plain text.") (defvar org-link-types-re nil - "Matches a link that has a url-like prefix like \"http:\"") + "Matches a link that has a url-like prefix like \"http:\".") (defvar org-link-angle-re nil "Matches link with angular brackets, spaces are allowed.") (defvar org-link-plain-re nil - "Matches plain link, without spaces.") + "Matches plain link, without spaces. +Group 1 must contain the link type (i.e. https). +Group 2 must contain the link path (i.e. //example.com). +Used by `org-element-link-parser'.") (defvar org-link-bracket-re nil "Matches a link in double brackets.") @@ -802,15 +803,33 @@ This should be called after the variable `org-link-parameters' has changed." (format "<%s:\\([^>\n]*\\(?:\n[ \t]*[^> \t\n][^>\n]*\\)*\\)>" types-re) org-link-plain-re - (concat - "\\<" types-re ":" - "\\([^][ \t\n()<>]+\\(?:([[:word:]0-9_]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)") - ;; "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)") - org-link-bracket-re - (rx (seq "[[" - ;; URI part: match group 1. - (group - (one-or-more + (let* ((non-space-bracket "[^][ \t\n()<>]") + (parenthesis + `(seq "(" + (0+ (or (regex ,non-space-bracket) + (seq "(" + (0+ (regex ,non-space-bracket)) + ")"))) + ")"))) + ;; Heuristics for an URL link inspired by + ;; https://daringfireball.net/2010/07/improved_regex_for_matching_urls + (rx-to-string + `(seq word-start + ;; Link type: match group 1. + (regexp ,types-re) + ":" + ;; Link path: match group 2. + (group + (1+ (or (regex ,non-space-bracket) + ,parenthesis)) + (or (regexp "[^[:punct:] \t\n]") + ?/ + ,parenthesis))))) + org-link-bracket-re + (rx (seq "[[" + ;; URI part: match group 1. + (group + (one-or-more (or (not (any "[]\\")) (and "\\" (zero-or-more "\\\\") (any "[]")) (and (one-or-more "\\") (not (any "[]")))))) @@ -910,7 +929,7 @@ and dates." (defun org-link-encode (text table) "Return percent escaped representation of string TEXT. -TEXT is a string with the text to escape. TABLE is a list of +TEXT is a string with the text to escape. TABLE is a list of characters that should be escaped." (mapconcat (lambda (c) @@ -1301,14 +1320,6 @@ If there is no description, use the link target." ;;; Built-in link types -;;;; "doi" link type -(defun org-link--open-doi (path arg) - "Open a \"doi\" type link. -PATH is a the path to search for, as a string." - (browse-url (url-encode-url (concat org-link-doi-server-url path)) arg)) - -(org-link-set-parameters "doi" :follow #'org-link--open-doi) - ;;;; "elisp" link type (defun org-link--open-elisp (path _) "Open a \"elisp\" type link. @@ -1335,11 +1346,27 @@ PATH is the sexp to evaluate, as a string." "Open a \"help\" type link. PATH is a symbol name, as a string." (pcase (intern path) - ((and (pred fboundp) variable) (describe-function variable)) - ((and (pred boundp) function) (describe-variable function)) + ((and (pred fboundp) function) (describe-function function)) + ((and (pred boundp) variable) (describe-variable variable)) (name (user-error "Unknown function or variable: %s" name)))) -(org-link-set-parameters "help" :follow #'org-link--open-help) +(defun org-link--store-help () + "Store \"help\" type link." + (when (eq major-mode 'help-mode) + (let ((symbol + (save-excursion + (goto-char (point-min)) + ;; In case the help is about the key-binding, store the + ;; function instead. + (search-forward "runs the command " (line-end-position) t) + (read (current-buffer))))) + (org-link-store-props :type "help" + :link (format "help:%s" symbol) + :description nil)))) + +(org-link-set-parameters "help" + :follow #'org-link--open-help + :store #'org-link--store-help) ;;;; "http", "https", "mailto", "ftp", and "news" link types (dolist (scheme '("ftp" "http" "https" "mailto" "news")) @@ -1491,14 +1518,17 @@ non-nil." (apply #'org-link-store-props (cdr (assoc-string (completing-read - "Which function for creating the link? " - (mapcar #'car results-alist) - nil t (symbol-name name)) + (format "Store link with (default %s): " name) + (mapcar #'car results-alist) + nil t nil nil (symbol-name name)) results-alist))) t)))) (setq link (plist-get org-store-link-plist :link)) - (setq desc (or (plist-get org-store-link-plist :description) - link))) + ;; If store function actually set `:description' property, use + ;; it, even if it is nil. Otherwise, fallback to link value. + (setq desc (if (plist-member org-store-link-plist :description) + (plist-get org-store-link-plist :description) + link))) ;; Store a link from a remote editing buffer. ((org-src-edit-buffer-p) @@ -1556,19 +1586,6 @@ non-nil." nil nil nil)))) (org-link-store-props :type "calendar" :date cd))) - ((eq major-mode 'help-mode) - (let ((symbol (replace-regexp-in-string - ;; Help mode escapes backquotes and backslashes - ;; before displaying them. E.g., "`" appears - ;; as "\'" for reasons. Work around this. - (rx "\\" (group (or "`" "\\"))) "\\1" - (save-excursion - (goto-char (point-min)) - (looking-at "^[^ ]+") - (match-string 0))))) - (setq link (concat "help:" symbol))) - (org-link-store-props :type "help")) - ((eq major-mode 'w3-mode) (setq cpltxt (if (and (buffer-name) (not (string-match "Untitled" (buffer-name)))) @@ -1602,9 +1619,8 @@ non-nil." ((and (buffer-file-name (buffer-base-buffer)) (derived-mode-p 'org-mode)) (org-with-limited-levels - (setq custom-id (org-entry-get nil "CUSTOM_ID")) - (cond - ;; Store a link using the target at point + (cond + ;; Store a link using the target at point. ((org-in-regexp "[^<]<<\\([^<>]+\\)>>[^>]" 1) (setq cpltxt (concat "file:" @@ -1612,6 +1628,15 @@ non-nil." (buffer-file-name (buffer-base-buffer))) "::" (match-string 1)) link cpltxt)) + ;; Store a link using the CUSTOM_ID property. + ((setq custom-id (org-entry-get nil "CUSTOM_ID")) + (setq cpltxt + (concat "file:" + (abbreviate-file-name + (buffer-file-name (buffer-base-buffer))) + "::#" custom-id) + link cpltxt)) + ;; Store a link using (and perhaps creating) the ID property. ((and (featurep 'org-id) (or (eq org-id-link-to-org-use-id t) (and interactive? @@ -1620,14 +1645,13 @@ non-nil." 'create-if-interactive-and-no-custom-id) (not custom-id)))) (and org-id-link-to-org-use-id (org-entry-get nil "ID")))) - ;; Store a link using the ID at point (setq link (condition-case nil (prog1 (org-id-store-link) (setq desc (or (plist-get org-store-link-plist :description) ""))) (error - ;; Probably before first headline, link only to file + ;; Probably before first headline, link only to file. (concat "file:" (abbreviate-file-name (buffer-file-name (buffer-base-buffer)))))))) @@ -1696,7 +1720,7 @@ non-nil." (if (not (and interactive? link)) (or agenda-link (and link (org-link-make-string link desc))) (if (member (list link desc) org-stored-links) - (message "This link already exists") + (message "This link has already been stored") (push (list link desc) org-stored-links) (message "Stored: %s" (or desc link)) (when custom-id @@ -1791,12 +1815,13 @@ Use TAB to complete link prefixes, then RET for type-specific completion support (reverse org-stored-links) "\n"))) (goto-char (point-min))) - (let ((cw (selected-window))) - (select-window (get-buffer-window "*Org Links*" 'visible)) - (with-current-buffer "*Org Links*" (setq truncate-lines t)) - (unless (pos-visible-in-window-p (point-max)) - (org-fit-window-to-buffer)) - (and (window-live-p cw) (select-window cw))) + (when (get-buffer-window "*Org Links*" 'visible) + (let ((cw (selected-window))) + (select-window (get-buffer-window "*Org Links*" 'visible)) + (with-current-buffer "*Org Links*" (setq truncate-lines t)) + (unless (pos-visible-in-window-p (point-max)) + (org-fit-window-to-buffer)) + (and (window-live-p cw) (select-window cw)))) (setq all-prefixes (append (mapcar #'car abbrevs) (mapcar #'car org-link-abbrev-alist) (org-link-types))) @@ -1877,6 +1902,9 @@ Use TAB to complete link prefixes, then RET for type-specific completion support (setq path (expand-file-name path))) ((eq org-link-file-path-type 'relative) (setq path (file-relative-name path))) + ((functionp org-link-file-path-type) + (setq path (funcall org-link-file-path-type + (expand-file-name path)))) (t (save-match-data (if (string-match (concat "^" (regexp-quote diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 271eac1c30..354f408679 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -1,8 +1,8 @@ -;;; org-agenda.el --- Dynamic task and appointment lists for Org +;;; org-agenda.el --- Dynamic task and appointment lists for Org -*- lexical-binding: t; -*- ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; @@ -99,8 +99,8 @@ (defvar org-agenda-buffer-name "*Org Agenda*") (defvar org-agenda-overriding-header nil) (defvar org-agenda-title-append nil) -(with-no-warnings (defvar entry)) ;; unprefixed, from calendar.el -(with-no-warnings (defvar date)) ;; unprefixed, from calendar.el +;; (with-no-warnings (defvar entry)) ;; unprefixed, from calendar.el +;; (with-no-warnings (defvar date)) ;; unprefixed, from calendar.el (defvar original-date) ; dynamically scoped, calendar.el does scope this (defvar org-agenda-undo-list nil @@ -148,6 +148,8 @@ addresses the separator between the current and the previous block." :type 'boolean) (defcustom org-agenda-exporter-settings nil + ;; FIXME: Do we really want to evaluate those settings and thus force + ;; the user to use `quote' all the time? "Alist of variable/value pairs that should be active during agenda export. This is a good place to set options for ps-print and for htmlize. Note that the way this is implemented, the values will be evaluated @@ -1188,11 +1190,11 @@ This function makes sure that dates are aligned for easy reading." (year (nth 2 date)) (iso-week (org-days-to-iso-week (calendar-absolute-from-gregorian date))) - (weekyear (cond ((and (= month 1) (>= iso-week 52)) - (1- year)) - ((and (= month 12) (<= iso-week 1)) - (1+ year)) - (t year))) + ;; (weekyear (cond ((and (= month 1) (>= iso-week 52)) + ;; (1- year)) + ;; ((and (= month 12) (<= iso-week 1)) + ;; (1+ year)) + ;; (t year))) (weekstring (if (= day-of-week 1) (format " W%02d" iso-week) ""))) @@ -2081,9 +2083,25 @@ For example, this value makes those two functions available: With selected entries in an agenda buffer, `B R' will call the custom function `set-category' on the selected entries. -Note that functions in this alist don't need to be quoted." - :type '(alist :key-type character :value-type (group function)) - :version "24.1" +Note that functions in this alist don't need to be quoted. + +You can also specify a function which collects arguments to be +used for each call to your bulk custom function. The argument +collecting function will be run once and should return a list of +arguments to pass to the bulk function. For example: + + \\='((?R set-category get-category)) + +Now, `B R' will call the custom `get-category' which would prompt +the user once for a category. That category is then passed as an +argument to `set-category' for each entry it's called against." + :type + '(alist :key-type character + :value-type + (group (function :tag "Bulk Custom Function") + (choice (function :tag "Bulk Custom Argument Function") + (const :tag "No Bulk Custom Argument Function" nil)))) + :package-version '(Org . "9.5") :group 'org-agenda) (defmacro org-agenda-with-point-at-orig-entry (string &rest body) @@ -2114,7 +2132,8 @@ works you probably want to add it to `org-agenda-custom-commands' for good." The inserted header depends on `org-agenda-overriding-header'. If the empty string, don't insert a header. If any other string, insert it as a header. If nil, insert DEFAULT, which should -evaluate to a string." +evaluate to a string. If a function, call it and insert the +string that it returns." (declare (debug (form)) (indent defun)) `(cond ((not org-agenda-overriding-header) (insert ,default)) @@ -2123,6 +2142,8 @@ evaluate to a string." (insert (propertize org-agenda-overriding-header 'face 'org-agenda-structure) "\n")) + ((functionp org-agenda-overriding-header) + (insert (funcall org-agenda-overriding-header))) (t (user-error "Invalid value for `org-agenda-overriding-header': %S" org-agenda-overriding-header)))) @@ -2239,26 +2260,26 @@ The following commands are available: (save (buffer-local-variables))) (kill-all-local-variables) (cl-flet ((reset-saved (var-set) - "Reset variables in VAR-SET to possibly stored value in SAVE." - (dolist (elem save) - (pcase elem - (`(,var . ,val) ;ignore unbound variables - (when (and val (memq var var-set)) - (set var val))))))) + "Reset variables in VAR-SET to possibly stored value in SAVE." + (dolist (elem save) + (pcase elem + (`(,var . ,val) ;ignore unbound variables + (when (and val (memq var var-set)) + (set var val))))))) (cond (org-agenda-doing-sticky-redo - ;; Refreshing sticky agenda-buffer - ;; - ;; Preserve the value of `org-agenda-local-vars' variables. - (mapc #'make-local-variable org-agenda-local-vars) - (reset-saved org-agenda-local-vars) - (setq-local org-agenda-this-buffer-is-sticky t)) + ;; Refreshing sticky agenda-buffer + ;; + ;; Preserve the value of `org-agenda-local-vars' variables. + (mapc #'make-local-variable org-agenda-local-vars) + (reset-saved org-agenda-local-vars) + (setq-local org-agenda-this-buffer-is-sticky t)) (org-agenda-sticky - ;; Creating a sticky Agenda buffer for the first time - (mapc 'make-local-variable org-agenda-local-vars) - (setq-local org-agenda-this-buffer-is-sticky t)) + ;; Creating a sticky Agenda buffer for the first time + (mapc #'make-local-variable org-agenda-local-vars) + (setq-local org-agenda-this-buffer-is-sticky t)) (t - ;; Creating a non-sticky agenda buffer - (setq-local org-agenda-this-buffer-is-sticky nil))) + ;; Creating a non-sticky agenda buffer + (setq-local org-agenda-this-buffer-is-sticky nil))) (mapc #'make-local-variable agenda-local-vars-to-keep) (reset-saved agenda-local-vars-to-keep))) (setq org-agenda-undo-list nil @@ -2272,8 +2293,8 @@ The following commands are available: (use-local-map org-agenda-mode-map) (when org-startup-truncated (setq truncate-lines t)) (setq-local line-move-visual nil) - (add-hook 'post-command-hook 'org-agenda-update-agenda-type nil 'local) - (add-hook 'pre-command-hook 'org-unhighlight nil 'local) + (add-hook 'post-command-hook #'org-agenda-update-agenda-type nil 'local) + (add-hook 'pre-command-hook #'org-unhighlight nil 'local) ;; Make sure properties are removed when copying text (if (boundp 'filter-buffer-substring-functions) (add-hook 'filter-buffer-substring-functions @@ -2301,11 +2322,9 @@ The following commands are available: '(org-edit-agenda-file-list) (not (get 'org-agenda-files 'org-restrict))) "--") - (mapcar 'org-file-menu-entry (org-agenda-files)))) + (mapcar #'org-file-menu-entry (org-agenda-files)))) (org-agenda-set-mode-name) - (apply - (if (fboundp 'run-mode-hooks) 'run-mode-hooks 'run-hooks) - (list 'org-agenda-mode-hook))) + (run-mode-hooks 'org-agenda-mode-hook)) (substitute-key-definition #'undo #'org-agenda-undo org-agenda-mode-map global-map) @@ -2453,7 +2472,7 @@ The following commands are available: (when org-agenda-mouse-1-follows-link (org-defkey org-agenda-mode-map [follow-link] 'mouse-face)) -(easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu" +(easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu." '("Agenda" ("Agenda Files") "--" @@ -2645,7 +2664,7 @@ that have been changed along." (while (bufferp (setq buf (pop entry))) (when (pop entry) (with-current-buffer buf - (let ((last-undo-buffer buf) + (let (;; (last-undo-buffer buf) (inhibit-read-only t)) (unless (memq buf org-agenda-undo-has-started-in) (push buf org-agenda-undo-has-started-in) @@ -2797,7 +2816,7 @@ to limit entries to in this type." (defvar org-keys nil) (defvar org-match nil) ;;;###autoload -(defun org-agenda (&optional arg org-keys restriction) +(defun org-agenda (&optional arg keys restriction) "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: @@ -2832,7 +2851,8 @@ Pressing `<' twice means to restrict to the current subtree or region \(if active)." (interactive "P") (catch 'exit - (let* ((prefix-descriptions nil) + (let* ((org-keys keys) + (prefix-descriptions nil) (org-agenda-buffer-name org-agenda-buffer-name) (org-agenda-window-setup (if (equal (buffer-name) org-agenda-buffer-name) @@ -2854,9 +2874,9 @@ Pressing `<' twice means to restrict to the current subtree or region (org-agenda-custom-commands (org-contextualize-keys org-agenda-custom-commands org-agenda-custom-commands-contexts)) - (buf (current-buffer)) + ;; (buf (current-buffer)) (bfn (buffer-file-name (buffer-base-buffer))) - entry key type org-match lprops ans) + entry type org-match lprops ans) ;; key ;; Turn off restriction unless there is an overriding one, (unless org-agenda-overriding-restriction (unless org-agenda-keep-restricted-file-list @@ -2908,47 +2928,51 @@ Pressing `<' twice means to restrict to the current subtree or region ((setq entry (assoc org-keys org-agenda-custom-commands)) (if (or (symbolp (nth 2 entry)) (functionp (nth 2 entry))) (progn - (setq type (nth 2 entry) org-match (eval (nth 3 entry)) + ;; FIXME: Is (nth 3 entry) supposed to have access (via dynvars) + ;; to some of the local variables? There's no doc about + ;; that for `org-agenda-custom-commands'. + (setq type (nth 2 entry) org-match (eval (nth 3 entry) t) lprops (nth 4 entry)) (when org-agenda-sticky (setq org-agenda-buffer-name (or (and (stringp org-match) (format "*Org Agenda(%s:%s)*" org-keys org-match)) (format "*Org Agenda(%s)*" org-keys)))) (put 'org-agenda-redo-command 'org-lprops lprops) - (cond - ((eq type 'agenda) - (org-let lprops '(org-agenda-list current-prefix-arg))) - ((eq type 'agenda*) - (org-let lprops '(org-agenda-list current-prefix-arg nil nil t))) - ((eq type 'alltodo) - (org-let lprops '(org-todo-list current-prefix-arg))) - ((eq type 'search) - (org-let lprops '(org-search-view current-prefix-arg org-match nil))) - ((eq type 'stuck) - (org-let lprops '(org-agenda-list-stuck-projects - current-prefix-arg))) - ((eq type 'tags) - (org-let lprops '(org-tags-view current-prefix-arg org-match))) - ((eq type 'tags-todo) - (org-let lprops '(org-tags-view '(4) org-match))) - ((eq type 'todo) - (org-let lprops '(org-todo-list org-match))) - ((eq type 'tags-tree) - (org-check-for-org-mode) - (org-let lprops '(org-match-sparse-tree current-prefix-arg org-match))) - ((eq type 'todo-tree) - (org-check-for-org-mode) - (org-let lprops - '(org-occur (concat "^" org-outline-regexp "[ \t]*" - (regexp-quote org-match) "\\>")))) - ((eq type 'occur-tree) - (org-check-for-org-mode) - (org-let lprops '(org-occur org-match))) - ((functionp type) - (org-let lprops '(funcall type org-match))) - ((fboundp type) - (org-let lprops '(funcall type org-match))) - (t (user-error "Invalid custom agenda command type %s" type)))) + (cl-progv + (mapcar #'car lprops) + (mapcar (lambda (binding) (eval (cadr binding) t)) lprops) + (pcase type + (`agenda + (org-agenda-list current-prefix-arg)) + (`agenda* + (org-agenda-list current-prefix-arg nil nil t)) + (`alltodo + (org-todo-list current-prefix-arg)) + (`search + (org-search-view current-prefix-arg org-match nil)) + (`stuck + (org-agenda-list-stuck-projects current-prefix-arg)) + (`tags + (org-tags-view current-prefix-arg org-match)) + (`tags-todo + (org-tags-view '(4) org-match)) + (`todo + (org-todo-list org-match)) + (`tags-tree + (org-check-for-org-mode) + (org-match-sparse-tree current-prefix-arg org-match)) + (`todo-tree + (org-check-for-org-mode) + (org-occur (concat "^" org-outline-regexp "[ \t]*" + (regexp-quote org-match) "\\>"))) + (`occur-tree + (org-check-for-org-mode) + (org-occur org-match)) + ((pred functionp) + (funcall type org-match)) + ;; FIXME: Will signal an error since it's not `functionp'! + ((pred fboundp) (funcall type org-match)) + (_ (user-error "Invalid custom agenda command type %s" type))))) (org-agenda-run-series (nth 1 entry) (cddr entry)))) ((equal org-keys "C") (setq org-agenda-custom-commands org-agenda-custom-commands-orig) @@ -3227,70 +3251,79 @@ s Search for keywords M Like m, but only TODO entries (defvar org-agenda-overriding-cmd-arguments nil) (defun org-let (list &rest body) ;FIXME: So many kittens are suffering here. - (declare (indent 1)) + (declare (indent 1) (obsolete cl-progv "2021")) (eval (cons 'let (cons list body)))) (defun org-let2 (list1 list2 &rest body) ;FIXME: Where did our karma go? - (declare (indent 2)) + (declare (indent 2) (obsolete cl-progv "2021")) (eval (cons 'let (cons list1 (list (cons 'let (cons list2 body))))))) (defun org-agenda-run-series (name series) "Run agenda NAME as a SERIES of agenda commands." - (org-let (nth 1 series) '(org-agenda-prepare name)) - ;; We need to reset agenda markers here, because when constructing a - ;; block agenda, the individual blocks do not do that. - (org-agenda-reset-markers) - (let* ((org-agenda-multi t) - (redo (list 'org-agenda-run-series name (list 'quote series))) - (cmds (car series)) - (gprops (nth 1 series)) - match ;; The byte compiler incorrectly complains about this. Keep it! - org-cmd type lprops) - (while (setq org-cmd (pop cmds)) - (setq type (car org-cmd)) - (setq match (eval (nth 1 org-cmd))) - (setq lprops (nth 2 org-cmd)) - (let ((org-agenda-overriding-arguments - (if (eq org-agenda-overriding-cmd org-cmd) - (or org-agenda-overriding-arguments - org-agenda-overriding-cmd-arguments)))) - (cond - ((eq type 'agenda) - (org-let2 gprops lprops - '(call-interactively 'org-agenda-list))) - ((eq type 'agenda*) - (org-let2 gprops lprops - '(funcall 'org-agenda-list nil nil t))) - ((eq type 'alltodo) - (org-let2 gprops lprops - '(call-interactively 'org-todo-list))) - ((eq type 'search) - (org-let2 gprops lprops - '(org-search-view current-prefix-arg match nil))) - ((eq type 'stuck) - (org-let2 gprops lprops - '(call-interactively 'org-agenda-list-stuck-projects))) - ((eq type 'tags) - (org-let2 gprops lprops - '(org-tags-view current-prefix-arg match))) - ((eq type 'tags-todo) - (org-let2 gprops lprops - '(org-tags-view '(4) match))) - ((eq type 'todo) - (org-let2 gprops lprops - '(org-todo-list match))) - ((fboundp type) - (org-let2 gprops lprops - '(funcall type match))) - (t (error "Invalid type in command series"))))) - (widen) - (let ((inhibit-read-only t)) - (add-text-properties (point-min) (point-max) - `(org-series t org-series-redo-cmd ,redo))) - (setq org-agenda-redo-command redo) - (goto-char (point-min))) - (org-agenda-fit-window-to-buffer) - (org-let (nth 1 series) '(org-agenda-finalize))) + (let* ((gprops (nth 1 series)) + (gvars (mapcar #'car gprops)) + (gvals (mapcar (lambda (binding) (eval (cadr binding) t)) gprops))) + (cl-progv gvars gvals (org-agenda-prepare name)) + ;; We need to reset agenda markers here, because when constructing a + ;; block agenda, the individual blocks do not do that. + (org-agenda-reset-markers) + (with-no-warnings + (defvar match)) ;Used via the `eval' below. + (let* ((org-agenda-multi t) + ;; FIXME: Redo should contain lists of (FUNS . ARGS) rather + ;; than expressions, so you don't need to `quote' the args + ;; and you just need to `apply' instead of `eval' when using it. + (redo (list 'org-agenda-run-series name (list 'quote series))) + (cmds (car series)) + match + org-cmd type lprops) + (while (setq org-cmd (pop cmds)) + (setq type (car org-cmd)) + (setq match (eval (nth 1 org-cmd) t)) + (setq lprops (nth 2 org-cmd)) + (let ((org-agenda-overriding-arguments + (if (eq org-agenda-overriding-cmd org-cmd) + (or org-agenda-overriding-arguments + org-agenda-overriding-cmd-arguments))) + (lvars (mapcar #'car lprops)) + (lvals (mapcar (lambda (binding) (eval (cadr binding) t)) lprops))) + (cl-progv (append gvars lvars) (append gvals lvals) + (pcase type + (`agenda + (call-interactively 'org-agenda-list)) + (`agenda* + (funcall 'org-agenda-list nil nil t)) + (`alltodo + (call-interactively 'org-todo-list)) + (`search + (org-search-view current-prefix-arg match nil)) + (`stuck + (call-interactively 'org-agenda-list-stuck-projects)) + (`tags + (org-tags-view current-prefix-arg match)) + (`tags-todo + (org-tags-view '(4) match)) + (`todo + (org-todo-list match)) + ((pred fboundp) + (funcall type match)) + (_ (error "Invalid type in command series")))))) + (widen) + (let ((inhibit-read-only t)) + (add-text-properties (point-min) (point-max) + `(org-series t org-series-redo-cmd ,redo))) + (setq org-agenda-redo-command redo) + (goto-char (point-min))) + (org-agenda-fit-window-to-buffer) + (cl-progv gvars gvals (org-agenda-finalize)))) + +(defun org-agenda--split-plist (plist) + ;; We could/should arguably use `map-keys' and `map-values'. + (let (keys vals) + (while plist + (push (pop plist) keys) + (push (pop plist) vals)) + (cons (nreverse keys) (nreverse vals)))) ;;;###autoload (defmacro org-batch-agenda (cmd-key &rest parameters) @@ -3300,7 +3333,13 @@ If CMD-KEY is a string of length 1, it is used as a key in 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." - (org-eval-in-environment (org-make-parameter-alist parameters) + (pcase-let ((`(,vars . ,exps) (org-agenda--split-plist parameters))) + `(org--batch-agenda ,cmd-key ',vars (list ,@exps)))) + +(defun org--batch-agenda (cmd-key vars vals) + ;; `org-batch-agenda' is a macro because every other "parameter" is + ;; a variable name rather than an expression to evaluate. Yuck! + (cl-progv vars vals (let (org-agenda-sticky) (if (> (length cmd-key) 1) (org-tags-view nil cmd-key) @@ -3345,11 +3384,18 @@ 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" - (org-eval-in-environment (append '((org-agenda-remove-tags t)) - (org-make-parameter-alist parameters)) - (if (> (length cmd-key) 2) - (org-tags-view nil cmd-key) - (org-agenda nil cmd-key))) + (pcase-let ((`(,vars . ,exps) (org-agenda--split-plist parameters))) + `(org--batch-agenda-csv ,cmd-key ',vars (list ,@exps)))) + +(defun org--batch-agenda-csv (cmd-key vars vals) + ;; `org-batch-agenda-csv' is a macro because every other "parameter" is + ;; a variable name rather than an expression to evaluate. Yuck! + (let ((org-agenda-remove-tags t)) + (cl-progv vars vals + ;; FIXME: Shouldn't this be 1 (see commit 10173ad6d610b)? + (if (> (length cmd-key) 2) + (org-tags-view nil cmd-key) + (org-agenda nil cmd-key)))) (set-buffer org-agenda-buffer-name) (let ((lines (org-split-string (buffer-string) "\n"))) (dolist (line lines) @@ -3357,9 +3403,9 @@ agenda-day The day in the agenda where this is listed" (setq org-agenda-info (org-fix-agenda-info (text-properties-at 0 line))) (princ - (mapconcat 'org-agenda-export-csv-mapper + (mapconcat #'org-agenda-export-csv-mapper '(org-category txt type todo tags date time extra - priority-letter priority agenda-day) + priority-letter priority agenda-day) ",")) (princ "\n"))))) @@ -3368,7 +3414,7 @@ agenda-day The day in the agenda where this is listed" This ensures the export commands can easily use it." (let (tmp re) (when (setq tmp (plist-get props 'tags)) - (setq props (plist-put props 'tags (mapconcat 'identity tmp ":")))) + (setq props (plist-put props 'tags (mapconcat #'identity tmp ":")))) (when (setq tmp (plist-get props 'date)) (when (integerp tmp) (setq tmp (calendar-gregorian-from-absolute tmp))) (let ((calendar-date-display-form '(year "-" month "-" day))) @@ -3404,19 +3450,22 @@ This ensures the export commands can easily use it." (org-trim (replace-regexp-in-string "," ";" res nil t)))) ;;;###autoload -(defun org-store-agenda-views (&rest parameters) +(defun org-store-agenda-views (&rest _parameters) "Store agenda views." (interactive) - (eval (list 'org-batch-store-agenda-views))) + (org--batch-store-agenda-views nil nil)) ;;;###autoload (defmacro org-batch-store-agenda-views (&rest parameters) "Run all custom agenda commands that have a file argument." + (pcase-let ((`(,vars . ,exps) (org-agenda--split-plist parameters))) + `(org--batch-store-agenda-views ',vars (list ,@exps)))) + +(defun org--batch-store-agenda-views (vars vals) (let ((cmds (org-agenda-normalize-custom-commands org-agenda-custom-commands)) - (pop-up-frames nil) - (dir default-directory) - (pars (org-make-parameter-alist parameters)) - cmd thiscmdkey thiscmdcmd match files opts cmd-or-set bufname) + (pop-up-frames nil) + (dir default-directory) + cmd thiscmdkey thiscmdcmd match files opts cmd-or-set bufname) (save-window-excursion (while cmds (setq cmd (pop cmds) @@ -3433,14 +3482,18 @@ This ensures the export commands can easily use it." files (nth (if (listp cmd-or-set) 4 5) cmd)) (if (stringp files) (setq files (list files))) (when files - (org-eval-in-environment (append org-agenda-exporter-settings - opts pars) - (org-agenda nil thiscmdkey)) - (set-buffer bufname) - (while files - (org-eval-in-environment (append org-agenda-exporter-settings - opts pars) - (org-agenda-write (expand-file-name (pop files) dir) nil t bufname))) + (let* ((opts (append org-agenda-exporter-settings opts)) + (vars (append (mapcar #'car opts) vars)) + (vals (append (mapcar (lambda (binding) (eval (cadr binding) t)) + opts) + vals))) + (cl-progv vars vals + (org-agenda nil thiscmdkey)) + (set-buffer bufname) + (while files + (cl-progv vars vals + (org-agenda-write (expand-file-name (pop files) dir) + nil t bufname)))) (and (get-buffer bufname) (kill-buffer bufname))))))) @@ -3480,80 +3533,87 @@ the agenda to write." (if (called-interactively-p 'any) (not (y-or-n-p (format "Overwrite existing file %s? " file)))))) (user-error "Cannot write agenda to file %s" file)) - (org-let (if nosettings nil org-agenda-exporter-settings) - '(save-excursion - (save-window-excursion - (let ((bs (copy-sequence (buffer-string))) - (extension (file-name-extension file)) - (default-directory (file-name-directory file)) - beg content) - (with-temp-buffer - (rename-buffer org-agenda-write-buffer-name t) - (set-buffer-modified-p nil) - (insert bs) - (org-agenda-remove-marked-text 'invisible 'org-filtered) - (run-hooks 'org-agenda-before-write-hook) - (cond - ((bound-and-true-p org-mobile-creating-agendas) - (org-mobile-write-agenda-for-mobile file)) - ((string= "org" extension) - (let (content p m message-log-max) - (goto-char (point-min)) - (while (setq p (next-single-property-change (point) 'org-hd-marker nil)) - (goto-char p) - (setq m (get-text-property (point) 'org-hd-marker)) - (when m - (push (save-excursion - (set-buffer (marker-buffer m)) - (goto-char m) - (org-copy-subtree 1 nil t t) - org-subtree-clip) - content))) - (find-file file) - (erase-buffer) - (dolist (s content) (org-paste-subtree 1 s)) - (write-file file) - (kill-buffer (current-buffer)) - (message "Org file written to %s" file))) - ((member extension '("html" "htm")) - (or (require 'htmlize nil t) - (error "Please install htmlize from https://github.com/hniksic/emacs-htmlize")) - (set-buffer (htmlize-buffer (current-buffer))) - (when org-agenda-export-html-style - ;; replace ")) - (insert org-agenda-export-html-style)) - (write-file file) - (kill-buffer (current-buffer)) - (message "HTML written to %s" file)) - ((string= "ps" extension) - (require 'ps-print) - (ps-print-buffer-with-faces file) - (message "Postscript written to %s" file)) - ((string= "pdf" extension) - (require 'ps-print) - (ps-print-buffer-with-faces - (concat (file-name-sans-extension file) ".ps")) - (call-process "ps2pdf" nil nil nil - (expand-file-name - (concat (file-name-sans-extension file) ".ps")) - (expand-file-name file)) - (delete-file (concat (file-name-sans-extension file) ".ps")) - (message "PDF written to %s" file)) - ((string= "ics" extension) - (require 'ox-icalendar) - (org-icalendar-export-current-agenda (expand-file-name file))) - (t - (let ((bs (buffer-string))) - (find-file file) - (erase-buffer) - (insert bs) - (save-buffer 0) - (kill-buffer (current-buffer)) - (message "Plain text written to %s" file)))))))) + (cl-progv + (if nosettings nil (mapcar #'car org-agenda-exporter-settings)) + (if nosettings nil (mapcar (lambda (binding) (eval (cadr binding) t)) + org-agenda-exporter-settings)) + (save-excursion + (save-window-excursion + (let ((bs (copy-sequence (buffer-string))) + (extension (file-name-extension file)) + (default-directory (file-name-directory file)) + ) ;; beg content + (with-temp-buffer + (rename-buffer org-agenda-write-buffer-name t) + (set-buffer-modified-p nil) + (insert bs) + (org-agenda-remove-marked-text 'invisible 'org-filtered) + (run-hooks 'org-agenda-before-write-hook) + (cond + ((bound-and-true-p org-mobile-creating-agendas) + (org-mobile-write-agenda-for-mobile file)) + ((string= "org" extension) + (let (content p m message-log-max) + (goto-char (point-min)) + (while (setq p (next-single-property-change (point) 'org-hd-marker nil)) + (goto-char p) + (setq m (get-text-property (point) 'org-hd-marker)) + (when m + (push (with-current-buffer (marker-buffer m) + (goto-char m) + (org-copy-subtree 1 nil t t) + org-subtree-clip) + content))) + (find-file file) + (erase-buffer) + (dolist (s content) (org-paste-subtree 1 s)) + (write-file file) + (kill-buffer (current-buffer)) + (message "Org file written to %s" file))) + ((member extension '("html" "htm")) + (or (require 'htmlize nil t) + (error "Please install htmlize from https://github.com/hniksic/emacs-htmlize")) + (declare-function htmlize-buffer "htmlize" (&optional buffer)) + (set-buffer (htmlize-buffer (current-buffer))) + (when org-agenda-export-html-style + ;; replace ")) + (insert org-agenda-export-html-style)) + (write-file file) + (kill-buffer (current-buffer)) + (message "HTML written to %s" file)) + ((string= "ps" extension) + (require 'ps-print) + (ps-print-buffer-with-faces file) + (message "Postscript written to %s" file)) + ((string= "pdf" extension) + (require 'ps-print) + (ps-print-buffer-with-faces + (concat (file-name-sans-extension file) ".ps")) + (call-process "ps2pdf" nil nil nil + (expand-file-name + (concat (file-name-sans-extension file) ".ps")) + (expand-file-name file)) + (delete-file (concat (file-name-sans-extension file) ".ps")) + (message "PDF written to %s" file)) + ((string= "ics" extension) + (require 'ox-icalendar) + (declare-function org-icalendar-export-current-agenda + "ox-icalendar" (file)) + (org-icalendar-export-current-agenda (expand-file-name file))) + (t + (let ((bs (buffer-string))) + (find-file file) + (erase-buffer) + (insert bs) + (save-buffer 0) + (kill-buffer (current-buffer)) + (message "Plain text written to %s" file)))))))) (set-buffer (or agenda-bufname + ;; FIXME: I'm pretty sure called-interactively-p + ;; doesn't do what we want here! (and (called-interactively-p 'any) (buffer-name)) org-agenda-buffer-name))) (when open (org-open-file file))) @@ -3709,15 +3769,14 @@ the global options and expect it to be applied to the entire view.") (tag . org-agenda-tag-filter) (effort . org-agenda-effort-filter) (regexp . org-agenda-regexp-filter)) - "Alist of filter types and associated variables") + "Alist of filter types and associated variables.") (defun org-agenda-filter-any () "Is any filter active?" - (let ((form (cons 'or (mapcar (lambda (x) - (if (or (symbol-value (cdr x)) - (get :preset-filter x)) - t nil)) - org-agenda-filter-variables)))) - (eval form))) + (cl-some (lambda (x) + (or (symbol-value (cdr x)) + (get :preset-filter x))) + org-agenda-filter-variables)) + (defvar org-agenda-category-filter-preset nil "A preset of the category filter used for secondary agenda filtering. This must be a list of strings, each string must be a single category @@ -3929,7 +3988,7 @@ agenda display, configure `org-agenda-finalize-hook'." (put-text-property (point-at-bol) (point-at-eol) 'tags (org-with-point-at mrk - (mapcar #'downcase (org-get-tags))))))))) + (org-get-tags)))))))) (setq org-agenda-represented-tags nil org-agenda-represented-categories nil) (when org-agenda-top-headline-filter @@ -3955,7 +4014,7 @@ agenda display, configure `org-agenda-finalize-hook'." (when (get 'org-agenda-effort-filter :preset-filter) (org-agenda-filter-apply (get 'org-agenda-effort-filter :preset-filter) 'effort)) - (add-hook 'kill-buffer-hook 'org-agenda-reset-markers 'append 'local)) + (add-hook 'kill-buffer-hook #'org-agenda-reset-markers 'append 'local)) (run-hooks 'org-agenda-finalize-hook)))) (defun org-agenda-mark-clocking-task () @@ -4024,10 +4083,10 @@ agenda display, configure `org-agenda-finalize-hook'." (defvar org-depend-tag-blocked) -(defun org-agenda-dim-blocked-tasks (&optional invisible) +(defun org-agenda-dim-blocked-tasks (&optional _invisible) "Dim currently blocked TODOs in the agenda display. When INVISIBLE is non-nil, hide currently blocked TODO instead of -dimming them." +dimming them." ;FIXME: The arg isn't used, actually! (interactive "P") (when (called-interactively-p 'interactive) (message "Dim or hide blocked tasks...")) @@ -4052,7 +4111,9 @@ dimming them." (overlay-put ov 'face 'org-agenda-dimmed-todo-face)) (when invisible (org-agenda-filter-hide-line 'todo-blocked))) - (move-beginning-of-line 2)))) + (if (= (point-max) (line-end-position)) + (goto-char (point-max)) + (move-beginning-of-line 2))))) (when (called-interactively-p 'interactive) (message "Dim or hide blocked tasks...done"))) @@ -4135,7 +4196,7 @@ functions do." (save-match-data (if fp (funcall form) - (eval form))))))) + (eval form t))))))) (defvar org-agenda-markers nil "List of all currently active markers created by `org-agenda'.") @@ -4209,6 +4270,9 @@ This check for agenda markers in all agenda buffers currently active." "Return the face DATE should be displayed with." (cond ((and (functionp org-agenda-day-face-function) (funcall org-agenda-day-face-function date))) + ((and (org-agenda-today-p date) + (memq (calendar-day-of-week date) org-agenda-weekend-days)) + 'org-agenda-date-weekend-today) ((org-agenda-today-p date) 'org-agenda-date-today) ((memq (calendar-day-of-week date) org-agenda-weekend-days) 'org-agenda-date-weekend) @@ -4251,7 +4315,7 @@ items if they have an hour specification like [h]h:mm." (setq span arg arg nil)) (when (numberp span) (unless (< 0 span) - (user-error "Agenda creation impossible for this span(=%d days)." span))) + (user-error "Agenda creation impossible for this span(=%d days)" span))) (catch 'exit (setq org-agenda-buffer-name (org-agenda--get-buffer-name @@ -4289,11 +4353,11 @@ items if they have an hour specification like [h]h:mm." (day-cnt 0) (inhibit-redisplay (not debug-on-error)) (org-agenda-show-log-scoped org-agenda-show-log) - s e rtn rtnall file date d start-pos end-pos todayp - clocktable-start clocktable-end filter) + s rtn rtnall file date d start-pos end-pos todayp ;; e + clocktable-start clocktable-end) ;; filter (setq org-agenda-redo-command (list 'org-agenda-list (list 'quote arg) start-day (list 'quote span) with-hour)) - (dotimes (n (1- ndays)) + (dotimes (_ (1- ndays)) (push (1+ (car day-numbers)) day-numbers)) (setq day-numbers (nreverse day-numbers)) (setq clocktable-start (car day-numbers) @@ -4359,11 +4423,11 @@ items if they have an hour specification like [h]h:mm." (setq rtn (org-agenda-get-day-entries file date :closed))) (org-agenda-show-log-scoped - (setq rtn (apply 'org-agenda-get-day-entries + (setq rtn (apply #'org-agenda-get-day-entries file date (append '(:closed) org-agenda-entry-types)))) (t - (setq rtn (apply 'org-agenda-get-day-entries + (setq rtn (apply #'org-agenda-get-day-entries file date org-agenda-entry-types))))) (setq rtnall (append rtnall rtn)))) ;; all entries @@ -4403,7 +4467,7 @@ items if they have an hour specification like [h]h:mm." (setq p (plist-put p :tstart clocktable-start)) (setq p (plist-put p :tend clocktable-end)) (setq p (plist-put p :scope 'agenda)) - (setq tbl (apply 'org-clock-get-clocktable p)) + (setq tbl (apply #'org-clock-get-clocktable p)) (insert tbl))) (goto-char (point-min)) (or org-agenda-multi (org-agenda-fit-window-to-buffer)) @@ -4624,7 +4688,7 @@ is active." (setq re (regexp-quote (downcase w))))) (if neg (push re regexps-) (push re regexps+))) words) - (push (mapconcat (lambda (w) (regexp-quote w)) words "\\s-+") + (push (mapconcat #'regexp-quote words "\\s-+") regexps+)) (setq regexps+ (sort regexps+ (lambda (a b) (> (length a) (length b))))) (if (not regexps+) @@ -4747,7 +4811,7 @@ is active." (list 'face 'org-agenda-structure)) (setq pos (point)) (insert string "\n") - (add-text-properties pos (1- (point)) (list 'face 'org-warning)) + (add-text-properties pos (1- (point)) (list 'face 'org-agenda-structure-filter)) (setq pos (point)) (unless org-agenda-multi (insert (substitute-command-keys "\\\ @@ -4757,7 +4821,7 @@ Press `\\[org-agenda-manipulate-query-add]', \ `\\[org-agenda-manipulate-query-subtract-re]' to add/sub regexp, \ `\\[universal-argument] \\[org-agenda-redo]' for a fresh search\n")) (add-text-properties pos (1- (point)) - (list 'face 'org-agenda-structure))) + (list 'face 'org-agenda-structure-secondary))) (buffer-string))) (org-agenda-mark-header-line (point-min)) (when rtnall @@ -4778,10 +4842,10 @@ Press `\\[org-agenda-manipulate-query-add]', \ "Use `org-todo-keyword-faces' for the selected todo KEYWORDS." (concat (if (or (equal keywords "ALL") (not keywords)) - (propertize "ALL" 'face 'warning) + (propertize "ALL" 'face 'org-agenda-structure-filter) (mapconcat (lambda (kw) - (propertize kw 'face (org-get-todo-face kw))) + (propertize kw 'face (list (org-get-todo-face kw) 'org-agenda-structure))) (org-split-string keywords "|") "|")) "\n")) @@ -4789,6 +4853,8 @@ Press `\\[org-agenda-manipulate-query-add]', \ (defvar org-select-this-todo-keyword nil) (defvar org-last-arg nil) +(defvar crm-separator) + ;;;###autoload (defun org-todo-list (&optional arg) "Show all (not done) TODO entries from all agenda file in a single list. @@ -4864,7 +4930,7 @@ to search again: (0)[ALL]")) (insert "\n ")) (insert " " s)))) (insert "\n")) - (add-text-properties pos (1- (point)) (list 'face 'org-agenda-structure)) + (add-text-properties pos (1- (point)) (list 'face 'org-agenda-structure-secondary)) (buffer-string))) (org-agenda-mark-header-line (point-min)) (when rtnall @@ -4955,7 +5021,7 @@ The prefix arg TODO-ONLY limits the search to TODO entries." (concat "Match: " match))) (setq pos (point)) (insert match "\n") - (add-text-properties pos (1- (point)) (list 'face 'org-warning)) + (add-text-properties pos (1- (point)) (list 'face 'org-agenda-structure-filter)) (setq pos (point)) (unless org-agenda-multi (insert (substitute-command-keys @@ -4963,7 +5029,7 @@ The prefix arg TODO-ONLY limits the search to TODO entries." \\`\\[universal-argument] \\[org-agenda-redo]' \ to search again\n"))) (add-text-properties pos (1- (point)) - (list 'face 'org-agenda-structure)) + (list 'face 'org-agenda-structure-secondary)) (buffer-string))) (org-agenda-mark-header-line (point-min)) (when rtnall @@ -4989,10 +5055,11 @@ used by user-defined selections using `org-agenda-skip-function'.") (defvar org-agenda-overriding-header nil "When set during agenda, todo and tags searches it replaces the header. If an empty string, no header will be inserted. If any other -string, it will be inserted as a header. If nil, a header will -be generated automatically according to the command. This -variable should not be set directly, but custom commands can bind -it in the options section.") +string, it will be inserted as a header. If a function, insert +the string returned by the function as a header. If nil, a +header will be generated automatically according to the command. +This variable should not be set directly, but custom commands can +bind it in the options section.") (defun org-agenda-skip-entry-if (&rest conditions) "Skip entry if any of CONDITIONS is true. @@ -5005,7 +5072,7 @@ See `org-agenda-skip-if' for details." (org-agenda-skip-if t conditions)) (defun org-agenda-skip-if (subtree conditions) - "Checks current entity for CONDITIONS. + "Check current entity for CONDITIONS. If SUBTREE is non-nil, the entire subtree is checked. Otherwise, only the entry (i.e. the text before the next heading) is checked. @@ -5044,7 +5111,7 @@ If any of these conditions is met, this function returns the end point of the entity, causing the search to continue from there. This is a function that can be put into `org-agenda-skip-function' for the duration of a command." (org-back-to-heading t) - (let* ((beg (point)) + (let* (;; (beg (point)) (end (if subtree (save-excursion (org-end-of-subtree t) (point)) (org-entry-end-position))) (planning-end (if subtree end (line-end-position 2))) @@ -5118,7 +5185,7 @@ a list of TODO keywords, or a state symbol `todo' or `done' or (`(,type . ,_) (error "Unknown TODO skip type: %S" type))))) ;;;###autoload -(defun org-agenda-list-stuck-projects (&rest ignore) +(defun org-agenda-list-stuck-projects (&rest _ignore) "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 @@ -5156,12 +5223,12 @@ of what a project is and how to check if it stuck, customize the variable (org-agenda-skip-function ;; Skip entry if `org-agenda-skip-regexp' matches anywhere ;; in the subtree. - `(lambda () - (and (save-excursion - (let ((case-fold-search nil)) - (re-search-forward - ,skip-re (save-excursion (org-end-of-subtree t)) t))) - (progn (outline-next-heading) (point)))))) + (lambda () + (and (save-excursion + (let ((case-fold-search nil)) + (re-search-forward + skip-re (save-excursion (org-end-of-subtree t)) t))) + (progn (outline-next-heading) (point)))))) (org-tags-view nil matcher) (setq org-agenda-buffer-name (buffer-name)) (with-current-buffer org-agenda-buffer-name @@ -5177,24 +5244,28 @@ of what a project is and how to check if it stuck, customize the variable (defvar org-disable-agenda-to-diary nil) ;Dynamically-scoped param. (defvar diary-list-entries-hook) (defvar diary-time-regexp) +(defvar diary-modify-entry-list-string-function) +(defvar diary-file-name-prefix) +(defvar diary-display-function) + (defun org-get-entries-from-diary (date) "Get the (Emacs Calendar) diary entries for DATE." (require 'diary-lib) + (declare-function diary-fancy-display "diary-lib" ()) (let* ((diary-fancy-buffer "*temporary-fancy-diary-buffer*") - (diary-display-function 'diary-fancy-display) + (diary-display-function #'diary-fancy-display) (pop-up-frames nil) (diary-list-entries-hook (cons 'org-diary-default-entry diary-list-entries-hook)) (diary-file-name-prefix nil) ; turn this feature off - (diary-modify-entry-list-string-function 'org-modify-diary-entry-string) + (diary-modify-entry-list-string-function + #'org-modify-diary-entry-string) (diary-time-regexp (concat "^" diary-time-regexp)) entries (org-disable-agenda-to-diary t)) (save-excursion (save-window-excursion - (funcall (if (fboundp 'diary-list-entries) - 'diary-list-entries 'list-diary-entries) - date 1))) + (diary-list-entries date 1))) (if (not (get-buffer diary-fancy-buffer)) (setq entries nil) (with-current-buffer diary-fancy-buffer @@ -5269,15 +5340,7 @@ each date. It also removes lines that contain only whitespace." Needed to avoid empty dates which mess up holiday display." ;; Catch the error if dealing with the new add-to-diary-alist (when org-disable-agenda-to-diary - (condition-case nil - (org-add-to-diary-list original-date "Org mode dummy" "") - (error - (org-add-to-diary-list original-date "Org mode dummy" "" nil))))) - -(defun org-add-to-diary-list (&rest args) - (if (fboundp 'diary-add-to-list) - (apply 'diary-add-to-list args) - (apply 'add-to-diary-list args))) + (diary-add-to-list original-date "Org mode dummy" ""))) (defvar org-diary-last-run-time nil) @@ -5308,6 +5371,7 @@ So the example above may also be written as 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." + (with-no-warnings (defvar date) (defvar entry)) (when (> (- (float-time) org-agenda-last-marker-time) 5) @@ -5332,7 +5396,7 @@ function from a program - use `org-agenda-get-day-entries' instead." ;; the calendar. Org Agenda will list these entries itself. (when org-disable-agenda-to-diary (setq files nil)) (while (setq file (pop files)) - (setq rtn (apply 'org-agenda-get-day-entries file date args)) + (setq rtn (apply #'org-agenda-get-day-entries file date args)) (setq results (append results rtn))) (when results (setq results @@ -5393,27 +5457,29 @@ the documentation of `org-diary'." (setf args (cons :deadline* (delq :deadline* args))))) ;; Collect list of headlines. Return them flattened. (let ((case-fold-search nil) results deadlines) - (dolist (arg args (apply #'nconc (nreverse results))) - (pcase arg - ((and :todo (guard (org-agenda-today-p date))) - (push (org-agenda-get-todos) results)) - (:timestamp - (push (org-agenda-get-blocks) results) - (push (org-agenda-get-timestamps deadlines) results)) - (:sexp - (push (org-agenda-get-sexps) results)) - (:scheduled - (push (org-agenda-get-scheduled deadlines) results)) - (:scheduled* - (push (org-agenda-get-scheduled deadlines t) results)) - (:closed - (push (org-agenda-get-progress) results)) - (:deadline - (setf deadlines (org-agenda-get-deadlines)) - (push deadlines results)) - (:deadline* - (setf deadlines (org-agenda-get-deadlines t)) - (push deadlines results))))))))))) + (org-dlet + ((date date)) + (dolist (arg args (apply #'nconc (nreverse results))) + (pcase arg + ((and :todo (guard (org-agenda-today-p date))) + (push (org-agenda-get-todos) results)) + (:timestamp + (push (org-agenda-get-blocks) results) + (push (org-agenda-get-timestamps deadlines) results)) + (:sexp + (push (org-agenda-get-sexps) results)) + (:scheduled + (push (org-agenda-get-scheduled deadlines) results)) + (:scheduled* + (push (org-agenda-get-scheduled deadlines t) results)) + (:closed + (push (org-agenda-get-progress) results)) + (:deadline + (setf deadlines (org-agenda-get-deadlines)) + (push deadlines results)) + (:deadline* + (setf deadlines (org-agenda-get-deadlines t)) + (push deadlines results)))))))))))) (defsubst org-em (x y list) "Is X or Y a member of LIST?" @@ -5475,11 +5541,12 @@ and the timestamp type relevant for the sorting strategy in org-todo-regexp) (org-select-this-todo-keyword (concat "\\(" - (mapconcat 'identity + (mapconcat #'identity (org-split-string org-select-this-todo-keyword "|") - "\\|") "\\)")) + "\\|") + "\\)")) (t org-not-done-regexp)))) marker priority category level tags todo-state ts-date ts-date-type ts-date-pair @@ -5619,6 +5686,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines', "Return the date stamp information for agenda display. Optional argument DEADLINES is a list of deadline items to be displayed in agenda view." + (with-no-warnings (defvar date)) (let* ((props (list 'face 'org-agenda-calendar-event 'org-not-done-regexp org-not-done-regexp 'org-todo-regexp org-todo-regexp @@ -5761,12 +5829,15 @@ displayed in agenda view." (defun org-agenda-get-sexps () "Return the sexp information for agenda display." (require 'diary-lib) + (with-no-warnings (defvar date) (defvar entry)) (let* ((props (list 'face 'org-agenda-calendar-sexp 'mouse-face 'highlight 'help-echo (format "mouse-2 or RET jump to org file %s" (abbreviate-file-name buffer-file-name)))) (regexp "^&?%%(") + ;; FIXME: Is this `entry' binding intended to be dynamic, + ;; so as to "hide" any current binding for it? marker category extra level ee txt tags entry result beg b sexp sexp-entry todo-state warntime inherited-tags) (goto-char (point-min)) @@ -5847,6 +5918,7 @@ item should be skipped. If any of the SKIP-WEEKS arguments is the symbol `holidays', then any date that is known by the Emacs calendar to be a holiday will also be skipped. If SKIP-WEEKS arguments are holiday strings, then those holidays will be skipped." + (with-no-warnings (defvar date) (defvar entry)) (let* ((date1 (calendar-absolute-from-gregorian (list m1 d1 y1))) (date2 (calendar-absolute-from-gregorian (list m2 d2 y2))) (d (calendar-absolute-from-gregorian date)) @@ -5863,9 +5935,10 @@ then those holidays will be skipped." (delq nil (mapcar (lambda(g) (member g skip-weeks)) h)))) entry))) -(defalias 'org-get-closed 'org-agenda-get-progress) +(defalias 'org-get-closed #'org-agenda-get-progress) (defun org-agenda-get-progress () "Return the logged TODO entries for agenda display." + (with-no-warnings (defvar date)) (let* ((props (list 'mouse-face 'highlight 'org-not-done-regexp org-not-done-regexp 'org-todo-regexp org-todo-regexp @@ -5885,7 +5958,7 @@ then those holidays will be skipped." (when (memq 'clock items) (concat "\\<" org-clock-string)) (when (memq 'state items) (format "- +State \"%s\".*?" org-todo-regexp))))) - (parts-re (if parts (mapconcat 'identity parts "\\|") + (parts-re (if parts (mapconcat #'identity parts "\\|") (error "`org-agenda-log-mode-items' is empty"))) (regexp (concat "\\(" parts-re "\\)" @@ -5996,7 +6069,7 @@ See also the user option `org-agenda-clock-consistency-checks'." '((:background "DarkRed") (:foreground "white")))) issue face m te ts dt ov) (goto-char (point-min)) - (while (re-search-forward " Clocked: +(-\\|\\([0-9]+:[0-9]+\\))" nil t) + (while (re-search-forward " Clocked: +(\\(?:-\\|\\([0-9]+:[0-9]+\\)\\))" nil t) (setq issue nil face def-face) (catch 'next (setq m (org-get-at-bol 'org-marker) @@ -6097,6 +6170,7 @@ See also the user option `org-agenda-clock-consistency-checks'." "Return the deadline information for agenda display. When WITH-HOUR is non-nil, only return deadlines with an hour specification like [h]h:mm." + (with-no-warnings (defvar date)) (let* ((props (list 'mouse-face 'highlight 'org-not-done-regexp org-not-done-regexp 'org-todo-regexp org-todo-regexp @@ -6255,6 +6329,7 @@ FRACTION is what fraction of the head-warning time has passed." Optional argument DEADLINES is a list of deadline items to be displayed in agenda view. When WITH-HOUR is non-nil, only return scheduled items with an hour specification like [h]h:mm." + (with-no-warnings (defvar date)) (let* ((props (list 'org-not-done-regexp org-not-done-regexp 'org-todo-regexp org-todo-regexp 'org-complex-heading-regexp org-complex-heading-regexp @@ -6455,6 +6530,7 @@ scheduled items with an hour specification like [h]h:mm." (defun org-agenda-get-blocks () "Return the date-range information for agenda display." + (with-no-warnings (defvar date)) (let* ((props (list 'face nil 'org-not-done-regexp org-not-done-regexp 'org-todo-regexp org-todo-regexp @@ -6586,14 +6662,14 @@ The flag is set if the currently compiled format contains a `%b'.") (cl-return (cadr entry)) (cl-return (apply #'create-image (cdr entry))))))) -(defun org-agenda-format-item (extra txt &optional level category tags dotime +(defun org-agenda-format-item (extra txt &optional with-level with-category tags dotime remove-re habitp) "Format TXT to be inserted into the agenda buffer. In particular, add the prefix and corresponding text properties. EXTRA must be a string to replace the `%s' specifier in the prefix format. -LEVEL may be a string to replace the `%l' specifier. -CATEGORY (a string, a symbol or nil) may be used to overrule the default +WITH-LEVEL may be a string to replace the `%l' specifier. +WITH-CATEGORY (a string, a symbol or nil) may be used to overrule the default category taken from local variable or file name. It will replace the `%c' specifier in the format. DOTIME, when non-nil, indicates that a time-of-day should be extracted from @@ -6623,7 +6699,14 @@ Any match of REMOVE-RE will be removed from TXT." org-agenda-show-inherited-tags org-agenda-hide-tags-regexp)) - (let* ((category (or category + (with-no-warnings + ;; `time', `tag', `effort' are needed for the eval of the prefix format. + ;; Based on what I see in `org-compile-prefix-format', I added + ;; a few more. + (defvar breadcrumbs) (defvar category) (defvar category-icon) + (defvar effort) (defvar extra) + (defvar level) (defvar tag) (defvar time)) + (let* ((category (or with-category (if buffer-file-name (file-name-sans-extension (file-name-nondirectory buffer-file-name)) @@ -6634,9 +6717,9 @@ Any match of REMOVE-RE will be removed from TXT." "")) (effort (and (not (string= txt "")) (get-text-property 1 'effort txt))) - ;; time, tag, effort are needed for the eval of the prefix format (tag (if tags (nth (1- (length tags)) tags) "")) (time-grid-trailing-characters (nth 2 org-agenda-time-grid)) + (extra (or (and (not habitp) extra) "")) time (ts (when dotime (concat (if (stringp dotime) dotime "") @@ -6666,10 +6749,9 @@ Any match of REMOVE-RE will be removed from TXT." (= (match-beginning 0) 0) t)) (setq txt (replace-match "" nil nil txt)))) - ;; Normalize the time(s) to 24 hour - (when s1 (setq s1 (org-get-time-of-day s1 'string t))) - (when s2 (setq s2 (org-get-time-of-day s2 'string t))) - + ;; Normalize the time(s) to 24 hour. + (when s1 (setq s1 (org-get-time-of-day s1 t))) + (when s2 (setq s2 (org-get-time-of-day s2 t))) ;; Try to set s2 if s1 and ;; `org-agenda-default-appointment-duration' are set (when (and s1 (not s2) org-agenda-default-appointment-duration) @@ -6678,12 +6760,13 @@ Any match of REMOVE-RE will be removed from TXT." (+ (org-duration-to-minutes s1 t) org-agenda-default-appointment-duration) nil t))) - ;; Compute the duration (when s2 (setq duration (- (org-duration-to-minutes s2) - (org-duration-to-minutes s1))))) - + (org-duration-to-minutes s1)))) + ;; Format S1 and S2 for display. + (when s1 (setq s1 (org-get-time-of-day s1 'overtime))) + (when s2 (setq s2 (org-get-time-of-day s2 'overtime)))) (when (string-match org-tag-group-re txt) ;; Tags are in the string (if (or (eq org-agenda-remove-tags t) @@ -6720,9 +6803,8 @@ Any match of REMOVE-RE will be removed from TXT." (concat time-grid-trailing-characters " ") time-grid-trailing-characters))) (t "")) - extra (or (and (not habitp) extra) "") category (if (symbolp category) (symbol-name category) category) - level (or level "")) + level (or with-level "")) (if (string-match org-link-bracket-re category) (progn (setq l (string-width (or (match-string 2) (match-string 1)))) @@ -6735,14 +6817,14 @@ Any match of REMOVE-RE will be removed from TXT." (>= (length category) org-prefix-category-max-length)) (setq category (substring category 0 (1- org-prefix-category-max-length))))) ;; Evaluate the compiled format - (setq rtn (concat (eval formatter) txt)) + (setq rtn (concat (eval formatter t) txt)) ;; And finally add the text properties (remove-text-properties 0 (length rtn) '(line-prefix t wrap-prefix t) rtn) (org-add-props rtn nil 'org-category category - 'tags (mapcar 'org-downcase-keep-props tags) - 'org-priority-highest org-priority-highest + 'tags tags + 'org-priority-highest org-priority-highest 'org-priority-lowest org-priority-lowest 'time-of-day time-of-day 'duration duration @@ -6786,12 +6868,6 @@ The modified list may contain inherited tags, and tags matched by (if have-i "::" ":")))))) txt) -(defun org-downcase-keep-props (s) - (let ((props (text-properties-at 0 s))) - (setq s (downcase s)) - (add-text-properties 0 (length s) props s) - s)) - (defvar org-agenda-sorting-strategy) ;; because the def is in a let form (defun org-agenda-add-time-grid-maybe (list ndays todayp) @@ -6854,8 +6930,8 @@ and stored in the variable `org-prefix-format-compiled'." (cdr (assq key org-agenda-prefix-format))) (t " %-12:c%?-12t% s"))) (start 0) - varform vars var e c f opt) - (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cltseib]\\|(.+)\\)" + varform vars var c f opt) ;; e + (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cltseib]\\|(.+?)\\)" s start) (setq var (or (cdr (assoc (match-string 4 s) '(("c" . category) ("t" . time) ("l" . level) ("s" . extra) @@ -6879,17 +6955,21 @@ and stored in the variable `org-prefix-format-compiled'." (and (string-match "\\.[0-9]+" x) (string-to-number (substring (match-string 0 x) 1))))))) (if (eq var 'eval) - (setq varform `(format ,f (org-eval ,(read (match-string 4 s))))) + (setq varform `(format ,f (org-eval ,(read (substring s (match-beginning 4)))))) (if opt (setq varform - `(if (or (equal "" ,var) (equal nil ,var)) + `(if (member ,var '("" nil)) "" (format ,f (concat ,var ,c)))) (setq varform - `(format ,f (if (or (equal ,var "") - (equal ,var nil)) "" + `(format ,f (if (member ,var '("" nil)) "" (concat ,var ,c (get-text-property 0 'extra-space ,var))))))) - (setq s (replace-match "%s" t nil s)) + (if (eq var 'eval) + (setf (substring s (match-beginning 0) + (+ (match-beginning 4) + (length (format "%S" (read (substring s (match-beginning 4))))))) + "%s") + (setq s (replace-match "%s" t nil s))) (push varform vars)) (setq vars (nreverse vars)) (with-current-buffer (or org-agenda-buffer (current-buffer)) @@ -6903,43 +6983,57 @@ and stored in the variable `org-prefix-format-compiled'." `(format ,s ,@vars)))))) (defun org-set-sorting-strategy (key) - (if (symbolp (car org-agenda-sorting-strategy)) - ;; the old format - (setq org-agenda-sorting-strategy-selected org-agenda-sorting-strategy) - (setq org-agenda-sorting-strategy-selected + (setq org-agenda-sorting-strategy-selected + (if (symbolp (car org-agenda-sorting-strategy)) + ;; the old format + org-agenda-sorting-strategy (or (cdr (assq key org-agenda-sorting-strategy)) (cdr (assq 'agenda org-agenda-sorting-strategy)) '(time-up category-keep priority-down))))) -(defun org-get-time-of-day (s &optional string mod24) +(defun org-get-time-of-day (s &optional string) "Check string S for a time of day. + If found, return it as a military time number between 0 and 2400. If not found, return nil. + The optional STRING argument forces conversion into a 5 character wide string -HH:MM." - (save-match-data - (when - (and - (or (string-match "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s) - (string-match "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\([AaPp][Mm]\\)\\> *" s)) - (not (eq (get-text-property 1 'face s) 'org-link))) - (let* ((h (string-to-number (match-string 1 s))) - (m (if (match-end 3) (string-to-number (match-string 3 s)) 0)) - (ampm (when (match-end 4) (downcase (match-string 4 s)))) - (am-p (equal ampm "am")) - (h1 (cond ((not ampm) h) - ((= h 12) (if am-p 0 12)) - (t (+ h (if am-p 0 12))))) - (h2 (if (and string mod24 (not (and (= m 0) (= h1 24)))) - (mod h1 24) h1)) - (t0 (+ (* 100 h2) m)) - (t1 (concat (if (>= h1 24) "+" " ") - (if (and org-agenda-time-leading-zero - (< t0 1000)) "0" "") - (if (< t0 100) "0" "") - (if (< t0 10) "0" "") - (number-to-string t0)))) - (if string (concat (substring t1 -4 -2) ":" (substring t1 -2)) t0))))) +HH:MM. When it is `overtime', any time above 24:00 is turned into \"+H:MM\" +where H:MM is the duration above midnight." + (let ((case-fold-search t) + (time-regexp + (rx word-start + (group (opt (any "012")) digit) ;group 1: hours + (or (and ":" (group (any "012345") digit) ;group 2: minutes + (opt (group (or "am" "pm")))) ;group 3: am/pm + ;; Special "HHam/pm" case. + (group-n 3 (or "am" "pm"))) + word-end))) + (save-match-data + (when (and (string-match time-regexp s) + (not (eq 'org-link (get-text-property 1 'face s)))) + (let ((hours + (let* ((ampm (and (match-end 3) (downcase (match-string 3 s)))) + (am-p (equal ampm "am"))) + (pcase (string-to-number (match-string 1 s)) + ((and (guard (not ampm)) h) h) + (12 (if am-p 0 12)) + (h (+ h (if am-p 0 12)))))) + (minutes + (if (match-end 2) + (string-to-number (match-string 2 s)) + 0))) + (pcase string + (`nil (+ minutes (* hours 100))) + ((and `overtime + (guard (or (> hours 24) + (and (= hours 24) + (> minutes 0))))) + (format "+%d:%02d" (- hours 24) minutes)) + ((guard org-agenda-time-leading-zero) + (format "%02d:%02d" hours minutes)) + (_ + (format "%d:%02d" hours minutes)))))))) (defvar org-agenda-before-sorting-filter-function nil "Function to be applied to agenda items prior to sorting. @@ -6981,8 +7075,8 @@ The optional argument TYPE tells the agenda type." (delq nil (mapcar org-agenda-before-sorting-filter-function list)))) - (setq list (mapcar 'org-agenda-highlight-todo list) - list (mapcar 'identity (sort list 'org-entries-lessp))) + (setq list (mapcar #'org-agenda-highlight-todo list) + list (mapcar #'identity (sort list #'org-entries-lessp))) (when max-effort (setq list (org-agenda-limit-entries list 'effort-minutes max-effort @@ -6996,7 +7090,7 @@ The optional argument TYPE tells the agenda type." (setq list (org-agenda-limit-entries list 'org-hd-marker max-entries))) (when (and org-agenda-dim-blocked-tasks org-blocker-hook) (setq list (mapcar #'org-agenda--mark-blocked-entry list))) - (mapconcat 'identity list "\n"))) + (mapconcat #'identity list "\n"))) (defun org-agenda-limit-entries (list prop limit &optional fn) "Limit the number of agenda entries." @@ -7082,13 +7176,14 @@ The optional argument TYPE tells the agenda type." (setq x (concat (substring x 0 (match-end 1)) - (format org-agenda-todo-keyword-format - (match-string 2 x)) - ;; Remove `display' property as the icon could leak + (unless (string= org-agenda-todo-keyword-format "") + (format org-agenda-todo-keyword-format + (match-string 2 x))) + ;; Remove `display' property as the icon could leak ;; on the white space. (org-add-props " " (org-plist-delete (text-properties-at 0 x) - 'display)) - (substring x (match-end 3))))))) + 'display)) + (substring x (match-end 3))))))) x))) (defsubst org-cmp-values (a b property) @@ -7211,8 +7306,9 @@ their type." "Predicate for sorting agenda entries." ;; The following variables will be used when the form is evaluated. ;; So even though the compiler complains, keep them. - (let* ((ss org-agenda-sorting-strategy-selected) - (timestamp-up (and (org-em 'timestamp-up 'timestamp-down ss) + (let ((ss org-agenda-sorting-strategy-selected)) + (org-dlet + ((timestamp-up (and (org-em 'timestamp-up 'timestamp-down ss) (org-cmp-ts a b ""))) (timestamp-down (if timestamp-up (- timestamp-up) nil)) (scheduled-up (and (org-em 'scheduled-up 'scheduled-down ss) @@ -7258,14 +7354,14 @@ their type." (alpha-down (if alpha-up (- alpha-up) nil)) (need-user-cmp (org-em 'user-defined-up 'user-defined-down ss)) user-defined-up user-defined-down) - (when (and need-user-cmp org-agenda-cmp-user-defined - (functionp org-agenda-cmp-user-defined)) - (setq user-defined-up - (funcall org-agenda-cmp-user-defined a b) - user-defined-down (if user-defined-up (- user-defined-up) nil))) - (cdr (assoc - (eval (cons 'or org-agenda-sorting-strategy-selected)) - '((-1 . t) (1 . nil) (nil . nil)))))) + (when (and need-user-cmp org-agenda-cmp-user-defined + (functionp org-agenda-cmp-user-defined)) + (setq user-defined-up + (funcall org-agenda-cmp-user-defined a b) + user-defined-down (if user-defined-up (- user-defined-up) nil))) + (cdr (assoc + (eval (cons 'or org-agenda-sorting-strategy-selected) t) + '((-1 . t) (1 . nil) (nil . nil))))))) ;;; Agenda restriction lock @@ -7300,7 +7396,7 @@ 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 +in the file. Otherwise, only apply the restriction to the current subtree." (interactive "P") (if (and org-agenda-overriding-restriction @@ -7467,7 +7563,7 @@ This is used when toggling sticky agendas." (dolist (buf (buffer-list)) (when (with-current-buffer buf (eq major-mode 'org-agenda-mode)) (push buf blist))) - (mapc 'kill-buffer blist))) + (mapc #'kill-buffer blist))) (defun org-agenda-execute (arg) "Execute another agenda command, keeping same window. @@ -7480,6 +7576,7 @@ in the agenda." (defun org-agenda-redo (&optional all) "Rebuild possibly ALL agenda view(s) in the current buffer." (interactive "P") + (defvar org-agenda-tag-filter-while-redo) ;FIXME: Where is this var used? (let* ((p (or (and (looking-at "\\'") (1- (point))) (point))) (cpa (unless (eq all t) current-prefix-arg)) (org-agenda-doing-sticky-redo org-agenda-sticky) @@ -7518,8 +7615,11 @@ in the agenda." (and cols (org-columns-quit)) (message "Rebuilding agenda buffer...") (if series-redo-cmd - (eval series-redo-cmd) - (org-let lprops redo-cmd)) + (eval series-redo-cmd t) + (cl-progv + (mapcar #'car lprops) + (mapcar (lambda (binding) (eval (cadr binding) t)) lprops) + (eval redo-cmd t))) (setq org-agenda-undo-list nil org-agenda-pending-undo-list nil org-agenda-tag-filter tag-filter @@ -7721,7 +7821,7 @@ A single `\\[universal-argument]' prefix arg STRIP-OR-ACCUMULATE will negate the entire filter, which can be useful in connection with the prompt history. A double `\\[universal-argument] \\[universal-argument]' prefix arg will add the new filter elements to the -existing ones. A shortcut for this is to add an additional `+' at the +existing ones. A shortcut for this is to add an additional `+' at the beginning of the string, like `+-John'. With a triple prefix argument, execute the computed filtering defined in @@ -7745,7 +7845,7 @@ the variable `org-agenda-auto-exclude-function'." (negate (equal strip-or-accumulate '(4))) (cf (mapconcat #'identity org-agenda-category-filter "")) (tf (mapconcat #'identity org-agenda-tag-filter "")) - (rpl-fn (lambda (c) (replace-regexp-in-string "^\\+" "" (or (car c) "")))) + ;; (rpl-fn (lambda (c) (replace-regexp-in-string "^\\+" "" (or (car c) "")))) (ef (replace-regexp-in-string "^\\+" "" (or (car org-agenda-effort-filter) ""))) (rf (replace-regexp-in-string "^\\+" "" (or (car org-agenda-regexp-filter) ""))) (ff (concat cf tf ef (when (not (equal rf "")) (concat "/" rf "/")))) @@ -7753,7 +7853,7 @@ the variable `org-agenda-auto-exclude-function'." (concat (if negate "Negative filter" "Filter") " [+cat-tag<0:10-/regexp/]: ") - 'org-agenda-filter-completion-function + #'org-agenda-filter-completion-function nil nil ff)) (keep (or (if (string-match "^\\+[+-]" f-string) (progn (setq f-string (substring f-string 1)) t)) @@ -7779,20 +7879,20 @@ the variable `org-agenda-auto-exclude-function'." "~~~" "-" (match-string 3 f-string))) (cond ((member s tag-list) - (add-to-list 'ft (concat pm s) 'append 'equal)) + (org-pushnew-to-end (concat pm s) ft)) ((member s category-list) - (add-to-list 'fc (concat pm ; Remove temporary double quotes. - (replace-regexp-in-string "\"\\(.*\\)\"" "\\1" s)) - 'append 'equal)) + (org-pushnew-to-end (concat pm ; Remove temporary double quotes. + (replace-regexp-in-string "\"\\(.*\\)\"" "\\1" s)) + fc)) (t (message "`%s%s' filter ignored because tag/category is not represented" pm s)))) ((match-beginning 4) ;; effort - (add-to-list 'fe (concat pm (match-string 4 f-string)) t 'equal)) + (org-pushnew-to-end (concat pm (match-string 4 f-string)) fe)) ((match-beginning 5) ;; regexp - (add-to-list 'fr (concat pm (match-string 6 f-string)) t 'equal))) + (org-pushnew-to-end (concat pm (match-string 6 f-string)) fr))) (setq f-string (substring f-string (match-end 0)))) (org-agenda-filter-remove-all) (and fc (org-agenda-filter-apply @@ -7872,7 +7972,7 @@ With a `\\[universal-argument] \\[universal-argument] \\[universal-argument]' pr i.e. don't filter on all its group members. -A lisp caller can specify CHAR. EXCLUDE means that the new tag +A Lisp caller can specify CHAR. EXCLUDE means that the new tag should be used to exclude the search - the interactive user can also press `-' or `+' to switch between filtering and excluding." (interactive "P") @@ -7894,7 +7994,7 @@ also press `-' or `+' to switch between filtering and excluding." (expand (not (equal strip-or-accumulate '(64)))) (inhibit-read-only t) (current org-agenda-tag-filter) - a n tag) + a tag) ;; n (unless char (while (not (memq char valid-char-list)) (org-unlogged-message @@ -7975,19 +8075,20 @@ These will be lower-case, for filtering." (if tt (push tt tags-lists))) (setq tags-lists (nreverse (org-uniquify - (delq nil (apply 'append tags-lists))))) + (delq nil (apply #'append tags-lists))))) (dolist (tag tags-lists) (mapc (lambda (group) - (when (member tag (mapcar #'downcase group)) - (push (downcase (car group)) tags-lists))) + (when (member tag group) + (push (car group) tags-lists))) org-tag-groups-alist-for-agenda)) (setq org-agenda-represented-tags tags-lists))))) (defun org-agenda-filter-make-matcher (filter type &optional expand) - "Create the form that tests a line for agenda filter. Optional -argument EXPAND can be used for the TYPE tag and will expand the -tags in the FILTER if any of the tags in FILTER are grouptags." + "Create the form that tests a line for agenda filter. +Optional argument EXPAND can be used for the TYPE tag and will +expand the tags in the FILTER if any of the tags in FILTER are +grouptags." (let ((multi-pos-cats (and (eq type 'category) (string-match-p "\\+.*\\+" @@ -8054,7 +8155,7 @@ function to set the right switches in the returned form." ((and (string-match-p "\\`{" tag) (string-match-p "}\\'" tag)) ;; TAG is a regexp. (list 'org-match-any-p (substring tag 1 -1) 'tags)) - (t (list 'member (downcase tag) 'tags))))) + (t (list 'member tag 'tags))))) (push (if (eq op ?-) (list 'not f) f) form))))) (defun org-agenda-filter-effort-form (e) @@ -8085,7 +8186,7 @@ If the line does not have an effort defined, return nil." When NO-OPERATOR is non-nil, do not add the + operator to returned tags." (if org-group-tags - (let ((case-fold-search t) rtn) + (let (case-fold-search rtn) (mapc (lambda (f) (let (f0 dir) @@ -8093,7 +8194,7 @@ returned tags." (setq dir (match-string 1 f) f0 (match-string 2 f)) (setq dir (if no-operator "" "+") f0 f)) (setq rtn (append (mapcar (lambda(f1) (concat dir f1)) - (org-tags-expand f0 t t)) + (org-tags-expand f0 t)) rtn)))) filter) (reverse rtn)) @@ -8119,10 +8220,11 @@ grouptags." (while (not (eobp)) (when (or (org-get-at-bol 'org-hd-marker) (org-get-at-bol 'org-marker)) - (let ((tags (org-get-at-bol 'tags)) - (cat (org-agenda-get-category)) - (txt (or (org-get-at-bol 'txt) ""))) - (unless (eval org-agenda-filter-form) + (org-dlet + ((tags (org-get-at-bol 'tags)) + (cat (org-agenda-get-category)) + (txt (or (org-get-at-bol 'txt) ""))) + (unless (eval org-agenda-filter-form t) (org-agenda-filter-hide-line type)))) (beginning-of-line 2))) (when (get-char-property (point) 'invisible) @@ -8232,13 +8334,13 @@ Negative selection means regexp must not match for selection of an entry." (defun org-add-to-string (var string) (set var (concat (symbol-value var) string))) -(defun org-agenda-goto-date (span) +(defun org-agenda-goto-date (date) "Jump to DATE in agenda." - (interactive "P") - (let* ((org-read-date-prefer-future - (eval org-agenda-jump-prefer-future)) - (date (org-read-date)) - (day (time-to-days (org-time-string-to-time date))) + (interactive + (list + (let ((org-read-date-prefer-future org-agenda-jump-prefer-future)) + (org-read-date)))) + (let* ((day (time-to-days (org-time-string-to-time date))) (org-agenda-sticky-orig org-agenda-sticky) (org-agenda-buffer-tmp-name (buffer-name)) (args (get-text-property (min (1- (point-max)) (point)) 'org-last-args)) @@ -8305,12 +8407,12 @@ When optional argument BACKWARD is set, go backward." "Cannot execute this command outside of org-agenda-mode buffers")) ((looking-at (if backward "\\`" "\\'")) (message "Already at the %s block" (if backward "first" "last"))) - (t (let ((pos (prog1 (point) - (ignore-errors (if backward (backward-char 1) - (move-end-of-line 1))))) + (t (let ((_pos (prog1 (point) + (ignore-errors (if backward (backward-char 1) + (move-end-of-line 1))))) (f (if backward - 'previous-single-property-change - 'next-single-property-change)) + #'previous-single-property-change + #'next-single-property-change)) moved dest) (while (and (setq dest (funcall f (point) 'org-agenda-structural-header)) @@ -8328,7 +8430,8 @@ When optional argument BACKWARD is set, go backward." With prefix ARG, go forward that many times the current span." (interactive "p") (org-agenda-check-type t 'agenda) - (let* ((args (get-text-property (min (1- (point-max)) (point)) 'org-last-args)) + (let* ((wstart (window-start)) + (args (get-text-property (min (1- (point-max)) (point)) 'org-last-args)) (span (or (nth 2 args) org-agenda-current-span)) (sd (or (nth 1 args) (org-get-at-bol 'day) org-starting-day)) (greg (calendar-gregorian-from-absolute sd)) @@ -8361,7 +8464,8 @@ With prefix ARG, go forward that many times the current span." (org-agenda-overriding-arguments (list (car args) sd span))) (org-agenda-redo) - (org-agenda-find-same-or-today-or-agenda cnt)))) + (org-agenda-find-same-or-today-or-agenda cnt)) + (set-window-start nil wstart))) (defun org-agenda-earlier (arg) "Go backward in time by the current span. @@ -8481,7 +8585,7 @@ SPAN may be `day', `week', `fortnight', `month', `year'. The return value is a cons cell with the starting date and the number of days, so that the date SD will be in that range." (let* ((greg (calendar-gregorian-from-absolute sd)) - (dg (nth 1 greg)) + ;; (dg (nth 1 greg)) (mg (car greg)) (yg (nth 2 greg))) (cond @@ -8553,7 +8657,7 @@ so that the date SD will be in that range." (defun org-unhighlight-once () "Remove the highlight from its position, and this function from the hook." - (remove-hook 'pre-command-hook 'org-unhighlight-once) + (remove-hook 'pre-command-hook #'org-unhighlight-once) (org-unhighlight)) (defvar org-agenda-pre-follow-window-conf nil) @@ -8690,7 +8794,8 @@ When called with a prefix argument, include all archive files as well." (if org-agenda-include-deadlines " Ddl" "") (if org-agenda-use-time-grid " Grid" "") (if (and (boundp 'org-habit-show-habits) - org-habit-show-habits) " Habit" "") + org-habit-show-habits) + " Habit" "") (cond ((consp org-agenda-show-log) " LogAll") ((eq org-agenda-show-log 'clockcheck) " ClkCk") @@ -8702,36 +8807,39 @@ When called with a prefix argument, include all archive files as well." '(:eval (propertize (concat "[" (mapconcat - 'identity + #'identity (append (get 'org-agenda-category-filter :preset-filter) org-agenda-category-filter) "") "]") 'face 'org-agenda-filter-category - 'help-echo "Category used in filtering")) "") + 'help-echo "Category used in filtering")) + "") (if (or org-agenda-tag-filter (get 'org-agenda-tag-filter :preset-filter)) '(:eval (propertize (concat (mapconcat - 'identity + #'identity (append (get 'org-agenda-tag-filter :preset-filter) org-agenda-tag-filter) "")) 'face 'org-agenda-filter-tags - 'help-echo "Tags used in filtering")) "") + 'help-echo "Tags used in filtering")) + "") (if (or org-agenda-effort-filter (get 'org-agenda-effort-filter :preset-filter)) '(:eval (propertize (concat (mapconcat - 'identity + #'identity (append (get 'org-agenda-effort-filter :preset-filter) org-agenda-effort-filter) "")) 'face 'org-agenda-filter-effort - 'help-echo "Effort conditions used in filtering")) "") + 'help-echo "Effort conditions used in filtering")) + "") (if (or org-agenda-regexp-filter (get 'org-agenda-regexp-filter :preset-filter)) '(:eval (propertize @@ -8742,7 +8850,8 @@ When called with a prefix argument, include all archive files as well." org-agenda-regexp-filter) "")) 'face 'org-agenda-filter-regexp - 'help-echo "Regexp used in filtering")) "") + 'help-echo "Regexp used in filtering")) + "") (if org-agenda-archives-mode (if (eq org-agenda-archives-mode t) " Archives" @@ -8773,7 +8882,7 @@ When called with a prefix argument, include all archive files as well." "Move cursor to next agenda item." (interactive "p") (let ((col (current-column))) - (dotimes (c n) + (dotimes (_ n) (when (next-single-property-change (point-at-eol) 'org-marker) (move-end-of-line 1) (goto-char (next-single-property-change (point) 'org-marker)))) @@ -8783,7 +8892,7 @@ When called with a prefix argument, include all archive files as well." (defun org-agenda-previous-item (n) "Move cursor to next agenda item." (interactive "p") - (dotimes (c n) + (dotimes (_ n) (let ((col (current-column)) (goto (save-excursion (move-end-of-line 0) @@ -8809,7 +8918,7 @@ When called with a prefix argument, include all archive files as well." (let* ((tags (org-get-at-bol 'tags))) (if tags (message "Tags are :%s:" - (org-no-properties (mapconcat 'identity tags ":"))) + (org-no-properties (mapconcat #'identity tags ":"))) (message "No tags associated with this line")))) (defun org-agenda-goto (&optional highlight) @@ -8950,6 +9059,8 @@ Pass ARG, FORCE-ARG, DELETE and BODY to `org-agenda-do-in-region'." (funcall-interactively #'org-agenda-archive-with 'org-archive-to-archive-sibling)) +(defvar org-archive-from-agenda) + (defun org-agenda-archive-with (cmd &optional confirm) "Move the entry to the archive sibling." (interactive) @@ -9026,7 +9137,7 @@ When NO-UPDATE is non-nil, don't redo the agenda buffer." (marker (or (org-get-at-bol 'org-hd-marker) (org-agenda-error))) (buffer (marker-buffer marker)) - (pos (marker-position marker)) + ;; (pos (marker-position marker)) (rfloc (or rfloc (org-refile-get-location (if goto "Goto" "Refile to") buffer @@ -9312,6 +9423,8 @@ by a remote command from the agenda.") (interactive) (org-agenda-todo 'previousset)) +(defvar org-agenda-headline-snapshot-before-repeat) + (defun org-agenda-todo (&optional arg) "Cycle TODO state of line at point, also in Org file. This changes the line at point, all other lines in the agenda referring to @@ -9336,11 +9449,14 @@ the same tree node, and the headline of the tree node in the Org file." (goto-char pos) (org-show-context 'agenda) (let ((current-prefix-arg arg)) - (call-interactively 'org-todo)) + (call-interactively 'org-todo) + ;; Make sure that log is recorded in current undo. + (when (and org-log-setup + (not (eq org-log-note-how 'note))) + (org-add-log-note))) (and (bolp) (forward-char 1)) (setq newhead (org-get-heading)) - (when (and (bound-and-true-p - org-agenda-headline-snapshot-before-repeat) + (when (and org-agenda-headline-snapshot-before-repeat (not (equal org-agenda-headline-snapshot-before-repeat newhead)) todayp) @@ -9359,15 +9475,15 @@ the same tree node, and the headline of the tree node in the Org file." (org-move-to-column col) (org-agenda-mark-clocking-task))))) -(defun org-agenda-add-note (&optional arg) +(defun org-agenda-add-note (&optional _arg) "Add a time-stamped note to the entry at point." - (interactive "P") + (interactive) ;; "P" (org-agenda-check-no-diary) (let* ((marker (or (org-get-at-bol 'org-marker) (org-agenda-error))) (buffer (marker-buffer marker)) (pos (marker-position marker)) - (hdmarker (org-get-at-bol 'org-hd-marker)) + (_hdmarker (org-get-at-bol 'org-hd-marker)) (inhibit-read-only t)) (with-current-buffer buffer (widen) @@ -9390,7 +9506,7 @@ If FORCE-TAGS is non-nil, the car of it returns the new tags." (org-agenda-buffer (current-buffer)) (thetags (with-current-buffer (marker-buffer hdmarker) (org-get-tags hdmarker))) - props m pl undone-face done-face finish new dotime level cat tags) + props m undone-face done-face finish new dotime level cat tags) ;; pl (save-excursion (goto-char (point-max)) (beginning-of-line 1) @@ -9412,7 +9528,7 @@ If FORCE-TAGS is non-nil, the car of it returns the new tags." (with-current-buffer (marker-buffer hdmarker) (org-with-wide-buffer (org-agenda-format-item extra newhead level cat tags dotime)))) - pl (text-property-any (point-at-bol) (point-at-eol) 'org-heading t) + ;; pl (text-property-any (point-at-bol) (point-at-eol) 'org-heading t) undone-face (org-get-at-bol 'undone-face) done-face (org-get-at-bol 'done-face)) (beginning-of-line 1) @@ -9491,33 +9607,35 @@ current line." (defun org-agenda-priority (&optional force-direction) "Set the priority of line at point, also in Org file. -This changes the line at point, all other lines in the agenda referring to -the same tree node, and the headline of the tree node in the Org file. -Called with a universal prefix arg, show the priority instead of setting it." +This changes the line at point, all other lines in the agenda +referring to the same tree node, and the headline of the tree +node in the Org file. + +Called with one universal prefix arg, show the priority instead +of setting it. + +When called programmatically, FORCE-DIRECTION can be `set', `up', +`down', or a character." (interactive "P") - (if (equal force-direction '(4)) - (org-priority-show) - (unless org-priority-enable-commands - (user-error "Priority commands are disabled")) - (org-agenda-check-no-diary) - (let* ((col (current-column)) - (marker (or (org-get-at-bol 'org-marker) - (org-agenda-error))) - (hdmarker (org-get-at-bol 'org-hd-marker)) - (buffer (marker-buffer hdmarker)) - (pos (marker-position hdmarker)) - (inhibit-read-only t) - newhead) - (org-with-remote-undo buffer - (with-current-buffer buffer - (widen) - (goto-char pos) - (org-show-context 'agenda) - (org-priority force-direction) - (end-of-line 1) - (setq newhead (org-get-heading))) - (org-agenda-change-all-lines newhead hdmarker) - (org-move-to-column col))))) + (unless org-priority-enable-commands + (user-error "Priority commands are disabled")) + (org-agenda-check-no-diary) + (let* ((col (current-column)) + (hdmarker (org-get-at-bol 'org-hd-marker)) + (buffer (marker-buffer hdmarker)) + (pos (marker-position hdmarker)) + (inhibit-read-only t) + newhead) + (org-with-remote-undo buffer + (with-current-buffer buffer + (widen) + (goto-char pos) + (org-show-context 'agenda) + (org-priority force-direction) + (end-of-line 1) + (setq newhead (org-get-heading))) + (org-agenda-change-all-lines newhead hdmarker) + (org-move-to-column col)))) ;; FIXME: should fix the tags property of the agenda line. (defun org-agenda-set-tags (&optional tag onoff) @@ -9556,7 +9674,7 @@ Called with a universal prefix arg, show the priority instead of setting it." (buffer (marker-buffer hdmarker)) (pos (marker-position hdmarker)) (inhibit-read-only t) - newhead) + ) ;; newhead (org-with-remote-undo buffer (with-current-buffer buffer (widen) @@ -9717,7 +9835,12 @@ Called with a universal prefix arg, show the priority instead of setting it." (line-end-position) '(display nil)) (org-move-to-column - (- (/ (window-width nil t) (window-font-width)) (length stamp)) t) + (- (if (fboundp 'window-font-width) + (/ (window-width nil t) (window-font-width)) + ;; Fall back to pre-9.3.3 behavior on Emacs <25. + (window-width)) + (length stamp)) + t) (add-text-properties (1- (point)) (point-at-eol) (list 'display (org-add-props stamp nil @@ -9757,7 +9880,7 @@ ARG is passed through to `org-schedule'." #'org-agenda-schedule arg t nil (let* ((marker (or (org-get-at-bol 'org-marker) (org-agenda-error))) - (type (marker-insertion-type marker)) + ;; (type (marker-insertion-type marker)) (buffer (marker-buffer marker)) (pos (marker-position marker)) ts) @@ -9832,9 +9955,9 @@ ARG is passed through to `org-deadline'." (org-move-to-column col) (org-agenda-unmark-clocking-task))) -(defun org-agenda-clock-cancel (&optional arg) +(defun org-agenda-clock-cancel (&optional _arg) "Cancel the currently running clock." - (interactive "P") + (interactive) ;; "P" (unless (marker-buffer org-clock-marker) (user-error "No running clock")) (org-with-remote-undo (marker-buffer org-clock-marker) @@ -10078,7 +10201,7 @@ entries in that Org file." (unwind-protect (progn (fset 'calendar-cursor-to-date - (lambda (&optional error dummy) + (lambda (&optional _error _dummy) (calendar-gregorian-from-absolute (get-text-property point 'day)))) (call-interactively cmd)) @@ -10093,18 +10216,19 @@ entries in that Org file." (let* ((oldf (symbol-function 'calendar-cursor-to-date)) (point (point)) (date (calendar-gregorian-from-absolute - (get-text-property point 'day))) - ;; the following 2 vars are needed in the calendar - (displayed-month (car date)) + (get-text-property point 'day)))) + ;; the following 2 vars are needed in the calendar + (org-dlet + ((displayed-month (car date)) (displayed-year (nth 2 date))) - (unwind-protect - (progn - (fset 'calendar-cursor-to-date - (lambda (&optional error dummy) - (calendar-gregorian-from-absolute - (get-text-property point 'day)))) - (call-interactively cmd)) - (fset 'calendar-cursor-to-date oldf)))) + (unwind-protect + (progn + (fset 'calendar-cursor-to-date + (lambda (&optional _error _dummy) + (calendar-gregorian-from-absolute + (get-text-property point 'day)))) + (call-interactively cmd)) + (fset 'calendar-cursor-to-date oldf))))) (defun org-agenda-phases-of-moon () "Display the phases of the moon for the 3 months around the cursor date." @@ -10209,7 +10333,7 @@ When ARG is greater than one mark ARG lines." (setq arg (count-lines (region-beginning) (region-end))) (goto-char (region-beginning)) (deactivate-mark)) - (dotimes (i (or arg 1)) + (dotimes (_ (or arg 1)) (unless (org-get-at-bol 'org-agenda-diary-link) (let* ((m (org-get-at-bol 'org-hd-marker)) ov) @@ -10406,7 +10530,7 @@ The prefix arg is passed through to the command if possible." (find-buffer-visiting (nth 1 refile-location)) (error "This should not happen"))))) - (setq cmd `(lambda () (org-agenda-refile nil ',refile-location t))) + (setq cmd (lambda () (org-agenda-refile nil refile-location t))) (setq redo-at-end t))) (?t @@ -10414,10 +10538,10 @@ The prefix arg is passed through to the command if possible." "Todo state: " (with-current-buffer (marker-buffer (car entries)) (mapcar #'list org-todo-keywords-1))))) - (setq cmd `(lambda () - (let ((org-inhibit-blocking t) - (org-inhibit-logging 'note)) - (org-agenda-todo ,state)))))) + (setq cmd (lambda () + (let ((org-inhibit-blocking t) + (org-inhibit-logging 'note)) + (org-agenda-todo state)))))) ((and (or ?- ?+) action) (let ((tag (completing-read @@ -10427,9 +10551,9 @@ The prefix arg is passed through to the command if possible." (mapcar (lambda (x) (and (stringp (car x)) x)) org-current-tag-alist)))))) (setq cmd - `(lambda () - (org-agenda-set-tags ,tag - ,(if (eq action ?+) ''on ''off)))))) + (lambda () + (org-agenda-set-tags tag + (if (eq action ?+) 'on 'off)))))) ((and (or ?s ?d) c) (let* ((schedule? (eq c ?s)) @@ -10451,13 +10575,13 @@ The prefix arg is passed through to the command if possible." ;; depending on the number of marked items. (setq cmd (if schedule? - `(lambda () - (let ((org-log-reschedule - (and org-log-reschedule 'time))) - (org-agenda-schedule arg ,time))) - `(lambda () - (let ((org-log-redeadline (and org-log-redeadline 'time))) - (org-agenda-deadline arg ,time))))))) + (lambda () + (let ((org-log-reschedule + (and org-log-reschedule 'time))) + (org-agenda-schedule arg time))) + (lambda () + (let ((org-log-redeadline (and org-log-redeadline 'time))) + (org-agenda-deadline arg time))))))) (?S (unless (org-agenda-check-type nil 'agenda 'todo) @@ -10467,29 +10591,29 @@ The prefix arg is passed through to the command if possible." (if arg "week" "")) 7))) (setq cmd - `(lambda () - (let ((distance (1+ (random ,days)))) - (when arg - (let ((dist distance) - (day-of-week - (calendar-day-of-week - (calendar-gregorian-from-absolute (org-today))))) - (dotimes (i (1+ dist)) - (while (member day-of-week org-agenda-weekend-days) - (cl-incf distance) - (cl-incf day-of-week) - (when (= day-of-week 7) - (setq day-of-week 0))) - (cl-incf day-of-week) - (when (= day-of-week 7) - (setq day-of-week 0))))) - ;; Silently fail when try to replan a sexp entry. - (ignore-errors - (let* ((date (calendar-gregorian-from-absolute - (+ (org-today) distance))) - (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) - (nth 2 date)))) - (org-agenda-schedule nil time)))))))) + (lambda () + (let ((distance (1+ (random days)))) + (when arg + (let ((dist distance) + (day-of-week + (calendar-day-of-week + (calendar-gregorian-from-absolute (org-today))))) + (dotimes (_ (1+ dist)) + (while (member day-of-week org-agenda-weekend-days) + (cl-incf distance) + (cl-incf day-of-week) + (when (= day-of-week 7) + (setq day-of-week 0))) + (cl-incf day-of-week) + (when (= day-of-week 7) + (setq day-of-week 0))))) + ;; Silently fail when try to replan a sexp entry. + (ignore-errors + (let* ((date (calendar-gregorian-from-absolute + (+ (org-today) distance))) + (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) + (nth 2 date)))) + (org-agenda-schedule nil time)))))))) (?f (setq cmd @@ -10497,10 +10621,15 @@ The prefix arg is passed through to the command if possible." (completing-read "Function: " obarray #'fboundp t nil nil)))) (action - (pcase (assoc action org-agenda-bulk-custom-functions) - (`(,_ ,f) (setq cmd f) (setq redo-at-end t)) - (_ (user-error "Invalid bulk action: %c" action))))) - + (setq cmd + (pcase (assoc action org-agenda-bulk-custom-functions) + (`(,_ ,fn) + fn) + (`(,_ ,fn ,arg-fn) + (apply #'apply-partially fn (funcall arg-fn))) + (_ + (user-error "Invalid bulk action: %c" action)))) + (setq redo-at-end t))) ;; Sort the markers, to make sure that parents are handled ;; before children. (setq entries (sort entries @@ -10524,9 +10653,7 @@ The prefix arg is passed through to the command if possible." (let (org-loop-over-headlines-in-active-region) (funcall cmd)) ;; `post-command-hook' is not run yet. We make sure any ;; pending log note is processed. - (when (or (memq 'org-add-log-note (default-value 'post-command-hook)) - (memq 'org-add-log-note post-command-hook)) - (org-add-log-note)) + (when org-log-setup (org-add-log-note)) (cl-incf processed)))) (when redo-at-end (org-agenda-redo)) (unless org-agenda-persistent-marks (org-agenda-bulk-unmark-all)) @@ -10571,7 +10698,7 @@ When the optional argument `backward' is non-nil, move backward." (let ((inhibit-read-only t) lst line) (if (or (not (get-text-property (point) 'txt)) (save-excursion - (dotimes (n arg) + (dotimes (_ arg) (move-beginning-of-line (if backward 0 2)) (push (not (get-text-property (point) 'txt)) lst)) (delq nil lst))) @@ -10600,7 +10727,7 @@ tag and (if present) the flagging note." (interactive) (let ((hdmarker (org-get-at-bol 'org-hd-marker)) (win (selected-window)) - note heading newhead) + note) ;; heading newhead (unless hdmarker (user-error "No linked entry at point")) (if (and (eq this-command last-command) @@ -10628,11 +10755,11 @@ tag and note"))))) (defun org-agenda-remove-flag (marker) "Remove the FLAGGED tag and any flagging note in the entry." - (let (newhead) - (org-with-point-at marker - (org-toggle-tag "FLAGGED" 'off) - (org-entry-delete nil "THEFLAGGINGNOTE") - (setq newhead (org-get-heading))) + (let ((newhead + (org-with-point-at marker + (org-toggle-tag "FLAGGED" 'off) + (org-entry-delete nil "THEFLAGGINGNOTE") + (org-get-heading)))) (org-agenda-change-all-lines newhead marker) (message "Entry unflagged"))) @@ -10700,7 +10827,7 @@ to override `appt-message-warning-time'." (setq entries (delq nil (append entries - (apply 'org-agenda-get-day-entries + (apply #'org-agenda-get-day-entries file today scope))))) ;; Map through entries and find if we should filter them out (mapc diff --git a/lisp/org/org-archive.el b/lisp/org/org-archive.el index 73cd83ebf3..0943869a88 100644 --- a/lisp/org/org-archive.el +++ b/lisp/org/org-archive.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; diff --git a/lisp/org/org-attach-git.el b/lisp/org/org-attach-git.el index 2091cbc610..4c6bdc9023 100644 --- a/lisp/org/org-attach-git.el +++ b/lisp/org/org-attach-git.el @@ -24,7 +24,7 @@ ;;; Commentary: ;; An extension to org-attach. If `org-attach-id-dir' is initialized -;; as a Git repository, then org-attach-git will automatically commit +;; as a Git repository, then `org-attach-git' will automatically commit ;; changes when it sees them. Requires git-annex. ;;; Code: @@ -52,9 +52,25 @@ If \\='ask, prompt using `y-or-n-p'. If t, always get. If nil, never get." (const :tag "always get from annex if necessary" t) (const :tag "never get from annex" nil))) +(defcustom org-attach-git-dir 'default + "Attachment directory with the Git repository to use. +The default value is to use `org-attach-id-dir'. When set to +`individual-repository', then the directory attached to the +current node, if correctly initialized as a Git repository, will +be used instead." + :group 'org-attach + :package-version '(Org . "9.5") + :type '(choice + (const :tag "Default" default) + (const :tag "Individual repository" individual-repository))) + (defun org-attach-git-use-annex () "Return non-nil if git annex can be used." - (let ((git-dir (vc-git-root (expand-file-name org-attach-id-dir)))) + (let ((git-dir (vc-git-root + (cond ((eq org-attach-git-dir 'default) + (expand-file-name org-attach-id-dir)) + ((eq org-attach-git-dir 'individual-repository) + (org-attach-dir)))))) (and org-attach-git-annex-cutoff (or (file-exists-p (expand-file-name "annex" git-dir)) (file-exists-p (expand-file-name ".git/annex" git-dir)))))) @@ -62,7 +78,11 @@ If \\='ask, prompt using `y-or-n-p'. If t, always get. If nil, never get." (defun org-attach-git-annex-get-maybe (path) "Call git annex get PATH (via shell) if using git annex. Signals an error if the file content is not available and it was not retrieved." - (let* ((default-directory (expand-file-name org-attach-id-dir)) + (let* ((default-directory + (cond ((eq org-attach-git-dir 'default) + (expand-file-name org-attach-id-dir)) + ((eq org-attach-git-dir 'individual-repository) + (org-attach-dir)))) (path-relative (file-relative-name path))) (when (and (org-attach-git-use-annex) (not @@ -86,7 +106,10 @@ This checks for the existence of a \".git\" directory in that directory. Takes an unused optional argument for the sake of being compatible with hook `org-attach-after-change-hook'." - (let* ((dir (expand-file-name org-attach-id-dir)) + (let* ((dir (cond ((eq org-attach-git-dir 'default) + (expand-file-name org-attach-id-dir)) + ((eq org-attach-git-dir 'individual-repository) + (org-attach-dir)))) (git-dir (vc-git-root dir)) (use-annex (org-attach-git-use-annex)) (changes 0)) @@ -102,7 +125,7 @@ with hook `org-attach-after-change-hook'." org-attach-git-annex-cutoff)) (call-process "git" nil nil nil "annex" "add" new-or-modified) (call-process "git" nil nil nil "add" new-or-modified)) - (cl-incf changes)) + (cl-incf changes)) (dolist (deleted (split-string (shell-command-to-string "git ls-files -z --deleted") "\0" t)) diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el index 46decacca0..75db69c9cc 100644 --- a/lisp/org/org-attach.el +++ b/lisp/org/org-attach.el @@ -40,8 +40,11 @@ (require 'org-id) (declare-function dired-dwim-target-directory "dired-aux") +(declare-function dired-get-marked-files "dired" (&optional localp arg filter distinguish-one-marked error)) (declare-function org-element-property "org-element" (property element)) (declare-function org-element-type "org-element" (element)) +(declare-function org-inlinetask-goto-beginning "org-inlinetask" ()) +(declare-function org-inlinetask-in-task-p "org-inlinetask" ()) (defgroup org-attach nil "Options concerning attachments in Org mode." @@ -118,7 +121,7 @@ lns create a symbol link. Note that this is not supported (defcustom org-attach-use-inheritance 'selective "Attachment inheritance for the outline. -Enabling inheritance for org-attach implies two things. First, +Enabling inheritance for `org-attach' implies two things. First, that attachment links will look through all parent headings until it finds the linked attachment. Second, that running org-attach inside a node without attachments will make org-attach operate on @@ -243,6 +246,17 @@ Each entry in this list is a list of three elements: (function :tag "Command") (string :tag "Docstring")))) +(defcustom org-attach-sync-delete-empty-dir 'query + "Determine what to do with an empty attachment directory on sync. +When set to nil, don't touch the directory. When set to `query', +ask the user instead, else remove without asking." + :group 'org-attach + :package-version '(Org . "9.5") + :type '(choice + (const :tag "Never delete" nil) + (const :tag "Always delete" t) + (const :tag "Query the user" query))) + ;;;###autoload (defun org-attach () "The dispatcher for attachment commands. @@ -256,38 +270,45 @@ Shows a list of commands and prompts for another key to execute a command." (unless marker (error "No item in current line"))) (org-with-point-at marker - (org-back-to-heading-or-point-min t) + (if (and (featurep 'org-inlinetask) + (not (org-inlinetask-in-task-p))) + (org-with-limited-levels + (org-back-to-heading-or-point-min t)) + (if (and (featurep 'org-inlinetask) + (org-inlinetask-in-task-p)) + (org-inlinetask-goto-beginning) + (org-back-to-heading-or-point-min t))) (save-excursion (save-window-excursion (unless org-attach-expert (org-switch-to-buffer-other-window "*Org Attach*") (erase-buffer) (setq cursor-type nil - header-line-format "Use C-v, M-v, C-n or C-p to navigate.") + header-line-format "Use C-v, M-v, C-n or C-p to navigate.") (insert - (concat "Attachment folder:\n" - (or dir - "Can't find an existing attachment-folder") - (unless (and dir (file-directory-p dir)) - "\n(Not yet created)") - "\n\n" - (format "Select an Attachment Command:\n\n%s" - (mapconcat - (lambda (entry) - (pcase entry - (`((,key . ,_) ,_ ,docstring) - (format "%c %s" - key - (replace-regexp-in-string "\n\\([\t ]*\\)" - " " - docstring - nil nil 1))) - (_ - (user-error - "Invalid `org-attach-commands' item: %S" - entry)))) - org-attach-commands - "\n"))))) + (concat "Attachment folder:\n" + (or dir + "Can't find an existing attachment-folder") + (unless (and dir (file-directory-p dir)) + "\n(Not yet created)") + "\n\n" + (format "Select an Attachment Command:\n\n%s" + (mapconcat + (lambda (entry) + (pcase entry + (`((,key . ,_) ,_ ,docstring) + (format "%c %s" + key + (replace-regexp-in-string "\n\\([\t ]*\\)" + " " + docstring + nil nil 1))) + (_ + (user-error + "Invalid `org-attach-commands' item: %S" + entry)))) + org-attach-commands + "\n"))))) (org-fit-window-to-buffer (get-buffer-window "*Org Attach*")) (let ((msg (format "Select command: [%s]" (concat (mapcar #'caar org-attach-commands))))) @@ -365,7 +386,7 @@ If the attachment by some reason cannot be created an error will be raised." attach-dir)) (defun org-attach-dir-from-id (id &optional try-all) - "Returns a folder path based on `org-attach-id-dir' and ID. + "Return a folder path based on `org-attach-id-dir' and ID. If TRY-ALL is non-nil, try all id-to-path functions in `org-attach-id-to-path-function-list' and return the first path that exist in the filesystem, or the first one if none exist. @@ -426,7 +447,7 @@ Return the directory." new)) (defun org-attach-unset-directory () - "Removes DIR node property. + "Remove DIR node property. If attachment folder is changed due to removal of DIR-property ask to move attachments to new location and ask to delete old attachment-folder. @@ -591,14 +612,22 @@ with no prompts." (defun org-attach-sync () "Synchronize the current outline node with its attachments. -This can be used after files have been added externally." +Useful after files have been added/removed externally. Option +`org-attach-sync-delete-empty-dir' controls the behavior for +empty attachment directories." (interactive) (let ((attach-dir (org-attach-dir))) - (when attach-dir + (if (not attach-dir) + (org-attach-tag 'off) (run-hook-with-args 'org-attach-after-change-hook attach-dir) (let ((files (org-attach-file-list attach-dir))) - (org-attach-tag (not files)))) - (unless attach-dir (org-attach-tag t)))) + (org-attach-tag (not files))) + (when org-attach-sync-delete-empty-dir + (when (and (org-directory-empty-p attach-dir) + (if (eq 'query org-attach-sync-delete-empty-dir) + (yes-or-no-p "Attachment directory is empty. Delete?") + t)) + (delete-directory attach-dir)))))) (defun org-attach-file-list (dir) "Return a list of files in the attachment directory. diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el index 7ae8fae3aa..a9350c58d5 100644 --- a/lisp/org/org-capture.el +++ b/lisp/org/org-capture.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2010-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; @@ -69,6 +69,7 @@ (declare-function org-table-goto-line "org-table" (N)) (defvar dired-buffers) +(defvar crm-separator) (defvar org-end-time-was-given) (defvar org-keyword-properties) (defvar org-remember-default-headline) @@ -107,7 +108,7 @@ (defun org-capture-upgrade-templates (templates) "Update the template list to the new format. -TEMPLATES is a template list, as in `org-capture-templates'. The +TEMPLATES is a template list, as in `org-capture-templates'. The new format unifies all the date/week tree targets into one that also allows for an optional outline path to specify a target." (let ((modified-templates @@ -246,6 +247,10 @@ properties are: :jump-to-captured When set, jump to the captured entry when finished. + :refile-targets When exiting capture mode via `org-capture-refile', the + variable `org-refile-targets' will be temporarily bound + to the value of this property. + :empty-lines Set this to the number of lines that should be inserted before and after the new item. Default 0, only common other value is 1. @@ -301,13 +306,15 @@ be replaced with content and expanded: current template. %(sexp) Evaluate elisp `(sexp)' and replace it with the results. Only placeholders pre-existing within the template, or - introduced with %[pathname] are expanded this way. Since this - happens after expanding non-interactive %-escapes, those can - be used to fill the expression. - %<...> The result of format-time-string on the ... format specification. - %t Time stamp, date only. The time stamp is the current time, - except when called from agendas with `\\[org-agenda-capture]' or - with `org-capture-use-agenda-date' set. + introduced with %[pathname] are expanded this way. + Since this happens after expanding non-interactive + %-escapes, those can be used to fill the expression. + %<...> The result of `format-time-string' on the ... format + specification. + %t Time stamp, date only. The time stamp is the current + time, except when called from agendas with + `\\[org-agenda-capture]' or with + `org-capture-use-agenda-date' set. %T Time stamp as above, with date and time. %u, %U Like the above, but inactive time stamps. %i Initial content, copied from the active region. If @@ -317,12 +324,13 @@ be replaced with content and expanded: %a Annotation, normally the link created with `org-store-link'. %A Like %a, but prompt for the description part. %l Like %a, but only insert the literal link. + %L Like %l, but without brackets (the link content itself). %c Current kill ring head. %x Content of the X clipboard. %k Title of currently clocked task. %K Link to currently clocked task. %n User name (taken from the variable `user-full-name'). - %f File visited by current buffer when org-capture was called. + %f File visited by current buffer when `org-capture' was called. %F Full path of the file or directory visited by current buffer. %:keyword Specific information for certain link types, see below. %^g Prompt for tags, with completion on tags in target file. @@ -333,6 +341,8 @@ be replaced with content and expanded: %^C Interactive selection of which kill or clip to use. %^L Like %^C, but insert as link. %^{prop}p Prompt the user for a value for property `prop'. + A default value can be specified like this: + %^{prop|default}p. %^{prompt} Prompt the user for a string and replace this sequence with it. A default value and a completion table can be specified like this: %^{prompt|default|completion2|completion3|...}. @@ -363,7 +373,7 @@ calendar | %:type %:date When you need to insert a literal percent sign in the template, you can escape ambiguous cases with a backward slash, e.g., \\%i." :group 'org-capture - :version "24.1" + :package-version '(Org . "9.5") :set (lambda (s v) (set s (org-capture-upgrade-templates v))) :type (let ((file-variants '(choice :tag "Filename " @@ -371,78 +381,78 @@ you can escape ambiguous cases with a backward slash, e.g., \\%i." (function :tag "Function") (variable :tag "Variable") (sexp :tag "Form")))) - `(repeat - (choice :value ("" "" entry (file "~/org/notes.org") "") - (list :tag "Multikey description" - (string :tag "Keys ") - (string :tag "Description")) - (list :tag "Template entry" - (string :tag "Keys ") - (string :tag "Description ") - (choice :tag "Capture Type " :value entry - (const :tag "Org entry" entry) - (const :tag "Plain list item" item) - (const :tag "Checkbox item" checkitem) - (const :tag "Plain text" plain) - (const :tag "Table line" table-line)) - (choice :tag "Target location" - (list :tag "File" - (const :format "" file) - ,file-variants) - (list :tag "ID" - (const :format "" id) - (string :tag " ID")) - (list :tag "File & Headline" - (const :format "" file+headline) - ,file-variants - (string :tag " Headline")) - (list :tag "File & Outline path" - (const :format "" file+olp) - ,file-variants - (repeat :tag "Outline path" :inline t - (string :tag "Headline"))) - (list :tag "File & Regexp" - (const :format "" file+regexp) - ,file-variants - (regexp :tag " Regexp")) - (list :tag "File [ & Outline path ] & Date tree" - (const :format "" file+olp+datetree) - ,file-variants - (option (repeat :tag "Outline path" :inline t - (string :tag "Headline")))) - (list :tag "File & function" - (const :format "" file+function) - ,file-variants - (sexp :tag " Function")) - (list :tag "Current clocking task" - (const :format "" clock)) - (list :tag "Function" - (const :format "" function) - (sexp :tag " Function"))) - (choice :tag "Template " - (string) - (list :tag "File" - (const :format "" file) - (file :tag "Template file")) - (list :tag "Function" - (const :format "" function) - (function :tag "Template function"))) - (plist :inline t - ;; Give the most common options as checkboxes - :options (((const :format "%v " :prepend) (const t)) - ((const :format "%v " :immediate-finish) (const t)) - ((const :format "%v " :jump-to-captured) (const t)) - ((const :format "%v " :empty-lines) (const 1)) - ((const :format "%v " :empty-lines-before) (const 1)) - ((const :format "%v " :empty-lines-after) (const 1)) - ((const :format "%v " :clock-in) (const t)) - ((const :format "%v " :clock-keep) (const t)) - ((const :format "%v " :clock-resume) (const t)) - ((const :format "%v " :time-prompt) (const t)) - ((const :format "%v " :tree-type) (const week)) - ((const :format "%v " :unnarrowed) (const t)) - ((const :format "%v " :table-line-pos) (string)) - ((const :format "%v " :kill-buffer) (const t))))))))) + `(repeat + (choice :value ("" "" entry (file "~/org/notes.org") "") + (list :tag "Multikey description" + (string :tag "Keys ") + (string :tag "Description")) + (list :tag "Template entry" + (string :tag "Keys ") + (string :tag "Description ") + (choice :tag "Capture Type " :value entry + (const :tag "Org entry" entry) + (const :tag "Plain list item" item) + (const :tag "Checkbox item" checkitem) + (const :tag "Plain text" plain) + (const :tag "Table line" table-line)) + (choice :tag "Target location" + (list :tag "File" + (const :format "" file) + ,file-variants) + (list :tag "ID" + (const :format "" id) + (string :tag " ID")) + (list :tag "File & Headline" + (const :format "" file+headline) + ,file-variants + (string :tag " Headline")) + (list :tag "File & Outline path" + (const :format "" file+olp) + ,file-variants + (repeat :tag "Outline path" :inline t + (string :tag "Headline"))) + (list :tag "File & Regexp" + (const :format "" file+regexp) + ,file-variants + (regexp :tag " Regexp")) + (list :tag "File [ & Outline path ] & Date tree" + (const :format "" file+olp+datetree) + ,file-variants + (option (repeat :tag "Outline path" :inline t + (string :tag "Headline")))) + (list :tag "File & function" + (const :format "" file+function) + ,file-variants + (sexp :tag " Function")) + (list :tag "Current clocking task" + (const :format "" clock)) + (list :tag "Function" + (const :format "" function) + (sexp :tag " Function"))) + (choice :tag "Template " + (string) + (list :tag "File" + (const :format "" file) + (file :tag "Template file")) + (list :tag "Function" + (const :format "" function) + (function :tag "Template function"))) + (plist :inline t + ;; Give the most common options as checkboxes + :options (((const :format "%v " :prepend) (const t)) + ((const :format "%v " :immediate-finish) (const t)) + ((const :format "%v " :jump-to-captured) (const t)) + ((const :format "%v " :empty-lines) (const 1)) + ((const :format "%v " :empty-lines-before) (const 1)) + ((const :format "%v " :empty-lines-after) (const 1)) + ((const :format "%v " :clock-in) (const t)) + ((const :format "%v " :clock-keep) (const t)) + ((const :format "%v " :clock-resume) (const t)) + ((const :format "%v " :time-prompt) (const t)) + ((const :format "%v " :tree-type) (const week)) + ((const :format "%v " :unnarrowed) (const t)) + ((const :format "%v " :table-line-pos) (string)) + ((const :format "%v " :kill-buffer) (const t))))))))) (defcustom org-capture-before-finalize-hook nil "Hook that is run right before a capture process is finalized. @@ -467,8 +477,7 @@ The capture buffer is current and still narrowed." :type 'hook) (defcustom org-capture-bookmark t - "When non-nil, add a bookmark pointing at the last stored -position when capturing." + "When non-nil, add bookmark pointing at the last stored position when capturing." :group 'org-capture :version "24.3" :type 'boolean) @@ -488,19 +497,19 @@ is copied to this variable, which is local in the indirect buffer.") (defvar org-capture-clock-keep nil "Local variable to store the value of the :clock-keep parameter. -This is needed in case org-capture-finalize is called interactively.") +This is needed in case `org-capture-finalize' is called interactively.") -(defun org-capture-put (&rest stuff) - "Add properties to the capture property list `org-capture-plist'." - (while stuff +(defun org-capture-put (&rest elements) + "Add ELEMENTS to the capture property list `org-capture-plist'." + (while elements (setq org-capture-plist (plist-put org-capture-plist - (pop stuff) (pop stuff))))) -(defun org-capture-get (prop &optional local) - "Get properties from the capture property list `org-capture-plist'. + (pop elements) (pop elements))))) +(defun org-capture-get (property &optional local) + "Get PROPERTY from the capture property list `org-capture-plist'. When LOCAL is set, use the local variable `org-capture-current-plist', this is necessary after initialization of the capture process, to avoid conflicts with other active capture processes." - (plist-get (if local org-capture-current-plist org-capture-plist) prop)) + (plist-get (if local org-capture-current-plist org-capture-plist) property)) ;;; The minor mode @@ -579,17 +588,17 @@ to avoid duplicates.)" (string :tag " Capture key") (string :tag "Replace by template") (repeat :tag "Available when" - (choice - (cons :tag "Condition" - (choice - (const :tag "In file" in-file) - (const :tag "Not in file" not-in-file) - (const :tag "In buffer" in-buffer) - (const :tag "Not in buffer" not-in-buffer) - (const :tag "In mode" in-mode) - (const :tag "Not in mode" not-in-mode)) - (regexp)) - (function :tag "Custom function")))))) + (choice + (cons :tag "Condition" + (choice + (const :tag "In file" in-file) + (const :tag "Not in file" not-in-file) + (const :tag "In buffer" in-buffer) + (const :tag "Not in buffer" not-in-buffer) + (const :tag "In mode" in-mode) + (const :tag "Not in mode" not-in-mode)) + (regexp)) + (function :tag "Custom function")))))) (defcustom org-capture-use-agenda-date nil "Non-nil means use the date at point when capturing from agendas. @@ -882,7 +891,8 @@ for `entry'-type templates")) (pos (make-marker)) (org-capture-is-refiling t) (kill-buffer (org-capture-get :kill-buffer 'local)) - (jump-to-captured (org-capture-get :jump-to-captured 'local))) + (jump-to-captured (org-capture-get :jump-to-captured 'local)) + (refile-targets (org-capture-get :refile-targets 'local))) ;; Since `org-capture-finalize' may alter buffer contents (e.g., ;; empty lines) around entry, use a marker to refer to the ;; headline to be refiled. Place the marker in the base buffer, @@ -892,11 +902,12 @@ for `entry'-type templates")) ;; early. We want to wait for the refiling to be over, so we ;; control when the latter function is called. (org-capture-put :kill-buffer nil :jump-to-captured nil) - (org-capture-finalize) - (save-window-excursion - (with-current-buffer base - (org-with-point-at pos - (call-interactively 'org-refile)))) + (let ((org-refile-targets (or refile-targets org-refile-targets))) + (org-capture-finalize) + (save-window-excursion + (with-current-buffer base + (org-with-point-at pos + (call-interactively 'org-refile))))) (when kill-buffer (with-current-buffer base (save-buffer)) (kill-buffer base)) @@ -916,7 +927,7 @@ for `entry'-type templates")) (interactive) (org-goto-marker-or-bmk org-capture-last-stored-marker (plist-get org-bookmark-names-plist - :last-capture)) + :last-capture)) (message "This is the last note stored by a capture process")) ;;; Supporting functions for handling the process @@ -1025,28 +1036,23 @@ Store them in the capture property list." (time-to-days org-overriding-default-time)) ((or (org-capture-get :time-prompt) (equal current-prefix-arg 1)) - ;; Prompt for date. - (let ((prompt-time (org-read-date - nil t nil "Date for tree entry:"))) + ;; Prompt for date. Bind `org-end-time-was-given' so + ;; that `org-read-date-analyze' handles the time range + ;; case and returns `prompt-time' with the start value. + (let* ((org-time-was-given nil) + (org-end-time-was-given nil) + (prompt-time (org-read-date + nil t nil "Date for tree entry:"))) (org-capture-put :default-time - (cond ((and (or (not (boundp 'org-time-was-given)) - (not org-time-was-given)) - (not (= (time-to-days prompt-time) (org-today)))) - ;; Use 00:00 when no time is given for another - ;; date than today? - (apply #'encode-time 0 0 - org-extend-today-until - (cl-cdddr (decode-time prompt-time)))) - ((string-match "\\([^ ]+\\)-[^ ]+[ ]+\\(.*\\)" - org-read-date-final-answer) - ;; Replace any time range by its start. - (apply #'encode-time - (org-read-date-analyze - (replace-match "\\1 \\2" nil nil - org-read-date-final-answer) - prompt-time (decode-time prompt-time)))) - (t prompt-time))) + (if (or org-time-was-given + (= (time-to-days prompt-time) (org-today))) + prompt-time + ;; Use 00:00 when no time is given for another + ;; date than today? + (apply #'encode-time 0 0 + org-extend-today-until + (cl-cdddr (decode-time prompt-time))))) (time-to-days prompt-time))) (t ;; Current date, possibly corrected for late night @@ -1115,7 +1121,7 @@ FILE is a generalized file location, as handled by (defun org-capture-place-template (&optional inhibit-wconf-store) "Insert the template at the target location, and display the buffer. -When `inhibit-wconf-store', don't store the window configuration, as it +When INHIBIT-WCONF-STORE is non-nil, don't store the window configuration, as it may have been stored before." (unless inhibit-wconf-store (org-capture-put :return-to-wconf (current-window-configuration))) @@ -1410,21 +1416,21 @@ Of course, if exact position has been required, just put it there." (org-capture--position-cursor beg end))))) (defun org-capture-mark-kill-region (beg end) - "Mark the region that will have to be killed when aborting capture." + "Mark region between BEG and END to be killed on aborted capture." (let ((m1 (copy-marker beg)) (m2 (copy-marker end t))) (org-capture-put :begin-marker m1) (org-capture-put :end-marker m2))) -(defun org-capture-position-for-last-stored (where) - "Memorize the position that should later become the position of last capture." +(defun org-capture-position-for-last-stored (position) + "Put POSITION on `org-capture-plist' for future use as `last capture`." (cond - ((integerp where) + ((integerp position) (org-capture-put :position-for-last-stored - (move-marker (make-marker) where + (move-marker (make-marker) position (or (buffer-base-buffer (current-buffer)) (current-buffer))))) - ((eq where 'table-line) + ((eq position 'table-line) (org-capture-put :position-for-last-stored (list 'table-line (org-table-current-dline)))) @@ -1451,7 +1457,8 @@ Of course, if exact position has been required, just put it there." (move-marker org-capture-last-stored-marker (point)))))) (defun org-capture-narrow (beg end) - "Narrow, unless configuration says not to narrow." + "Possibly narrow to region between BEG and END. +If configuration contains non-nil :unnarrowed property, do not narrow." (unless (org-capture-get :unnarrowed) (narrow-to-region beg end))) @@ -1464,8 +1471,9 @@ of the template." (replace-match ""))) (defun org-capture-empty-lines-before (&optional n) - "Set the correct number of empty lines before the insertion point. -Point will be after the empty lines, so insertion can directly be done." + "Insert N empty lines before the insertion point. +Point will be after the empty lines, so insertion can directly be done. +If N is nil, :empty-lines-before or :empty-lines are considered." (setq n (or n (org-capture-get :empty-lines-before) (org-capture-get :empty-lines) 0)) (let ((pos (point))) @@ -1475,7 +1483,8 @@ Point will be after the empty lines, so insertion can directly be done." (defun org-capture-empty-lines-after (&optional n) "Set the correct number of empty lines after the inserted string. -Point will remain at the first line after the inserted text." +Point will remain at the first line after the inserted text. +If N is nil, :empty-lines-after or :empty-lines are considered." (setq n (or n (org-capture-get :empty-lines-after) (org-capture-get :empty-lines) 0)) (org-back-over-empty-lines) @@ -1487,7 +1496,7 @@ Point will remain at the first line after the inserted text." (defvar org-clock-marker) ; Defined in org.el (defun org-capture-set-plist (entry) - "Initialize the property list from the template definition." + "Initialize the property list for ENTRY from the template definition." (setq org-capture-plist (copy-sequence (nthcdr 5 entry))) (org-capture-put :key (car entry) :description (nth 1 entry) :target (nth 3 entry)) @@ -1504,7 +1513,7 @@ Point will remain at the first line after the inserted text." (defun org-capture-goto-target (&optional template-key) "Go to the target location of a capture template. -The user is queried for the template." +If TEMPLATE-KEY is nil, the user is queried for the template." (interactive) (let ((entry (org-capture-select-template template-key))) (unless entry (error "No capture template selected")) @@ -1514,7 +1523,7 @@ The user is queried for the template." (goto-char (org-capture-get :pos)))) (defun org-capture-get-indirect-buffer (&optional buffer prefix) - "Make an indirect buffer for a capture process. + "Make an indirect BUFFER for a capture process. Use PREFIX as a prefix for the name of the indirect buffer." (setq buffer (or buffer (current-buffer))) (let ((n 1) (base (buffer-name buffer)) bname) @@ -1556,8 +1565,10 @@ Lisp programs can force the template by setting KEYS to a string." "List various clipboards values.") (defun org-capture-fill-template (&optional template initial annotation) - "Fill a template and return the filled template as a string. -The template may still contain \"%?\" for cursor positioning." + "Fill a TEMPLATE and return the filled template as a string. +The template may still contain \"%?\" for cursor positioning. +INITIAL content and/or ANNOTATION may be specified, but will be overridden +by their respective `org-store-link-plist' properties if present." (let* ((template (or template (org-capture-get :template))) (buffer (org-capture-get :buffer)) (file (buffer-file-name (or (buffer-base-buffer buffer) buffer))) @@ -1595,6 +1606,9 @@ The template may still contain \"%?\" for cursor positioning." (v-l (if (and v-a (string-match l-re v-a)) (replace-match "[[\\1]]" nil nil v-a) v-a)) + (v-L (if (and v-a (string-match l-re v-a)) + (replace-match "\\1" nil nil v-a) + v-a)) (v-n user-full-name) (v-k (if (marker-buffer org-clock-marker) (org-no-properties org-clock-heading) @@ -1647,7 +1661,7 @@ The template may still contain \"%?\" for cursor positioning." ;; Mark %() embedded elisp for later evaluation. (org-capture-expand-embedded-elisp 'mark) ;; Expand non-interactive templates. - (let ((regexp "%\\(:[-A-Za-z]+\\|<\\([^>\n]+\\)>\\|[aAcfFikKlntTuUx]\\)")) + (let ((regexp "%\\(:[-A-Za-z]+\\|<\\([^>\n]+\\)>\\|[aAcfFikKlLntTuUx]\\)")) (save-excursion (while (re-search-forward regexp nil t) ;; `org-capture-escaped-%' may modify buffer and cripple @@ -1684,6 +1698,7 @@ The template may still contain \"%?\" for cursor positioning." (?k v-k) (?K v-K) (?l v-l) + (?L v-L) (?n v-n) (?t v-t) (?T v-T) @@ -1731,12 +1746,11 @@ The template may still contain \"%?\" for cursor positioning." (org-add-colon-after-tag-completion t) (ins (mapconcat #'identity - (org-split-string - (completing-read - (if prompt (concat prompt ": ") "Tags: ") - 'org-tags-completion-function nil nil nil - 'org-tags-history) - "[^[:alnum:]_@#%]+") + (let ((crm-separator "[ \t]*:[ \t]*")) + (completing-read-multiple + (if prompt (concat prompt ": ") "Tags: ") + org-last-tags-completion-table nil nil nil + 'org-tags-history)) ":"))) (when (org-string-nw-p ins) (unless (eq (char-before) ?:) (insert ":")) @@ -1785,7 +1799,8 @@ The template may still contain \"%?\" for cursor positioning." (setq l (org-up-heading-safe))) (if l (point-marker) (point-min-marker))))))) - (value (org-read-property-value prompt pom))) + (value + (org-read-property-value prompt pom default))) (org-set-property prompt value))) ((or "t" "T" "u" "U") ;; These are the date/time related ones. @@ -1840,7 +1855,7 @@ The template may still contain \"%?\" for cursor positioning." (defun org-capture-escaped-% () "Non-nil if % was escaped. -If yes, unescape it now. Assume match-data contains the +If yes, unescape it now. Assume `match-data' contains the placeholder to check." (save-excursion (goto-char (match-beginning 0)) diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 1283970bc2..143ed4f123 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; @@ -85,7 +85,7 @@ function `org-clock-into-drawer' instead." (string :tag "Into Drawer named..."))) (defun org-clock-into-drawer () - "Value of `org-clock-into-drawer'. but let properties overrule. + "Value of `org-clock-into-drawer', but let properties overrule. If the current entry has or inherits a CLOCK_INTO_DRAWER property, it will be used instead of the default value. @@ -438,12 +438,11 @@ specifications than `frame-title-format', which see." (defcustom org-clock-x11idle-program-name "x11idle" "Name of the program which prints X11 idle time in milliseconds. -You can find x11idle.c in the contrib/scripts directory of the -Org git distribution. Or, you can do: +you can do \"~$ sudo apt-get install xprintidle\" if you are using +a Debian-based distribution. - sudo apt-get install xprintidle - -if you are using Debian." +Alternatively, can find x11idle.c in the org-contrib repository at +https://git.sr.ht/~bzg/org-contrib" :group 'org-clock :version "24.4" :package-version '(Org . "8.0") @@ -485,6 +484,17 @@ is added to the user configuration." (integer :tag "Clock out after Emacs is idle for X seconds") (const :tag "Never auto clock out" nil))) +(defcustom org-clock-ask-before-exiting t + "If non-nil, ask if the user wants to clock out before exiting Emacs. +This variable only has effect if set with \\[customize]." + :set (lambda (symbol value) + (if value + (add-hook 'kill-emacs-query-functions #'org-clock-kill-emacs-query) + (remove-hook 'kill-emacs-query-functions #'org-clock-kill-emacs-query)) + (set symbol value)) + :type 'boolean + :package-version '(Org . "9.5")) + (defvar org-clock-in-prepare-hook nil "Hook run when preparing the clock. This hook is run before anything happens to the task that @@ -503,9 +513,9 @@ to add an effort property.") "Has the clock been used during the current Emacs session?") (defvar org-clock-stored-history nil - "Clock history, populated by `org-clock-load'") + "Clock history, populated by `org-clock-load'.") (defvar org-clock-stored-resume-clock nil - "Clock to resume, saved by `org-clock-load'") + "Clock to resume, saved by `org-clock-load'.") ;;; The clock for measuring work time. @@ -607,10 +617,6 @@ cannot be translated." ((stringp drawer) drawer) (t nil)))) -(defun org-clocking-buffer () - "Return the clocking buffer if we are currently clocking a task or nil." - (marker-buffer org-clock-marker)) - (defun org-clocking-p () "Return t when clocking a task." (not (equal (org-clocking-buffer) nil))) @@ -677,19 +683,19 @@ pointing to it." (let (cat task heading prefix) (with-current-buffer (org-base-buffer (marker-buffer marker)) (org-with-wide-buffer - (ignore-errors - (goto-char marker) - (setq cat (org-get-category) - heading (org-get-heading 'notags) - prefix (save-excursion - (org-back-to-heading t) - (looking-at org-outline-regexp) - (match-string 0)) - task (substring - (org-fontify-like-in-org-mode - (concat prefix heading) - org-odd-levels-only) - (length prefix)))))) + (ignore-errors + (goto-char marker) + (setq cat (org-get-category) + heading (org-get-heading 'notags) + prefix (save-excursion + (org-back-to-heading t) + (looking-at org-outline-regexp) + (match-string 0)) + task (substring + (org-fontify-like-in-org-mode + (concat prefix heading) + org-odd-levels-only) + (length prefix)))))) (when (and cat task) (insert (format "[%c] %-12s %s\n" i cat task)) (cons i marker))))) @@ -853,6 +859,10 @@ use libnotify if available, or fall back on a message." org-show-notification-timeout nil (lambda () (w32-notification-close id))))) + ((fboundp 'ns-do-applescript) + (ns-do-applescript + (format "display notification \"%s\" with title \"Org mode notification\"" + (replace-regexp-in-string "\"" "#" notification)))) ((fboundp 'notifications-notify) (notifications-notify :title "Org mode message" @@ -1162,13 +1172,12 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling (org-clock-resolve clock (or prompt-fn - (function - (lambda (clock) - (format - "Dangling clock started %d mins ago" - (floor (org-time-convert-to-integer - (org-time-since (cdr clock))) - 60))))) + (lambda (clock) + (format + "Dangling clock started %d mins ago" + (floor (org-time-convert-to-integer + (org-time-since (cdr clock))) + 60)))) (or last-valid (cdr clock))))))))))) @@ -1367,7 +1376,7 @@ the default behavior." (end-of-line 0) (org-in-item-p))) (beginning-of-line 1) - (indent-line-to (- (current-indentation) 2))) + (indent-line-to (max 0 (- (current-indentation) 2)))) (insert org-clock-string " ") (setq org-clock-effort (org-entry-get (point) org-effort-property)) (setq org-clock-total-time (org-clock-sum-current-item @@ -1671,17 +1680,13 @@ to, overriding the existing value of `org-clock-out-switch-to-state'." (insert " => " (format "%2d:%02d" h m)) (move-marker org-clock-marker nil) (move-marker org-clock-hd-marker nil) - ;; Possibly remove zero time clocks. However, do not add - ;; a note associated to the CLOCK line in this case. - (cond ((and org-clock-out-remove-zero-time-clocks - (= 0 h m)) - (setq remove t) - (delete-region (line-beginning-position) - (line-beginning-position 2))) - (org-log-note-clock-out - (org-add-log-setup - 'clock-out nil nil nil - (concat "# Task: " (org-get-heading t) "\n\n")))) + ;; Possibly remove zero time clocks. + (when (and org-clock-out-remove-zero-time-clocks + (= 0 h m)) + (setq remove t) + (delete-region (line-beginning-position) + (line-beginning-position 2))) + (org-clock-remove-empty-clock-drawer) (when org-clock-mode-line-timer (cancel-timer org-clock-mode-line-timer) (setq org-clock-mode-line-timer nil)) @@ -1712,11 +1717,14 @@ to, overriding the existing value of `org-clock-out-switch-to-state'." "Clock stopped at %s after %s => LINE REMOVED" "Clock stopped at %s after %s") te (org-duration-from-minutes (+ (* 60 h) m))) - (run-hooks 'org-clock-out-hook) - (unless (org-clocking-p) - (setq org-clock-current-task nil))))))) - -(add-hook 'org-clock-out-hook #'org-clock-remove-empty-clock-drawer) + (unless (org-clocking-p) + (setq org-clock-current-task nil)) + (run-hooks 'org-clock-out-hook) + ;; Add a note, but only if we didn't remove the clock line. + (when (and org-log-note-clock-out (not remove)) + (org-add-log-setup + 'clock-out nil nil nil + (concat "# Task: " (org-get-heading t) "\n\n")))))))) (defun org-clock-remove-empty-clock-drawer () "Remove empty clock drawers in current subtree." @@ -2696,7 +2704,18 @@ from the dynamic block definition." (format (concat "| %s %s | %s%s%s" (format org-clock-file-time-cell-format (org-clock--translate "File time" lang)) - " | *%s*|\n") + + ;; The file-time rollup value goes in the first time + ;; column (of which there is always at least one)... + " | *%s*|" + ;; ...and the remaining file time cols (if any) are blank. + (make-string (max 0 (1- time-columns)) ?|) + + ;; Optionally show the percentage contribution of "this" + ;; file time to the total time. + (if (eq formula '%) " %s |" "") + "\n") + (file-name-nondirectory file-name) (if level? "| " "") ;level column, maybe (if timestamp "| " "") ;timestamp column, maybe @@ -2704,7 +2723,12 @@ from the dynamic block definition." (if properties ;properties columns, maybe (make-string (length properties) ?|) "") - (org-duration-from-minutes file-time)))) ;time + (org-duration-from-minutes file-time) ;time + + (cond ((not (eq formula '%)) "") ;time percentage, maybe + ((or (not total-time) (= total-time 0)) "0.0") + (t + (format "%.1f" (* 100 (/ file-time (float total-time))))))))) ;; Get the list of node entries and iterate over it (when (> maxlevel 0) @@ -2732,13 +2756,13 @@ from the dynamic block definition." (if timestamp (concat ts "|") "") ;timestamp, maybe (if tags (concat (mapconcat #'identity tgs ", ") "|") "") ;tags, maybe (if properties ;properties columns, maybe - (concat (mapconcat (lambda (p) (or (cdr (assoc p props)) "")) - properties - "|") - "|") + (concat (mapconcat (lambda (p) (or (cdr (assoc p props)) "")) + properties + "|") + "|") "") (if indent ;indentation - (org-clocktable-indent-string level) + (org-clocktable-indent-string level) "") (format-field headline) ;; Empty fields for higher levels. @@ -2746,7 +2770,7 @@ from the dynamic block definition." (format-field (org-duration-from-minutes time)) (make-string (max 0 (- time-columns level)) ?|) (if (eq formula '%) - (format "%.1f |" (* 100 (/ time (float total-time)))) + (format "%.1f |" (* 100 (/ time (float total-time)))) "") "\n"))))))) (delete-char -1) @@ -3101,6 +3125,17 @@ The details of what will be saved are regulated by the variable (when (org-invisible-p) (org-show-context)))))) (_ nil))))) +(defun org-clock-kill-emacs-query () + "Query user when killing Emacs. +This function is added to `kill-emacs-query-functions'." + (let ((buf (org-clocking-buffer))) + (when (and buf (yes-or-no-p "Clock out and save? ")) + (with-current-buffer buf + (org-clock-out) + (save-buffer)))) + ;; Unconditionally return t for `kill-emacs-query-functions'. + t) + ;; Suggested bindings (org-defkey org-mode-map "\C-c\C-x\C-e" 'org-clock-modify-effort-estimate) diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el index 2f03906440..9794382d8a 100644 --- a/lisp/org/org-colview.el +++ b/lisp/org/org-colview.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; @@ -213,7 +213,7 @@ See `org-columns-summary-types' for details.") (lambda () (interactive) (org-columns-next-allowed-value nil i)))) -(easy-menu-define org-columns-menu org-columns-map "Org Column Menu" +(easy-menu-define org-columns-menu org-columns-map "Org Column Menu." '("Column" ["Edit property" org-columns-edit-value t] ["Next allowed value" org-columns-next-allowed-value t] @@ -836,12 +836,11 @@ Also sets `org-columns-top-level-marker' to the new position." (defun org-columns (&optional global columns-fmt-string) "Turn on column view on an Org mode file. -Column view applies to the whole buffer if point is before the -first headline. Otherwise, it applies to the first ancestor -setting \"COLUMNS\" property. If there is none, it defaults to -the current headline. With a `\\[universal-argument]' prefix \ -argument, turn on column -view for the whole buffer unconditionally. +Column view applies to the whole buffer if point is before the first +headline. Otherwise, it applies to the first ancestor setting +\"COLUMNS\" property. If there is none, it defaults to the current +headline. With a `\\[universal-argument]' prefix \ argument, GLOBAL, +turn on column view for the whole buffer unconditionally. When COLUMNS-FMT-STRING is non-nil, use it as the column format." (interactive "P") @@ -867,9 +866,8 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format." (let ((cache ;; Collect contents of columns ahead of time so as to ;; compute their maximum width. - (org-map-entries - (lambda () (cons (point) (org-columns--collect-values))) - nil nil (and org-columns-skip-archived-trees 'archive)))) + (org-scan-tags + (lambda () (cons (point) (org-columns--collect-values))) t org--matcher-tags-todo-only))) (when cache (org-columns--set-widths cache) (org-columns--display-here-title) @@ -879,7 +877,8 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format." (unless (local-variable-p 'org-colview-initial-truncate-line-value) (setq-local org-colview-initial-truncate-line-value truncate-lines)) - (setq truncate-lines t) + (if (not global-visual-line-mode) + (setq truncate-lines t)) (dolist (entry cache) (goto-char (car entry)) (org-columns--display-here (cdr entry))))))))) @@ -1165,7 +1164,11 @@ properties drawers." (last-level lmax) (property (car spec)) (printf (nth 4 spec)) - (operator (nth 3 spec)) + ;; Special properties cannot be collected nor summarized, as + ;; they have their own way to be computed. Therefore, ignore + ;; any operator attached to them. + (operator (and (not (member property org-special-properties)) + (nth 3 spec))) (collect (and operator (org-columns--collect operator))) (summarize (and operator (org-columns--summarize operator)))) (org-with-wide-buffer @@ -1269,7 +1272,7 @@ When PRINTF is non-nil, use it to format the result." "Summarize CHECK-BOXES with a check-box cookie." (format "[%d/%d]" (cl-count-if (lambda (b) (or (equal b "[X]") - (string-match-p "\\[\\([1-9]\\)/\\1\\]" b))) + (string-match-p "\\[\\([1-9]\\)/\\1\\]" b))) check-boxes) (length check-boxes))) @@ -1395,8 +1398,9 @@ other rows. Each row is a list of fields, as strings, or (org-get-tags)))) (push (cons (org-reduced-level (org-current-level)) (nreverse row)) table))))) - (or (and maxlevel (format "LEVEL<=%d" maxlevel)) - (and match match)) + (if match + (concat match (and maxlevel (format "+LEVEL<=%d" maxlevel))) + (and maxlevel (format "LEVEL<=%d" maxlevel))) (and local 'tree) 'archive 'comment) (org-columns-quit) @@ -1691,7 +1695,7 @@ This will add overlays to the date lines, to show the summary for each day." (delq nil (mapcar (lambda (e) (org-string-nw-p - (nth 1 (assoc spec e)))) + (nth 1 (assoc spec e)))) entries))) (final (if values (funcall summarize values printf) diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index 7f97ac9c2a..d230ee2b11 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; @@ -71,6 +71,16 @@ (defvar org-table-tab-recognizes-table.el) (defvar org-table1-hline-regexp) + +;;; Emacs < 28.1 compatibility + +(if (fboundp 'directory-empty-p) + (defalias 'org-directory-empty-p #'directory-empty-p) + (defun org-directory-empty-p (dir) + "Return t if DIR names an existing directory containing no other files." + (and (file-directory-p dir) + (null (directory-files dir nil directory-files-no-dot-files-regexp t))))) + ;;; Emacs < 27.1 compatibility @@ -119,6 +129,32 @@ extension beyond end of line was not controllable." (when (fboundp 'set-face-extend) (mapc (lambda (f) (set-face-extend f extend-p)) faces))) +(if (fboundp 'string-distance) + (defalias 'org-string-distance 'string-distance) + (defun org-string-distance (s1 s2) + "Return the edit (levenshtein) distance between strings S1 S2." + (let* ((l1 (length s1)) + (l2 (length s2)) + (dist (vconcat (mapcar (lambda (_) (make-vector (1+ l2) nil)) + (number-sequence 1 (1+ l1))))) + (in (lambda (i j) (aref (aref dist i) j)))) + (setf (aref (aref dist 0) 0) 0) + (dolist (j (number-sequence 1 l2)) + (setf (aref (aref dist 0) j) j)) + (dolist (i (number-sequence 1 l1)) + (setf (aref (aref dist i) 0) i) + (dolist (j (number-sequence 1 l2)) + (setf (aref (aref dist i) j) + (min + (1+ (funcall in (1- i) j)) + (1+ (funcall in i (1- j))) + (+ (if (equal (aref s1 (1- i)) (aref s2 (1- j))) 0 1) + (funcall in (1- i) (1- j))))))) + (funcall in l1 l2)))) + +(define-obsolete-function-alias 'org-babel-edit-distance 'org-string-distance + "9.5") + ;;; Emacs < 26.1 compatibility @@ -212,38 +248,38 @@ Case is significant." ;;; Obsolete aliases (remove them after the next major release). ;;;; XEmacs compatibility, now removed. -(define-obsolete-function-alias 'org-activate-mark 'activate-mark "Org 9.0") -(define-obsolete-function-alias 'org-add-hook 'add-hook "Org 9.0") -(define-obsolete-function-alias 'org-bound-and-true-p 'bound-and-true-p "Org 9.0") -(define-obsolete-function-alias 'org-decompose-region 'decompose-region "Org 9.0") -(define-obsolete-function-alias 'org-defvaralias 'defvaralias "Org 9.0") -(define-obsolete-function-alias 'org-detach-overlay 'delete-overlay "Org 9.0") -(define-obsolete-function-alias 'org-file-equal-p 'file-equal-p "Org 9.0") -(define-obsolete-function-alias 'org-float-time 'float-time "Org 9.0") -(define-obsolete-function-alias 'org-indent-line-to 'indent-line-to "Org 9.0") -(define-obsolete-function-alias 'org-indent-to-column 'indent-to-column "Org 9.0") -(define-obsolete-function-alias 'org-looking-at-p 'looking-at-p "Org 9.0") -(define-obsolete-function-alias 'org-looking-back 'looking-back "Org 9.0") -(define-obsolete-function-alias 'org-match-string-no-properties 'match-string-no-properties "Org 9.0") -(define-obsolete-function-alias 'org-propertize 'propertize "Org 9.0") -(define-obsolete-function-alias 'org-select-frame-set-input-focus 'select-frame-set-input-focus "Org 9.0") -(define-obsolete-function-alias 'org-file-remote-p 'file-remote-p "Org 9.2") +(define-obsolete-function-alias 'org-activate-mark 'activate-mark "9.0") +(define-obsolete-function-alias 'org-add-hook 'add-hook "9.0") +(define-obsolete-function-alias 'org-bound-and-true-p 'bound-and-true-p "9.0") +(define-obsolete-function-alias 'org-decompose-region 'decompose-region "9.0") +(define-obsolete-function-alias 'org-defvaralias 'defvaralias "9.0") +(define-obsolete-function-alias 'org-detach-overlay 'delete-overlay "9.0") +(define-obsolete-function-alias 'org-file-equal-p 'file-equal-p "9.0") +(define-obsolete-function-alias 'org-float-time 'float-time "9.0") +(define-obsolete-function-alias 'org-indent-line-to 'indent-line-to "9.0") +(define-obsolete-function-alias 'org-indent-to-column 'indent-to-column "9.0") +(define-obsolete-function-alias 'org-looking-at-p 'looking-at-p "9.0") +(define-obsolete-function-alias 'org-looking-back 'looking-back "9.0") +(define-obsolete-function-alias 'org-match-string-no-properties 'match-string-no-properties "9.0") +(define-obsolete-function-alias 'org-propertize 'propertize "9.0") +(define-obsolete-function-alias 'org-select-frame-set-input-focus 'select-frame-set-input-focus "9.0") +(define-obsolete-function-alias 'org-file-remote-p 'file-remote-p "9.2") (defmacro org-re (s) "Replace posix classes in regular expression S." (declare (debug (form)) - (obsolete "you can safely remove it." "Org 9.0")) + (obsolete "you can safely remove it." "9.0")) s) ;;;; Functions from cl-lib that Org used to have its own implementation of. -(define-obsolete-function-alias 'org-count 'cl-count "Org 9.0") -(define-obsolete-function-alias 'org-every 'cl-every "Org 9.0") -(define-obsolete-function-alias 'org-find-if 'cl-find-if "Org 9.0") -(define-obsolete-function-alias 'org-reduce 'cl-reduce "Org 9.0") -(define-obsolete-function-alias 'org-remove-if 'cl-remove-if "Org 9.0") -(define-obsolete-function-alias 'org-remove-if-not 'cl-remove-if-not "Org 9.0") -(define-obsolete-function-alias 'org-some 'cl-some "Org 9.0") -(define-obsolete-function-alias 'org-floor* 'cl-floor "Org 9.0") +(define-obsolete-function-alias 'org-count 'cl-count "9.0") +(define-obsolete-function-alias 'org-every 'cl-every "9.0") +(define-obsolete-function-alias 'org-find-if 'cl-find-if "9.0") +(define-obsolete-function-alias 'org-reduce 'cl-reduce "9.0") +(define-obsolete-function-alias 'org-remove-if 'cl-remove-if "9.0") +(define-obsolete-function-alias 'org-remove-if-not 'cl-remove-if-not "9.0") +(define-obsolete-function-alias 'org-some 'cl-some "9.0") +(define-obsolete-function-alias 'org-floor* 'cl-floor "9.0") (defun org-sublist (list start end) "Return a section of LIST, from START to END. @@ -251,89 +287,91 @@ Counting starts at 1." (cl-subseq list (1- start) end)) (make-obsolete 'org-sublist "use cl-subseq (note the 0-based counting)." - "Org 9.0") + "9.0") ;;;; Functions available since Emacs 24.3 -(define-obsolete-function-alias 'org-buffer-narrowed-p 'buffer-narrowed-p "Org 9.0") -(define-obsolete-function-alias 'org-called-interactively-p 'called-interactively-p "Org 9.0") -(define-obsolete-function-alias 'org-char-to-string 'char-to-string "Org 9.0") -(define-obsolete-function-alias 'org-delete-directory 'delete-directory "Org 9.0") -(define-obsolete-function-alias 'org-format-seconds 'format-seconds "Org 9.0") -(define-obsolete-function-alias 'org-link-escape-browser 'url-encode-url "Org 9.0") -(define-obsolete-function-alias 'org-no-warnings 'with-no-warnings "Org 9.0") -(define-obsolete-function-alias 'org-number-sequence 'number-sequence "Org 9.0") -(define-obsolete-function-alias 'org-pop-to-buffer-same-window 'pop-to-buffer-same-window "Org 9.0") -(define-obsolete-function-alias 'org-string-match-p 'string-match-p "Org 9.0") +(define-obsolete-function-alias 'org-buffer-narrowed-p 'buffer-narrowed-p "9.0") +(define-obsolete-function-alias 'org-called-interactively-p 'called-interactively-p "9.0") +(define-obsolete-function-alias 'org-char-to-string 'char-to-string "9.0") +(define-obsolete-function-alias 'org-delete-directory 'delete-directory "9.0") +(define-obsolete-function-alias 'org-format-seconds 'format-seconds "9.0") +(define-obsolete-function-alias 'org-link-escape-browser 'url-encode-url "9.0") +(define-obsolete-function-alias 'org-no-warnings 'with-no-warnings "9.0") +(define-obsolete-function-alias 'org-number-sequence 'number-sequence "9.0") +(define-obsolete-function-alias 'org-pop-to-buffer-same-window 'pop-to-buffer-same-window "9.0") +(define-obsolete-function-alias 'org-string-match-p 'string-match-p "9.0") ;;;; Functions and variables from previous releases now obsolete. (define-obsolete-function-alias 'org-element-remove-indentation - 'org-remove-indentation "Org 9.0") + 'org-remove-indentation "9.0") (define-obsolete-variable-alias 'org-latex-create-formula-image-program - 'org-preview-latex-default-process "Org 9.0") + 'org-preview-latex-default-process "9.0") (define-obsolete-variable-alias 'org-latex-preview-ltxpng-directory - 'org-preview-latex-image-directory "Org 9.0") -(define-obsolete-function-alias 'org-table-p 'org-at-table-p "Org 9.0") -(define-obsolete-function-alias 'org-on-heading-p 'org-at-heading-p "Org 9.0") -(define-obsolete-function-alias 'org-at-regexp-p 'org-in-regexp "Org 8.3") + 'org-preview-latex-image-directory "9.0") +(define-obsolete-function-alias 'org-table-p 'org-at-table-p "9.0") +(define-obsolete-function-alias 'org-on-heading-p 'org-at-heading-p "9.0") +(define-obsolete-function-alias 'org-at-regexp-p 'org-in-regexp "8.3") (define-obsolete-function-alias 'org-image-file-name-regexp - 'image-file-name-regexp "Org 9.0") + 'image-file-name-regexp "9.0") (define-obsolete-function-alias 'org-completing-read-no-i - 'completing-read "Org 9.0") + 'completing-read "9.0") (define-obsolete-function-alias 'org-icompleting-read - 'completing-read "Org 9.0") -(define-obsolete-function-alias 'org-iread-file-name 'read-file-name "Org 9.0") + 'completing-read "9.0") +(define-obsolete-function-alias 'org-iread-file-name 'read-file-name "9.0") (define-obsolete-function-alias 'org-days-to-time - 'org-time-stamp-to-now "Org 8.2") + 'org-time-stamp-to-now "8.2") (define-obsolete-variable-alias 'org-agenda-ignore-drawer-properties - 'org-agenda-ignore-properties "Org 9.0") + 'org-agenda-ignore-properties "9.0") (define-obsolete-function-alias 'org-preview-latex-fragment - 'org-toggle-latex-fragment "Org 8.3") + 'org-toggle-latex-fragment "8.3") (define-obsolete-function-alias 'org-export-get-genealogy - 'org-element-lineage "Org 9.0") + 'org-element-lineage "9.0") (define-obsolete-variable-alias 'org-latex-with-hyperref - 'org-latex-hyperref-template "Org 9.0") -(define-obsolete-variable-alias 'hfy-optimisations 'hfy-optimizations "Org 9.0") + 'org-latex-hyperref-template "9.0") +(define-obsolete-variable-alias 'hfy-optimisations 'hfy-optimizations "9.0") (define-obsolete-variable-alias 'org-export-htmlized-org-css-url - 'org-org-htmlized-css-url "Org 8.2") -(define-obsolete-function-alias 'org-list-parse-list 'org-list-to-lisp "Org 9.0") + 'org-org-htmlized-css-url "8.2") +(define-obsolete-function-alias 'org-list-parse-list 'org-list-to-lisp "9.0") (define-obsolete-function-alias 'org-agenda-todayp - 'org-agenda-today-p "Org 9.0") + 'org-agenda-today-p "9.0") (define-obsolete-function-alias 'org-babel-examplize-region - 'org-babel-examplify-region "Org 9.0") + 'org-babel-examplify-region "9.0") (define-obsolete-variable-alias 'org-babel-capitalize-example-region-markers - 'org-babel-uppercase-example-markers "Org 9.1") + 'org-babel-uppercase-example-markers "9.1") -(define-obsolete-function-alias 'org-babel-trim 'org-trim "Org 9.0") +(define-obsolete-function-alias 'org-babel-trim 'org-trim "9.0") (define-obsolete-variable-alias 'org-html-style 'org-html-head "24.4") (define-obsolete-function-alias 'org-insert-columns-dblock - 'org-columns-insert-dblock "Org 9.0") + 'org-columns-insert-dblock "9.0") (define-obsolete-variable-alias 'org-export-babel-evaluate - 'org-export-use-babel "Org 9.1") + 'org-export-use-babel "9.1") (define-obsolete-function-alias 'org-activate-bracket-links - 'org-activate-links "Org 9.0") -(define-obsolete-function-alias 'org-activate-plain-links 'ignore "Org 9.0") -(define-obsolete-function-alias 'org-activate-angle-links 'ignore "Org 9.0") -(define-obsolete-function-alias 'org-remove-double-quotes 'org-strip-quotes "Org 9.0") + 'org-activate-links "9.0") +(define-obsolete-function-alias 'org-activate-plain-links 'ignore "9.0") +(define-obsolete-function-alias 'org-activate-angle-links 'ignore "9.0") +(define-obsolete-function-alias 'org-remove-double-quotes 'org-strip-quotes "9.0") (define-obsolete-function-alias 'org-get-indentation - 'current-indentation "Org 9.2") -(define-obsolete-function-alias 'org-capture-member 'org-capture-get "Org 9.2") + 'current-indentation "9.2") +(define-obsolete-function-alias 'org-capture-member 'org-capture-get "9.2") (define-obsolete-function-alias 'org-remove-from-invisibility-spec - 'remove-from-invisibility-spec "Org 9.2") + 'remove-from-invisibility-spec "9.2") (define-obsolete-variable-alias 'org-effort-durations 'org-duration-units - "Org 9.2") + "9.2") (define-obsolete-function-alias 'org-toggle-latex-fragment 'org-latex-preview - "Org 9.3") + "9.3") (define-obsolete-function-alias 'org-remove-latex-fragment-image-overlays - 'org-clear-latex-preview "Org 9.3") + 'org-clear-latex-preview "9.3") (define-obsolete-variable-alias 'org-attach-directory - 'org-attach-id-dir "Org 9.3") -(make-obsolete 'org-attach-store-link "No longer used" "Org 9.4") -(make-obsolete 'org-attach-expand-link "No longer used" "Org 9.4") + 'org-attach-id-dir "9.3") +(make-obsolete 'org-attach-store-link "No longer used" "9.4") +(make-obsolete 'org-attach-expand-link "No longer used" "9.4") + +(define-obsolete-function-alias 'org-file-url-p 'org-url-p "9.5") (defun org-in-fixed-width-region-p () "Non-nil if point in a fixed-width region." @@ -341,7 +379,7 @@ Counting starts at 1." (eq 'fixed-width (org-element-type (org-element-at-point))))) (make-obsolete 'org-in-fixed-width-region-p "use `org-element' library" - "Org 9.0") + "9.0") (defun org-compatible-face (inherits specs) "Make a compatible face specification. @@ -352,7 +390,7 @@ is, use SPECS to define the face." (if (facep inherits) (list (list t :inherit inherits)) specs)) -(make-obsolete 'org-compatible-face "you can remove it." "Org 9.0") +(make-obsolete 'org-compatible-face "you can remove it." "9.0") (defun org-add-link-type (type &optional follow export) "Add a new TYPE link. @@ -383,7 +421,7 @@ See `org-link-parameters' for documentation on the other parameters." (org-link-set-parameters type :follow follow :export export) (message "Created %s link." type)) -(make-obsolete 'org-add-link-type "use `org-link-set-parameters' instead." "Org 9.0") +(make-obsolete 'org-add-link-type "use `org-link-set-parameters' instead." "9.0") ;;;; Functions unused in Org core. (defun org-table-recognize-table.el () @@ -407,12 +445,12 @@ See `org-link-parameters' for documentation on the other parameters." ;; Not used since commit 6d1e3082, Feb 2010. (make-obsolete 'org-table-recognize-table.el "please notify Org mailing list if you use this function." - "Org 9.0") + "9.0") (defmacro org-preserve-lc (&rest body) (declare (debug (body)) (obsolete "please notify Org mailing list if you use this function." - "Org 9.2")) + "9.2")) (org-with-gensyms (line col) `(let ((,line (org-current-line)) (,col (current-column))) @@ -424,12 +462,12 @@ See `org-link-parameters' for documentation on the other parameters." (defun org-version-check (version &rest _) "Non-nil if VERSION is lower (older) than `emacs-version'." (declare (obsolete "use `version<' or `fboundp' instead." - "Org 9.2")) + "9.2")) (version< version emacs-version)) (defun org-remove-angle-brackets (s) (org-unbracket-string "<" ">" s)) -(make-obsolete 'org-remove-angle-brackets 'org-unbracket-string "Org 9.0") +(make-obsolete 'org-remove-angle-brackets 'org-unbracket-string "9.0") (defcustom org-publish-sitemap-file-entry-format "%t" "Format string for site-map file entry. @@ -443,7 +481,7 @@ You could use brackets to delimit on what part the link will be. (make-obsolete-variable 'org-publish-sitemap-file-entry-format "set `:sitemap-format-entry' in `org-publish-project-alist' instead." - "Org 9.1") + "9.1") (defvar org-agenda-skip-regexp) (defun org-agenda-skip-entry-when-regexp-matches () @@ -452,7 +490,7 @@ If yes, it returns the end position of this entry, causing agenda commands to skip the entry but continuing the search in the subtree. This is a function that can be put into `org-agenda-skip-function' for the duration of a command." - (declare (obsolete "use `org-agenda-skip-if' instead." "Org 9.1")) + (declare (obsolete "use `org-agenda-skip-if' instead." "9.1")) (let ((end (save-excursion (org-end-of-subtree t))) skip) (save-excursion @@ -464,7 +502,7 @@ of a command." If yes, it returns the end position of this tree, causing agenda commands to skip this subtree. This is a function that can be put into `org-agenda-skip-function' for the duration of a command." - (declare (obsolete "use `org-agenda-skip-if' instead." "Org 9.1")) + (declare (obsolete "use `org-agenda-skip-if' instead." "9.1")) (let ((end (save-excursion (org-end-of-subtree t))) skip) (save-excursion @@ -478,7 +516,7 @@ causing agenda commands to skip the entry but continuing the search in the subtree. This is a function that can be put into `org-agenda-skip-function' for the duration of a command. An important use of this function is for the stuck project list." - (declare (obsolete "use `org-agenda-skip-if' instead." "Org 9.1")) + (declare (obsolete "use `org-agenda-skip-if' instead." "9.1")) (let ((end (save-excursion (org-end-of-subtree t))) (entry-end (save-excursion (outline-next-heading) (1- (point)))) skip) @@ -487,126 +525,126 @@ use of this function is for the stuck project list." (and skip entry-end))) (define-obsolete-function-alias 'org-minutes-to-clocksum-string - 'org-duration-from-minutes "Org 9.1") + 'org-duration-from-minutes "9.1") (define-obsolete-function-alias 'org-hh:mm-string-to-minutes - 'org-duration-to-minutes "Org 9.1") + 'org-duration-to-minutes "9.1") (define-obsolete-function-alias 'org-duration-string-to-minutes - 'org-duration-to-minutes "Org 9.1") + 'org-duration-to-minutes "9.1") (make-obsolete-variable 'org-time-clocksum-format - "set `org-duration-format' instead." "Org 9.1") + "set `org-duration-format' instead." "9.1") (make-obsolete-variable 'org-time-clocksum-use-fractional - "set `org-duration-format' instead." "Org 9.1") + "set `org-duration-format' instead." "9.1") (make-obsolete-variable 'org-time-clocksum-fractional-format - "set `org-duration-format' instead." "Org 9.1") + "set `org-duration-format' instead." "9.1") (make-obsolete-variable 'org-time-clocksum-use-effort-durations - "set `org-duration-units' instead." "Org 9.1") + "set `org-duration-units' instead." "9.1") (define-obsolete-function-alias 'org-babel-number-p - 'org-babel--string-to-number "Org 9.0") + 'org-babel--string-to-number "9.0") (define-obsolete-variable-alias 'org-usenet-links-prefer-google - 'org-gnus-prefer-web-links "Org 9.1") + 'org-gnus-prefer-web-links "9.1") (define-obsolete-variable-alias 'org-texinfo-def-table-markup - 'org-texinfo-table-default-markup "Org 9.1") + 'org-texinfo-table-default-markup "9.1") (define-obsolete-variable-alias 'org-agenda-overriding-columns-format - 'org-overriding-columns-format "Org 9.2.2") + 'org-overriding-columns-format "9.2.2") (define-obsolete-variable-alias 'org-doi-server-url - 'org-link-doi-server-url "Org 9.3") + 'org-link-doi-server-url "9.3") (define-obsolete-variable-alias 'org-email-link-description-format - 'org-link-email-description-format "Org 9.3") + 'org-link-email-description-format "9.3") (define-obsolete-variable-alias 'org-make-link-description-function - 'org-link-make-description-function "Org 9.3") + 'org-link-make-description-function "9.3") (define-obsolete-variable-alias 'org-from-is-user-regexp - 'org-link-from-user-regexp "Org 9.3") + 'org-link-from-user-regexp "9.3") (define-obsolete-variable-alias 'org-descriptive-links - 'org-link-descriptive "Org 9.3") + 'org-link-descriptive "9.3") (define-obsolete-variable-alias 'org-context-in-file-links - 'org-link-context-for-files "Org 9.3") + 'org-link-context-for-files "9.3") (define-obsolete-variable-alias 'org-keep-stored-link-after-insertion - 'org-link-keep-stored-after-insertion "Org 9.3") + 'org-link-keep-stored-after-insertion "9.3") (define-obsolete-variable-alias 'org-display-internal-link-with-indirect-buffer - 'org-link-use-indirect-buffer-for-internals "Org 9.3") + 'org-link-use-indirect-buffer-for-internals "9.3") (define-obsolete-variable-alias 'org-confirm-shell-link-function - 'org-link-shell-confirm-function "Org 9.3") + 'org-link-shell-confirm-function "9.3") (define-obsolete-variable-alias 'org-confirm-shell-link-not-regexp - 'org-link-shell-skip-confirm-regexp "Org 9.3") + 'org-link-shell-skip-confirm-regexp "9.3") (define-obsolete-variable-alias 'org-confirm-elisp-link-function - 'org-link-elisp-confirm-function "Org 9.3") + 'org-link-elisp-confirm-function "9.3") (define-obsolete-variable-alias 'org-confirm-elisp-link-not-regexp - 'org-link-elisp-skip-confirm-regexp "Org 9.3") + 'org-link-elisp-skip-confirm-regexp "9.3") (define-obsolete-function-alias 'org-file-complete-link - 'org-link-complete-file "Org 9.3") + 'org-link-complete-file "9.3") (define-obsolete-function-alias 'org-email-link-description - 'org-link-email-description "Org 9.3") + 'org-link-email-description "9.3") (define-obsolete-function-alias 'org-make-link-string - 'org-link-make-string "Org 9.3") + 'org-link-make-string "9.3") (define-obsolete-function-alias 'org-store-link-props - 'org-link-store-props "Org 9.3") + 'org-link-store-props "9.3") (define-obsolete-function-alias 'org-add-link-props - 'org-link-add-props "Org 9.3") + 'org-link-add-props "9.3") (define-obsolete-function-alias 'org-make-org-heading-search-string - 'org-link-heading-search-string "Org 9.3") + 'org-link-heading-search-string "9.3") (define-obsolete-function-alias 'org-make-link-regexps - 'org-link-make-regexps "Org 9.3") + 'org-link-make-regexps "9.3") (define-obsolete-function-alias 'org-property-global-value - 'org-property-global-or-keyword-value "Org 9.3") + 'org-property-global-or-keyword-value "9.3") -(make-obsolete-variable 'org-file-properties 'org-keyword-properties "Org 9.3") +(make-obsolete-variable 'org-file-properties 'org-keyword-properties "9.3") (define-obsolete-variable-alias 'org-angle-link-re - 'org-link-angle-re "Org 9.3") + 'org-link-angle-re "9.3") (define-obsolete-variable-alias 'org-plain-link-re - 'org-link-plain-re "Org 9.3") + 'org-link-plain-re "9.3") (define-obsolete-variable-alias 'org-bracket-link-regexp - 'org-link-bracket-re "Org 9.3") + 'org-link-bracket-re "9.3") (define-obsolete-variable-alias 'org-bracket-link-analytic-regexp - 'org-link-bracket-re "Org 9.3") + 'org-link-bracket-re "9.3") (define-obsolete-variable-alias 'org-any-link-re - 'org-link-any-re "Org 9.3") + 'org-link-any-re "9.3") (define-obsolete-function-alias 'org-open-link-from-string - 'org-link-open-from-string "Org 9.3") + 'org-link-open-from-string "9.3") (define-obsolete-function-alias 'org-add-angle-brackets - 'org-link-add-angle-brackets "Org 9.3") + 'org-link-add-angle-brackets "9.3") ;; The function was made obsolete by commit 65399674d5 of 2013-02-22. ;; This make-obsolete call was added 2016-09-01. (make-obsolete 'org-capture-import-remember-templates "use the `org-capture-templates' variable instead." - "Org 9.0") + "9.0") (defun org-show-block-all () "Unfold all blocks in the current buffer." @@ -615,34 +653,34 @@ use of this function is for the stuck project list." (make-obsolete 'org-show-block-all "use `org-show-all' instead." - "Org 9.2") + "9.2") -(define-obsolete-function-alias 'org-get-tags-at 'org-get-tags "Org 9.2") +(define-obsolete-function-alias 'org-get-tags-at 'org-get-tags "9.2") (defun org-get-local-tags () "Get a list of tags defined in the current headline." - (declare (obsolete "use `org-get-tags' instead." "Org 9.2")) + (declare (obsolete "use `org-get-tags' instead." "9.2")) (org-get-tags nil 'local)) (defun org-get-local-tags-at (&optional pos) "Get a list of tags defined in the current headline." - (declare (obsolete "use `org-get-tags' instead." "Org 9.2")) + (declare (obsolete "use `org-get-tags' instead." "9.2")) (org-get-tags pos 'local)) (defun org-get-tags-string () "Get the TAGS string in the current headline." - (declare (obsolete "use `org-make-tag-string' instead." "Org 9.2")) + (declare (obsolete "use `org-make-tag-string' instead." "9.2")) (org-make-tag-string (org-get-tags nil t))) -(define-obsolete-function-alias 'org-set-tags-to 'org-set-tags "Org 9.2") +(define-obsolete-function-alias 'org-set-tags-to 'org-set-tags "9.2") (defun org-align-all-tags () "Align the tags in all headings." - (declare (obsolete "use `org-align-tags' instead." "Org 9.2")) + (declare (obsolete "use `org-align-tags' instead." "9.2")) (org-align-tags t)) (define-obsolete-function-alias - 'org-at-property-block-p 'org-at-property-drawer-p "Org 9.4") + 'org-at-property-block-p 'org-at-property-drawer-p "9.4") (defun org-flag-drawer (flag &optional element beg end) "When FLAG is non-nil, hide the drawer we are at. @@ -653,7 +691,7 @@ When optional argument ELEMENT is a parsed drawer, as returned by When buffer positions BEG and END are provided, hide or show that region as a drawer without further ado." - (declare (obsolete "use `org-hide-drawer-toggle' instead." "Org 9.4")) + (declare (obsolete "use `org-hide-drawer-toggle' instead." "9.4")) (if (and beg end) (org-flag-region beg end flag 'outline) (let ((drawer (or element @@ -678,14 +716,14 @@ region as a drawer without further ado." "Toggle visibility of block at point. Unlike to `org-hide-block-toggle', this function does not throw an error. Return a non-nil value when toggling is successful." - (declare (obsolete "use `org-hide-block-toggle' instead." "Org 9.4")) + (declare (obsolete "use `org-hide-block-toggle' instead." "9.4")) (interactive) (org-hide-block-toggle nil t)) (defun org-hide-block-toggle-all () "Toggle the visibility of all blocks in the current buffer." (declare (obsolete "please notify Org mailing list if you use this function." - "Org 9.4")) + "9.4")) (let ((start (point-min)) (end (point-max))) (save-excursion @@ -703,17 +741,17 @@ an error. Return a non-nil value when toggling is successful." Calls `org-table-next-row' or `newline-and-indent', depending on context. See the individual commands for more information." (declare (obsolete "use `org-return' with INDENT set to t instead." - "Org 9.4")) + "9.4")) (interactive) (org-return t)) (defmacro org-with-silent-modifications (&rest body) - (declare (obsolete "use `with-silent-modifications' instead." "Org 9.2") + (declare (obsolete "use `with-silent-modifications' instead." "9.2") (debug (body))) `(with-silent-modifications ,@body)) (define-obsolete-function-alias 'org-babel-strip-quotes - 'org-strip-quotes "Org 9.2") + 'org-strip-quotes "9.2") (define-obsolete-variable-alias 'org-sort-agenda-notime-is-late 'org-agenda-sort-notime-is-late "9.4") @@ -730,7 +768,11 @@ context. See the individual commands for more information." (make-obsolete-variable 'org-maybe-keyword-time-regexp "use `org-planning-line-re', followed by `org-ts-regexp-both' instead." - "Org 9.4") + "9.4") + +(define-obsolete-function-alias 'org-copy 'org-refile-copy "9.4") + +(define-obsolete-function-alias 'org-get-last-sibling 'org-get-previous-sibling "9.4") ;;;; Obsolete link types @@ -1023,8 +1065,7 @@ ELEMENT is the element at point." (defun org-mode-flyspell-verify () "Function used for `flyspell-generic-check-word-predicate'." (if (org-at-heading-p) - ;; At a headline or an inlinetask, check title only. This is - ;; faster than relying on `org-element-at-point'. + ;; At a headline or an inlinetask, check title only. (and (save-excursion (beginning-of-line) (and (let ((case-fold-search t)) (not (looking-at-p "\\*+ END[ \t]*$"))) @@ -1033,7 +1074,9 @@ ELEMENT is the element at point." (match-beginning 4) (>= (point) (match-beginning 4)) (or (not (match-beginning 5)) - (< (point) (match-beginning 5)))) + (< (point) (match-beginning 5))) + ;; Ignore checks in code, verbatim and others. + (org--flyspell-object-check-p (org-element-at-point))) (let* ((element (org-element-at-point)) (post-affiliated (org-element-property :post-affiliated element))) (cond @@ -1102,14 +1145,7 @@ ELEMENT is the element at point." (org-show-context 'bookmark-jump))) ;; Make `bookmark-jump' shows the jump location if it was hidden. -(eval-after-load 'bookmark - '(if (boundp 'bookmark-after-jump-hook) - ;; We can use the hook - (add-hook 'bookmark-after-jump-hook 'org-bookmark-jump-unhide) - ;; Hook not available, use advice - (defadvice bookmark-jump (after org-make-visible activate) - "Make the position visible." - (org-bookmark-jump-unhide)))) +(add-hook 'bookmark-after-jump-hook 'org-bookmark-jump-unhide) ;;;; Calendar @@ -1206,6 +1242,11 @@ key." (eval-after-load 'session '(add-to-list 'session-globals-exclude 'org-mark-ring)) +;;;; Speed commands + +(make-obsolete-variable 'org-speed-commands-user + "configure `org-speed-commands' instead." "9.5") + (provide 'org-compat) ;; Local variables: diff --git a/lisp/org/org-crypt.el b/lisp/org/org-crypt.el index 103baeb49e..48f76b79fd 100644 --- a/lisp/org/org-crypt.el +++ b/lisp/org/org-crypt.el @@ -185,10 +185,10 @@ See `org-crypt-disable-auto-save'." ((eq org-crypt-disable-auto-save 'encrypt) (message "org-decrypt: Enabling re-encryption on auto-save.") (add-hook 'auto-save-hook - (lambda () - (message "org-crypt: Re-encrypting all decrypted entries due to auto-save.") - (org-encrypt-entries)) - nil t)) + (lambda () + (message "org-crypt: Re-encrypting all decrypted entries due to auto-save.") + (org-encrypt-entries)) + nil t)) (t nil)))) (defun org-crypt-key-for-heading () diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el index dc2b3be632..7876c6ef75 100644 --- a/lisp/org/org-ctags.el +++ b/lisp/org/org-ctags.el @@ -3,10 +3,8 @@ ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. ;; Author: Paul Sexton - - ;; Keywords: org, wp -;; + ;; This file is part of GNU Emacs. ;; ;; GNU Emacs is free software: you can redistribute it and/or modify @@ -22,6 +20,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Commentary: + ;; ;; Synopsis ;; ======== diff --git a/lisp/org/org-datetree.el b/lisp/org/org-datetree.el index 62bd46e2e9..74442b038a 100644 --- a/lisp/org/org-datetree.el +++ b/lisp/org/org-datetree.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2009-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; @@ -72,8 +72,8 @@ will be built under the headline at point." (defun org-datetree--find-create-group (d time-grouping &optional keep-restriction) "Find or create an entry for date D. -If time-period is day, group entries by day. If time-period is -month, then group entries by month." +If time-period is day, group entries by day. +If time-period is month, then group entries by month." (setq-local org-datetree-base-level 1) (save-restriction (if (eq keep-restriction 'subtree-at-point) diff --git a/lisp/org/org-duration.el b/lisp/org/org-duration.el index 29fae2dbf0..e627d0936a 100644 --- a/lisp/org/org-duration.el +++ b/lisp/org/org-duration.el @@ -97,7 +97,11 @@ sure to call the following command: :group 'org-agenda :version "26.1" :package-version '(Org . "9.1") - :set (lambda (var val) (set-default var val) (org-duration-set-regexps)) + :set (lambda (var val) + (set-default var val) + ;; Avoid recursive load at startup. + (when (featurep 'org-duration) + (org-duration-set-regexps))) :initialize 'custom-initialize-changed :type '(choice (const :tag "H:MM" h:mm) diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el index 31f5f78eae..1c971b2f8a 100644 --- a/lisp/org/org-element.el +++ b/lisp/org/org-element.el @@ -117,6 +117,19 @@ ;; `org-element-update-syntax' builds proper syntax regexps according ;; to current setup. +(defconst org-element-citation-key-re + (rx "@" (group (one-or-more (any word "-.:?!`'/*@+|(){}<>&_^$#%&~")))) + "Regexp matching a citation key. +Key is located in match group 1.") + +(defconst org-element-citation-prefix-re + (rx "[cite" + (opt "/" (group (one-or-more (any "/_-" alnum)))) ;style + ":" + (zero-or-more (any "\t\n "))) + "Regexp matching a citation prefix. +Style, if any, is located in match group 1.") + (defvar org-element-paragraph-separate nil "Regexp to separate paragraphs in an Org buffer. In the case of lines starting with \"#\" and \":\", this regexp @@ -182,15 +195,17 @@ specially in `org-element--object-lex'.") (nth 2 org-emphasis-regexp-components))) ;; Plain links. (concat "\\<" link-types ":") - ;; Objects starting with "[": regular link, + ;; Objects starting with "[": citations, ;; footnote reference, statistics cookie, - ;; timestamp (inactive). - (concat "\\[\\(?:" - "fn:" "\\|" - "\\[" "\\|" - "[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" "\\|" - "[0-9]*\\(?:%\\|/[0-9]*\\)\\]" - "\\)") + ;; timestamp (inactive) and regular link. + (format "\\[\\(?:%s\\)" + (mapconcat + #'identity + (list "cite[:/]" + "fn:" + "\\(?:[0-9]\\|\\(?:%\\|/[0-9]*\\)\\]\\)" + "\\[") + "\\|")) ;; Objects starting with "@": export snippets. "@@" ;; Objects starting with "{": macro. @@ -234,15 +249,15 @@ specially in `org-element--object-lex'.") "List of recursive element types aka Greater Elements.") (defconst org-element-all-objects - '(bold code entity export-snippet footnote-reference inline-babel-call - inline-src-block italic line-break latex-fragment link macro - radio-target statistics-cookie strike-through subscript superscript - table-cell target timestamp underline verbatim) + '(bold citation citation-reference code entity export-snippet + footnote-reference inline-babel-call inline-src-block italic line-break + latex-fragment link macro radio-target statistics-cookie strike-through + subscript superscript table-cell target timestamp underline verbatim) "Complete list of object types.") (defconst org-element-recursive-objects - '(bold footnote-reference italic link subscript radio-target strike-through - superscript table-cell underline) + '(bold citation footnote-reference italic link subscript radio-target + strike-through superscript table-cell underline) "List of recursive object types.") (defconst org-element-object-containers @@ -331,9 +346,12 @@ Don't modify it, set `org-element-affiliated-keywords' instead.") (defconst org-element-object-restrictions (let* ((minimal-set '(bold code entity italic latex-fragment strike-through subscript superscript underline verbatim)) - (standard-set (remq 'table-cell org-element-all-objects)) + (standard-set + (remq 'citation-reference (remq 'table-cell org-element-all-objects))) (standard-set-no-line-break (remq 'line-break standard-set))) `((bold ,@standard-set) + (citation citation-reference) + (citation-reference ,@minimal-set) (footnote-reference ,@standard-set) (headline ,@standard-set-no-line-break) (inlinetask ,@standard-set-no-line-break) @@ -354,8 +372,8 @@ Don't modify it, set `org-element-affiliated-keywords' instead.") ;; Ignore inline babel call and inline source block as formulas ;; are possible. Also ignore line breaks and statistics ;; cookies. - (table-cell export-snippet footnote-reference link macro radio-target - target timestamp ,@minimal-set) + (table-cell citation export-snippet footnote-reference link macro + radio-target target timestamp ,@minimal-set) (table-row table-cell) (underline ,@standard-set) (verse-block ,@standard-set))) @@ -370,9 +388,11 @@ This alist also applies to secondary string. For example, an still has an entry since one of its properties (`:title') does.") (defconst org-element-secondary-value-alist - '((headline :title) + '((citation :prefix :suffix) + (headline :title) (inlinetask :title) - (item :tag)) + (item :tag) + (citation-reference :prefix :suffix)) "Alist between element types and locations of secondary values.") (defconst org-element--pair-round-table @@ -737,7 +757,9 @@ Return a list whose CAR is `drawer' and CDR is a plist containing Assume point is at beginning of drawer." (let ((case-fold-search t)) - (if (not (save-excursion (re-search-forward "^[ \t]*:END:[ \t]*$" limit t))) + (if (not (save-excursion + (goto-char (min limit (line-end-position))) + (re-search-forward "^[ \t]*:END:[ \t]*$" limit t))) ;; Incomplete drawer: parse it as a paragraph. (org-element-paragraph-parser limit affiliated) (save-excursion @@ -999,7 +1021,10 @@ Assume point is at beginning of the headline." (commentedp (and (let (case-fold-search) (looking-at org-comment-string)) (goto-char (match-end 0)))) - (title-start (point)) + (title-start (prog1 (point) + (unless (or todo priority commentedp) + ;; Headline like "* :tag:" + (skip-syntax-backward " \t")))) (tags (when (re-search-forward "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$" (line-end-position) @@ -2751,6 +2776,129 @@ CONTENTS is the contents of the object." (format "*%s*" contents)) +;;;; Citation + +(defun org-element-citation-parser () + "Parse citation object at point, if any. + +When at a citation object, return a list whose car is `citation' +and cdr is a plist with `:style', `:prefix', `:suffix', `:begin', +`:end', `:contents-begin', `:contents-end', and `:post-blank' +keywords. Otherwise, return nil. + +Assume point is at the beginning of the citation." + (when (looking-at org-element-citation-prefix-re) + (let* ((begin (point)) + (style (and (match-end 1) + (match-string-no-properties 1))) + ;; Ignore blanks between cite type and prefix or key. + (start (match-end 0)) + (closing (with-syntax-table org-element--pair-square-table + (ignore-errors (scan-lists begin 1 0))))) + (save-excursion + (when (and closing + (re-search-forward org-element-citation-key-re closing t)) + ;; Find prefix, if any. + (let ((first-key-end (match-end 0)) + (types (org-element-restriction 'citation-reference)) + (cite + (list 'citation + (list :style style + :begin begin + :post-blank (progn + (goto-char closing) + (skip-chars-forward " \t")) + :end (point))))) + ;; `:contents-begin' depends on the presence of + ;; a non-empty common prefix. + (goto-char first-key-end) + (if (not (search-backward ";" start t)) + (org-element-put-property cite :contents-begin start) + (when (< start (point)) + (org-element-put-property + cite :prefix + (org-element--parse-objects start (point) nil types cite))) + (forward-char) + (org-element-put-property cite :contents-begin (point))) + ;; `:contents-end' depends on the presence of a non-empty + ;; common suffix. + (goto-char (1- closing)) + (skip-chars-backward " \r\t\n") + (let ((end (point))) + (if (or (not (search-backward ";" first-key-end t)) + (re-search-forward org-element-citation-key-re end t)) + (org-element-put-property cite :contents-end end) + (forward-char) + (when (< (point) end) + (org-element-put-property + cite :suffix + (org-element--parse-objects (point) end nil types cite))) + (org-element-put-property cite :contents-end (point)))) + cite)))))) + +(defun org-element-citation-interpreter (citation contents) + "Interpret CITATION object as Org syntax. +CONTENTS is the contents of the object, as a string." + (let ((prefix (org-element-property :prefix citation)) + (suffix (org-element-property :suffix citation)) + (style (org-element-property :style citation))) + (concat "[cite" + (and style (concat "/" style)) + ":" + (and prefix (concat (org-element-interpret-data prefix) ";")) + (if suffix + (concat contents (org-element-interpret-data suffix)) + ;; Remove spurious semicolon. + (substring contents nil -1)) + "]"))) + + +;;;; Citation Reference + +(defun org-element-citation-reference-parser () + "Parse citation reference object at point, if any. + +When at a reference, return a list whose car is +`citation-reference', and cdr is a plist with `:key', +`:prefix', `:suffix', `:begin', `:end', and `:post-blank' keywords. + +Assume point is at the beginning of the reference." + (save-excursion + (let ((begin (point))) + (when (re-search-forward org-element-citation-key-re nil t) + (let* ((key (match-string-no-properties 1)) + (key-start (match-beginning 0)) + (key-end (match-end 0)) + (separator (search-forward ";" nil t)) + (end (or separator (point-max))) + (suffix-end (if separator (1- end) end)) + (types (org-element-restriction 'citation-reference)) + (reference + (list 'citation-reference + (list :key key + :begin begin + :end end + :post-blank 0)))) + (when (< begin key-start) + (org-element-put-property + reference :prefix + (org-element--parse-objects begin key-start nil types reference))) + (when (< key-end suffix-end) + (org-element-put-property + reference :suffix + (org-element--parse-objects key-end suffix-end nil types reference))) + reference))))) + +(defun org-element-citation-reference-interpreter (citation-reference _) + "Interpret CITATION-REFERENCE object as Org syntax." + (concat (org-element-interpret-data + (org-element-property :prefix citation-reference)) + "@" (org-element-property :key citation-reference) + (org-element-interpret-data + (org-element-property :suffix citation-reference)) + ";")) + + ;;;; Code (defun org-element-code-parser () @@ -3951,14 +4099,36 @@ element it has to parse." ;; There is no strict definition of a table.el ;; table. Try to prevent false positive while being ;; quick. - (let ((rule-regexp "[ \t]*\\+\\(-+\\+\\)+[ \t]*$") + (let ((rule-regexp + (rx (zero-or-more (any " \t")) + "+" + (one-or-more (one-or-more "-") "+") + (zero-or-more (any " \t")) + eol)) + (non-table.el-line + (rx bol + (zero-or-more (any " \t")) + (or eol (not (any "+| \t"))))) (next (line-beginning-position 2))) - (and (looking-at rule-regexp) - (save-excursion - (forward-line) - (re-search-forward "^[ \t]*\\($\\|[^|]\\)" limit t) - (and (> (line-beginning-position) next) - (org-match-line rule-regexp)))))) + ;; Start with a full rule. + (and + (looking-at rule-regexp) + (< next limit) ;no room for a table.el table + (save-excursion + (end-of-line) + (cond + ;; Must end with a full rule. + ((not (re-search-forward non-table.el-line limit 'move)) + (if (bolp) (forward-line -1) (beginning-of-line)) + (looking-at rule-regexp)) + ;; Ignore pseudo-tables with a single + ;; rule. + ((= next (line-beginning-position)) + nil) + ;; Must end with a full rule. + (t + (forward-line -1) + (looking-at rule-regexp))))))) (org-element-table-parser limit affiliated)) ;; List. ((looking-at (org-item-re)) @@ -4322,7 +4492,7 @@ element or object. Meaningful values are `first-section', TYPE is the type of the current element or object. If PARENT? is non-nil, assume the next element or object will be -located inside the current one. " +located inside the current one." (if parent? (pcase type (`headline 'section) @@ -4413,7 +4583,11 @@ Elements are accumulated into ACC." RESTRICTION is a list of object types, as symbols, that should be looked after. This function assumes that the buffer is narrowed to an appropriate container (e.g., a paragraph)." - (if (memq 'table-cell restriction) (org-element-table-cell-parser) + (cond + ((memq 'table-cell restriction) (org-element-table-cell-parser)) + ((memq 'citation-reference restriction) + (org-element-citation-reference-parser)) + (t (let* ((start (point)) (limit ;; Object regexp sometimes needs to have a peek at @@ -4501,6 +4675,9 @@ to an appropriate container (e.g., a paragraph)." ((and ?f (guard (memq 'footnote-reference restriction))) (org-element-footnote-reference-parser)) + ((and ?c + (guard (memq 'citation restriction))) + (org-element-citation-parser)) ((and (or ?% ?/) (guard (memq 'statistics-cookie restriction))) (org-element-statistics-cookie-parser)) @@ -4515,8 +4692,8 @@ to an appropriate container (e.g., a paragraph)." (or (eobp) (forward-char)))) (cond (found) (limit (forward-char -1) - (org-element-link-parser)) ;radio link - (t nil)))))) + (org-element-link-parser)) ;radio link + (t nil))))))) (defun org-element--parse-objects (beg end acc restriction &optional parent) "Parse objects between BEG and END and return recursive structure. @@ -4640,7 +4817,7 @@ to interpret. Return Org syntax as a string." (eq (org-element-property :pre-blank parent) 0))))) "")))))) - (if (memq type '(org-data plain-text nil)) results + (if (memq type '(org-data nil)) results ;; Build white spaces. If no `:post-blank' property ;; is specified, assume its value is 0. (let ((blank (or (org-element-property :post-blank data) 0))) @@ -4655,19 +4832,18 @@ to interpret. Return Org syntax as a string." "Return ELEMENT's affiliated keywords as Org syntax. If there is no affiliated keyword, return the empty string." (let ((keyword-to-org - (function - (lambda (key value) - (let (dual) - (when (member key org-element-dual-keywords) - (setq dual (cdr value) value (car value))) - (concat "#+" (downcase key) - (and dual - (format "[%s]" (org-element-interpret-data dual))) - ": " - (if (member key org-element-parsed-keywords) - (org-element-interpret-data value) - value) - "\n")))))) + (lambda (key value) + (let (dual) + (when (member key org-element-dual-keywords) + (setq dual (cdr value) value (car value))) + (concat "#+" (downcase key) + (and dual + (format "[%s]" (org-element-interpret-data dual))) + ": " + (if (member key org-element-parsed-keywords) + (org-element-interpret-data value) + value) + "\n"))))) (mapconcat (lambda (prop) (let ((value (org-element-property prop element)) diff --git a/lisp/org/org-entities.el b/lisp/org/org-entities.el index eb098993b7..9c5f626ab7 100644 --- a/lisp/org/org-entities.el +++ b/lisp/org/org-entities.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2010-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik , +;; Author: Carsten Dominik , ;; Ulf Stegemann ;; Keywords: outlines, calendar, wp ;; Homepage: https://orgmode.org @@ -114,6 +114,8 @@ packages to be loaded, add these packages to `org-latex-packages-alist'." ("igrave" "\\`{i}" nil "ì" "i" "ì" "ì") ("Iacute" "\\'{I}" nil "Í" "I" "Í" "Í") ("iacute" "\\'{i}" nil "í" "i" "í" "í") + ("Idot" "\\.{I}" nil "&idot;" "I" "İ" "İ") + ("inodot" "\\i" nil "ı" "i" "ı" "ı") ("Icirc" "\\^{I}" nil "Î" "I" "Î" "Î") ("icirc" "\\^{i}" nil "î" "i" "î" "î") ("Iuml" "\\\"{I}" nil "Ï" "I" "Ï" "Ï") diff --git a/lisp/org/org-faces.el b/lisp/org/org-faces.el index c56873b54c..b151045a95 100644 --- a/lisp/org/org-faces.el +++ b/lisp/org/org-faces.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; @@ -38,13 +38,28 @@ :group 'org-faces) (defface org-hide - '((((background light)) (:foreground "white")) + '((default :inherit fixed-pitch) + (((background light)) (:foreground "white")) (((background dark)) (:foreground "black"))) "Face used to hide leading stars in headlines. The foreground color of this face should be equal to the background color of the frame." :group 'org-faces) +(defface org-dispatcher-highlight + '((default :weight bold) + (((class color) (min-colors 88) (background dark)) + :background "gray20" :foreground "gold1") + (((class color) (min-colors 88) (background light)) + :background "SlateGray1" :foreground "DarkBlue") + (((class color) (min-colors 16) (background dark)) + :foreground "yellow") + (((class color) (min-colors 16) (background light)) + :foreground "blue") + (t :inverse-video t)) + "Face for highlighted keys in the dispatcher." + :group 'org-faces) + (defface org-level-1 '((t :inherit outline-1)) "Face used for level 1 headlines." :group 'org-faces) @@ -153,6 +168,14 @@ set the properties in the `org-column' face. For example, set "Face for headline with the ARCHIVE tag." :group 'org-faces) +(defface org-cite '((t :inherit link)) + "Face for citations." + :group 'org-faces) + +(defface org-cite-key '((t :inherit link)) + "Face for citation keys." + :group 'org-faces) + (defface org-link '((t :inherit link)) "Face for links." :group 'org-faces) @@ -179,7 +202,8 @@ set the properties in the `org-column' face. For example, set :group 'org-faces) (defface org-date - '((((class color) (background light)) (:foreground "Purple" :underline t)) + '((default :inherit fixed-pitch) + (((class color) (background light)) (:foreground "Purple" :underline t)) (((class color) (background dark)) (:foreground "Cyan" :underline t)) (t (:underline t))) "Face for date/time stamps." @@ -355,7 +379,8 @@ changes." (sexp :tag "Face"))))) (defface org-table ;Copied from `font-lock-function-name-face' - '((((class color) (min-colors 88) (background light)) (:foreground "Blue1")) + '((default :inherit fixed-pitch) + (((class color) (min-colors 88) (background light)) (:foreground "Blue1")) (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue")) (((class color) (min-colors 16) (background light)) (:foreground "Blue")) (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue")) @@ -371,7 +396,8 @@ changes." :group 'org-faces) (defface org-formula - '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) + '((default :inherit fixed-pitch) + (((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1")) (((class color) (min-colors 8) (background light)) (:foreground "red")) (((class color) (min-colors 8) (background dark)) (:foreground "red")) @@ -379,12 +405,12 @@ changes." "Face for formulas." :group 'org-faces) -(defface org-code '((t :inherit shadow)) +(defface org-code '((t :inherit (fixed-pitch shadow))) "Face for fixed-width text like code snippets." :group 'org-faces :version "22.1") -(defface org-meta-line '((t :inherit font-lock-comment-face)) +(defface org-meta-line '((t :inherit (fixed-pitch font-lock-comment-face))) "Face for meta lines starting with \"#+\"." :group 'org-faces :version "22.1") @@ -400,15 +426,18 @@ changes." '((((class color) (background light)) (:foreground "midnight blue")) (((class color) (background dark)) (:foreground "pale turquoise")) (t nil)) - "Face for document date, author and email; i.e. that which -follows a #+DATE:, #+AUTHOR: or #+EMAIL: keyword." + "Face for document information such as the author and date. +This applies to the text that follows a #+SUBTITLE:, #+DATE:, +#+AUTHOR: or #+EMAIL: keyword." :group 'org-faces) (defface org-document-info-keyword '((t :inherit shadow)) - "Face for #+TITLE:, #+AUTHOR:, #+EMAIL: and #+DATE: keywords." + "Face for document information keywords. +This face applies to the #+TITLE:, #+SUBTITLE:, #+AUTHOR:, +#+EMAIL: and #+DATE: keywords." :group 'org-faces) -(defface org-block `((t :inherit shadow +(defface org-block `((t :inherit (fixed-pitch shadow) ,@(and (>= emacs-major-version 27) '(:extend t)))) "Face used for text inside various blocks. @@ -430,7 +459,7 @@ verse and quote blocks are fontified using the `org-verse' and "Face used for the line delimiting the end of source blocks." :group 'org-faces) -(defface org-verbatim '((t (:inherit shadow))) +(defface org-verbatim '((t (:inherit (fixed-pitch shadow)))) "Face for fixed-with text like code snippets." :group 'org-faces :version "22.1") @@ -478,6 +507,16 @@ content of these blocks will still be treated as Org syntax." "Face used in agenda for captions and dates." :group 'org-faces) +(defface org-agenda-structure-secondary '((t (:inherit org-agenda-structure))) + "Face used for secondary information in agenda block headers." + :group 'org-faces) + +(defface org-agenda-structure-filter '((t (:inherit (org-warning org-agenda-structure)))) + "Face used for the current type of task filter in the agenda. +It inherits from `org-agenda-structure' so it can adapt to +it (e.g. if that is assigned a diffent font height or family)." + :group 'org-faces) + (defface org-agenda-date '((t (:inherit org-agenda-structure))) "Face used in agenda for normal days." :group 'org-faces) @@ -487,6 +526,10 @@ content of these blocks will still be treated as Org syntax." "Face used in agenda for today." :group 'org-faces) +(defface org-agenda-date-weekend-today '((t (:inherit org-agenda-date-today))) + "Face used in agenda for today during weekends." + :group 'org-faces) + (defface org-agenda-clocking '((t (:inherit secondary-selection))) "Face marking the current clock item in the agenda." :group 'org-faces) @@ -529,6 +572,11 @@ which days belong to the weekend." "Face for items scheduled previously, and not yet done." :group 'org-faces) +(defface org-imminent-deadline '((t :inherit org-warning)) + "Face for current deadlines in the agenda. +See also `org-agenda-deadline-faces'." + :group 'org-faces) + (defface org-upcoming-deadline '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1")) @@ -544,7 +592,7 @@ See also `org-agenda-deadline-faces'." See also `org-agenda-deadline-faces'.") (defcustom org-agenda-deadline-faces - '((1.0 . org-warning) + '((1.0 . org-imminent-deadline) (0.5 . org-upcoming-deadline) (0.0 . org-upcoming-distant-deadline)) "Faces for showing deadlines in the agenda. diff --git a/lisp/org/org-feed.el b/lisp/org/org-feed.el index 5dbd887ef5..5df3b69766 100644 --- a/lisp/org/org-feed.el +++ b/lisp/org/org-feed.el @@ -2,7 +2,7 @@ ;; ;; Copyright (C) 2009-2021 Free Software Foundation, Inc. ;; -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el index 3d42421e0d..c8c4dae800 100644 --- a/lisp/org/org-footnote.el +++ b/lisp/org/org-footnote.el @@ -2,7 +2,7 @@ ;; ;; Copyright (C) 2009-2021 Free Software Foundation, Inc. ;; -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; @@ -37,6 +37,7 @@ (declare-function org-at-comment-p "org" ()) (declare-function org-at-heading-p "org" (&optional ignored)) (declare-function org-back-over-empty-lines "org" ()) +(declare-function org-end-of-meta-data "org" (&optional full)) (declare-function org-edit-footnote-reference "org-src" ()) (declare-function org-element-at-point "org-element" ()) (declare-function org-element-class "org-element" (datum &optional parent)) @@ -287,6 +288,11 @@ otherwise." ((= (point) (org-element-property :begin context))) ;; Within recursive object too, but not in a link. ((eq type 'link) nil) + ((eq type 'table-cell) + ;; :contents-begin is not reliable on empty cells, so special + ;; case it. + (<= (save-excursion (skip-chars-backward " \t") (point)) + (org-element-property :contents-end context))) ((let ((cbeg (org-element-property :contents-begin context)) (cend (org-element-property :contents-end context))) (and cbeg (>= (point) cbeg) (<= (point) cend)))))))) @@ -704,7 +710,7 @@ function doesn't move point." (concat "^\\*+[ \t]+" (regexp-quote org-footnote-section) "[ \t]*$") nil t)) (goto-char (match-end 0)) - (forward-line) + (org-end-of-meta-data t) (unless (bolp) (insert "\n"))) (t (org-footnote--clear-footnote-section))) (when (zerop (org-back-over-empty-lines)) (insert "\n")) diff --git a/lisp/org/org-goto.el b/lisp/org/org-goto.el index 163aa580ef..0a3470f545 100644 --- a/lisp/org/org-goto.el +++ b/lisp/org/org-goto.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2012-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; This file is part of GNU Emacs. @@ -219,9 +219,9 @@ position or nil." (error (make-indirect-buffer (current-buffer) "*org-goto*" t)))) (let (temp-buffer-show-function temp-buffer-show-hook) (with-output-to-temp-buffer "*Org Help*" - (princ (format help (if org-goto-auto-isearch - " Just type for auto-isearch." - " n/p/f/b/u to navigate, q to quit."))))) + (princ (format help (if org-goto-auto-isearch + " Just type for auto-isearch." + " n/p/f/b/u to navigate, q to quit."))))) (org-fit-window-to-buffer (get-buffer-window "*Org Help*")) (org-overview) (setq buffer-read-only t) @@ -250,7 +250,7 @@ want. This command works around this by showing a copy of the current buffer in an indirect buffer, in overview mode. You can dive -into the tree in that copy, use org-occur and incremental search +into the tree in that copy, use `org-occur' and incremental search to find a location. When pressing RET or `Q', the command returns to the original buffer in which the visibility is still unchanged. After RET it will also jump to the location selected diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el index 231c08be0a..a355d8e5fa 100644 --- a/lisp/org/org-habit.el +++ b/lisp/org/org-habit.el @@ -90,7 +90,7 @@ It will be green even if it was done after the deadline." :type 'boolean) (defcustom org-habit-scheduled-past-days nil -"Value to use instead of `org-scheduled-past-days', for habits only. + "Value to use instead of `org-scheduled-past-days', for habits only. If nil, `org-scheduled-past-days' is used. diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el index b3b98c614a..56783d1083 100644 --- a/lisp/org/org-id.el +++ b/lisp/org/org-id.el @@ -2,7 +2,7 @@ ;; ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. ;; -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; @@ -128,6 +128,15 @@ nil Never use an ID to make a link, instead link using a text search for :group 'org-id :type 'string) +(defcustom org-id-ts-format "%Y%m%dT%H%M%S.%6N" + "Timestamp format for IDs generated using `ts' `org-id-method'. +The format should be suitable to pass as an argument to `format-time-string'. + +Defaults to ISO8601 timestamps without separators and without +timezone, local time and precision down to 1e-6 seconds." + :type 'string + :package-version '(Org . "9.5")) + (defcustom org-id-method 'uuid "The method that should be used to create new IDs. @@ -144,13 +153,12 @@ uuid Create random (version 4) UUIDs. If the program defined in `org-id-uuid-program' is available it is used to create the ID. Otherwise an internal functions is used. -ts Create ID's based on ISO8601 timestamps (without separators - and without timezone, local time). Precision down to seconds." +ts Create ID's based on timestamps as specified in `org-id-ts-format'." :group 'org-id :type '(choice (const :tag "Org's internal method" org) (const :tag "external: uuidgen" uuid) - (const :tag "ISO8601 timestamp" ts))) + (const :tag "Timestamp with format `org-id-ts-format'" ts))) (defcustom org-id-prefix nil "The prefix for IDs. @@ -196,7 +204,7 @@ This variable is only relevant when `org-id-track-globally' is set." :type 'file) (defcustom org-id-locations-file-relative nil - "Determines if org-id-locations should be stored as relative links. + "Determine if `org-id-locations' should be stored as relative links. Non-nil means that links to locations are stored as links relative to the location of where `org-id-locations-file' is stored. @@ -297,7 +305,7 @@ If necessary, the ID is created." (if (caar org-refile-targets) 'file t)) (org-refile-target-verify-function nil) (spos (org-refile-get-location "Entry")) - (pom (and spos (move-marker (make-marker) (nth 3 spos) + (pom (and spos (move-marker (make-marker) (or (nth 3 spos) 1) (get-file-buffer (nth 1 spos)))))) (prog1 (org-id-get pom 'create) (move-marker pom nil)))) @@ -374,17 +382,15 @@ So a typical ID could look like \"Org:4nd91V40HI\"." (setq unique (org-id-uuid)))) ((eq org-id-method 'org) (let* ((etime (org-reverse-string (org-id-time-to-b36))) - (postfix (if org-id-include-domain - (progn - (require 'message) - (concat "@" (message-make-fqdn)))))) + (postfix (when org-id-include-domain + (require 'message) + (concat "@" (message-make-fqdn))))) (setq unique (concat etime postfix)))) ((eq org-id-method 'ts) - (let ((ts (format-time-string "%Y%m%dT%H%M%S.%6N")) - (postfix (if org-id-include-domain - (progn - (require 'message) - (concat "@" (message-make-fqdn)))))) + (let ((ts (format-time-string org-id-ts-format)) + (postfix (when org-id-include-domain + (require 'message) + (concat "@" (message-make-fqdn))))) (setq unique (concat ts postfix)))) (t (error "Invalid `org-id-method'"))) (concat prefix unique))) @@ -413,15 +419,15 @@ So a typical ID could look like \"Org:4nd91V40HI\"." (substring rnd 18 20) (substring rnd 20 32)))) -(defun org-id-int-to-b36-one-digit (i) - "Turn an integer between 0 and 61 into a single character 0..9, A..Z, a..z." +(defun org-id-int-to-b36-one-digit (integer) + "Convert INTEGER between 0 and 61 into a single character 0..9, A..Z, a..z." (cond - ((< i 10) (+ ?0 i)) - ((< i 36) (+ ?a i -10)) + ((< integer 10) (+ ?0 integer)) + ((< integer 36) (+ ?a integer -10)) (t (error "Larger that 35")))) (defun org-id-b36-to-int-one-digit (i) - "Turn a character 0..9, A..Z, a..z into a number 0..61. + "Convert character 0..9, A..Z, a..z into a number 0..61. The input I may be a character, or a single-letter string." (and (stringp i) (setq i (string-to-char i))) (cond @@ -429,9 +435,11 @@ The input I may be a character, or a single-letter string." ((and (>= i ?a) (<= i ?z)) (+ (- i ?a) 10)) (t (error "Invalid b36 letter")))) -(defun org-id-int-to-b36 (i &optional length) - "Convert an integer to a base-36 number represented as a string." - (let ((s "")) +(defun org-id-int-to-b36 (integer &optional length) + "Convert an INTEGER to a base-36 number represented as a string. +The returned string is padded with leading zeros to LENGTH if necessary." + (let ((s "") + (i integer)) (while (> i 0) (setq s (concat (char-to-string (org-id-int-to-b36-one-digit (mod i 36))) s) @@ -441,11 +449,11 @@ The input I may be a character, or a single-letter string." (setq s (concat (make-string (- length (length s)) ?0) s))) s)) -(defun org-id-b36-to-int (s) - "Convert a base-36 string into the corresponding integer." +(defun org-id-b36-to-int (string) + "Convert a base-36 STRING into the corresponding integer." (let ((r 0)) (mapc (lambda (i) (setq r (+ (* r 36) (org-id-b36-to-int-one-digit i)))) - s) + string) r)) (defun org-id-time-to-b36 (&optional time) @@ -483,7 +491,8 @@ and TIME is a Lisp time value (HI LO USEC)." Store the relation between files and corresponding IDs. This will scan all agenda files, all associated archives, and all files currently mentioned in `org-id-locations'. -When FILES is given, scan also these files." +When FILES is given, scan also these files. +If SILENT is non-nil, messages are suppressed." (interactive) (unless org-id-track-globally (error "Please turn on `org-id-track-globally' if you want to track IDs")) @@ -512,28 +521,31 @@ When FILES is given, scan also these files." (seen-ids nil) (ndup 0) (i 0)) - (dolist (file files) - (when (file-exists-p file) - (unless silent - (cl-incf i) - (message "Finding ID locations (%d/%d files): %s" i nfiles file)) - (with-current-buffer (find-file-noselect file t) - (let ((ids nil) - (case-fold-search t)) - (org-with-point-at 1 - (while (re-search-forward id-regexp nil t) - (when (org-at-property-p) - (push (org-entry-get (point) "ID") ids))) - (when ids - (push (cons (abbreviate-file-name file) ids) - org-id-locations) - (dolist (id ids) - (cond - ((not (member id seen-ids)) (push id seen-ids)) - (silent nil) - (t - (message "Duplicate ID %S" id) - (cl-incf ndup)))))))))) + (with-temp-buffer + (delay-mode-hooks + (org-mode) + (dolist (file files) + (when (file-exists-p file) + (unless silent + (cl-incf i) + (message "Finding ID locations (%d/%d files): %s" i nfiles file)) + (insert-file-contents file nil nil nil 'replace) + (let ((ids nil) + (case-fold-search t)) + (org-with-point-at 1 + (while (re-search-forward id-regexp nil t) + (when (org-at-property-p) + (push (org-entry-get (point) "ID") ids))) + (when ids + (push (cons (abbreviate-file-name file) ids) + org-id-locations) + (dolist (id ids) + (cond + ((not (member id seen-ids)) (push id seen-ids)) + (silent nil) + (t + (message "Duplicate ID %S" id) + (cl-incf ndup))))))))))) (setq org-id-files (mapcar #'car org-id-locations)) (org-id-locations-save) ;; Now convert to a hash table. @@ -580,7 +592,7 @@ When FILES is given, scan also these files." (setf (car item) (expand-file-name (car item) loc)))) org-id-locations))) (error - (message "Could not read org-id-values from %s. Setting it to nil." + (message "Could not read `org-id-values' from %s, setting it to nil" org-id-locations-file)))) (setq org-id-files (mapcar 'car org-id-locations)) (setq org-id-locations (org-id-alist-to-hash org-id-locations)))) @@ -589,7 +601,7 @@ When FILES is given, scan also these files." "Add the ID with location FILE to the database of ID locations." ;; Only if global tracking is on, and when the buffer has a file (unless file - (error "bug: org-id-get expects a file-visiting buffer")) + (error "`org-id-get' expects a file-visiting buffer")) (let ((afile (abbreviate-file-name file))) (when (and org-id-track-globally id) (unless org-id-locations (org-id-locations-load)) @@ -601,7 +613,8 @@ When FILES is given, scan also these files." (add-hook 'kill-emacs-hook 'org-id-locations-save)) (defun org-id-hash-to-alist (hash) - "Turn an org-id hash into an alist, so that it can be written to a file." + "Turn an org-id HASH into an alist. +This is to be able to write it to a file." (let (res x) (maphash (lambda (k v) @@ -612,7 +625,7 @@ When FILES is given, scan also these files." res)) (defun org-id-alist-to-hash (list) - "Turn an org-id location list into a hash table." + "Turn an org-id location LIST into a hash table." (let ((res (make-hash-table :test 'equal :size (apply '+ (mapcar 'length list)))) @@ -625,7 +638,7 @@ When FILES is given, scan also these files." res)) (defun org-id-paste-tracker (txt &optional buffer-or-file) - "Update any IDs in TXT and assign BUFFER-OR-FILE to them." + "Update any ids in TXT and assign BUFFER-OR-FILE to them." (when org-id-track-globally (save-match-data (setq buffer-or-file (or buffer-or-file (current-buffer))) @@ -644,7 +657,7 @@ When FILES is given, scan also these files." ;;;###autoload (defun org-id-find-id-file (id) - "Query the id database for the file in which this ID is located." + "Query the id database for the file in which ID is located." (unless org-id-locations (org-id-locations-load)) (or (and org-id-locations (hash-table-p org-id-locations) @@ -655,20 +668,27 @@ When FILES is given, scan also these files." (defun org-id-find-id-in-file (id file &optional markerp) "Return the position of the entry ID in FILE. + If that files does not exist, or if it does not contain this ID, return nil. + The position is returned as a cons cell (file-name . position). With optional argument MARKERP, return the position as a new marker." - (let (org-agenda-new-buffers buf pos) - (cond - ((not file) nil) - ((not (file-exists-p file)) nil) - (t (with-current-buffer (setq buf (org-get-agenda-file-buffer file)) - (setq pos (org-find-entry-with-id id)) - (when pos - (if markerp - (move-marker (make-marker) pos buf) - (cons file pos)))))))) + (cond + ((not file) nil) + ((not (file-exists-p file)) nil) + (t + (let* ((visiting (find-buffer-visiting file)) + (buffer (or visiting (find-file-noselect file)))) + (unwind-protect + (with-current-buffer buffer + (let ((pos (org-find-entry-with-id id))) + (cond + ((null pos) nil) + (markerp (move-marker (make-marker) pos buffer)) + (t (cons file pos))))) + ;; Remove opened buffer in the process. + (unless (or visiting markerp) (kill-buffer buffer))))))) ;; id link type @@ -677,21 +697,27 @@ optional argument MARKERP, return the position as a new marker." ;;;###autoload (defun org-id-store-link () - "Store a link to the current entry, using its ID." + "Store a link to the current entry, using its ID. + +If before first heading store first title-keyword as description +or filename if no title." (interactive) (when (and (buffer-file-name (buffer-base-buffer)) (derived-mode-p 'org-mode)) (let* ((link (concat "id:" (org-id-get-create))) (case-fold-search nil) (desc (save-excursion (org-back-to-heading-or-point-min t) - (or (and (org-before-first-heading-p) - (file-name-nondirectory - (buffer-file-name (buffer-base-buffer)))) - (and (looking-at org-complex-heading-regexp) - (if (match-end 4) - (match-string 4) - (match-string 0))) - link)))) + (cond ((org-before-first-heading-p) + (let ((keywords (org-collect-keywords '("TITLE")))) + (if keywords + (cadr (assoc "TITLE" keywords)) + (file-name-nondirectory + (buffer-file-name (buffer-base-buffer)))))) + ((looking-at org-complex-heading-regexp) + (if (match-end 4) + (match-string 4) + (match-string 0))) + (t link))))) (org-link-store-props :link link :description desc :type "id") link))) diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el index 3475cadc42..e0cb69780e 100644 --- a/lisp/org/org-indent.el +++ b/lisp/org/org-indent.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2009-2021 Free Software Foundation, Inc. ;; -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; @@ -126,31 +126,32 @@ useful to make it ever so slightly different." (make-vector org-indent--deepest-level nil)) (setq org-indent--text-line-prefixes (make-vector org-indent--deepest-level nil)) - (dotimes (n org-indent--deepest-level) - (let ((indentation (if (<= n 1) 0 - (* (1- org-indent-indentation-per-level) - (1- n))))) - ;; Headlines line prefixes. - (let ((heading-prefix (make-string indentation ?*))) - (aset org-indent--heading-line-prefixes + (when (> org-indent-indentation-per-level 0) + (dotimes (n org-indent--deepest-level) + (let ((indentation (if (<= n 1) 0 + (* (1- org-indent-indentation-per-level) + (1- n))))) + ;; Headlines line prefixes. + (let ((heading-prefix (make-string indentation ?*))) + (aset org-indent--heading-line-prefixes + n + (org-add-props heading-prefix nil 'face 'org-indent)) + ;; Inline tasks line prefixes + (aset org-indent--inlinetask-line-prefixes + n + (cond ((<= n 1) "") + ((bound-and-true-p org-inlinetask-show-first-star) + (concat org-indent-inlinetask-first-star + (substring heading-prefix 1))) + (t (org-add-props heading-prefix nil 'face 'org-indent))))) + ;; Text line prefixes. + (aset org-indent--text-line-prefixes n - (org-add-props heading-prefix nil 'face 'org-indent)) - ;; Inline tasks line prefixes - (aset org-indent--inlinetask-line-prefixes - n - (cond ((<= n 1) "") - ((bound-and-true-p org-inlinetask-show-first-star) - (concat org-indent-inlinetask-first-star - (substring heading-prefix 1))) - (t (org-add-props heading-prefix nil 'face 'org-indent))))) - ;; Text line prefixes. - (aset org-indent--text-line-prefixes - n - (org-add-props - (concat (make-string (+ n indentation) ?\s) - (and (> n 0) - (char-to-string org-indent-boundary-char))) - nil 'face 'org-indent))))) + (org-add-props + (concat (make-string (+ n indentation) ?\s) + (and (> n 0) + (char-to-string org-indent-boundary-char))) + nil 'face 'org-indent)))))) (defsubst org-indent-remove-properties (beg end) "Remove indentations between BEG and END." diff --git a/lisp/org/org-inlinetask.el b/lisp/org/org-inlinetask.el index 48402b092b..3379a2e460 100644 --- a/lisp/org/org-inlinetask.el +++ b/lisp/org/org-inlinetask.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2009-2021 Free Software Foundation, Inc. ;; -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org @@ -131,7 +131,7 @@ If there is a region wrap it inside the inline task." ;; before this one. (when (and (org-inlinetask-in-task-p) (not (and (org-inlinetask-at-task-p) (bolp)))) - (error "Cannot nest inline tasks")) + (user-error "Cannot nest inline tasks")) (or (bolp) (newline)) (let* ((indent (if org-odd-levels-only (1- (* 2 org-inlinetask-min-level)) @@ -189,7 +189,7 @@ The number of levels is controlled by `org-inlinetask-min-level'." (defun org-inlinetask-goto-end () "Go to the end of the inline task at point. - Return point." +Return point." (save-match-data (beginning-of-line) (let ((case-fold-search t) @@ -225,7 +225,7 @@ If the task has an end part, promote it. Also, prevents level from going below `org-inlinetask-min-level'." (interactive) (if (not (org-inlinetask-in-task-p)) - (error "Not in an inline task") + (user-error "Not in an inline task") (save-excursion (let* ((lvl (org-inlinetask-get-task-level)) (next-lvl (org-get-valid-level lvl -1)) @@ -233,15 +233,18 @@ going below `org-inlinetask-min-level'." (down-task (concat (make-string next-lvl ?*))) beg) (if (< next-lvl org-inlinetask-min-level) - (error "Cannot promote an inline task at minimum level") + (user-error "Cannot promote an inline task at minimum level") (org-inlinetask-goto-beginning) (setq beg (point)) (replace-match down-task nil t nil 1) (org-inlinetask-goto-end) - (if (eobp) (beginning-of-line) (forward-line -1)) + (if (and (eobp) (looking-back "END\\s-*" (point-at-bol))) + (beginning-of-line) + (forward-line -1)) (unless (= (point) beg) + (looking-at (org-inlinetask-outline-regexp)) (replace-match down-task nil t nil 1) - (when org-adapt-indentation + (when (eq org-adapt-indentation t) (goto-char beg) (org-fixup-indentation diff)))))))) @@ -250,7 +253,7 @@ going below `org-inlinetask-min-level'." If the task has an end part, also demote it." (interactive) (if (not (org-inlinetask-in-task-p)) - (error "Not in an inline task") + (user-error "Not in an inline task") (save-excursion (let* ((lvl (org-inlinetask-get-task-level)) (next-lvl (org-get-valid-level lvl 1)) @@ -261,10 +264,13 @@ If the task has an end part, also demote it." (setq beg (point)) (replace-match down-task nil t nil 1) (org-inlinetask-goto-end) - (if (eobp) (beginning-of-line) (forward-line -1)) + (if (and (eobp) (looking-back "END\\s-*" (point-at-bol))) + (beginning-of-line) + (forward-line -1)) (unless (= (point) beg) + (looking-at (org-inlinetask-outline-regexp)) (replace-match down-task nil t nil 1) - (when org-adapt-indentation + (when (eq org-adapt-indentation t) (goto-char beg) (org-fixup-indentation diff))))))) diff --git a/lisp/org/org-keys.el b/lisp/org/org-keys.el index f0fdb79ea4..2984a4f514 100644 --- a/lisp/org/org-keys.el +++ b/lisp/org/org-keys.el @@ -31,6 +31,8 @@ (defvar org-outline-regexp) +(require 'oc) + (declare-function org-add-note "org" ()) (declare-function org-agenda "org" (&optional arg org-keys restriction)) (declare-function org-agenda-file-to-front "org" (&optional to-end)) @@ -56,7 +58,6 @@ (declare-function org-clone-subtree-with-time-shift "org" (n &optional shift)) (declare-function org-columns "org" (&optional global columns-fmt-string)) (declare-function org-comment-dwim "org" (arg)) -(declare-function org-refile-copy "org" ()) (declare-function org-copy-special "org" ()) (declare-function org-copy-visible "org" (beg end)) (declare-function org-ctrl-c-ctrl-c "org" (&optional arg)) @@ -143,6 +144,8 @@ (declare-function org-promote-subtree "org" ()) (declare-function org-redisplay-inline-images "org" ()) (declare-function org-refile "org" (&optional arg1 default-buffer rfloc msg)) +(declare-function org-refile-copy "org" ()) +(declare-function org-refile-reverse "org-refile" (&optional arg default-buffer rfloc msg)) (declare-function org-reftex-citation "org" ()) (declare-function org-reload "org" (&optional arg1)) (declare-function org-remove-file "org" (&optional file)) @@ -174,7 +177,6 @@ (declare-function org-show-subtree "org" ()) (declare-function org-sort "org" (&optional with-case)) (declare-function org-sparse-tree "org" (&optional arg type)) -(declare-function org-table-blank-field "org" ()) (declare-function org-table-copy-down "org" (n)) (declare-function org-table-create-or-convert-from-region "org" (arg)) (declare-function org-table-create-with-table\.el "org-table" ()) @@ -337,7 +339,6 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names." (org-defkey org-mouse-map [follow-link] 'mouse-face)) (when org-tab-follows-link - (org-defkey org-mouse-map (kbd "") #'org-open-at-point) (org-defkey org-mouse-map (kbd "TAB") #'org-open-at-point)) @@ -443,18 +444,13 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names." (org-defkey org-mode-map (kbd "C-c C-x") (make-sparse-keymap)) ;;;; TAB key with modifiers -(org-defkey org-mode-map (kbd "C-i") #'org-cycle) -(org-defkey org-mode-map (kbd "") #'org-cycle) -(org-defkey org-mode-map (kbd "C-c C-") #'org-force-cycle-archived) +(org-defkey org-mode-map (kbd "TAB") #'org-cycle) +(org-defkey org-mode-map (kbd "C-c C-TAB") #'org-force-cycle-archived) ;; Override text-mode binding to expose `complete-symbol' for ;; pcomplete functionality. -(org-defkey org-mode-map (kbd "M-") nil) (org-defkey org-mode-map (kbd "M-TAB") nil) -(org-defkey org-mode-map (kbd "ESC ") nil) (org-defkey org-mode-map (kbd "ESC TAB") nil) -(org-defkey org-mode-map (kbd "") #'org-shifttab) -(org-defkey org-mode-map (kbd "S-") #'org-shifttab) (org-defkey org-mode-map (kbd "S-TAB") #'org-shifttab) (define-key org-mode-map (kbd "") #'org-shifttab) @@ -463,12 +459,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names." (org-defkey org-mode-map (kbd "S-RET") #'org-table-copy-down) (org-defkey org-mode-map (kbd "M-S-") #'org-insert-todo-heading) (org-defkey org-mode-map (kbd "M-S-RET") #'org-insert-todo-heading) -(org-defkey org-mode-map (kbd "ESC S-") #'org-insert-todo-heading) -(org-defkey org-mode-map (kbd "ESC S-RET") #'org-insert-todo-heading) -(org-defkey org-mode-map (kbd "M-") #'org-meta-return) (org-defkey org-mode-map (kbd "M-RET") #'org-meta-return) -(org-defkey org-mode-map (kbd "ESC ") #'org-meta-return) -(org-defkey org-mode-map (kbd "ESC RET") #'org-meta-return) ;;;; Cursor keys with modifiers (org-defkey org-mode-map (kbd "M-") #'org-metaleft) @@ -582,6 +573,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names." (org-defkey org-mode-map (kbd "C-c ;") #'org-toggle-comment) (org-defkey org-mode-map (kbd "C-c C-w") #'org-refile) (org-defkey org-mode-map (kbd "C-c M-w") #'org-refile-copy) +(org-defkey org-mode-map (kbd "C-c C-M-w") #'org-refile-reverse) (org-defkey org-mode-map (kbd "C-c /") #'org-sparse-tree) ;minor-mode reserved (org-defkey org-mode-map (kbd "C-c \\") #'org-match-sparse-tree) ;minor-mode r. (org-defkey org-mode-map (kbd "C-c RET") #'org-ctrl-c-ret) @@ -620,7 +612,6 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names." (org-defkey org-mode-map (kbd "RET") #'org-return) (org-defkey org-mode-map (kbd "C-j") #'org-return-and-maybe-indent) (org-defkey org-mode-map (kbd "C-c ?") #'org-table-field-info) -(org-defkey org-mode-map (kbd "C-c SPC") #'org-table-blank-field) (org-defkey org-mode-map (kbd "C-c +") #'org-table-sum) (org-defkey org-mode-map (kbd "C-c =") #'org-table-eval-formula) (org-defkey org-mode-map (kbd "C-c '") #'org-edit-special) @@ -676,6 +667,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names." (org-defkey org-mode-map (kbd "C-c C-x !") #'org-reload) (org-defkey org-mode-map (kbd "C-c C-x g") #'org-feed-update-all) (org-defkey org-mode-map (kbd "C-c C-x G") #'org-feed-goto-inbox) +(org-defkey org-mode-map (kbd "C-c C-x @") #'org-cite-insert) (org-defkey org-mode-map (kbd "C-c C-x [") #'org-reftex-citation) (org-defkey org-mode-map (kbd "C-c C-x I") #'org-info-find-node) @@ -698,28 +690,6 @@ star at the beginning of the headline, you can do this: (const :tag "At beginning of headline stars" t) (function))) -(defcustom org-speed-commands-user nil - "Alist of additional speed commands. -This list will be checked before `org-speed-commands-default' -when the variable `org-use-speed-commands' is non-nil -and when the cursor is at the beginning of a headline. -The car of each entry is a string with a single letter, which must -be assigned to `self-insert-command' in the global map. -The cdr is either a command to be called interactively, a function -to be called, or a form to be evaluated. -An entry that is just a list with a single string will be interpreted -as a descriptive headline that will be added when listing the speed -commands in the Help buffer using the `?' speed command." - :group 'org-structure - :type '(repeat :value ("k" . ignore) - (choice :value ("k" . ignore) - (list :tag "Descriptive Headline" (string :tag "Headline")) - (cons :tag "Letter and Command" - (string :tag "Command letter") - (choice - (function) - (sexp)))))) - (defcustom org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) "Hook for activating speed commands at strategic locations. @@ -739,7 +709,7 @@ hook. The default setting is `org-speed-command-activate'." :version "24.1" :type 'hook) -(defconst org-speed-commands-default +(defcustom org-speed-commands '(("Outline Navigation") ("n" . (org-speed-move-safe 'org-next-visible-heading)) ("p" . (org-speed-move-safe 'org-previous-visible-heading)) @@ -749,7 +719,7 @@ hook. The default setting is `org-speed-command-activate'." ("B" . org-previous-block) ("u" . (org-speed-move-safe 'outline-up-heading)) ("j" . org-goto) - ("g" . (org-refile t)) + ("g" . (org-refile '(4))) ("Outline Visibility") ("c" . org-cycle) ("C" . org-shifttab) @@ -764,8 +734,7 @@ hook. The default setting is `org-speed-command-activate'." ("l" . org-metaleft) ("R" . org-shiftmetaright) ("L" . org-shiftmetaleft) - ("i" . (progn (forward-char 1) (call-interactively - 'org-insert-heading-respect-content))) + ("i" . (progn (forward-char 1) (call-interactively 'org-insert-heading-respect-content))) ("^" . org-sort) ("w" . org-refile) ("a" . org-archive-subtree-default-with-confirmation) @@ -784,8 +753,7 @@ hook. The default setting is `org-speed-command-activate'." (":" . org-set-tags-command) ("e" . org-set-effort) ("E" . org-inc-effort) - ("W" . (lambda(m) (interactive "sMinutes before warning: ") - (org-entry-put (point) "APPT_WARNTIME" m))) + ("W" . (lambda (m) (interactive "sMinutes before warning: ") (org-entry-put (point) "APPT_WARNTIME" m))) ("Agenda Views etc") ("v" . org-agenda) ("/" . org-sparse-tree) @@ -794,7 +762,28 @@ hook. The default setting is `org-speed-command-activate'." ("?" . org-speed-command-help) ("<" . (org-agenda-set-restriction-lock 'subtree)) (">" . (org-agenda-remove-restriction-lock))) - "The default speed commands.") + "Alist of speed commands. + +The car of each entry is a string with a single letter, which +must be assigned to `self-insert-command' in the global map. + +The cdr is either a command to be called interactively, a +function to be called, or a form to be evaluated. + +An entry that is just a list with a single string will be +interpreted as a descriptive headline that will be added when +listing the speed commands in the Help buffer using the `?' speed +command." + :group 'org-structure + :package-version '(Org . "9.5") + :type '(repeat :value ("k" . ignore) + (choice :value ("k" . ignore) + (list :tag "Descriptive Headline" (string :tag "Headline")) + (cons :tag "Letter and Command" + (string :tag "Command letter") + (choice + (function) + (sexp)))))) (defun org-print-speed-command (e) (if (> (length (car e)) 1) @@ -816,12 +805,18 @@ hook. The default setting is `org-speed-command-activate'." (interactive) (unless org-use-speed-commands (user-error "Speed commands are not activated, customize `org-use-speed-commands'")) + ;; FIXME: remove this warning for 9.6 + (when (boundp 'org-speed-commands-user) + (message "`org-speed-command-user' is obsolete, please use `org-speed-commands'") + (sit-for 3)) (with-output-to-temp-buffer "*Help*" - (princ "User-defined Speed commands\n===========================\n") - (mapc #'org-print-speed-command org-speed-commands-user) - (princ "\n") - (princ "Built-in Speed commands\n=======================\n") - (mapc #'org-print-speed-command org-speed-commands-default)) + (princ "Speed commands\n==============\n") + (mapc #'org-print-speed-command + ;; FIXME: don't check `org-speed-commands-user' past 9.6 + (if (boundp 'org-speed-commands-user) + (append org-speed-commands + org-speed-commands-user) + org-speed-commands))) (with-current-buffer "*Help*" (setq truncate-lines t))) @@ -837,13 +832,16 @@ If not, return to the original position and throw an error." (defun org-speed-command-activate (keys) "Hook for activating single-letter speed commands. -`org-speed-commands-default' specifies a minimal command set. -Use `org-speed-commands-user' for further customization." +See `org-speed-commands' for configuring them." (when (or (and (bolp) (looking-at org-outline-regexp)) (and (functionp org-use-speed-commands) (funcall org-use-speed-commands))) - (cdr (assoc keys (append org-speed-commands-user - org-speed-commands-default))))) + (cdr (assoc keys + ;; FIXME: don't check `org-speed-commands-user' past 9.6 + (if (boundp 'org-speed-commands-user) + (append org-speed-commands + org-speed-commands-user) + org-speed-commands))))) ;;; Babel speed keys diff --git a/lisp/org/org-lint.el b/lisp/org/org-lint.el index 2e080cc138..5c64c5a5c9 100644 --- a/lisp/org/org-lint.el +++ b/lisp/org/org-lint.el @@ -593,7 +593,7 @@ in description" (let ((file (org-unbracket-string "\"" "\"" (org-element-property :value k)))) - (and (not (org-file-url-p file)) + (and (not (org-url-p file)) (not (file-remote-p file)) (not (file-exists-p file)) (list (org-element-property :begin k) @@ -671,7 +671,7 @@ Use \"export %s\" instead" (when (string= (org-element-property :key k) "OPTIONS") (let ((value (org-element-property :value k)) (start 0)) - (while (string-match "\\(.+?\\):\\((.*?)\\|\\S-*\\)[ \t]*" + (while (string-match "\\(.+?\\):\\((.*?)\\|\\S-+\\)?[ \t]*" value start) (setf start (match-end 0)) @@ -679,19 +679,50 @@ Use \"export %s\" instead" (unless (member item allowed) (push (list (org-element-property :post-affiliated k) (format "Unknown OPTIONS item \"%s\"" item)) - reports)))))))) + reports)) + (unless (match-string 2 value) + (push (list (org-element-property :post-affiliated k) + (format "Missing value for option item %S" item)) + reports)))))))) reports)) (defun org-lint-invalid-macro-argument-and-template (ast) - (let ((extract-placeholders - (lambda (template) - (let ((start 0) - args) - (while (string-match "\\$\\([1-9][0-9]*\\)" template start) - (setf start (match-end 0)) - (push (string-to-number (match-string 1 template)) args)) - (sort (org-uniquify args) #'<)))) - reports) + (let* ((reports nil) + (extract-placeholders + (lambda (template) + (let ((start 0) + args) + (while (string-match "\\$\\([1-9][0-9]*\\)" template start) + (setf start (match-end 0)) + (push (string-to-number (match-string 1 template)) args)) + (sort (org-uniquify args) #'<)))) + (check-arity + (lambda (arity macro) + (let* ((name (org-element-property :key macro)) + (pos (org-element-property :begin macro)) + (args (org-element-property :args macro)) + (l (length args))) + (cond + ((< l (1- (car arity))) + (push (list pos (format "Missing arguments in macro %S" name)) + reports)) + ((< l (car arity)) + (push (list pos (format "Missing argument in macro %S" name)) + reports)) + ((> l (1+ (cdr arity))) + (push (let ((spurious-args (nthcdr (cdr arity) args))) + (list pos + (format "Spurious arguments in macro %S: %s" + name + (mapconcat #'org-trim spurious-args ", ")))) + reports)) + ((> l (cdr arity)) + (push (list pos + (format "Spurious argument in macro %S: %s" + name + (org-last args))) + reports)) + (t nil)))))) ;; Check arguments for macro templates. (org-element-map ast 'keyword (lambda (k) @@ -727,25 +758,29 @@ Use \"export %s\" instead" (lambda (macro) (let* ((name (org-element-property :key macro)) (template (cdr (assoc-string name templates t)))) - (if (not template) - (push (list (org-element-property :begin macro) - (format "Undefined macro \"%s\"" name)) - reports) - (let ((arg-numbers (funcall extract-placeholders template))) - (when arg-numbers - (let ((spurious-args - (nthcdr (apply #'max arg-numbers) - (org-element-property :args macro)))) - (when spurious-args - (push - (list (org-element-property :begin macro) - (format "Unused argument%s in macro \"%s\": %s" - (if (> (length spurious-args) 1) "s" "") - name - (mapconcat (lambda (a) (format "\"%s\"" a)) - spurious-args - ", "))) - reports)))))))))) + (pcase template + (`nil + (push (list (org-element-property :begin macro) + (format "Undefined macro %S" name)) + reports)) + ((guard (string= name "keyword")) + (funcall check-arity '(1 . 1) macro)) + ((guard (string= name "modification-time")) + (funcall check-arity '(1 . 2) macro)) + ((guard (string= name "n")) + (funcall check-arity '(0 . 2) macro)) + ((guard (string= name "property")) + (funcall check-arity '(1 . 2) macro)) + ((guard (string= name "time")) + (funcall check-arity '(1 . 1) macro)) + ((pred functionp)) ;ignore (eval ...) templates + (_ + (let* ((arg-numbers (funcall extract-placeholders template)) + (arity (if (null arg-numbers) + '(0 . 0) + (let ((m (apply #'max arg-numbers))) + (cons m m))))) + (funcall check-arity arity macro)))))))) reports)) (defun org-lint-undefined-footnote-reference (ast) @@ -1191,7 +1226,6 @@ CHECKERS is the list of checkers used." (setf org-lint--source-buffer source) (setf org-lint--local-checkers checkers) (org-lint--refresh-reports) - (tabulated-list-print) (add-hook 'tabulated-list-revert-hook #'org-lint--refresh-reports nil t)) (pop-to-buffer buffer))) @@ -1217,7 +1251,7 @@ CHECKERS is the list of checkers used." (let ((c (org-lint--current-checker))) (setf tabulated-list-entries (cl-remove-if (lambda (e) (equal c (org-lint--current-checker e))) - tabulated-list-entries)) + tabulated-list-entries)) (tabulated-list-print))) (defun org-lint--ignore-checker () @@ -1271,7 +1305,7 @@ ARG can also be a list of checker names, as symbols, to run." (throw 'exit c))))))) ((pred consp) (cl-remove-if-not (lambda (c) (memq (org-lint-checker-name c) arg)) - org-lint--checkers)) + org-lint--checkers)) (_ (user-error "Invalid argument `%S' for `org-lint'" arg))))) (if (not (called-interactively-p 'any)) (org-lint--generate-reports (current-buffer) checkers) diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index ddb47dd190..2bd9dc4d9e 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/org-list.el @@ -2,7 +2,7 @@ ;; ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. ;; -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Bastien Guerry ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org @@ -601,25 +601,23 @@ Assume point is at an item." (beg-cell (cons (point) (current-indentation))) itm-lst itm-lst-2 end-lst end-lst-2 struct (assoc-at-point - (function - ;; Return association at point. - (lambda (ind) - (looking-at org-list-full-item-re) - (let ((bullet (match-string-no-properties 1))) - (list (point) - ind - bullet - (match-string-no-properties 2) ; counter - (match-string-no-properties 3) ; checkbox - ;; Description tag. - (and (string-match-p "[-+*]" bullet) - (match-string-no-properties 4))))))) + ;; Return association at point. + (lambda (ind) + (looking-at org-list-full-item-re) + (let ((bullet (match-string-no-properties 1))) + (list (point) + ind + bullet + (match-string-no-properties 2) ; counter + (match-string-no-properties 3) ; checkbox + ;; Description tag. + (and (string-match-p "[-+*]" bullet) + (match-string-no-properties 4)))))) (end-before-blank - (function - ;; Ensure list ends at the first blank line. - (lambda () - (skip-chars-backward " \r\t\n") - (min (1+ (point-at-eol)) lim-down))))) + ;; Ensure list ends at the first blank line. + (lambda () + (skip-chars-backward " \r\t\n") + (min (1+ (point-at-eol)) lim-down)))) ;; 1. Read list from starting item to its beginning, and save ;; top item position and indentation in BEG-CELL. Also store ;; ending position of items in END-LST. @@ -1004,23 +1002,22 @@ alist of ancestors, as returned by `org-list-parents-alist'. Return value is a list of integers. Counters have an impact on that value." (let ((get-relative-number - (function - (lambda (item struct prevs) - ;; Return relative sequence number of ITEM in the sub-list - ;; it belongs. STRUCT is the list structure. PREVS is - ;; the alist of previous items. - (let ((seq 0) (pos item) counter) - (while (and (not (setq counter (org-list-get-counter pos struct))) - (setq pos (org-list-get-prev-item pos struct prevs))) - (cl-incf seq)) - (if (not counter) (1+ seq) - (cond - ((string-match "[A-Za-z]" counter) - (+ (- (string-to-char (upcase (match-string 0 counter))) 64) - seq)) - ((string-match "[0-9]+" counter) - (+ (string-to-number (match-string 0 counter)) seq)) - (t (1+ seq))))))))) + (lambda (item struct prevs) + ;; Return relative sequence number of ITEM in the sub-list + ;; it belongs. STRUCT is the list structure. PREVS is + ;; the alist of previous items. + (let ((seq 0) (pos item) counter) + (while (and (not (setq counter (org-list-get-counter pos struct))) + (setq pos (org-list-get-prev-item pos struct prevs))) + (cl-incf seq)) + (if (not counter) (1+ seq) + (cond + ((string-match "[A-Za-z]" counter) + (+ (- (string-to-char (upcase (match-string 0 counter))) 64) + seq)) + ((string-match "[0-9]+" counter) + (+ (string-to-number (match-string 0 counter)) seq)) + (t (1+ seq)))))))) ;; Cons each parent relative number into return value (OUT). (let ((out (list (funcall get-relative-number item struct prevs))) (parent item)) @@ -1182,14 +1179,13 @@ some heuristics to guess the result." (cdr (assq 'plain-list-item org-blank-before-new-entry))) usr-blank (count-blanks - (function - (lambda () - ;; Count blank lines above beginning of line. - (save-excursion - (count-lines (goto-char (point-at-bol)) - (progn (skip-chars-backward " \r\t\n") - (forward-line) - (point)))))))) + (lambda () + ;; Count blank lines above beginning of line. + (save-excursion + (count-lines (goto-char (point-at-bol)) + (progn (skip-chars-backward " \r\t\n") + (forward-line) + (point))))))) (cond ;; Trivial cases where there should be none. ((not insert-blank-p) 0) @@ -1652,65 +1648,64 @@ PREVS is the alist of previous items, as returned by This function modifies STRUCT." (let ((case-fold-search nil) (fix-bul - (function - ;; Set bullet of ITEM in STRUCT, depending on the type of - ;; first item of the list, the previous bullet and counter - ;; if any. - (lambda (item) - (let* ((prev (org-list-get-prev-item item struct prevs)) - (prev-bul (and prev (org-list-get-bullet prev struct))) - (counter (org-list-get-counter item struct)) - (bullet (org-list-get-bullet item struct)) - (alphap (and (not prev) - (org-list-use-alpha-bul-p item struct prevs)))) - (org-list-set-bullet - item struct - (org-list-bullet-string - (cond - ;; Alpha counter in alpha list: use counter. - ((and prev counter - (string-match "[a-zA-Z]" counter) - (string-match "[a-zA-Z]" prev-bul)) - ;; Use cond to be sure `string-match' is used in - ;; both cases. - (let ((real-count - (cond - ((string-match "[a-z]" prev-bul) (downcase counter)) - ((string-match "[A-Z]" prev-bul) (upcase counter))))) - (replace-match real-count nil nil prev-bul))) - ;; Num counter in a num list: use counter. - ((and prev counter - (string-match "[0-9]+" counter) - (string-match "[0-9]+" prev-bul)) - (replace-match counter nil nil prev-bul)) - ;; No counter: increase, if needed, previous bullet. - (prev - (org-list-inc-bullet-maybe (org-list-get-bullet prev struct))) - ;; Alpha counter at first item: use counter. - ((and counter (org-list-use-alpha-bul-p item struct prevs) - (string-match "[A-Za-z]" counter) - (string-match "[A-Za-z]" bullet)) - (let ((real-count - (cond - ((string-match "[a-z]" bullet) (downcase counter)) - ((string-match "[A-Z]" bullet) (upcase counter))))) - (replace-match real-count nil nil bullet))) - ;; Num counter at first item: use counter. - ((and counter - (string-match "[0-9]+" counter) - (string-match "[0-9]+" bullet)) - (replace-match counter nil nil bullet)) - ;; First bullet is alpha uppercase: use "A". - ((and alphap (string-match "[A-Z]" bullet)) - (replace-match "A" nil nil bullet)) - ;; First bullet is alpha lowercase: use "a". - ((and alphap (string-match "[a-z]" bullet)) - (replace-match "a" nil nil bullet)) - ;; First bullet is num: use "1". - ((string-match "\\([0-9]+\\|[A-Za-z]\\)" bullet) - (replace-match "1" nil nil bullet)) - ;; Not an ordered list: keep bullet. - (t bullet))))))))) + ;; Set bullet of ITEM in STRUCT, depending on the type of + ;; first item of the list, the previous bullet and counter + ;; if any. + (lambda (item) + (let* ((prev (org-list-get-prev-item item struct prevs)) + (prev-bul (and prev (org-list-get-bullet prev struct))) + (counter (org-list-get-counter item struct)) + (bullet (org-list-get-bullet item struct)) + (alphap (and (not prev) + (org-list-use-alpha-bul-p item struct prevs)))) + (org-list-set-bullet + item struct + (org-list-bullet-string + (cond + ;; Alpha counter in alpha list: use counter. + ((and prev counter + (string-match "[a-zA-Z]" counter) + (string-match "[a-zA-Z]" prev-bul)) + ;; Use cond to be sure `string-match' is used in + ;; both cases. + (let ((real-count + (cond + ((string-match "[a-z]" prev-bul) (downcase counter)) + ((string-match "[A-Z]" prev-bul) (upcase counter))))) + (replace-match real-count nil nil prev-bul))) + ;; Num counter in a num list: use counter. + ((and prev counter + (string-match "[0-9]+" counter) + (string-match "[0-9]+" prev-bul)) + (replace-match counter nil nil prev-bul)) + ;; No counter: increase, if needed, previous bullet. + (prev + (org-list-inc-bullet-maybe (org-list-get-bullet prev struct))) + ;; Alpha counter at first item: use counter. + ((and counter (org-list-use-alpha-bul-p item struct prevs) + (string-match "[A-Za-z]" counter) + (string-match "[A-Za-z]" bullet)) + (let ((real-count + (cond + ((string-match "[a-z]" bullet) (downcase counter)) + ((string-match "[A-Z]" bullet) (upcase counter))))) + (replace-match real-count nil nil bullet))) + ;; Num counter at first item: use counter. + ((and counter + (string-match "[0-9]+" counter) + (string-match "[0-9]+" bullet)) + (replace-match counter nil nil bullet)) + ;; First bullet is alpha uppercase: use "A". + ((and alphap (string-match "[A-Z]" bullet)) + (replace-match "A" nil nil bullet)) + ;; First bullet is alpha lowercase: use "a". + ((and alphap (string-match "[a-z]" bullet)) + (replace-match "a" nil nil bullet)) + ;; First bullet is num: use "1". + ((string-match "\\([0-9]+\\|[A-Za-z]\\)" bullet) + (replace-match "1" nil nil bullet)) + ;; Not an ordered list: keep bullet. + (t bullet)))))))) (mapc fix-bul (mapcar #'car struct)))) (defun org-list-struct-fix-ind (struct parents &optional bullet-size) @@ -1756,21 +1751,20 @@ all others cases, the return value will be nil. This function modifies STRUCT." (let ((all-items (mapcar #'car struct)) (set-parent-box - (function - (lambda (item) - (let* ((box-list - (mapcar (lambda (child) - (org-list-get-checkbox child struct)) - (org-list-get-children item struct parents)))) - (org-list-set-checkbox - item struct - (cond - ((and (member "[ ]" box-list) (member "[X]" box-list)) "[-]") - ((member "[-]" box-list) "[-]") - ((member "[X]" box-list) "[X]") - ((member "[ ]" box-list) "[ ]") - ;; Parent has no boxed child: leave box as-is. - (t (org-list-get-checkbox item struct)))))))) + (lambda (item) + (let* ((box-list + (mapcar (lambda (child) + (org-list-get-checkbox child struct)) + (org-list-get-children item struct parents)))) + (org-list-set-checkbox + item struct + (cond + ((and (member "[ ]" box-list) (member "[X]" box-list)) "[-]") + ((member "[-]" box-list) "[-]") + ((member "[X]" box-list) "[X]") + ((member "[ ]" box-list) "[ ]") + ;; Parent has no boxed child: leave box as-is. + (t (org-list-get-checkbox item struct))))))) parent-list) ;; 1. List all parents with a checkbox. (mapc @@ -1841,56 +1835,54 @@ Initial position of cursor is restored after the changes." (org-inlinetask-outline-regexp))) (item-re (org-item-re)) (shift-body-ind - (function - ;; Shift the indentation between END and BEG by DELTA. - ;; Start from the line before END. - (lambda (end beg delta) - (goto-char end) - (skip-chars-backward " \r\t\n") - (beginning-of-line) - (while (or (> (point) beg) - (and (= (point) beg) - (not (looking-at item-re)))) - (cond - ;; Skip inline tasks. - ((and inlinetask-re (looking-at inlinetask-re)) - (org-inlinetask-goto-beginning)) - ;; Shift only non-empty lines. - ((looking-at-p "^[ \t]*\\S-") - (indent-line-to (+ (current-indentation) delta)))) - (forward-line -1))))) - (modify-item - (function - ;; Replace ITEM first line elements with new elements from - ;; STRUCT, if appropriate. - (lambda (item) - (goto-char item) - (let* ((new-ind (org-list-get-ind item struct)) - (old-ind (current-indentation)) - (new-bul (org-list-bullet-string - (org-list-get-bullet item struct))) - (old-bul (org-list-get-bullet item old-struct)) - (new-box (org-list-get-checkbox item struct))) - (looking-at org-list-full-item-re) - ;; a. Replace bullet - (unless (equal old-bul new-bul) - (replace-match new-bul nil nil nil 1)) - ;; b. Replace checkbox. - (cond - ((equal (match-string 3) new-box)) - ((and (match-string 3) new-box) - (replace-match new-box nil nil nil 3)) - ((match-string 3) - (looking-at ".*?\\([ \t]*\\[[ X-]\\]\\)") - (replace-match "" nil nil nil 1)) - (t (let ((counterp (match-end 2))) - (goto-char (if counterp (1+ counterp) (match-end 1))) - (insert (concat new-box (unless counterp " ")))))) - ;; c. Indent item to appropriate column. - (unless (= new-ind old-ind) - (delete-region (goto-char (point-at-bol)) - (progn (skip-chars-forward " \t") (point))) - (indent-to new-ind))))))) + ;; Shift the indentation between END and BEG by DELTA. + ;; Start from the line before END. + (lambda (end beg delta) + (goto-char end) + (skip-chars-backward " \r\t\n") + (beginning-of-line) + (while (or (> (point) beg) + (and (= (point) beg) + (not (looking-at item-re)))) + (cond + ;; Skip inline tasks. + ((and inlinetask-re (looking-at inlinetask-re)) + (org-inlinetask-goto-beginning)) + ;; Shift only non-empty lines. + ((looking-at-p "^[ \t]*\\S-") + (indent-line-to (+ (current-indentation) delta)))) + (forward-line -1)))) + (modify-item + ;; Replace ITEM first line elements with new elements from + ;; STRUCT, if appropriate. + (lambda (item) + (goto-char item) + (let* ((new-ind (org-list-get-ind item struct)) + (old-ind (current-indentation)) + (new-bul (org-list-bullet-string + (org-list-get-bullet item struct))) + (old-bul (org-list-get-bullet item old-struct)) + (new-box (org-list-get-checkbox item struct))) + (looking-at org-list-full-item-re) + ;; a. Replace bullet + (unless (equal old-bul new-bul) + (replace-match new-bul nil nil nil 1)) + ;; b. Replace checkbox. + (cond + ((equal (match-string 3) new-box)) + ((and (match-string 3) new-box) + (replace-match new-box nil nil nil 3)) + ((match-string 3) + (looking-at ".*?\\([ \t]*\\[[ X-]\\]\\)") + (replace-match "" nil nil nil 1)) + (t (let ((counterp (match-end 2))) + (goto-char (if counterp (1+ counterp) (match-end 1))) + (insert (concat new-box (unless counterp " ")))))) + ;; c. Indent item to appropriate column. + (unless (= new-ind old-ind) + (delete-region (goto-char (point-at-bol)) + (progn (skip-chars-forward " \t") (point))) + (indent-to new-ind)))))) ;; 1. First get list of items and position endings. We maintain ;; two alists: ITM-SHIFT, determining indentation shift needed ;; at item, and END-LIST, a pseudo-alist where key is ending @@ -2484,10 +2476,10 @@ With optional prefix argument ALL, do this for the whole buffer." (let* ((cookie-re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)") (box-re "^[ \t]*\\([-+*]\\|\\([0-9]+\\|[A-Za-z]\\)[.)]\\)[ \t]+\ \\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?\\(\\[[- X]\\]\\)") + (cookie-data (or (org-entry-get nil "COOKIE_DATA") "")) (recursivep (or (not org-checkbox-hierarchical-statistics) - (string-match "\\" - (or (org-entry-get nil "COOKIE_DATA") "")))) + (string-match-p "\\" cookie-data))) (within-inlinetask (and (not all) (featurep 'org-inlinetask) (org-inlinetask-in-task-p))) @@ -2533,7 +2525,8 @@ With optional prefix argument ALL, do this for the whole buffer." (while (re-search-forward cookie-re end t) (let ((context (save-excursion (backward-char) (save-match-data (org-element-context))))) - (when (eq (org-element-type context) 'statistics-cookie) + (when (and (eq (org-element-type context) 'statistics-cookie) + (not (string-match-p "\\" cookie-data))) (push (append (list (match-beginning 1) (match-end 1) (match-end 2)) diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el index f914a33d61..b8d3373418 100644 --- a/lisp/org/org-macro.el +++ b/lisp/org/org-macro.el @@ -30,7 +30,7 @@ ;; `org-macro-initialize-templates', which recursively calls ;; `org-macro--collect-macros' in order to read setup files. -;; Argument in macros are separated with commas. Proper escaping rules +;; Argument in macros are separated with commas. Proper escaping rules ;; are implemented in `org-macro-escape-arguments' and arguments can ;; be extracted from a string with `org-macro-extract-arguments'. @@ -61,7 +61,6 @@ (declare-function org-element-type "org-element" (element)) (declare-function org-entry-get "org" (pom property &optional inherit literal-nil)) (declare-function org-file-contents "org" (file &optional noerror nocache)) -(declare-function org-file-url-p "org" (file)) (declare-function org-in-commented-heading-p "org" (&optional no-inheritance)) (declare-function org-link-search "ol" (s &optional avoid-pos stealth)) (declare-function org-mode "org" ()) @@ -84,42 +83,67 @@ directly, use instead: ;;; Functions -(defun org-macro--set-template (name value templates) +(defun org-macro--makeargs (template) + "Compute the formal arglist to use for TEMPLATE." + (let ((max 0) (i 0)) + (while (string-match "\\$\\([0-9]+\\)" template i) + (setq i (match-end 0)) + (setq max (max max (string-to-number (match-string 1 template))))) + (let ((args '(&rest _))) + (if (< max 1) args ;Avoid `&optional &rest', refused by Emacs-26! + (while (> max 0) + (push (intern (format "$%d" max)) args) + (setq max (1- max))) + (cons '&optional args))))) + +(defun org-macro--set-templates (templates) "Set template for the macro NAME. VALUE is the template of the macro. The new value override the -previous one, unless VALUE is nil. TEMPLATES is the list of -templates. Return the updated list." - (let ((old-definition (assoc name templates))) - (cond ((and value old-definition) (setcdr old-definition value)) - (old-definition) - (t (push (cons name (or value "")) templates)))) - templates) +previous one, unless VALUE is nil. Return the updated list." + (let ((new-templates nil)) + (pcase-dolist (`(,name . ,value) templates) + (let ((old-definition (assoc name new-templates))) + (when (and (stringp value) (string-match-p "\\`(eval\\>" value)) + ;; Pre-process the evaluation form for faster macro expansion. + (let* ((args (org-macro--makeargs value)) + (body + (condition-case nil + ;; `value' is of the form "(eval ...)" but we + ;; don't want this to mean to pass the result to + ;; `eval' (which would cause double evaluation), + ;; so we strip the `eval' away with `cadr'. + (cadr (read value)) + (error + (user-error "Invalid definition for macro %S" name))))) + (setq value (eval (macroexpand-all `(lambda ,args ,body)) t)))) + (cond ((and value old-definition) (setcdr old-definition value)) + (old-definition) + (t (push (cons name (or value "")) new-templates))))) + new-templates)) (defun org-macro--collect-macros () "Collect macro definitions in current buffer and setup files. Return an alist containing all macro templates found." - (let ((templates nil)) + (let ((templates + `(("author" . ,(org-macro--find-keyword-value "AUTHOR")) + ("email" . ,(org-macro--find-keyword-value "EMAIL")) + ("title" . ,(org-macro--find-keyword-value "TITLE" t)) + ("date" . ,(org-macro--find-date))))) (pcase (org-collect-keywords '("MACRO")) (`(("MACRO" . ,values)) (dolist (value values) (when (string-match "^\\(\\S-+\\)[ \t]*" value) (let ((name (match-string 1 value)) (definition (substring value (match-end 0)))) - (setq templates - (org-macro--set-template name definition templates))))))) - (let ((macros `(("author" . ,(org-macro--find-keyword-value "AUTHOR")) - ("email" . ,(org-macro--find-keyword-value "EMAIL")) - ("title" . ,(org-macro--find-keyword-value "TITLE" t)) - ("date" . ,(org-macro--find-date))))) - (pcase-dolist (`(,name . ,value) macros) - (setq templates (org-macro--set-template name value templates)))) + (push (cons name definition) templates)))))) templates)) -(defun org-macro-initialize-templates () +(defun org-macro-initialize-templates (&optional default) "Collect macro templates defined in current buffer. -Templates are stored in buffer-local variable -`org-macro-templates'. +DEFAULT is a list of globally available templates. + +Templates are stored in buffer-local variable `org-macro-templates'. In addition to buffer-defined macros, the function installs the following ones: \"n\", \"author\", \"email\", \"keyword\", @@ -129,8 +153,9 @@ a file, \"input-file\" and \"modification-time\"." (org-macro--counter-initialize) ;for "n" macro (setq org-macro-templates (nconc - ;; Install user-defined macros. - (org-macro--collect-macros) + ;; Install user-defined macros. Local macros have higher + ;; precedence than global ones. + (org-macro--set-templates (append default (org-macro--collect-macros))) ;; Install file-specific macros. (let ((visited-file (buffer-file-name (buffer-base-buffer)))) (and visited-file @@ -138,21 +163,23 @@ a file, \"input-file\" and \"modification-time\"." (list `("input-file" . ,(file-name-nondirectory visited-file)) `("modification-time" . - ,(format "(eval -\(format-time-string $1 - (or (and (org-string-nw-p $2) - (org-macro--vc-modified-time %s)) - '%s)))" - (prin1-to-string visited-file) - (prin1-to-string - (file-attribute-modification-time - (file-attributes visited-file)))))))) + ,(let ((modtime (file-attribute-modification-time + (file-attributes visited-file)))) + (lambda (arg1 &optional arg2 &rest _) + (format-time-string + arg1 + (or (and (org-string-nw-p arg2) + (org-macro--vc-modified-time visited-file)) + modtime)))))))) ;; Install generic macros. - (list - '("n" . "(eval (org-macro--counter-increment $1 $2))") - '("keyword" . "(eval (org-macro--find-keyword-value $1))") - '("time" . "(eval (format-time-string $1))") - '("property" . "(eval (org-macro--get-property $1 $2))"))))) + '(("keyword" . (lambda (arg1 &rest _) + (org-macro--find-keyword-value arg1))) + ("n" . (lambda (&optional arg1 arg2 &rest _) + (org-macro--counter-increment arg1 arg2))) + ("property" . (lambda (arg1 &optional arg2 &rest _) + (org-macro--get-property arg1 arg2))) + ("time" . (lambda (arg1 &rest _) + (format-time-string arg1))))))) (defun org-macro-expand (macro templates) "Return expanded MACRO, as a string. @@ -164,21 +191,17 @@ default value. Return nil if no template was found." ;; Macro names are case-insensitive. (cdr (assoc-string (org-element-property :key macro) templates t)))) (when template - (let* ((eval? (string-match-p "\\`(eval\\>" template)) - (value - (replace-regexp-in-string - "\\$[0-9]+" - (lambda (m) - (let ((arg (or (nth (1- (string-to-number (substring m 1))) - (org-element-property :args macro)) - ;; No argument: remove place-holder. - ""))) - ;; `eval' implies arguments are strings. - (if eval? (format "%S" arg) arg))) - template nil 'literal))) - (when eval? - (setq value (eval (condition-case nil (read value) - (error (debug)))))) + (let* ((value + (if (functionp template) + (apply template (org-element-property :args macro)) + (replace-regexp-in-string + "\\$[0-9]+" + (lambda (m) + (or (nth (1- (string-to-number (substring m 1))) + (org-element-property :args macro)) + ;; No argument: remove place-holder. + "")) + template nil 'literal)))) ;; Force return value to be a string. (format "%s" (or value "")))))) @@ -380,7 +403,7 @@ value, i.e. do not increment. If the string represents an integer, set the counter to this number. Any other non-empty string resets the counter to 1." - (let ((name-trimmed (org-trim name)) + (let ((name-trimmed (if (stringp name) (org-trim name) "")) (action-trimmed (when (org-string-nw-p action) (org-trim action)))) (puthash name-trimmed diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index 58d3fd3992..a8fb79ea3c 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; @@ -39,6 +39,7 @@ (declare-function org-string-collate-lessp "org-compat" (s1 s2 &optional locale ignore-case)) (defvar org-ts-regexp0) +(defvar ffap-url-regexp) ;;; Macros @@ -172,7 +173,7 @@ because otherwise all these markers will point to nowhere." ,@body))) (defmacro org-eval-in-environment (environment form) - (declare (debug (form form)) (indent 1)) + (declare (debug (form form)) (indent 1) (obsolete cl-progv "2021")) `(eval (list 'let ,environment ',form))) ;;;###autoload @@ -208,7 +209,7 @@ because otherwise all these markers will point to nowhere." (defmacro org-no-popups (&rest body) "Suppress popup windows and evaluate BODY." - `(let (pop-up-frames display-buffer-alist) + `(let (pop-up-frames pop-up-windows) ,@body)) @@ -366,15 +367,17 @@ error when the user input is empty." (allow-empty? nil) (t (user-error "Empty input is not valid"))))) +(declare-function org-time-stamp-inactive "org" (&optional arg)) + (defun org-completing-read (&rest args) "Completing-read with SPACE being a normal character." (let ((enable-recursive-minibuffers t) (minibuffer-local-completion-map (copy-keymap minibuffer-local-completion-map))) - (define-key minibuffer-local-completion-map " " 'self-insert-command) - (define-key minibuffer-local-completion-map "?" 'self-insert-command) + (define-key minibuffer-local-completion-map " " #'self-insert-command) + (define-key minibuffer-local-completion-map "?" #'self-insert-command) (define-key minibuffer-local-completion-map (kbd "C-c !") - 'org-time-stamp-inactive) + #'org-time-stamp-inactive) (apply #'completing-read args))) (defun org--mks-read-key (allowed-keys prompt navigation-keys) @@ -470,8 +473,8 @@ is selected, only the bare key is returned." (goto-char (point-min)) (org-fit-window-to-buffer) (message "") ; With this line the prompt appears in - ; the minibuffer. Else keystrokes may - ; appear, which is spurious. + ; the minibuffer. Else keystrokes may + ; appear, which is spurious. (let ((pressed (org--mks-read-key allowed-keys prompt (not (pos-visible-in-window-p (1- (point-max))))))) @@ -535,6 +538,11 @@ that may remove elements by altering the list structure." (setq list (delete (pop elts) list))) list) +(defun org-plist-delete-all (plist props) + "Delete all elements in PROPS from PLIST." + (dolist (e props plist) + (setq plist (org-plist-delete plist e)))) + (defun org-plist-delete (plist property) "Delete PROPERTY from PLIST. This is in contrast to merely setting it to 0." @@ -627,6 +635,30 @@ program is needed for, so that the error message can be more informative." (let ((message-log-max nil)) (apply #'message args))) +(defmacro org-dlet (binders &rest body) + "Like `let*' but using dynamic scoping." + (declare (indent 1) (debug let)) + (let ((vars (mapcar (lambda (binder) + (if (consp binder) (car binder) binder)) + binders))) + `(progn + (with-no-warnings + ,@(mapcar (lambda (var) `(defvar ,var)) vars)) + (let* ,binders ,@body)))) + +(defmacro org-pushnew-to-end (val var) + "Like `cl-pushnew' but pushes to the end of the list. +Uses `equal' for comparisons. + +Beware: this performs O(N) memory allocations, so if you use it in a loop, you +get an unnecessary O(N²) space complexity, so you're usually better off using +`cl-pushnew' (with a final `reverse' if you care about the order of elements)." + (declare (debug (form gv-place))) + (let ((v (make-symbol "v"))) + `(let ((,v ,val)) + (unless (member ,v ,var) + (setf ,var (append ,var (list ,v))))))) + (defun org-eval (form) "Eval FORM and return result." (condition-case error @@ -781,6 +813,10 @@ return nil." (list context (match-beginning group) (match-end group)) t))) +(defun org-url-p (s) + "Non-nil if string S is a URL." + (require 'ffap) + (and ffap-url-regexp (string-match-p ffap-url-regexp s))) ;;; String manipulation @@ -975,7 +1011,7 @@ IF WIDTH is nil and LINES is non-nil, the string is forced into at most that many lines, whatever width that takes. The return value is a list of lines, without newlines at the end." (let* ((words (split-string string)) - (maxword (apply 'max (mapcar 'org-string-width words))) + (maxword (apply #'max (mapcar #'org-string-width words))) w ll) (cond (width (org--do-wrap words (max maxword width))) @@ -1072,10 +1108,11 @@ that will be added to PLIST. Returns the string that was modified." string) (defun org-make-parameter-alist (flat) + ;; FIXME: "flat" is called a "plist"! "Return alist based on FLAT. FLAT is a list with alternating symbol names and values. The returned alist is a list of lists with the symbol name in car and -the value in cdr." +the value in cadr." (when flat (cons (list (car flat) (cadr flat)) (org-make-parameter-alist (cddr flat))))) @@ -1122,13 +1159,13 @@ move it back by one char before doing this check." (org-invisible-p))) (defun org-find-visible () - "Return closest visible buffer position, or `point-max'" + "Return closest visible buffer position, or `point-max'." (if (org-invisible-p) (next-single-char-property-change (point) 'invisible) (point))) (defun org-find-invisible () - "Return closest invisible buffer position, or `point-max'" + "Return closest invisible buffer position, or `point-max'." (if (org-invisible-p) (point) (next-single-char-property-change (point) 'invisible))) @@ -1221,10 +1258,11 @@ Return 0. if S is not recognized as a valid value." ((string= s "") (+ 86400.0 today)) ((string= s "") (- today 86400.0)) ((string-match "\\`<\\([-+][0-9]+\\)\\([hdwmy]\\)>\\'" s) - (+ today + (+ (if (string= (match-string 2 s) "h") (float-time) today) (* (string-to-number (match-string 1 s)) (cdr (assoc (match-string 2 s) - '(("d" . 86400.0) ("w" . 604800.0) + '(("h" . 3600.0) + ("d" . 86400.0) ("w" . 604800.0) ("m" . 2678400.0) ("y" . 31557600.0))))))) ((string-match org-ts-regexp0 s) (org-2ft s)) (t 0.))))) @@ -1238,13 +1276,13 @@ window." (scrldn (if additional-keys `(?\d ?\M-v) ?\M-v))) (pcase key (?\C-n (if (not (pos-visible-in-window-p (point-max))) - (ignore-errors (scroll-up 1)) - (message "End of buffer") - (sit-for 1))) + (ignore-errors (scroll-up 1)) + (message "End of buffer") + (sit-for 1))) (?\C-p (if (not (pos-visible-in-window-p (point-min))) - (ignore-errors (scroll-down 1)) - (message "Beginning of buffer") - (sit-for 1))) + (ignore-errors (scroll-down 1)) + (message "Beginning of buffer") + (sit-for 1))) ;; SPC or ((guard (memq key scrlup)) (if (not (pos-visible-in-window-p (point-max))) diff --git a/lisp/org/org-mobile.el b/lisp/org/org-mobile.el index a64e0a274a..e51258af05 100644 --- a/lisp/org/org-mobile.el +++ b/lisp/org/org-mobile.el @@ -1,7 +1,7 @@ ;;; org-mobile.el --- Code for Asymmetric Sync With a Mobile Device -*- lexical-binding: t; -*- ;; Copyright (C) 2009-2021 Free Software Foundation, Inc. ;; -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el index 57281dd68c..a35a19bca6 100644 --- a/lisp/org/org-mouse.el +++ b/lisp/org/org-mouse.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2006-2021 Free Software Foundation, Inc. ;; Author: Piotr Zielinski -;; Maintainer: Carsten Dominik +;; Maintainer: Carsten Dominik ;; This file is part of GNU Emacs. @@ -161,7 +161,7 @@ it is intended to operate on. If nil, then the action has been invoked indirectly, for example, through the agenda buffer.") (defgroup org-mouse nil - "Mouse support for org-mode." + "Mouse support for `org-mode'." :tag "Org Mouse" :group 'org) @@ -220,7 +220,7 @@ this function is called. Otherwise, the current major mode menu is used." (if (fboundp 'mouse-menu-major-mode-map) (popup-menu (mouse-menu-major-mode-map) event prefix) (with-no-warnings ; don't warn about fallback, obsolete since 23.1 - (mouse-major-mode-menu event prefix))))) + (mouse-major-mode-menu event prefix))))) (setq this-command 'mouse-save-then-kill) (mouse-save-then-kill event))) @@ -291,18 +291,18 @@ string to (format ITEMFORMAT keyword). If it is neither a string nor a function, elements of KEYWORDS are used directly." (mapcar (lambda (keyword) - (vector (cond - ((functionp itemformat) (funcall itemformat keyword)) - ((stringp itemformat) (format itemformat keyword)) - (t keyword)) - (list 'funcall function keyword) - :style (cond - ((null selected) t) - ((functionp selected) 'toggle) - (t 'radio)) - :selected (if (functionp selected) - (and (funcall selected keyword) t) - (equal selected keyword)))) + (vector (cond + ((functionp itemformat) (funcall itemformat keyword)) + ((stringp itemformat) (format itemformat keyword)) + (t keyword)) + (list 'funcall function keyword) + :style (cond + ((null selected) t) + ((functionp selected) 'toggle) + (t 'radio)) + :selected (if (functionp selected) + (and (funcall selected keyword) t) + (equal selected keyword)))) keywords)) (defun org-mouse-remove-match-and-spaces () @@ -424,11 +424,11 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" (org-mouse-keyword-menu (sort (mapcar #'car (org-get-buffer-tags)) #'string-lessp) (lambda (tag) - (org-mouse-set-tags - (sort (if (member tag tags) - (delete tag tags) - (cons tag tags)) - #'string-lessp))) + (org-mouse-set-tags + (sort (if (member tag tags) + (delete tag tags) + (cons tag tags)) + #'string-lessp))) (lambda (tag) (member tag tags)) )) '("--" @@ -499,7 +499,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" ("Check Tags" ,@(org-mouse-keyword-menu (sort (mapcar #'car (org-get-buffer-tags)) #'string-lessp) - #'(lambda (tag) (org-tags-sparse-tree nil tag))) + (lambda (tag) (org-tags-sparse-tree nil tag))) "--" ["Custom Tag ..." org-tags-sparse-tree t]) ["Check Phrase ..." org-occur] @@ -509,26 +509,26 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" ("Display Tags" ,@(org-mouse-keyword-menu (sort (mapcar #'car (org-get-buffer-tags)) #'string-lessp) - #'(lambda (tag) (org-tags-view nil tag))) + (lambda (tag) (org-tags-view nil tag))) "--" ["Custom Tag ..." org-tags-view t]) ["Display Calendar" org-goto-calendar t] "--" ,@(org-mouse-keyword-menu (mapcar #'car org-agenda-custom-commands) - #'(lambda (key) - (org-agenda nil (string-to-char key))) + (lambda (key) + (org-agenda nil (string-to-char key))) nil - #'(lambda (key) - (let ((entry (assoc key org-agenda-custom-commands))) - (org-mouse-clip-text - (cond - ((stringp (nth 1 entry)) (nth 1 entry)) - ((stringp (nth 2 entry)) - (concat (org-mouse-agenda-type (nth 1 entry)) - (nth 2 entry))) - (t "Agenda Command `%s'")) - 30)))) + (lambda (key) + (let ((entry (assoc key org-agenda-custom-commands))) + (org-mouse-clip-text + (cond + ((stringp (nth 1 entry)) (nth 1 entry)) + ((stringp (nth 2 entry)) + (concat (org-mouse-agenda-type (nth 1 entry)) + (nth 2 entry))) + (t "Agenda Command `%s'")) + 30)))) "--" ["Delete Blank Lines" delete-blank-lines :visible (org-mouse-empty-line)] @@ -793,8 +793,8 @@ This means, between the beginning of line and the point." ("Tags and Priorities" ,@(org-mouse-keyword-menu (org-mouse-priority-list) - #'(lambda (keyword) - (org-mouse-set-priority (string-to-char keyword))) + (lambda (keyword) + (org-mouse-set-priority (string-to-char keyword))) priority "Priority %s") "--" ,@(org-mouse-tag-menu)) @@ -854,55 +854,55 @@ This means, between the beginning of line and the point." (mouse-drag-region event))) (add-hook 'org-mode-hook - #'(lambda () - (setq org-mouse-context-menu-function #'org-mouse-context-menu) - - (when (memq 'context-menu org-mouse-features) - (org-defkey org-mouse-map [mouse-3] nil) - (org-defkey org-mode-map [mouse-3] #'org-mouse-show-context-menu)) - (org-defkey org-mode-map [down-mouse-1] #'org-mouse-down-mouse) - (when (memq 'context-menu org-mouse-features) - (org-defkey org-mouse-map [C-drag-mouse-1] #'org-mouse-move-tree) - (org-defkey org-mouse-map [C-down-mouse-1] #'org-mouse-move-tree-start)) - (when (memq 'yank-link org-mouse-features) - (org-defkey org-mode-map [S-mouse-2] #'org-mouse-yank-link) - (org-defkey org-mode-map [drag-mouse-3] #'org-mouse-yank-link)) - (when (memq 'move-tree org-mouse-features) - (org-defkey org-mouse-map [drag-mouse-3] #'org-mouse-move-tree) - (org-defkey org-mouse-map [down-mouse-3] #'org-mouse-move-tree-start)) - - (when (memq 'activate-stars org-mouse-features) - (font-lock-add-keywords - nil - `((,org-outline-regexp - 0 `(face org-link mouse-face highlight keymap ,org-mouse-map) - 'prepend)) - t)) - - (when (memq 'activate-bullets org-mouse-features) - (font-lock-add-keywords - nil - `(("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +" - (1 `(face org-link keymap ,org-mouse-map mouse-face highlight) - 'prepend))) - t)) - - (when (memq 'activate-checkboxes org-mouse-features) - (font-lock-add-keywords - nil - `(("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[ X]\\]\\)" - (2 `(face bold keymap ,org-mouse-map mouse-face highlight) t))) - t)) - - (defadvice org-open-at-point (around org-mouse-open-at-point activate) - (let ((context (org-context))) - (cond - ((assq :headline-stars context) (org-cycle)) - ((assq :checkbox context) (org-toggle-checkbox)) - ((assq :item-bullet context) - (let ((org-cycle-include-plain-lists t)) (org-cycle))) - ((org-footnote-at-reference-p) nil) - (t ad-do-it)))))) + (lambda () + (setq org-mouse-context-menu-function #'org-mouse-context-menu) + + (when (memq 'context-menu org-mouse-features) + (org-defkey org-mouse-map [mouse-3] nil) + (org-defkey org-mode-map [mouse-3] #'org-mouse-show-context-menu)) + (org-defkey org-mode-map [down-mouse-1] #'org-mouse-down-mouse) + (when (memq 'context-menu org-mouse-features) + (org-defkey org-mouse-map [C-drag-mouse-1] #'org-mouse-move-tree) + (org-defkey org-mouse-map [C-down-mouse-1] #'org-mouse-move-tree-start)) + (when (memq 'yank-link org-mouse-features) + (org-defkey org-mode-map [S-mouse-2] #'org-mouse-yank-link) + (org-defkey org-mode-map [drag-mouse-3] #'org-mouse-yank-link)) + (when (memq 'move-tree org-mouse-features) + (org-defkey org-mouse-map [drag-mouse-3] #'org-mouse-move-tree) + (org-defkey org-mouse-map [down-mouse-3] #'org-mouse-move-tree-start)) + + (when (memq 'activate-stars org-mouse-features) + (font-lock-add-keywords + nil + `((,org-outline-regexp + 0 `(face org-link mouse-face highlight keymap ,org-mouse-map) + 'prepend)) + t)) + + (when (memq 'activate-bullets org-mouse-features) + (font-lock-add-keywords + nil + `(("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +" + (1 `(face org-link keymap ,org-mouse-map mouse-face highlight) + 'prepend))) + t)) + + (when (memq 'activate-checkboxes org-mouse-features) + (font-lock-add-keywords + nil + `(("^[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\)[ \t]+\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\(\\[[- X]\\]\\)" + (1 `(face nil keymap ,org-mouse-map mouse-face highlight) prepend))) + t)) + + (defadvice org-open-at-point (around org-mouse-open-at-point activate) + (let ((context (org-context))) + (cond + ((assq :headline-stars context) (org-cycle)) + ((assq :checkbox context) (org-toggle-checkbox)) + ((assq :item-bullet context) + (let ((org-cycle-include-plain-lists t)) (org-cycle))) + ((org-footnote-at-reference-p) nil) + (t ad-do-it)))))) (defun org-mouse-move-tree-start (_event) (interactive "e") diff --git a/lisp/org/org-num.el b/lisp/org/org-num.el index ebddaa32b4..408b86ff41 100644 --- a/lisp/org/org-num.el +++ b/lisp/org/org-num.el @@ -29,8 +29,8 @@ ;; to toggle it. ;; ;; You can select what is numbered according to level, tags, COMMENT -;; keyword, or UNNUMBERED property. You can also skip footnotes -;; sections. See `org-num-max-level', `org-num-skip-tags', +;; keyword, or UNNUMBERED property. You can also skip footnotes +;; sections. See `org-num-max-level', `org-num-skip-tags', ;; `org-num-skip-commented', `org-num-skip-unnumbered', and ;; `org-num-skip-footnotes' for details. ;; @@ -63,6 +63,7 @@ (require 'cl-lib) (require 'org-macs) +(require 'org) ;Otherwise `org-num--comment-re' burps on `org-comment-string' (defvar org-comment-string) (defvar org-complex-heading-regexp) @@ -90,7 +91,7 @@ output." (face :tag "Use face")) :safe (lambda (val) (or (null val) (facep val)))) -(defcustom org-num-format-function 'org-num-default-format +(defcustom org-num-format-function #'org-num-default-format "Function used to display numbering. It is called with one argument, a list of numbers, and should return a string, or nil. When nil, no numbering is displayed. diff --git a/lisp/org/org-pcomplete.el b/lisp/org/org-pcomplete.el index d8a4937b95..b31dc333fd 100644 --- a/lisp/org/org-pcomplete.el +++ b/lisp/org/org-pcomplete.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. ;; -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; John Wiegley ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org @@ -21,8 +21,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; + ;;; Code: ;;;; Require other packages @@ -186,7 +185,7 @@ When completing for #+STARTUP, for example, this function returns (cons (reverse args) (reverse begins)))))) (defun org-pcomplete-initial () - "Calls the right completion function for first argument completions." + "Call the right completion function for first argument completions." (ignore (funcall (or (pcomplete-find-completion-function (car (org-thing-at-point))) diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el index 4ac15b379d..63176fce15 100644 --- a/lisp/org/org-plot.el +++ b/lisp/org/org-plot.el @@ -51,19 +51,28 @@ "Parse an OPTIONS line and set values in the property list P. Returns the resulting property list." (when options - (let ((op '(("type" . :plot-type) - ("script" . :script) - ("line" . :line) - ("set" . :set) - ("title" . :title) - ("ind" . :ind) - ("deps" . :deps) - ("with" . :with) - ("file" . :file) - ("labels" . :labels) - ("map" . :map) - ("timeind" . :timeind) - ("timefmt" . :timefmt))) + (let ((op '(("type" . :plot-type) + ("script" . :script) + ("line" . :line) + ("set" . :set) + ("title" . :title) + ("ind" . :ind) + ("deps" . :deps) + ("with" . :with) + ("file" . :file) + ("labels" . :labels) + ("map" . :map) + ("timeind" . :timeind) + ("timefmt" . :timefmt) + ("min" . :ymin) + ("ymin" . :ymin) + ("max" . :ymax) + ("ymax" . :ymax) + ("xmin" . :xmin) + ("xmax" . :xmax) + ("ticks" . :ticks) + ("trans" . :transpose) + ("transpose" . :transpose))) (multiples '("set" "line")) (regexp ":\\([\"][^\"]+?[\"]\\|[(][^)]+?[)]\\|[^ \t\n\r;,.]*\\)") (start 0)) @@ -180,94 +189,440 @@ and dependent variables." (setf back-edge "") (setf front-edge "")))) row-vals)) -(defun org-plot/gnuplot-script (data-file num-cols params &optional preface) - "Write a gnuplot script to DATA-FILE respecting the options set in PARAMS. +(defun org--plot/values-stats (nums &optional hard-min hard-max) + "Rudimentary statistics about NUMS, useful for guessing axis ticks. +If HARD-MIN or HARD-MAX are set, they will be used instead of the min/max +of the NUMS." + (let* ((minimum (or hard-min (apply #'min nums))) + (maximum (or hard-max (apply #'max nums))) + (range (- maximum minimum)) + (rangeOrder (if (= range 0) 0 + (ceiling (- 1 (log range 10))))) + (range-factor (expt 10 rangeOrder)) + (nice-min (if (= range 0) (car nums) + (/ (float (floor (* minimum range-factor))) range-factor))) + (nice-max (if (= range 0) (car nums) + (/ (float (ceiling (* maximum range-factor))) range-factor)))) + `(:min ,minimum :max ,maximum :range ,range + :range-factor ,range-factor + :nice-min ,nice-min :nice-max ,nice-max :nice-range ,(- nice-max nice-min)))) + +(defun org--plot/sensible-tick-num (table &optional hard-min hard-max) + "From a the values in a TABLE of data, guess an appropriate number of ticks. +If HARD-MIN and HARD-MAX can be used to fix the ends of the axis." + (let* ((row-data + (mapcar (lambda (row) (org--plot/values-stats + (mapcar #'string-to-number (cdr row)) + hard-min + hard-max)) table)) + (row-normalised-ranges (mapcar (lambda (r-data) + (let ((val (round (* + (plist-get r-data :range-factor) + (plist-get r-data :nice-range))))) + (if (= (% val 10) 0) (/ val 10) val))) + row-data)) + (range-prime-decomposition (mapcar #'org--plot/prime-factors row-normalised-ranges)) + (weighted-factors (sort (apply #'org--plot/merge-alists #'+ 0 + (mapcar (lambda (factors) (org--plot/item-frequencies factors t)) + range-prime-decomposition)) + (lambda (a b) (> (cdr a) (cdr b)))))) + (apply #'* (org--plot/nice-frequency-pick weighted-factors)))) + +(defun org--plot/nice-frequency-pick (frequencies) + "From a list of FREQUENCIES, try to sensibly pick a sample of the most frequent." + ;; TODO this mosly works decently, but could do with some tweaking to work more consistently. + (cl-case (length frequencies) + (1 (list (car (nth 0 frequencies)))) + (2 (if (<= 3 (/ (cdr (nth 0 frequencies)) + (cdr (nth 1 frequencies)))) + (make-list 2 + (car (nth 0 frequencies))) + (list (car (nth 0 frequencies)) + (car (nth 1 frequencies))))) + (t + (let* ((total-count (apply #'+ (mapcar #'cdr frequencies))) + (n-freq (mapcar (lambda (freq) `(,(car freq) . ,(/ (float (cdr freq)) total-count))) frequencies)) + (f-pick (list (car (car n-freq)))) + (1-2-ratio (/ (cdr (nth 0 n-freq)) + (cdr (nth 1 n-freq)))) + (2-3-ratio (/ (cdr (nth 1 n-freq)) + (cdr (nth 2 n-freq)))) + (1-3-ratio (* 1-2-ratio 2-3-ratio)) + (1-val (car (nth 0 n-freq))) + (2-val (car (nth 1 n-freq))) + (3-val (car (nth 2 n-freq)))) + (when (> 1-2-ratio 4) (push 1-val f-pick)) + (when (and (< 1-2-ratio 2-val) + (< (* (apply #'* f-pick) 2-val) 30)) + (push 2-val f-pick)) + (when (and (< 1-3-ratio 3-val) + (< (* (apply #'* f-pick) 3-val) 30)) + (push 3-val f-pick)) + f-pick)))) + +(defun org--plot/merge-alists (function default alist1 alist2 &rest alists) + "Using FUNCTION, combine the elements of ALIST1, ALIST2 and any other ALISTS. +When an element is only present in one alist, DEFAULT is used as the second +argument for the FUNCTION." + (when (> (length alists) 0) + (setq alist2 (apply #'org--plot/merge-alists function default alist2 alists))) + (cl-flet ((keys (alist) (mapcar #'car alist)) + (lookup (key alist) (or (cdr (assoc key alist)) default))) + (cl-loop with keys = (cl-union (keys alist1) (keys alist2) :test 'equal) + for k in keys collect + (cons k (funcall function (lookup k alist1) (lookup k alist2)))))) + +(defun org--plot/item-frequencies (values &optional normalise) + "Return an alist indicating the frequency of values in VALUES list. +When NORMALISE is non-nil, the count is divided by the number of values." + (let ((normaliser (if normalise (float (length values)) 1))) + (cl-loop for (n . m) in (seq-group-by #'identity values) + collect (cons n (/ (length m) normaliser))))) + +(defun org--plot/prime-factors (value) + "Return the prime decomposition of VALUE, e.g. for 12, '(3 2 2)." + (let ((factors '(1)) (i 1)) + (while (/= 1 value) + (setq i (1+ i)) + (when (eq 0 (% value i)) + (push i factors) + (setq value (/ value i)) + (setq i (1- i)) + )) + (cl-subseq factors 0 -1))) + +(defcustom org-plot/gnuplot-script-preamble "" + "String of function to be inserted before the gnuplot plot command is run. + +Note that this is in addition to, not instead of other content generated in +`org-plot/gnuplot-script'. If a function, it is called with the plot type as +the argument, and must return a string to be used." + :group 'org-plot + :type '(choice string function)) + +(defcustom org-plot/preset-plot-types + '((2d :plot-cmd "plot" + :check-ind-type t + :plot-func + (lambda (_table data-file num-cols params plot-str) + (let* ((type (plist-get params :plot-type)) + (with (if (eq type 'grid) 'pm3d (plist-get params :with))) + (ind (plist-get params :ind)) + (deps (if (plist-member params :deps) (plist-get params :deps))) + (text-ind (or (plist-get params :textind) + (eq (plist-get params :with) 'histograms))) + (col-labels (plist-get params :labels)) + res) + (dotimes (col num-cols res) + (unless (and (eq type '2d) + (or (and ind (equal (1+ col) ind)) + (and deps (not (member (1+ col) deps))))) + (setf res + (cons + (format plot-str data-file + (or (and ind (> ind 0) + (not text-ind) + (format "%d:" ind)) "") + (1+ col) + (if text-ind (format ":xticlabel(%d)" ind) "") + with + (or (nth col col-labels) + (format "%d" (1+ col)))) + res))))))) + (3d :plot-cmd "splot" + :plot-pre (lambda (_table _data-file _num-cols params _plot-str) + (if (plist-get params :map) "set map")) + :plot-func + (lambda (_table data-file _num-cols params _plot-str) + (let* ((type (plist-get params :plot-type)) + (with (if (eq type 'grid) 'pm3d (plist-get params :with)))) + (list (format "'%s' matrix with %s title ''" + data-file with))))) + (grid :plot-cmd "splot" + :plot-pre (lambda (_table _data-file _num-cols params _plot-str) + (if (plist-get params :map) "set pm3d map" "set map")) + :data-dump (lambda (table data-file params _num-cols) + (let ((y-labels (org-plot/gnuplot-to-grid-data + table data-file params))) + (when y-labels (plist-put params :ylabels y-labels)))) + :plot-func + (lambda (table data-file _num-cols params _plot-str) + (let* ((type (plist-get params :plot-type)) + (with (if (eq type 'grid) 'pm3d (plist-get params :with)))) + (list (format "'%s' with %s title ''" + data-file with))))) + (radar :plot-func + (lambda (table _data-file _num-cols params plot-str) + (list (org--plot/radar table params))))) + "List of plists describing the available plot types. +The car is the type name, and the property :plot-func must be +set. The value of :plot-func is a lambda which yields plot-lines +\(a list of strings) as the cdr. + +All lambda functions have the parameters of +`org-plot/gnuplot-script' and PLOT-STR passed to them. i.e. they +are called with the following signature: (TABLE DATA-FILE +NUM-COLS PARAMS PLOT-STR) + +Potentially useful parameters in PARAMS include: + :set :line :map :title :file :ind :timeind :timefmt :textind + :deps :labels :xlabels :ylabels :xmin :xmax :ymin :ymax :ticks + +In addition to :plot-func, the following optional properties may +be set. + +- :plot-cmd - A gnuplot command appended to each plot-line. + Accepts string or nil. Default value: nil. + +- :check-ind-type - Whether the types of ind values should be checked. + Accepts boolean. + +- :plot-str - the formula string passed to :plot-func as PLOT-STR + Accepts string. Default value: \"'%s' using %s%d%s with %s title '%s'\" + +- :data-dump - Function to dump the table to a datafile for ease of + use. + + Accepts lambda function. Default lambda body: + (org-plot/gnuplot-to-data table data-file params) + +- :plot-pre - Gnuplot code to be inserted early into the script, just + after term and output have been set. + + Accepts string, nil, or lambda function which returns string + or nil. Defaults to nil." + :group 'org-plot + :type '(alist :value-type (symbol group))) + +(defvar org--plot/radar-template + "### spider plot/chart with gnuplot +# also known as: radar chart, web chart, star chart, cobweb chart, +# radar plot, web plot, star plot, cobweb plot, etc. ... +set datafile separator ' ' +set size square +unset tics +set angles degree +set key bmargin center horizontal +unset border + +# Load data and setup +load \"%s\" + +# General settings +DataColCount = words($Data[1])-1 +AxesCount = |$Data|-HeaderLines-1 +AngleOffset = 90 +Max = 1 +d=0.1*Max +Direction = -1 # counterclockwise=1, clockwise = -1 + +# Tic settings +TicCount = %s +TicOffset = 0.1 +TicValue(axis,i) = real(i)*(word($Settings[axis],3)-word($Settings[axis],2)) \\ + / word($Settings[axis],4)+word($Settings[axis],2) +TicLabelPosX(axis,i) = PosX(axis,i/TicCount) + PosY(axis, TicOffset) +TicLabelPosY(axis,i) = PosY(axis,i/TicCount) - PosX(axis, TicOffset) +TicLen = 0.03 +TicdX(axis,i) = 0.5*TicLen*cos(alpha(axis)-90) +TicdY(axis,i) = 0.5*TicLen*sin(alpha(axis)-90) + +# Label +LabOffset = 0.10 +LabX(axis) = PosX(axis+1,Max+2*d) + PosY(axis, LabOffset) +LabY(axis) = PosY($0+1,Max+2*d) + +# Functions +alpha(axis) = (axis-1)*Direction*360.0/AxesCount+AngleOffset +PosX(axis,R) = R*cos(alpha(axis)) +PosY(axis,R) = R*sin(alpha(axis)) +Scale(axis,value) = real(value-word($Settings[axis],2))/(word($Settings[axis],3)-word($Settings[axis],2)) + +# Spider settings +set style arrow 1 dt 1 lw 1.0 @fgal head filled size 0.06,25 # style for axes +set style arrow 2 dt 2 lw 0.5 @fgal nohead # style for weblines +set style arrow 3 dt 1 lw 1 @fgal nohead # style for axis tics +set samples AxesCount +set isosamples TicCount +set urange[1:AxesCount] +set vrange[1:TicCount] +set style fill transparent solid 0.2 + +set xrange[-Max-4*d:Max+4*d] +set yrange[-Max-4*d:Max+4*d] +plot \\ + '+' u (0):(0):(PosX($0,Max+d)):(PosY($0,Max+d)) w vec as 1 not, \\ + $Data u (LabX($0)): \\ + (LabY($0)):1 every ::HeaderLines w labels center enhanced @fgt not, \\ + for [i=1:DataColCount] $Data u (PosX($0+1,Scale($0+1,column(i+1)))): \\ + (PosY($0+1,Scale($0+1,column(i+1)))) every ::HeaderLines w filledcurves lt i title word($Data[1],i+1), \\ +%s +# '++' u (PosX($1,$2/TicCount)-TicdX($1,$2/TicCount)): \\ +# (PosY($1,$2/TicCount)-TicdY($1,$2/TicCount)): \\ +# (2*TicdX($1,$2/TicCount)):(2*TicdY($1,$2/TicCount)) \\ +# w vec as 3 not, \\ +### end of code +") + +(defvar org--plot/radar-ticks + " '++' u (PosX($1,$2/TicCount)):(PosY($1,$2/TicCount)): \\ + (PosX($1+1,$2/TicCount)-PosX($1,$2/TicCount)): \\ + (PosY($1+1,$2/TicCount)-PosY($1,$2/TicCount)) w vec as 2 not, \\ + '++' u (TicLabelPosX(%s,$2)):(TicLabelPosY(%s,$2)): \\ + (sprintf('%%g',TicValue(%s,$2))) w labels font ',8' @fgat not") + +(defvar org--plot/radar-setup-template + "# Data +$Data < ind 0) - (not text-ind) - (format "%d:" ind)) "") - (1+ col) - (if text-ind (format ":xticlabel(%d)" ind) "") - with - (or (nth col col-labels) - (format "%d" (1+ col)))) - plot-lines))))) - (`3d - (setq plot-lines (list (format "'%s' matrix with %s title ''" - data-file with)))) - (`grid - (setq plot-lines (list (format "'%s' with %s title ''" - data-file with))))) + (let* ((type-name (plist-get params :plot-type)) + (type (cdr (assoc type-name org-plot/preset-plot-types)))) + (unless type + (user-error "Org-plot type `%s' is undefined" type-name)) + (let* ((sets (plist-get params :set)) + (lines (plist-get params :line)) + (title (plist-get params :title)) + (file (plist-get params :file)) + (time-ind (plist-get params :timeind)) + (timefmt (plist-get params :timefmt)) + (x-labels (plist-get params :xlabels)) + (y-labels (plist-get params :ylabels)) + (plot-str (or (plist-get type :plot-str) + "'%s' using %s%d%s with %s title '%s'")) + (plot-cmd (plist-get type :plot-cmd)) + (plot-pre (plist-get type :plot-pre)) + (script "reset") + ;; ats = add-to-script + (ats (lambda (line) (when line (setf script (concat script "\n" line))))) + plot-lines) + + + ;; handle output file, background, and size + (funcall ats (format "set term %s %s" + (if file (file-name-extension file) "GNUTERM") + (if (stringp org-plot/gnuplot-term-extra) + org-plot/gnuplot-term-extra + (funcall org-plot/gnuplot-term-extra type)))) + (when file ; output file + (funcall ats (format "set output '%s'" (expand-file-name file)))) + + (when plot-pre + (funcall ats (funcall plot-pre table data-file num-cols params plot-str))) + (funcall ats - (concat plot-cmd " " (mapconcat #'identity - (reverse plot-lines) - ",\\\n ")))) - script)) + (if (stringp org-plot/gnuplot-script-preamble) + org-plot/gnuplot-script-preamble + (funcall org-plot/gnuplot-script-preamble type))) + + (when title (funcall ats (format "set title '%s'" title))) ; title + (mapc ats lines) ; line + (dolist (el sets) (funcall ats (format "set %s" el))) ; set + ;; Unless specified otherwise, values are TAB separated. + (unless (string-match-p "^set datafile separator" script) + (funcall ats "set datafile separator \"\\t\"")) + (when x-labels ; x labels (xtics) + (funcall ats + (format "set xtics (%s)" + (mapconcat (lambda (pair) + (format "\"%s\" %d" (cdr pair) (car pair))) + x-labels ", ")))) + (when y-labels ; y labels (ytics) + (funcall ats + (format "set ytics (%s)" + (mapconcat (lambda (pair) + (format "\"%s\" %d" (cdr pair) (car pair))) + y-labels ", ")))) + (when time-ind ; timestamp index + (funcall ats "set xdata time") + (funcall ats (concat "set timefmt \"" + (or timefmt ; timefmt passed to gnuplot + "%Y-%m-%d-%H:%M:%S") "\""))) + (unless preface + (let ((type-func (plist-get type :plot-func))) + (when type-func + (setq plot-lines + (funcall type-func table data-file num-cols params plot-str)))) + (funcall ats + (concat plot-cmd + (when plot-cmd " ") + (mapconcat #'identity + (reverse plot-lines) + ",\\\n ")))) + script))) + +(defun org-plot/redisplay-img-in-buffer (img-file) + "Find any overlays for IMG-FILE in the current Org buffer, and refresh them." + (dolist (img-overlay org-inline-image-overlays) + (when (string= img-file (plist-get (cdr (overlay-get img-overlay 'display)) :file)) + (when (file-exists-p img-file) + (image-refresh (overlay-get img-overlay 'display)))))) ;;----------------------------------------------------------------------------- ;; facade functions @@ -283,15 +638,40 @@ line directly before or after the table." (when (get-buffer "*gnuplot*") ; reset *gnuplot* if it already running (with-current-buffer "*gnuplot*" (goto-char (point-max)))) - (org-plot/goto-nearest-table) - ;; Set default options. - (dolist (pair org-plot/gnuplot-default-options) - (unless (plist-member params (car pair)) - (setf params (plist-put params (car pair) (cdr pair))))) + (save-excursion + (org-plot/goto-nearest-table) + ;; Set default options. + (dolist (pair org-plot/gnuplot-default-options) + (unless (plist-member params (car pair)) + (setf params (plist-put params (car pair) (cdr pair))))) + ;; Collect options. + (while (and (equal 0 (forward-line -1)) + (looking-at "[[:space:]]*#\\+")) + (setf params (org-plot/collect-options params)))) ;; collect table and table information (let* ((data-file (make-temp-file "org-plot")) - (table (org-table-collapse-header (org-table-to-lisp))) - (num-cols (length (car table)))) + (table (let ((tbl (save-excursion + (org-plot/goto-nearest-table) + (org-table-to-lisp)))) + (when (pcase (plist-get params :transpose) + (`y t) + (`yes t) + (`t t)) + (if (not (memq 'hline tbl)) + (setq tbl (apply #'cl-mapcar #'list tbl)) + ;; When present, remove hlines as they can't (currentily) be easily transposed. + (setq tbl (apply #'cl-mapcar #'list + (remove 'hline tbl))) + (push 'hline (cdr tbl)))) + tbl)) + (num-cols (length (if (eq (nth 0 table) 'hline) (nth 1 table) + (nth 0 table)))) + (type (assoc (plist-get params :plot-type) + org-plot/preset-plot-types))) + + (unless type + (user-error "Org-plot type `%s' is undefined" (plist-get params :plot-type))) + (run-with-idle-timer 0.1 nil #'delete-file data-file) (when (eq (cadr table) 'hline) (setf params @@ -301,15 +681,12 @@ line directly before or after the table." (save-excursion (while (and (equal 0 (forward-line -1)) (looking-at "[[:space:]]*#\\+")) (setf params (org-plot/collect-options params)))) - ;; Dump table to datafile (very different for grid). - (pcase (plist-get params :plot-type) - (`2d (org-plot/gnuplot-to-data table data-file params)) - (`3d (org-plot/gnuplot-to-data table data-file params)) - (`grid (let ((y-labels (org-plot/gnuplot-to-grid-data - table data-file params))) - (when y-labels (plist-put params :ylabels y-labels))))) + ;; Dump table to datafile + (if-let ((dump-func (plist-get type :data-dump))) + (funcall dump-func table data-file num-cols params) + (org-plot/gnuplot-to-data table data-file params)) ;; Check type of ind column (timestamp? text?) - (when (eq `2d (plist-get params :plot-type)) + (when (plist-get params :check-ind-type) (let* ((ind (1- (plist-get params :ind))) (ind-column (mapcar (lambda (row) (nth ind row)) table))) (cond ((< ind 0) nil) ; ind is implicit @@ -326,18 +703,23 @@ line directly before or after the table." (with-temp-buffer (if (plist-get params :script) ; user script (progn (insert - (org-plot/gnuplot-script data-file num-cols params t)) - (insert "\n") - (insert-file-contents (plist-get params :script)) - (goto-char (point-min)) - (while (re-search-forward "\\$datafile" nil t) - (replace-match data-file nil nil))) - (insert (org-plot/gnuplot-script data-file num-cols params))) + (org-plot/gnuplot-script table data-file num-cols params t)) + (insert "\n") + (insert-file-contents (plist-get params :script)) + (goto-char (point-min)) + (while (re-search-forward "\\$datafile" nil t) + (replace-match data-file nil nil))) + (insert (org-plot/gnuplot-script table data-file num-cols params))) ;; Graph table. (gnuplot-mode) - (gnuplot-send-buffer-to-gnuplot)) + (condition-case nil + (gnuplot-send-buffer-to-gnuplot) + (buffer-read-only nil))) ;; Cleanup. - (bury-buffer (get-buffer "*gnuplot*"))))) + (bury-buffer (get-buffer "*gnuplot*")) + ;; Refresh any displayed images + (when (plist-get params :file) + (org-plot/redisplay-img-in-buffer (expand-file-name (plist-get params :file))))))) (provide 'org-plot) diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el index ff8c08d5c5..ca3249dda5 100644 --- a/lisp/org/org-protocol.el +++ b/lisp/org/org-protocol.el @@ -49,7 +49,7 @@ ;; 4.) Try this from the command line (adjust the URL as needed): ;; ;; $ emacsclient \ -;; org-protocol://store-link?url=http:%2F%2Flocalhost%2Findex.html&title=The%20title +;; "org-protocol://store-link?url=http:%2F%2Flocalhost%2Findex.html&title=The%20title" ;; ;; 5.) Optionally add custom sub-protocols and handlers: ;; @@ -94,6 +94,15 @@ ;; You may use the same bookmark URL for all those standard handlers and just ;; adjust the sub-protocol used: ;; +;; javascript:location.href='org-protocol://sub-protocol?'+ +;; new URLSearchParams({ +;; url: location.href, +;; title: document.title, +;; body: window.getSelection()}) +;; +;; Alternatively use the following expression that encodes space as \"%20\" +;; instead of \"+\", so it is compatible with Org versions from 9.0 to 9.4: +;; ;; location.href='org-protocol://sub-protocol?url='+ ;; encodeURIComponent(location.href)+'&title='+ ;; encodeURIComponent(document.title)+'&body='+ @@ -103,6 +112,11 @@ ;; char that, if present, triggers the use of a special template. ;; Example: ;; +;; location.href='org-protocol://capture?'+ +;; new URLSearchParams({template:'x', /* ... */}) +;; +;; or +;; ;; location.href='org-protocol://capture?template=x'+ ... ;; ;; uses template ?x. @@ -176,7 +190,7 @@ Possible properties are: :online-suffix - the suffix to strip from the published URLs :working-suffix - the replacement for online-suffix - :base-url - the base URL, e.g. http://www.example.com/project/ + :base-url - the base URL, e.g. https://www.example.com/project/ Last slash required. :working-directory - the local working directory. This is what base-url will be replaced with. @@ -427,7 +441,12 @@ Parameters: url, title (optional), body (optional) Old-style links such as org-protocol://store-link://URL/TITLE are also recognized. -The location for a browser's bookmark has to look like this: +The location for a browser's bookmark may look like this: + + javascript:location.href = \\='org-protocol://store-link?\\=' + + new URLSearchParams({url:location.href, title:document.title}); + +or to keep compatibility with Org versions from 9.0 to 9.4 it may be: javascript:location.href = \\ \\='org-protocol://store-link?url=\\=' + \\ @@ -436,7 +455,9 @@ The location for a browser's bookmark has to look like this: Don't use `escape()'! Use `encodeURIComponent()' instead. The title of the page could contain slashes and the location -definitely will. +definitely will. Org 9.4 and earlier could not decode \"+\" +to space, that is why less readable latter expression may be necessary +for backward compatibility. The sub-protocol used to reach this function is set in `org-protocol-protocol-alist'. @@ -464,8 +485,16 @@ The sub-protocol used to reach this function is set in This function detects an URL, title and optional text, separated by `/'. The location for a browser's bookmark looks like this: + javascript:location.href = \\='org-protocol://capture?\\=' + + new URLSearchParams({ + url: location.href, + title: document.title, + body: window.getSelection()}) + +or to keep compatibility with Org versions from 9.0 to 9.4: + javascript:location.href = \\='org-protocol://capture?url=\\='+ \\ - encodeURIComponent(location.href) + \\='&title=\\=' \\ + encodeURIComponent(location.href) + \\='&title=\\=' + \\ encodeURIComponent(document.title) + \\='&body=\\=' + \\ encodeURIComponent(window.getSelection()) @@ -519,10 +548,11 @@ Now template ?b will be used." (defun org-protocol-convert-query-to-plist (query) "Convert QUERY key=value pairs in the URL to a property list." (when query - (apply 'append (mapcar (lambda (x) - (let ((c (split-string x "="))) - (list (intern (concat ":" (car c))) (cadr c)))) - (split-string query "&"))))) + (let ((plus-decoded (replace-regexp-in-string "\\+" " " query t t))) + (apply 'append (mapcar (lambda (x) + (let ((c (split-string x "="))) + (list (intern (concat ":" (car c))) (cadr c)))) + (split-string plus-decoded "&")))))) (defun org-protocol-open-source (fname) "Process an org-protocol://open-source?url= style URL with FNAME. @@ -532,6 +562,12 @@ in `org-protocol-project-alist'. The location for a browser's bookmark should look like this: + javascript:location.href = \\='org-protocol://open-source?\\=' + + new URLSearchParams({url: location.href}) + +or if you prefer to keep compatibility with older Org versions (9.0 to 9.4), +consider the following expression: + javascript:location.href = \\='org-protocol://open-source?url=\\=' + \\ encodeURIComponent(location.href)" ;; As we enter this function for a match on our protocol, the return value @@ -554,7 +590,7 @@ The location for a browser's bookmark should look like this: (f1 (substring f 0 (string-match "\\([\\?#].*\\)?$" f))) (start-pos (+ (string-match wsearch f1) (length base-url))) (end-pos (if strip-suffix - (string-match (regexp-quote strip-suffix) f1) + (string-match (regexp-quote strip-suffix) f1) (length f1))) ;; We have to compare redirects without suffix below: (f2 (concat wdir (substring f1 start-pos end-pos))) @@ -632,7 +668,7 @@ CLIENT is ignored." (greedy (plist-get (cdr prolist) :greedy)) (split (split-string fname proto)) (result (if greedy restoffiles (cadr split))) - (new-style (string-match "/*?" (match-string 1 fname)))) + (new-style (not (= ?: (aref (match-string 1 fname) 0))))) (when (plist-get (cdr prolist) :kill-client) (message "Greedy org-protocol handler. Killing client.") (server-edit)) diff --git a/lisp/org/org-refile.el b/lisp/org/org-refile.el index 8b42f817c1..678759e10d 100644 --- a/lisp/org/org-refile.el +++ b/lisp/org/org-refile.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2010-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; ;; This file is part of GNU Emacs. @@ -214,7 +214,7 @@ converted to a headline before refiling." org-org-menu '("Edit Structure") i)) '(["Refile Subtree" org-refile (org-in-subtree-not-table-p)] - ["Refile and copy Subtree" org-copy (org-in-subtree-not-table-p)])) + ["Refile and copy Subtree" org-refile-copy (org-in-subtree-not-table-p)])) (defun org-refile-marker (pos) "Get a new refile marker, but only if caching is in use." @@ -310,11 +310,13 @@ converted to a headline before refiling." (setq f (buffer-file-name (buffer-base-buffer f)))) (setq f (and f (expand-file-name f))) (when (eq org-refile-use-outline-path 'file) - (push (list (file-name-nondirectory f) f nil nil) tgs)) + (push (list (and f (file-name-nondirectory f)) f nil nil) tgs)) (when (eq org-refile-use-outline-path 'buffer-name) (push (list (buffer-name (buffer-base-buffer)) f nil nil) tgs)) (when (eq org-refile-use-outline-path 'full-file-path) - (push (list (file-truename (buffer-file-name (buffer-base-buffer))) f nil nil) tgs)) + (push (list (and (buffer-file-name (buffer-base-buffer)) + (file-truename (buffer-file-name (buffer-base-buffer)))) + f nil nil) tgs)) (org-with-wide-buffer (goto-char (point-min)) (setq org-outline-path-cache nil) @@ -337,9 +339,10 @@ converted to a headline before refiling." #'identity (append (pcase org-refile-use-outline-path - (`file (list (file-name-nondirectory - (buffer-file-name - (buffer-base-buffer))))) + (`file (list + (and (buffer-file-name (buffer-base-buffer)) + (file-name-nondirectory + (buffer-file-name (buffer-base-buffer)))))) (`full-file-path (list (buffer-file-name (buffer-base-buffer)))) @@ -373,8 +376,6 @@ the *old* location.") (defvar org-refile-keep nil "Non-nil means `org-refile' will copy instead of refile.") -(define-obsolete-function-alias 'org-copy 'org-refile-copy "Org 9.4") - ;;;###autoload (defun org-refile-copy () "Like `org-refile', but preserve the refiled subtree." @@ -382,8 +383,19 @@ the *old* location.") (let ((org-refile-keep t)) (org-refile nil nil nil "Copy"))) +;;;###autoload +(defun org-refile-reverse (&optional arg default-buffer rfloc msg) + "Refile while temporarily toggling `org-reverse-note-order'. +So if `org-refile' would append the entry as the last entry under +the target heading, `org-refile-reverse' will prepend it as the +first entry, and vice-versa." + (interactive "P") + (let ((org-reverse-note-order (not (org-notes-order-reversed-p)))) + (org-refile arg default-buffer rfloc msg))) + (defvar org-capture-last-stored-marker) + ;;;###autoload (defun org-refile (&optional arg default-buffer rfloc msg) "Move the entry or entries at point to another heading. @@ -426,7 +438,7 @@ needed when passing RFLOC headline to refile under MSG is a string to replace \"Refile\" in the default prompt with -another verb. E.g. `org-copy' sets this parameter to \"Copy\". +another verb. E.g. `org-refile-copy' sets this parameter to \"Copy\". See also `org-refile-use-outline-path'. @@ -637,20 +649,18 @@ this function appends the default value from (setq old-hist org-refile-history) (setq answ (funcall cfunc prompt tbl nil (not new-nodes) nil 'org-refile-history - (or cdef (concat (car org-refile-history) extra)))) + (or cdef (car org-refile-history)))) (if (setq pa (org-refile--get-location answ tbl)) - (let* ((last-refile-loc (car org-refile-history)) - (last-refile-loc-path (concat last-refile-loc extra))) + (let ((last-refile-loc (car org-refile-history))) (org-refile-check-position pa) (when (or (not org-refile-history) (not (eq old-hist org-refile-history)) - (not (equal (car pa) last-refile-loc-path))) + (not (equal (car pa) last-refile-loc))) (setq org-refile-history (cons (car pa) (if (assoc last-refile-loc tbl) org-refile-history (cdr org-refile-history)))) - (when (or (equal last-refile-loc-path (nth 1 org-refile-history)) - (equal last-refile-loc (nth 1 org-refile-history))) + (when (equal last-refile-loc (nth 1 org-refile-history)) (pop org-refile-history))) pa) (if (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ) diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index cabedecb68..91a3d415df 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el @@ -2,7 +2,7 @@ ;; ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. ;; -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Bastien Guerry ;; Dan Davison ;; Keywords: outlines, hypermedia, calendar, wp @@ -299,6 +299,9 @@ is 0.") "File name associated to Org source buffer, or nil.") (put 'org-src-source-file-name 'permanent-local t) +(defvar-local org-src--preserve-blank-line nil) +(put 'org-src--preserve-blank-line 'permanent-local t) + (defun org-src--construct-edit-buffer-name (org-buffer-name lang) "Construct the buffer name for a source editing buffer." (concat "*Org Src " org-buffer-name "[ " lang " ]*")) @@ -327,8 +330,7 @@ a cons cell (LINE . COLUMN) or symbol `end'. See also (cons (count-lines beg (line-beginning-position)) ;; Column is relative to the end of line to avoid problems of ;; comma escaping or colons appended in front of the line. - (- (current-column) - (progn (end-of-line) (current-column))))))) + (- (point) (min end (line-end-position))))))) (defun org-src--goto-coordinates (coord beg end) "Move to coordinates COORD relatively to BEG and END. @@ -341,9 +343,9 @@ which see. BEG and END are buffer positions." (org-with-wide-buffer (goto-char beg) (forward-line (car coord)) - (end-of-line) - (org-move-to-column (max (+ (current-column) (cdr coord)) 0)) - (point))))) + (max (point) + (+ (min end (line-end-position)) + (cdr coord))))))) (defun org-src--contents-area (datum) "Return contents boundaries of DATUM. @@ -433,8 +435,8 @@ spaces after it as being outside." (line-end-position) (point)))))) -(defun org-src--contents-for-write-back () - "Return buffer contents in a format appropriate for write back. +(defun org-src--contents-for-write-back (write-back-buf) + "Populate WRITE-BACK-BUF with contents in the appropriate format. Assume point is in the corresponding edit buffer." (let ((indentation-offset (if org-src--preserve-indentation 0 @@ -444,27 +446,36 @@ Assume point is in the corresponding edit buffer." 0)))) (use-tabs? (and (> org-src--tab-width 0) t)) (source-tab-width org-src--tab-width) - (contents (org-with-wide-buffer (buffer-string))) - (write-back org-src--allow-write-back)) - (with-temp-buffer + (contents (org-with-wide-buffer + (let ((eol (line-end-position))) + (list (buffer-substring (point-min) eol) + (buffer-substring eol (point-max)))))) + (write-back org-src--allow-write-back) + (preserve-blank-line org-src--preserve-blank-line) + marker) + (with-current-buffer write-back-buf ;; Reproduce indentation parameters from source buffer. (setq indent-tabs-mode use-tabs?) (when (> source-tab-width 0) (setq tab-width source-tab-width)) ;; Apply WRITE-BACK function on edit buffer contents. - (insert (org-no-properties contents)) + (insert (org-no-properties (car contents))) + (setq marker (point-marker)) + (insert (org-no-properties (car (cdr contents)))) (goto-char (point-min)) (when (functionp write-back) (save-excursion (funcall write-back))) - ;; Add INDENTATION-OFFSET to every non-empty line in buffer, + ;; Add INDENTATION-OFFSET to every line in buffer, ;; unless indentation is meant to be preserved. (when (> indentation-offset 0) (while (not (eobp)) (skip-chars-forward " \t") - (unless (eolp) ;ignore blank lines + (when (or (not (eolp)) ; not a blank line + (and (eq (point) (marker-position marker)) ; current line + preserve-blank-line)) (let ((i (current-column))) (delete-region (line-beginning-position) (point)) (indent-to (+ i indentation-offset)))) (forward-line))) - (buffer-string)))) + (set-marker marker nil)))) (defun org-src--edit-element (datum name &optional initialize write-back contents remote) @@ -509,6 +520,11 @@ Leave point in edit buffer." (block-ind (org-with-point-at (org-element-property :begin datum) (current-indentation))) (content-ind org-edit-src-content-indentation) + (blank-line (save-excursion (beginning-of-line) + (looking-at-p "^[[:space:]]*$"))) + (empty-line (and blank-line (looking-at-p "^$"))) + (preserve-blank-line (or (and blank-line (not empty-line)) + (and empty-line (= (+ block-ind content-ind) 0)))) (preserve-ind (and (memq type '(example-block src-block)) (or (org-element-property :preserve-indent datum) @@ -557,6 +573,7 @@ Leave point in edit buffer." (setq org-src--overlay overlay) (setq org-src--allow-write-back write-back) (setq org-src-source-file-name source-file-name) + (setq org-src--preserve-blank-line preserve-blank-line) ;; Start minor mode. (org-src-mode) ;; Clear undo information so we cannot undo back to the @@ -587,7 +604,7 @@ Leave point in edit buffer." (defun org-src-font-lock-fontify-block (lang start end) "Fontify code block. -This function is called by emacs automatic fontification, as long +This function is called by Emacs' automatic fontification, as long as `org-src-fontify-natively' is non-nil." (let ((lang-mode (org-src-get-lang-mode lang))) (when (fboundp lang-mode) @@ -1190,20 +1207,27 @@ Throw an error if there is no such buffer." (interactive) (unless (org-src-edit-buffer-p) (user-error "Not in a sub-editing buffer")) (set-buffer-modified-p nil) - (let ((edited-code (org-src--contents-for-write-back)) + (let ((write-back-buf (generate-new-buffer "*org-src-write-back*")) (beg org-src--beg-marker) (end org-src--end-marker) (overlay org-src--overlay)) + (org-src--contents-for-write-back write-back-buf) (with-current-buffer (org-src-source-buffer) (undo-boundary) (goto-char beg) ;; Temporarily disable read-only features of OVERLAY in order to ;; insert new contents. (delete-overlay overlay) - (delete-region beg end) (let ((expecting-bol (bolp))) - (insert edited-code) + (if (version< emacs-version "27.1") + (progn (delete-region beg end) + (insert (with-current-buffer write-back-buf (buffer-string)))) + (save-restriction + (narrow-to-region beg end) + (replace-buffer-contents write-back-buf 0.1 nil) + (goto-char (point-max)))) (when (and expecting-bol (not (bolp))) (insert "\n"))) + (kill-buffer write-back-buf) (save-buffer) (move-overlay overlay beg (point)))) ;; `write-contents-functions' requires the function to return @@ -1213,30 +1237,45 @@ Throw an error if there is no such buffer." (defun org-edit-src-exit () "Kill current sub-editing buffer and return to source buffer." (interactive) - (unless (org-src-edit-buffer-p) (error "Not in a sub-editing buffer")) + (unless (org-src-edit-buffer-p) + (error "Not in a sub-editing buffer")) (let* ((beg org-src--beg-marker) (end org-src--end-marker) (write-back org-src--allow-write-back) (remote org-src--remote) (coordinates (and (not remote) (org-src--coordinates (point) 1 (point-max)))) - (code (and write-back (org-src--contents-for-write-back)))) + (write-back-buf + (and write-back (generate-new-buffer "*org-src-write-back*")))) + (when write-back (org-src--contents-for-write-back write-back-buf)) (set-buffer-modified-p nil) ;; Switch to source buffer. Kill sub-editing buffer. (let ((edit-buffer (current-buffer)) (source-buffer (marker-buffer beg))) - (unless source-buffer (error "Source buffer disappeared. Aborting")) + (unless source-buffer + (when write-back-buf (kill-buffer write-back-buf)) + (error "Source buffer disappeared. Aborting")) (org-src-switch-to-buffer source-buffer 'exit) (kill-buffer edit-buffer)) ;; Insert modified code. Ensure it ends with a newline character. (org-with-wide-buffer - (when (and write-back (not (equal (buffer-substring beg end) code))) + (when (and write-back + (not (equal (buffer-substring beg end) + (with-current-buffer write-back-buf + (buffer-string))))) (undo-boundary) (goto-char beg) - (delete-region beg end) (let ((expecting-bol (bolp))) - (insert code) + (if (version< emacs-version "27.1") + (progn (delete-region beg end) + (insert (with-current-buffer write-back-buf + (buffer-string)))) + (save-restriction + (narrow-to-region beg end) + (replace-buffer-contents write-back-buf 0.1 nil) + (goto-char (point-max)))) (when (and expecting-bol (not (bolp))) (insert "\n"))))) + (when write-back-buf (kill-buffer write-back-buf)) ;; If we are to return to source buffer, put point at an ;; appropriate location. In particular, if block is hidden, move ;; to the beginning of the block opening line. diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index 0e93fb271f..89c57fb06c 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; @@ -66,6 +66,7 @@ (declare-function org-export-install-filters "ox" (info)) (declare-function org-export-table-has-special-column-p "ox" (table)) (declare-function org-export-table-row-is-special-p "ox" (table-row info)) +(declare-function org-forward-paragraph "org" (&optional arg)) (declare-function org-id-find "org-id" (id &optional markerp)) (declare-function org-indent-line "org" ()) (declare-function org-load-modules-maybe "org" (&optional force)) @@ -331,7 +332,7 @@ relies on the variables to be present in the list." The default value is `hours', and will output the results as a number of hours. Other allowed values are `seconds', `minutes' and `days', and the output will be a fraction of seconds, minutes or -days. `hh:mm' selects to use hours and minutes, ignoring seconds. +days. `hh:mm' selects to use hours and minutes, ignoring seconds. The `U' flag in a table formula will select this specific format for a single formula." :group 'org-table-calculation @@ -461,36 +462,41 @@ This may be useful when columns have been shrunk." (when pos (goto-char pos)) (goto-char (line-beginning-position)) (let ((end (line-end-position)) str) + (backward-char) (while (progn (forward-char 1) (< (point) end)) (let ((ov (car (overlays-at (point))))) (if (not ov) (push (char-to-string (char-after)) str) (push (overlay-get ov 'display) str) (goto-char (1- (overlay-end ov)))))) - (format "|%s" (mapconcat #'identity (reverse str) ""))))) + (format "%s" (mapconcat #'identity (reverse str) ""))))) (defvar-local org-table-header-overlay nil) (defun org-table-header-set-header () "Display the header of the table at point." - (when (overlayp org-table-header-overlay) - (delete-overlay org-table-header-overlay)) - (let* ((ws (window-start)) - (beg (save-excursion - (goto-char (org-table-begin)) - (while (or (org-at-table-hline-p) - (looking-at-p ".*|\\s-+<[rcl]?\\([0-9]+\\)?>")) - (move-beginning-of-line 2)) - (point))) - (end (save-excursion (goto-char beg) (point-at-eol)))) - (if (pos-visible-in-window-p beg) - (when (overlayp org-table-header-overlay) - (delete-overlay org-table-header-overlay)) - (setq org-table-header-overlay - (make-overlay ws (+ ws (- end beg)))) - (org-overlay-display - org-table-header-overlay - (org-table-row-get-visible-string beg) - 'org-table-header)))) + (let ((gcol temporary-goal-column)) + (unwind-protect + (progn + (when (overlayp org-table-header-overlay) + (delete-overlay org-table-header-overlay)) + (let* ((ws (window-start)) + (beg (save-excursion + (goto-char (org-table-begin)) + (while (or (org-at-table-hline-p) + (looking-at-p ".*|\\s-+<[rcl]?\\([0-9]+\\)?>")) + (move-beginning-of-line 2)) + (line-beginning-position))) + (end (save-excursion (goto-char beg) (point-at-eol)))) + (if (pos-visible-in-window-p beg) + (when (overlayp org-table-header-overlay) + (delete-overlay org-table-header-overlay)) + (setq org-table-header-overlay + (make-overlay ws (+ ws (- end beg)))) + (org-overlay-display + org-table-header-overlay + (org-table-row-get-visible-string beg) + 'org-table-header)))) + (setq temporary-goal-column gcol)))) ;;;###autoload (define-minor-mode org-table-header-line-mode @@ -679,8 +685,6 @@ Will be filled automatically during use.") ("_" . "Names for values in row below this one.") ("^" . "Names for values in row above this one."))) -(defvar org-tbl-calc-modes nil) - (defvar org-pos nil) @@ -724,18 +728,6 @@ Field is restored even in case of abnormal exit." (org-table-goto-column ,column) (set-marker ,line nil))))) -(defsubst org-table--set-calc-mode (var &optional value) - (if (stringp var) - (setq var (assoc var '(("D" calc-angle-mode deg) - ("R" calc-angle-mode rad) - ("F" calc-prefer-frac t) - ("S" calc-symbolic-mode t))) - value (nth 2 var) var (nth 1 var))) - (if (memq var org-tbl-calc-modes) - (setcar (cdr (memq var org-tbl-calc-modes)) value) - (cons var (cons value org-tbl-calc-modes))) - org-tbl-calc-modes) - ;;; Predicates @@ -870,52 +862,52 @@ nil When nil, the command tries to be smart and figure out the (let* ((beg (min beg0 end0)) (end (max beg0 end0)) re) - (if (> (count-lines beg end) org-table-convert-region-max-lines) - (user-error "Region is longer than `org-table-convert-region-max-lines' (%s) lines; not converting" - org-table-convert-region-max-lines) - (when (equal separator '(64)) - (setq separator (read-regexp "Regexp for field separator"))) - (goto-char beg) - (beginning-of-line 1) - (setq beg (point-marker)) - (goto-char end) - (if (bolp) (backward-char 1) (end-of-line 1)) - (setq end (point-marker)) - ;; Get the right field separator - (unless separator - (goto-char beg) - (setq separator - (cond - ((not (re-search-forward "^[^\n\t]+$" end t)) '(16)) - ((not (re-search-forward "^[^\n,]+$" end t)) '(4)) - (t 1)))) + (when (> (count-lines beg end) org-table-convert-region-max-lines) + (user-error "Region is longer than `org-table-convert-region-max-lines' (%s) lines; not converting" + org-table-convert-region-max-lines)) + (when (equal separator '(64)) + (setq separator (read-regexp "Regexp for field separator"))) + (goto-char beg) + (beginning-of-line 1) + (setq beg (point-marker)) + (goto-char end) + (if (bolp) (backward-char 1) (end-of-line 1)) + (setq end (point-marker)) + ;; Get the right field separator + (unless separator (goto-char beg) - (if (equal separator '(4)) - (while (< (point) end) - ;; parse the csv stuff + (setq separator (cond - ((looking-at "^") (insert "| ")) - ((looking-at "[ \t]*$") (replace-match " |") (beginning-of-line 2)) - ((looking-at "[ \t]*\"\\([^\"\n]*\\)\"") - (replace-match "\\1") - (if (looking-at "\"") (insert "\""))) - ((looking-at "[^,\n]+") (goto-char (match-end 0))) - ((looking-at "[ \t]*,") (replace-match " | ")) - (t (beginning-of-line 2)))) - (setq re (cond - ((equal separator '(4)) "^\\|\"?[ \t]*,[ \t]*\"?") - ((equal separator '(16)) "^\\|\t") - ((integerp separator) - (if (< separator 1) - (user-error "Number of spaces in separator must be >= 1") - (format "^ *\\| *\t *\\| \\{%d,\\}" separator))) - ((stringp separator) - (format "^ *\\|%s" separator)) - (t (error "This should not happen")))) - (while (re-search-forward re end t) - (replace-match "| " t t))) - (goto-char beg) - (org-table-align)))) + ((not (re-search-forward "^[^\n\t]+$" end t)) '(16)) + ((not (re-search-forward "^[^\n,]+$" end t)) '(4)) + (t 1)))) + (goto-char beg) + (if (equal separator '(4)) + (while (< (point) end) + ;; parse the csv stuff + (cond + ((looking-at "^") (insert "| ")) + ((looking-at "[ \t]*$") (replace-match " |") (beginning-of-line 2)) + ((looking-at "[ \t]*\"\\([^\"\n]*\\)\"") + (replace-match "\\1") + (if (looking-at "\"") (insert "\""))) + ((looking-at "[^,\n]+") (goto-char (match-end 0))) + ((looking-at "[ \t]*,") (replace-match " | ")) + (t (beginning-of-line 2)))) + (setq re (cond + ((equal separator '(4)) "^\\|\"?[ \t]*,[ \t]*\"?") + ((equal separator '(16)) "^\\|\t") + ((integerp separator) + (if (< separator 1) + (user-error "Number of spaces in separator must be >= 1") + (format "^ *\\| *\t *\\| \\{%d,\\}" separator))) + ((stringp separator) + (format "^ *\\|%s" separator)) + (t (error "This should not happen")))) + (while (re-search-forward re end t) + (replace-match "| " t t))) + (goto-char beg) + (org-table-align))) ;;;###autoload (defun org-table-import (file separator) @@ -938,7 +930,8 @@ lines. It can have the following values: - regexp When a regular expression, use it to match the separator." (interactive "f\nP") (when (and (called-interactively-p 'any) - (not (string-match-p (rx "." (or "txt" "tsv" "csv") eos) file))) + (not (string-match-p (rx "." (or "txt" "tsv" "csv") eos) file)) + (not (yes-or-no-p "The file's extension is not .txt, .tsv or .csv. Import? "))) (user-error "Cannot import such file")) (unless (bolp) (insert "\n")) (let ((beg (point)) @@ -1936,8 +1929,9 @@ of lists of fields." (forward-line)) (set-marker end nil)) (when cut (org-table-align)) - (message (substitute-command-keys "Cells in the region copied, use \ -\\[org-table-paste-rectangle] to paste them in a table.")) + (when (called-interactively-p 'any) + (message (substitute-command-keys "Cells in the region copied, use \ +\\[org-table-paste-rectangle] to paste them in a table."))) (setq org-table-clip (nreverse region)))) ;;;###autoload @@ -2168,7 +2162,7 @@ LOCATION instead." (goto-char (match-beginning 3)) (delete-region (match-beginning 3) (match-end 0))) (org-indent-line) - (insert (or (match-string 2) "#+TBLFM:"))) + (insert "#+TBLFM:")) (insert " " (mapconcat (lambda (x) (concat (car x) "=" (cdr x))) (sort alist #'org-table-formula-less-p) @@ -2436,51 +2430,45 @@ location of point." equation (org-table-get-formula equation (equal arg '(4))))) (n0 (org-table-current-column)) - (org-tbl-calc-modes (copy-sequence org-calc-default-modes)) + (calc-modes (copy-sequence org-calc-default-modes)) (numbers nil) ; was a variable, now fixed default (keep-empty nil) - n form form0 formrpl formrg bw fmt x ev orig c lispp literal + form form0 formrpl formrg bw fmt ev orig lispp literal duration duration-output-format) ;; Parse the format string. Since we have a lot of modes, this is ;; a lot of work. However, I think calc still uses most of the time. - (if (string-match ";" formula) - (let ((tmp (org-split-string formula ";"))) - (setq formula (car tmp) - fmt (concat (cdr (assoc "%" org-table-local-parameters)) - (nth 1 tmp))) + (if (string-match "\\(.*\\);\\(.*\\)" formula) + (progn + (setq fmt (concat (cdr (assoc "%" org-table-local-parameters)) + (match-string-no-properties 2 formula))) + (setq formula (match-string-no-properties 1 formula)) (while (string-match "\\([pnfse]\\)\\(-?[0-9]+\\)" fmt) - (setq c (string-to-char (match-string 1 fmt)) - n (string-to-number (match-string 2 fmt))) - (if (= c ?p) - (setq org-tbl-calc-modes - (org-table--set-calc-mode 'calc-internal-prec n)) - (setq org-tbl-calc-modes - (org-table--set-calc-mode - 'calc-float-format - (list (cdr (assoc c '((?n . float) (?f . fix) - (?s . sci) (?e . eng)))) - n)))) + (let ((c (string-to-char (match-string 1 fmt))) + (n (string-to-number (match-string 2 fmt)))) + (cl-case c + (?p (setf (cl-getf calc-modes 'calc-internal-prec) n)) + (?n (setf (cl-getf calc-modes 'calc-float-format) (list 'float n))) + (?f (setf (cl-getf calc-modes 'calc-float-format) (list 'fix n))) + (?s (setf (cl-getf calc-modes 'calc-float-format) (list 'sci n))) + (?e (setf (cl-getf calc-modes 'calc-float-format) (list 'eng n))))) + ;; Remove matched flags from the mode string. (setq fmt (replace-match "" t t fmt))) - (if (string-match "[tTU]" fmt) - (let ((ff (match-string 0 fmt))) - (setq duration t numbers t - duration-output-format - (cond ((equal ff "T") nil) - ((equal ff "t") org-table-duration-custom-format) - ((equal ff "U") 'hh:mm)) - fmt (replace-match "" t t fmt)))) - (if (string-match "N" fmt) - (setq numbers t - fmt (replace-match "" t t fmt))) - (if (string-match "L" fmt) - (setq literal t - fmt (replace-match "" t t fmt))) - (if (string-match "E" fmt) - (setq keep-empty t - fmt (replace-match "" t t fmt))) - (while (string-match "[DRFS]" fmt) - (setq org-tbl-calc-modes - (org-table--set-calc-mode (match-string 0 fmt))) + (while (string-match "\\([tTUNLEDRFSu]\\)" fmt) + (let ((c (string-to-char (match-string 1 fmt)))) + (cl-case c + (?t (setq duration t numbers t + duration-output-format org-table-duration-custom-format)) + (?T (setq duration t numbers t duration-output-format nil)) + (?U (setq duration t numbers t duration-output-format 'hh:mm)) + (?N (setq numbers t)) + (?L (setq literal t)) + (?E (setq keep-empty t)) + (?D (setf (cl-getf calc-modes 'calc-angle-mode) 'deg)) + (?R (setf (cl-getf calc-modes 'calc-angle-mode) 'rad)) + (?F (setf (cl-getf calc-modes 'calc-prefer-frac) t)) + (?S (setf (cl-getf calc-modes 'calc-symbolic-mode) t)) + (?u (setf (cl-getf calc-modes 'calc-simplify-mode) 'units)))) + ;; Remove matched flags from the mode string. (setq fmt (replace-match "" t t fmt))) (unless (string-match "\\S-" fmt) (setq fmt nil)))) @@ -2582,17 +2570,17 @@ location of point." (setq form0 form) ;; Insert the references to fields in same row (while (string-match "\\$\\(\\([-+]\\)?[0-9]+\\)" form) - (setq n (+ (string-to-number (match-string 1 form)) - (if (match-end 2) n0 0)) - x (nth (1- (if (= n 0) n0 (max n 1))) fields) - formrpl (save-match-data - (org-table-make-reference - x keep-empty numbers lispp))) - (when (or (not x) - (save-match-data - (string-match (regexp-quote formula) formrpl))) - (user-error "Invalid field specifier \"%s\"" - (match-string 0 form))) + (let* ((n (+ (string-to-number (match-string 1 form)) + (if (match-end 2) n0 0))) + (x (nth (1- (if (= n 0) n0 (max n 1))) fields))) + (setq formrpl (save-match-data + (org-table-make-reference + x keep-empty numbers lispp))) + (when (or (not x) + (save-match-data + (string-match (regexp-quote formula) formrpl))) + (user-error "Invalid field specifier \"%s\"" + (match-string 0 form)))) (setq form (replace-match formrpl t t form))) (if lispp @@ -2624,7 +2612,7 @@ location of point." (setq ev (if (and duration (string-match "^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" form)) form - (calc-eval (cons form org-tbl-calc-modes) + (calc-eval (cons form calc-modes) (when (and (not keep-empty) numbers) 'num))) ev (if duration (org-table-time-seconds-to-string (if (string-match "^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" ev) @@ -3280,7 +3268,7 @@ Parameters get priority." (org-defkey map "\C-c}" 'org-table-fedit-toggle-coordinates) map)) -(easy-menu-define org-table-fedit-menu org-table-fedit-map "Org Edit Formulas Menu" +(easy-menu-define org-table-fedit-menu org-table-fedit-map "Org Edit Formulas Menu." '("Edit-Formulas" ["Finish and Install" org-table-fedit-finish t] ["Finish, Install, and Apply" (org-table-fedit-finish t) :keys "C-u C-c C-c"] @@ -4674,19 +4662,24 @@ blank, and the content is appended to the field above." (if (org-region-active-p) ;; There is a region: fill as a paragraph. (let ((start (region-beginning))) - (org-table-cut-region (region-beginning) (region-end)) - (when (> (length (car org-table-clip)) 1) - (user-error "Region must be limited to single column")) - (let ((nlines (cond ((not arg) (length org-table-clip)) - ((< arg 1) (+ (length org-table-clip) arg)) - (t arg)))) - (setq org-table-clip - (mapcar #'list - (org-wrap (mapconcat #'car org-table-clip " ") - nil - nlines)))) - (goto-char start) - (org-table-paste-rectangle)) + (save-restriction + (narrow-to-region + (save-excursion (goto-char start) (move-beginning-of-line 1)) + (save-excursion (org-forward-paragraph) (point))) + (org-table-cut-region (region-beginning) (region-end)) + (when (> (length (car org-table-clip)) 1) + (user-error "Region must be limited to single column")) + (let ((nlines (cond ((not arg) (length org-table-clip)) + ((< arg 1) (+ (length org-table-clip) arg)) + (t arg)))) + (setq org-table-clip + (mapcar #'list + (org-wrap (mapconcat #'car org-table-clip " ") + nil + nlines)))) + (goto-char start) + (org-table-paste-rectangle)) + (org-table-align)) ;; No region, split the current field at point. (unless (org-get-alist-option org-M-RET-may-split-line 'table) (skip-chars-forward "^\r\n|")) @@ -5084,7 +5077,7 @@ When LOCAL is non-nil, show references for the table at point." (put 'orgtbl-mode :included t) (put 'orgtbl-mode :menu-tag "Org Table Mode") -(easy-menu-define orgtbl-mode-menu orgtbl-mode-map "OrgTbl menu" +(easy-menu-define orgtbl-mode-menu orgtbl-mode-map "OrgTbl menu." '("OrgTbl" ["Create or convert" org-table-create-or-convert-from-region :active (not (org-at-table-p)) :keys "C-c |" ] @@ -5334,7 +5327,7 @@ With prefix arg, also recompute table." (defun orgtbl-create-or-convert-from-region (_arg) "Create table or convert region to table, if no conflicting binding. This installs the table binding `C-c |', but only if there is no -conflicting binding to this key outside orgtbl-mode." +conflicting binding to this key outside `orgtbl-mode'." (interactive "P") (let* (orgtbl-mode (cmd (key-binding "\C-c|"))) (if cmd @@ -5573,7 +5566,7 @@ First element has index 0, or I0 if given." ;;;###autoload (defun orgtbl-to-generic (table params) - "Convert the orgtbl-mode TABLE to some other format. + "Convert the `orgtbl-mode' TABLE to some other format. This generic routine can be used for many standard cases. @@ -5960,12 +5953,12 @@ information." ;;;###autoload (defun orgtbl-to-tsv (table params) - "Convert the orgtbl-mode table to TAB separated material." + "Convert the `orgtbl-mode' TABLE to TAB separated material." (orgtbl-to-generic table (org-combine-plists '(:sep "\t") params))) ;;;###autoload (defun orgtbl-to-csv (table params) - "Convert the orgtbl-mode table to CSV material. + "Convert the `orgtbl-mode' TABLE to CSV material. This does take care of the proper quoting of fields with comma or quotes." (orgtbl-to-generic table (org-combine-plists '(:sep "," :fmt org-quote-csv-field) @@ -5973,7 +5966,7 @@ This does take care of the proper quoting of fields with comma or quotes." ;;;###autoload (defun orgtbl-to-latex (table params) - "Convert the orgtbl-mode TABLE to LaTeX. + "Convert the `orgtbl-mode' TABLE to LaTeX. TABLE is a list, each entry either the symbol `hline' for a horizontal separator line, or a list of fields for that line. @@ -6006,7 +5999,7 @@ supported. It is also possible to use the following ones: ;;;###autoload (defun orgtbl-to-html (table params) - "Convert the orgtbl-mode TABLE to HTML. + "Convert the `orgtbl-mode' TABLE to HTML. TABLE is a list, each entry either the symbol `hline' for a horizontal separator line, or a list of fields for that line. @@ -6037,7 +6030,7 @@ supported. It is also possible to use the following one: ;;;###autoload (defun orgtbl-to-texinfo (table params) - "Convert the orgtbl-mode TABLE to Texinfo. + "Convert the `orgtbl-mode' TABLE to Texinfo. TABLE is a list, each entry either the symbol `hline' for a horizontal separator line, or a list of fields for that line. @@ -6068,7 +6061,7 @@ supported. It is also possible to use the following one: ;;;###autoload (defun orgtbl-to-orgtbl (table params) - "Convert the orgtbl-mode TABLE into another orgtbl-mode table. + "Convert the `orgtbl-mode' TABLE into another orgtbl-mode table. TABLE is a list, each entry either the symbol `hline' for a horizontal separator line, or a list of fields for that line. @@ -6083,7 +6076,7 @@ be set to provide ORGTBL directives for the generated table." (orgtbl-to-generic table (org-combine-plists params (list :backend 'org)))) (defun orgtbl-to-table.el (table params) - "Convert the orgtbl-mode TABLE into a table.el table. + "Convert the `orgtbl-mode' TABLE into a table.el table. TABLE is a list, each entry either the symbol `hline' for a horizontal separator line, or a list of fields for that line. PARAMS is a property list of parameters that can influence the @@ -6097,7 +6090,7 @@ supported." (replace-regexp-in-string "|-" "+-" (buffer-substring 1 (buffer-size)))))) (defun orgtbl-to-unicode (table params) - "Convert the orgtbl-mode TABLE into a table with unicode characters. + "Convert the `orgtbl-mode' TABLE into a table with unicode characters. TABLE is a list, each entry either the symbol `hline' for a horizontal separator line, or a list of fields for that line. @@ -6109,7 +6102,7 @@ supported. It is also possible to use the following ones: When non-nil, use \"ascii-art-to-unicode\" package to translate the table. You can download it here: - http://gnuvola.org/software/j/aa2u/ascii-art-to-unicode.el. + https://gnuvola.org/software/j/aa2u/ascii-art-to-unicode.el. :narrow @@ -6214,7 +6207,7 @@ which will prompt for the width." (defun orgtbl-uc-draw-grid (value min max &optional width) "Draw a bar in a table using block unicode characters. -It is a variant of orgtbl-ascii-draw with Unicode block +It is a variant of `orgtbl-ascii-draw' with Unicode block characters, for a smooth display. Bars appear as grids (to the extent the font allows)." ;; https://en.wikipedia.org/wiki/Block_Elements @@ -6224,7 +6217,7 @@ extent the font allows)." (defun orgtbl-uc-draw-cont (value min max &optional width) "Draw a bar in a table using block unicode characters. -It is a variant of orgtbl-ascii-draw with Unicode block +It is a variant of `orgtbl-ascii-draw' with Unicode block characters, for a smooth display. Bars are solid (to the extent the font allows)." (orgtbl-ascii-draw value min max width diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el index e2116be701..bfcea443c3 100644 --- a/lisp/org/org-timer.el +++ b/lisp/org/org-timer.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org ;; diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index 8871ef798d..ef363dc390 100644 --- a/lisp/org/org-version.el +++ b/lisp/org/org-version.el @@ -5,13 +5,13 @@ (defun org-release () "The release version of Org. Inserted by installing Org mode or when a release is made." - (let ((org-release "9.4.4")) + (let ((org-release "9.5")) org-release)) ;;;###autoload (defun org-git-version () "The Git version of Org mode. Inserted by installing Org or when a release is made." - (let ((org-git-version "release_9.4.4")) + (let ((org-git-version "release_9.5")) org-git-version)) (provide 'org-version) diff --git a/lisp/org/org.el b/lisp/org/org.el index 4a74eda842..2ec6566c0b 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -3,12 +3,13 @@ ;; Carstens outline-mode for keeping track of everything. ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. ;; -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Maintainer: Bastien Guerry ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org +;; Package-Requires: ((emacs "25.1")) -;; Version: 9.4.4 +;; Version: 9.5 ;; This file is part of GNU Emacs. ;; @@ -93,6 +94,7 @@ (require 'org-compat) (require 'org-keys) (require 'ol) +(require 'oc) (require 'org-table) ;; `org-outline-regexp' ought to be a defconst but is let-bound in @@ -144,7 +146,6 @@ Stars are put in group 1 and the trimmed body in group 2.") (declare-function org-clock-timestamps-down "org-clock" (&optional n)) (declare-function org-clock-timestamps-up "org-clock" (&optional n)) (declare-function org-clock-update-time-maybe "org-clock" ()) -(declare-function org-clocking-buffer "org-clock" ()) (declare-function org-clocktable-shift "org-clock" (dir n)) (declare-function org-columns-quit "org-colview" ()) (declare-function org-columns-insert-dblock "org-colview" ()) @@ -157,13 +158,18 @@ Stars are put in group 1 and the trimmed body in group 2.") (declare-function org-element-context "org-element" (&optional element)) (declare-function org-element-copy "org-element" (datum)) (declare-function org-element-create "org-element" (type &optional props &rest children)) +(declare-function org-element-extract-element "org-element" (element)) +(declare-function org-element-insert-before "org-element" (element location)) (declare-function org-element-interpret-data "org-element" (data)) (declare-function org-element-lineage "org-element" (blob &optional types with-self)) (declare-function org-element-link-parser "org-element" ()) +(declare-function org-element-map "org-element" (data types fun &optional info first-match no-recursion with-affiliated)) (declare-function org-element-nested-p "org-element" (elem-a elem-b)) (declare-function org-element-parse-buffer "org-element" (&optional granularity visible-only)) +(declare-function org-element-parse-secondary-string "org-element" (string restriction &optional parent)) (declare-function org-element-property "org-element" (property element)) (declare-function org-element-put-property "org-element" (element property value)) +(declare-function org-element-restriction "org-element" (element)) (declare-function org-element-swap-A-B "org-element" (elem-a elem-b)) (declare-function org-element-timestamp-parser "org-element" ()) (declare-function org-element-type "org-element" (element)) @@ -191,7 +197,6 @@ Stars are put in group 1 and the trimmed body in group 2.") (declare-function org-toggle-archive-tag "org-archive" (&optional find-done)) (declare-function org-update-radio-target-regexp "ol" ()) -(defvar ffap-url-regexp) (defvar org-element-paragraph-separate) (defvar org-indent-indentation-per-level) (defvar org-radio-target-regexp) @@ -202,6 +207,8 @@ Stars are put in group 1 and the trimmed body in group 2.") ;; load languages based on value of `org-babel-load-languages' (defvar org-babel-load-languages) +(defvar crm-separator) ; dynamically scoped param + ;;;###autoload (defun org-babel-do-load-languages (sym value) "Load the languages defined in `org-babel-load-languages'." @@ -230,7 +237,11 @@ byte-compiled before it is loaded." tangled-file (file-attribute-modification-time (file-attributes (file-truename file)))) - (org-babel-tangle-file file tangled-file "emacs-lisp\\|elisp")) + (org-babel-tangle-file file + tangled-file + (rx string-start + (or "emacs-lisp" "elisp") + string-end))) (if compile (progn (byte-compile-file tangled-file) @@ -263,32 +274,25 @@ requirement." (const :tag "Awk" awk) (const :tag "C" C) (const :tag "R" R) - (const :tag "Asymptote" asymptote) - (const :tag "Calc" calc) + (const :tag "Calc" calc) (const :tag "Clojure" clojure) (const :tag "CSS" css) (const :tag "Ditaa" ditaa) (const :tag "Dot" dot) - (const :tag "Ebnf2ps" ebnf2ps) - (const :tag "Emacs Lisp" emacs-lisp) + (const :tag "Emacs Lisp" emacs-lisp) (const :tag "Forth" forth) (const :tag "Fortran" fortran) (const :tag "Gnuplot" gnuplot) (const :tag "Haskell" haskell) - (const :tag "hledger" hledger) - (const :tag "IO" io) - (const :tag "J" J) - (const :tag "Java" java) + (const :tag "Java" java) (const :tag "Javascript" js) (const :tag "LaTeX" latex) - (const :tag "Ledger" ledger) - (const :tag "Lilypond" lilypond) + (const :tag "Lilypond" lilypond) (const :tag "Lisp" lisp) (const :tag "Makefile" makefile) (const :tag "Maxima" maxima) (const :tag "Matlab" matlab) - (const :tag "Mscgen" mscgen) - (const :tag "Ocaml" ocaml) + (const :tag "Ocaml" ocaml) (const :tag "Octave" octave) (const :tag "Org" org) (const :tag "Perl" perl) @@ -301,11 +305,9 @@ requirement." (const :tag "Scheme" scheme) (const :tag "Screen" screen) (const :tag "Shell Script" shell) - (const :tag "Shen" shen) - (const :tag "Sql" sql) + (const :tag "Sql" sql) (const :tag "Sqlite" sqlite) - (const :tag "Stan" stan) - (const :tag "Vala" vala)) + (const :tag "Stan" stan)) :value-type (boolean :tag "Activate" :value t))) ;;;; Customization variables @@ -654,6 +656,10 @@ defined in org-duration.el.") :group 'org :type 'hook) +(make-obsolete-variable + 'org-load-hook + "use `with-eval-after-load' instead." "9.5") + (defcustom org-log-buffer-setup-hook nil "Hook that is run after an Org log buffer is created." :group 'org @@ -680,15 +686,16 @@ defined in org-duration.el.") (org-load-modules-maybe 'force) (org-element-cache-reset 'all))) -(defcustom org-modules '(ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus ol-info ol-irc ol-mhe ol-rmail ol-eww) +(defcustom org-modules '(ol-doi ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus ol-info ol-irc ol-mhe ol-rmail ol-eww) "Modules that should always be loaded together with org.el. -If a description starts with , the file is not part of Emacs -and loading it will require that you have downloaded and properly -installed the Org mode distribution. +If a description starts with , the file is not part of Emacs and Org mode, +so loading it will require that you have properly installed org-contrib +package from NonGNU Emacs Lisp Package Archive +http://elpa.nongnu.org/nongnu/org-contrib.html You can also use this system to load external packages (i.e. neither Org -core modules, nor modules from the CONTRIB directory). Just add symbols +core modules, nor org-contrib modules). Just add symbols to the end of the list. If the package is called org-xyz.el, then you need to add the symbol `xyz', and the package must have a call to: @@ -697,8 +704,7 @@ to add the symbol `xyz', and the package must have a call to: For export specific modules, see also `org-export-backends'." :group 'org :set 'org-set-modules - :version "26.1" - :package-version '(Org . "9.2") + :package-version '(Org . "9.5") :type '(set :greedy t (const :tag " bbdb: Links to BBDB entries" ol-bbdb) @@ -706,6 +712,7 @@ For export specific modules, see also `org-export-backends'." (const :tag " crypt: Encryption of subtrees" org-crypt) (const :tag " ctags: Access to Emacs tags with links" org-ctags) (const :tag " docview: Links to Docview buffers" ol-docview) + (const :tag " doi: Links to DOI references" ol-doi) (const :tag " eww: Store link to URL of Eww" ol-eww) (const :tag " gnus: Links to GNUS folders/messages" ol-gnus) (const :tag " habit: Track your consistency with habits" org-habit) @@ -762,9 +769,10 @@ For export specific modules, see also `org-export-backends'." (defcustom org-export-backends '(ascii html icalendar latex odt) "List of export back-ends that should be always available. -If a description starts with , the file is not part of Emacs -and loading it will require that you have downloaded and properly -installed the Org mode distribution. +If a description starts with , the file is not part of Emacs and Org mode, +so loading it will require that you have properly installed org-contrib +package from NonGNU Emacs Lisp Package Archive +http://elpa.nongnu.org/nongnu/org-contrib.html Unlike to `org-modules', libraries in this list will not be loaded along with Org, but only once the export framework is @@ -940,6 +948,7 @@ the following lines anywhere in the buffer: #+STARTUP: fold (or `overview', this is equivalent) #+STARTUP: nofold (or `showall', this is equivalent) #+STARTUP: content + #+STARTUP: showlevels ( = 2..5) #+STARTUP: showeverything Set `org-agenda-inhibit-startup' to a non-nil value if you want @@ -950,6 +959,10 @@ time." :type '(choice (const :tag "nofold: show all" nil) (const :tag "fold: overview" t) + (const :tag "fold: show two levels" show2levels) + (const :tag "fold: show three levels" show3levels) + (const :tag "fold: show four levels" show4evels) + (const :tag "fold: show five levels" show5levels) (const :tag "content: all headlines" content) (const :tag "show everything, even drawers" showeverything))) @@ -1194,6 +1207,8 @@ Allowed visibility spans are ancestors show current headline and its direct ancestors; if point is not on headline, also show entry + ancestors-full show current subtree and its direct ancestors + lineage show current headline, its direct ancestors and all their children; if point is not on headline, also show entry and first child @@ -1235,6 +1250,7 @@ more context." (const minimal) (const local) (const ancestors) + (const ancestors-full) (const lineage) (const tree) (const canonical)))))) @@ -1575,14 +1591,13 @@ lines to the buffer: :group 'org-appearance :type 'boolean) -(defcustom org-adapt-indentation t +(defcustom org-adapt-indentation nil "Non-nil means adapt indentation to outline node level. -When this variable is set to t, Org assumes that you write -outlines by indenting text in each node to align with the -headline (after the stars). +When set to t, Org assumes that you write outlines by indenting +text in each node to align with the headline, after the stars. -When this variable is set to 'headline-data, only adapt the +When this variable is set to `headline-data', Org only adapts the indentation of the data lines right below the headline, such as planning/clock lines and property/logbook drawers. @@ -1608,9 +1623,9 @@ time in Emacs." :type '(choice (const :tag "Adapt indentation for all lines" t) (const :tag "Adapt indentation for headline data lines" - 'headline-data) + headline-data) (const :tag "Do not adapt indentation at all" nil)) - :safe #'booleanp) + :safe (lambda (x) (memq x '(t nil headline-data)))) (defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e) @@ -2437,8 +2452,20 @@ set a priority." (defcustom org-priority-highest ?A "The highest priority of TODO items. + A character like ?A, ?B, etc., or a numeric value like 1, 2, etc. -Must be smaller than `org-priority-lowest'." + +The default is the character ?A, which is 65 as a numeric value. + +If you set `org-priority-highest' to a numeric value inferior to +65, Org assumes you want to use digits for the priority cookie. +If you set it to >=65, Org assumes you want to use alphabetical +characters. + +In both cases, the value of `org-priority-highest' must be +smaller than `org-priority-lowest': for example, if \"A\" is the +highest priority, it is smaller than the lowest \"C\" priority: +65 < 67." :group 'org-priorities :type '(choice (character :tag "Character") @@ -2447,8 +2474,20 @@ Must be smaller than `org-priority-lowest'." (defvaralias 'org-lowest-priority 'org-priority-lowest) (defcustom org-priority-lowest ?C "The lowest priority of TODO items. -A character like ?A, ?B, etc., or a numeric value like 1, 2, etc. -Must be higher than `org-priority-highest'." + +A character like ?C, ?B, etc., or a numeric value like 9, 8, etc. + +The default is the character ?C, which is 67 as a numeric value. + +If you set `org-priority-lowest' to a numeric value inferior to +65, Org assumes you want to use digits for the priority cookie. +If you set it to >=65, Org assumes you want to use alphabetical +characters. + +In both cases, the value of `org-priority-lowest' must be greater +than `org-priority-highest': for example, if \"C\" is the lowest +priority, it is greater than the highest \"A\" priority: 67 > +65." :group 'org-priorities :type '(choice (character :tag "Character") @@ -3113,7 +3152,7 @@ it in the document property drawer. For example: :CATEGORY: ELisp :END: -Other ways to define it is as an emacs file variable, for example +Other ways to define it is as an Emacs file variable, for example # -*- mode: org; org-category: \"ELisp\" @@ -3285,7 +3324,7 @@ All available processes and theirs documents can be found in :image-output-type "png" :image-size-adjust (1.0 . 1.0) :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f") - :image-converter ("dvipng -D %D -T tight -o %O %f")) + :image-converter ("dvipng -D %D -T tight -bg Transparent -o %O %f")) (dvisvgm :programs ("latex" "dvisvgm") :description "dvi > svg" @@ -3428,13 +3467,11 @@ header, or they will be appended." '(("AUTO" "inputenc" t ("pdflatex")) ("T1" "fontenc" t ("pdflatex")) ("" "graphicx" t) - ("" "grffile" t) ("" "longtable" nil) ("" "wrapfig" nil) ("" "rotating" nil) ("normalem" "ulem" t) ("" "amsmath" t) - ("" "textcomp" t) ("" "amssymb" t) ("" "capt-of" nil) ("" "hyperref" nil)) @@ -3448,15 +3485,14 @@ Org mode to function properly: - inputenc, fontenc: for basic font and character selection - graphicx: for including images -- grffile: allow periods and spaces in graphics file names - longtable: For multipage tables - wrapfig: for figure placement - rotating: for sideways figures and tables - ulem: for underline and strike-through - amsmath: for subscript and superscript and math environments -- textcomp, amssymb: for various symbols used - for interpreting the entities in `org-entities'. You can skip - some of these packages if you don't use any of their symbols. +- amssymb: for various symbols used for interpreting the entities + in `org-entities'. You can skip some of this package if you don't + use any of the symbols. - capt-of: for captions outside of floats - hyperref: for cross references @@ -3570,10 +3606,11 @@ lines to the buffer: For example, a value \\='(title) for this list makes the document's title appear in the buffer without the initial \"#+TITLE:\" part." :group 'org-appearance - :version "24.1" + :package-version '(Org . "9.5") :type '(set (const :tag "#+AUTHOR" author) (const :tag "#+DATE" date) (const :tag "#+EMAIL" email) + (const :tag "#+SUBTITLE" subtitle) (const :tag "#+TITLE" title))) (defcustom org-custom-properties nil @@ -3822,10 +3859,11 @@ This is needed for font-lock setup.") "Marker recording the last clock-in, but the headline position.") (defvar org-clock-heading "" "The heading of the current clock entry.") -(defun org-clock-is-active () +(defun org-clocking-buffer () "Return the buffer where the clock is currently running. Return nil if no clock is running." (marker-buffer org-clock-marker)) +(defalias 'org-clock-is-active #'org-clocking-buffer) (defun org-check-running-clock () "Check if the current buffer contains the running clock. @@ -4106,7 +4144,7 @@ groups carry important information: (defconst org-stamp-time-of-day-regexp (concat "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +\\sw+ +\\)" - "\\([012][0-9]:[0-5][0-9]\\(-\\([012][0-9]:[0-5][0-9]\\)\\)?[^\n\r>]*?\\)>" + "\\([012][0-9]:[0-5][0-9]\\)\\(-\\([012][0-9]:[0-5][0-9]\\)\\)?[^\n\r>]*?>" "\\(--?" "<\\1\\([012][0-9]:[0-5][0-9]\\)>\\)?") "Regular expression to match a timestamp time or time range. @@ -4122,6 +4160,10 @@ After a match, the following groups carry important information: ("overview" org-startup-folded t) ("nofold" org-startup-folded nil) ("showall" org-startup-folded nil) + ("show2levels" org-startup-folded show2levels) + ("show3levels" org-startup-folded show3levels) + ("show4levels" org-startup-folded show4levels) + ("show5levels" org-startup-folded show5levels) ("showeverything" org-startup-folded showeverything) ("content" org-startup-folded content) ("indent" org-startup-indented t) @@ -4498,7 +4540,7 @@ directory." (when (and (org-string-nw-p value) (not buffer-read-only)) ;FIXME: bug in Gnus? (let* ((uri (org-strip-quotes value)) - (uri-is-url (org-file-url-p uri)) + (uri-is-url (org-url-p uri)) (uri (if uri-is-url uri (expand-file-name uri)))) @@ -4628,11 +4670,6 @@ This is the cache of file URLs read using `org-file-contents'.") "Reset the cache of files downloaded by `org-file-contents'." (clrhash org--file-cache)) -(defun org-file-url-p (file) - "Non-nil if FILE is a URL." - (require 'ffap) - (string-match-p ffap-url-regexp file)) - (defun org-file-contents (file &optional noerror nocache) "Return the contents of FILE, as a string. @@ -4647,7 +4684,7 @@ from file or URL, and return nil. If NOCACHE is non-nil, do a fresh fetch of FILE even if cached version is available. This option applies only if FILE is a URL." - (let* ((is-url (org-file-url-p file)) + (let* ((is-url (org-url-p file)) (cache (and is-url (not nocache) (gethash file org--file-cache)))) @@ -4793,6 +4830,7 @@ The following commands are available: (org-load-modules-maybe) (org-install-agenda-files-menu) (when org-link-descriptive (add-to-invisibility-spec '(org-link))) + (make-local-variable 'org-link-descriptive) (add-to-invisibility-spec '(org-hide-block . t)) (setq-local outline-regexp org-outline-regexp) (setq-local outline-level 'org-outline-level) @@ -4903,6 +4941,18 @@ The following commands are available: (when org-startup-numerated (require 'org-num) (org-num-mode 1)) (when org-startup-indented (require 'org-indent) (org-indent-mode 1)))) + ;; Add a custom keymap for `visual-line-mode' so that activating + ;; this minor mode does not override Org's keybindings. + ;; FIXME: Probably `visual-line-mode' should take care of this. + (let ((oldmap (cdr (assoc 'visual-line-mode minor-mode-map-alist))) + (newmap (make-sparse-keymap))) + (set-keymap-parent newmap oldmap) + (define-key newmap [remap move-beginning-of-line] nil) + (define-key newmap [remap move-end-of-line] nil) + (define-key newmap [remap kill-line] nil) + (make-local-variable 'minor-mode-overriding-map-alist) + (push `(visual-line-mode . ,newmap) minor-mode-overriding-map-alist)) + ;; Activate `org-table-header-line-mode' (when org-table-header-line-p (org-table-header-line-mode 1)) @@ -4926,7 +4976,8 @@ The following commands are available: ("9.1" . "26.1") ("9.2" . "27.1") ("9.3" . "27.1") - ("9.4" . "27.2"))) + ("9.4" . "27.2") + ("9.5" . "28.1"))) (defvar org-mode-transpose-word-syntax-table (let ((st (make-syntax-table text-mode-syntax-table))) @@ -5059,9 +5110,9 @@ stacked delimiters is N. Escaping delimiters is not possible." (when (and org-hide-emphasis-markers (not (org-at-comment-p))) (add-text-properties (match-end 4) (match-beginning 5) - '(invisible org-link)) + '(invisible t)) (add-text-properties (match-beginning 3) (match-end 3) - '(invisible org-link))) + '(invisible t))) (throw :exit t)))))))) (defun org-emphasize (&optional char) @@ -5143,30 +5194,31 @@ This includes angle, plain, and bracket links." (link (org-element-property :raw-link link-object)) (type (org-element-property :type link-object)) (path (org-element-property :path link-object)) + (face-property (pcase (org-link-get-parameter type :face) + ((and (pred functionp) face) (funcall face path)) + ((and (pred facep) face) face) + ((and (pred consp) face) face) ;anonymous + (_ 'org-link))) (properties ;for link's visible part - (list - 'face (pcase (org-link-get-parameter type :face) - ((and (pred functionp) face) (funcall face path)) - ((and (pred facep) face) face) - ((and (pred consp) face) face) ;anonymous - (_ 'org-link)) - 'mouse-face (or (org-link-get-parameter type :mouse-face) - 'highlight) - 'keymap (or (org-link-get-parameter type :keymap) - org-mouse-map) - 'help-echo (pcase (org-link-get-parameter type :help-echo) - ((and (pred stringp) echo) echo) - ((and (pred functionp) echo) echo) - (_ (concat "LINK: " link))) - 'htmlize-link (pcase (org-link-get-parameter type - :htmlize-link) - ((and (pred functionp) f) (funcall f)) - (_ `(:uri ,link))) - 'font-lock-multiline t))) + (list 'mouse-face (or (org-link-get-parameter type :mouse-face) + 'highlight) + 'keymap (or (org-link-get-parameter type :keymap) + org-mouse-map) + 'help-echo (pcase (org-link-get-parameter type :help-echo) + ((and (pred stringp) echo) echo) + ((and (pred functionp) echo) echo) + (_ (concat "LINK: " link))) + 'htmlize-link (pcase (org-link-get-parameter type + :htmlize-link) + ((and (pred functionp) f) (funcall f)) + (_ `(:uri ,link))) + 'font-lock-multiline t))) (org-remove-flyspell-overlays-in start end) (org-rear-nonsticky-at end) (if (not (eq 'bracket style)) - (add-text-properties start end properties) + (progn + (add-face-text-property start end face-property) + (add-text-properties start end properties)) ;; Handle invisible parts in bracket links. (remove-text-properties start end '(invisible nil)) (let ((hidden @@ -5175,6 +5227,7 @@ This includes angle, plain, and bracket links." 'org-link)) properties))) (add-text-properties start visible-start hidden) + (add-face-text-property start end face-property) (add-text-properties visible-start visible-end properties) (add-text-properties visible-end end hidden) (org-rear-nonsticky-at visible-start) @@ -5272,7 +5325,8 @@ by a #." (org-remove-flyspell-overlays-in nl-before-endline end-of-endline) (cond ((and lang (not (string= lang "")) org-src-fontify-natively) - (org-src-font-lock-fontify-block lang block-start block-end) + (save-match-data + (org-src-font-lock-fontify-block lang block-start block-end)) (add-text-properties bol-after-beginline block-end '(src-block t))) (quoting (add-text-properties @@ -5303,7 +5357,7 @@ by a #." (min (point-max) end-of-endline)) '(face org-block-end-line))) t)) - ((member dc1 '("+title:" "+author:" "+email:" "+date:")) + ((member dc1 '("+title:" "+subtitle:" "+author:" "+email:" "+date:")) (org-remove-flyspell-overlays-in (match-beginning 0) (if (equal "+title:" dc1) (match-end 2) (match-end 0))) @@ -5376,22 +5430,26 @@ by a #." t))))) (defun org-fontify-extend-region (beg end _old-len) - (let ((begin-re "\\(\\\\\\[\\|\\(#\\+begin_\\|\\\\begin{\\)\\S-+\\)") + (let ((end (if (progn (goto-char end) (looking-at-p "^[*#]")) + (1+ end) end)) + (begin-re "\\(\\\\\\[\\|\\(#\\+begin_\\|\\\\begin{\\)\\S-+\\)") (end-re "\\(\\\\\\]\\|\\(#\\+end_\\|\\\\end{\\)\\S-+\\)") - (extend (lambda (r1 r2 dir) - (let ((re (replace-regexp-in-string "\\(begin\\|end\\)" r1 - (replace-regexp-in-string "[][]" r2 - (match-string-no-properties 0))))) - (re-search-forward (regexp-quote re) nil t dir))))) + (extend + (lambda (r1 r2 dir) + (let ((re (replace-regexp-in-string + "\\(begin\\|end\\)" r1 + (replace-regexp-in-string + "[][]" r2 + (match-string-no-properties 0))))) + (re-search-forward (regexp-quote re) nil t dir))))) + (goto-char beg) + (back-to-indentation) (save-match-data - (save-excursion - (goto-char beg) - (back-to-indentation) - (cond ((looking-at end-re) - (cons (or (funcall extend "begin" "[" -1) beg) end)) - ((looking-at begin-re) - (cons beg (or (funcall extend "end" "]" 1) end))) - (t (cons beg end))))))) + (cond ((looking-at end-re) + (cons (or (funcall extend "begin" "[" -1) beg) end)) + ((looking-at begin-re) + (cons beg (or (funcall extend "end" "]" 1) end))) + (t (cons beg end)))))) (defun org-activate-footnote-links (limit) "Add text properties for footnotes." @@ -5488,6 +5546,8 @@ highlighting was done, nil otherwise." (while (and (< (point) limit) (re-search-forward org-latex-and-related-regexp nil t)) (cond + ((>= (match-beginning 0) limit) + (throw 'found nil)) ((cl-some (lambda (f) (memq f '(org-code org-verbatim underline org-special-keyword))) @@ -5600,111 +5660,116 @@ needs to be inserted at a specific position in the font-lock sequence.") (defun org-set-font-lock-defaults () "Set font lock defaults for the current buffer." - (let* ((em org-fontify-emphasized-text) - (lk org-highlight-links) - (org-font-lock-extra-keywords - (list - ;; Call the hook - '(org-font-lock-hook) - ;; Headlines - `(,(if org-fontify-whole-heading-line - "^\\(\\**\\)\\(\\* \\)\\(.*\n?\\)" - "^\\(\\**\\)\\(\\* \\)\\(.*\\)") - (1 (org-get-level-face 1)) - (2 (org-get-level-face 2)) - (3 (org-get-level-face 3))) - ;; Table lines - '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)" - (1 'org-table t)) - ;; Table internals - '("^[ \t]*|\\(?:.*?|\\)? *\\(:?=[^|\n]*\\)" (1 'org-formula t)) - '("^[ \t]*| *\\([#*]\\) *|" (1 'org-formula t)) - '("^[ \t]*|\\( *\\([$!_^/]\\) *|.*\\)|" (1 'org-formula t)) - '("| *\\(<[lrc]?[0-9]*>\\)" (1 'org-formula t)) - ;; Properties - (list org-property-re - '(1 'org-special-keyword t) - '(3 'org-property-value t)) - ;; Drawers - '(org-fontify-drawers) - ;; Link related fontification. - '(org-activate-links) - (when (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend))) - (when (memq 'radio lk) '(org-activate-target-links (1 'org-link t))) - (when (memq 'date lk) '(org-activate-dates (0 'org-date t))) - (when (memq 'footnote lk) '(org-activate-footnote-links)) - ;; Targets. - (list org-radio-target-regexp '(0 'org-target t)) - (list org-target-regexp '(0 'org-target t)) - ;; Diary sexps. - '("^&?%%(.*\\|<%%([^>\n]*?>" (0 'org-sexp-date t)) - ;; Macro - '(org-fontify-macros) - ;; TODO keyword - (list (format org-heading-keyword-regexp-format - org-todo-regexp) - '(2 (org-get-todo-face 2) t)) - ;; TODO - (when org-fontify-todo-headline - (list (format org-heading-keyword-regexp-format - (concat - "\\(?:" - (mapconcat 'regexp-quote org-not-done-keywords "\\|") - "\\)")) - '(2 'org-headline-todo t))) - ;; DONE - (when org-fontify-done-headline - (list (format org-heading-keyword-regexp-format - (concat - "\\(?:" - (mapconcat 'regexp-quote org-done-keywords "\\|") - "\\)")) - '(2 'org-headline-done t))) - ;; Priorities - '(org-font-lock-add-priority-faces) - ;; Tags - '(org-font-lock-add-tag-faces) - ;; Tags groups - (when (and org-group-tags org-tag-groups-alist) - (list (concat org-outline-regexp-bol ".+\\(:" - (regexp-opt (mapcar 'car org-tag-groups-alist)) - ":\\).*$") - '(1 'org-tag-group prepend))) - ;; Special keywords - (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t)) - (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t)) - (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t)) - (list (concat "\\<" org-clock-string) '(0 'org-special-keyword t)) - ;; Emphasis - (when em '(org-do-emphasis-faces)) - ;; Checkboxes - '("^[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\)[ \t]+\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\(\\[[- X]\\]\\)" - 1 'org-checkbox prepend) - (when (cdr (assq 'checkbox org-list-automatic-rules)) - '("\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]" - (0 (org-get-checkbox-statistics-face) t))) - ;; Description list items - '("^[ \t]*[-+*][ \t]+\\(.*?[ \t]+::\\)\\([ \t]+\\|$\\)" - 1 'org-list-dt prepend) - ;; ARCHIVEd headings - (list (concat - org-outline-regexp-bol - "\\(.*:" org-archive-tag ":.*\\)") - '(1 'org-archived prepend)) - ;; Specials - '(org-do-latex-and-related) - '(org-fontify-entities) - '(org-raise-scripts) - ;; Code - '(org-activate-code (1 'org-code t)) - ;; COMMENT - (list (format - "^\\*+\\(?: +%s\\)?\\(?: +\\[#[A-Z0-9]\\]\\)? +\\(?9:%s\\)\\(?: \\|$\\)" - org-todo-regexp - org-comment-string) - '(9 'org-special-keyword t)) - ;; Blocks and meta lines - '(org-fontify-meta-lines-and-blocks)))) + (let ((org-font-lock-extra-keywords + (list + ;; Call the hook + '(org-font-lock-hook) + ;; Headlines + `(,(if org-fontify-whole-heading-line + "^\\(\\**\\)\\(\\* \\)\\(.*\n?\\)" + "^\\(\\**\\)\\(\\* \\)\\(.*\\)") + (1 (org-get-level-face 1)) + (2 (org-get-level-face 2)) + (3 (org-get-level-face 3))) + ;; Table lines + '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)" + (1 'org-table t)) + ;; Table internals + '("^[ \t]*|\\(?:.*?|\\)? *\\(:?=[^|\n]*\\)" (1 'org-formula t)) + '("^[ \t]*| *\\([#*]\\) *|" (1 'org-formula t)) + '("^[ \t]*|\\( *\\([$!_^/]\\) *|.*\\)|" (1 'org-formula t)) + '("| *\\(<[lrc]?[0-9]*>\\)" (1 'org-formula t)) + ;; Properties + (list org-property-re + '(1 'org-special-keyword t) + '(3 'org-property-value t)) + ;; Drawers + '(org-fontify-drawers) + ;; Link related fontification. + '(org-activate-links) + (when (memq 'tag org-highlight-links) '(org-activate-tags (1 'org-tag prepend))) + (when (memq 'radio org-highlight-links) '(org-activate-target-links (1 'org-link t))) + (when (memq 'date org-highlight-links) '(org-activate-dates (0 'org-date t))) + (when (memq 'footnote org-highlight-links) '(org-activate-footnote-links)) + ;; Targets. + (list org-radio-target-regexp '(0 'org-target t)) + (list org-target-regexp '(0 'org-target t)) + ;; Diary sexps. + '("^&?%%(.*\\|<%%([^>\n]*?>" (0 'org-sexp-date t)) + ;; Macro + '(org-fontify-macros) + ;; TODO keyword + (list (format org-heading-keyword-regexp-format + org-todo-regexp) + '(2 (org-get-todo-face 2) prepend)) + ;; TODO + (when org-fontify-todo-headline + (list (format org-heading-keyword-regexp-format + (concat + "\\(?:" + (mapconcat 'regexp-quote org-not-done-keywords "\\|") + "\\)")) + '(2 'org-headline-todo prepend))) + ;; DONE + (when org-fontify-done-headline + (list (format org-heading-keyword-regexp-format + (concat + "\\(?:" + (mapconcat 'regexp-quote org-done-keywords "\\|") + "\\)")) + '(2 'org-headline-done prepend))) + ;; Priorities + '(org-font-lock-add-priority-faces) + ;; Tags + '(org-font-lock-add-tag-faces) + ;; Tags groups + (when (and org-group-tags org-tag-groups-alist) + (list (concat org-outline-regexp-bol ".+\\(:" + (regexp-opt (mapcar 'car org-tag-groups-alist)) + ":\\).*$") + '(1 'org-tag-group prepend))) + ;; Special keywords + (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t)) + (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t)) + (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t)) + (list (concat "\\<" org-clock-string) '(0 'org-special-keyword t)) + ;; Emphasis + (when org-fontify-emphasized-text '(org-do-emphasis-faces)) + ;; Checkboxes + '("^[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\)[ \t]+\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\(\\[[- X]\\]\\)" + 1 'org-checkbox prepend) + (when (cdr (assq 'checkbox org-list-automatic-rules)) + '("\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]" + (0 (org-get-checkbox-statistics-face) prepend))) + ;; Description list items + '("\\(?:^[ \t]*[-+]\\|^[ \t]+[*]\\)[ \t]+\\(.*?[ \t]+::\\)\\([ \t]+\\|$\\)" + 1 'org-list-dt prepend) + ;; Inline export snippets + '("\\(@@\\)\\([a-z-]+:\\).*?\\(@@\\)" + (1 'font-lock-comment-face t) + (2 'org-tag t) + (3 'font-lock-comment-face t)) + ;; ARCHIVEd headings + (list (concat + org-outline-regexp-bol + "\\(.*:" org-archive-tag ":.*\\)") + '(1 'org-archived prepend)) + ;; Specials + '(org-do-latex-and-related) + '(org-fontify-entities) + '(org-raise-scripts) + ;; Code + '(org-activate-code (1 'org-code t)) + ;; COMMENT + (list (format + "^\\*+\\(?: +%s\\)?\\(?: +\\[#[A-Z0-9]\\]\\)? +\\(?9:%s\\)\\(?: \\|$\\)" + org-todo-regexp + org-comment-string) + '(9 'org-special-keyword t)) + ;; Blocks and meta lines + '(org-fontify-meta-lines-and-blocks) + ;; Citations + '(org-cite-activate)))) (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords)) (run-hooks 'org-font-lock-set-keywords-hook) ;; Now set the full font-lock-keywords @@ -5842,19 +5907,26 @@ If TAG is a number, get the corresponding match group." (defun org-font-lock-add-priority-faces (limit) "Add the special priority faces." - (while (re-search-forward org-priority-regexp limit t) - (add-text-properties - (match-beginning 1) (1+ (match-end 2)) - (list 'face (org-get-priority-face (string-to-char (match-string 2))) - 'font-lock-fontified t)))) + (while (re-search-forward (concat "^\\*+" org-priority-regexp) limit t) + (let ((beg (match-beginning 1)) + (end (1+ (match-end 2)))) + (add-face-text-property + beg end + (org-get-priority-face (string-to-char (match-string 2)))) + (add-text-properties + beg end + (list 'font-lock-fontified t))))) (defun org-font-lock-add-tag-faces (limit) "Add the special tag faces." (when (and org-tag-faces org-tags-special-faces-re) (while (re-search-forward org-tags-special-faces-re limit t) + (add-face-text-property + (match-beginning 1) + (match-end 1) + (org-get-tag-face 1)) (add-text-properties (match-beginning 1) (match-end 1) - (list 'face (org-get-tag-face 1) - 'font-lock-fontified t)) + (list 'font-lock-fontified t)) (backward-char 1)))) (defun org-unfontify-region (beg end &optional _maybe_loudly) @@ -5928,8 +6000,9 @@ and subscripts." "Remove outline overlays that do not contain non-white stuff." (dolist (o (overlays-at pos)) (and (eq 'outline (overlay-get o 'invisible)) - (not (string-match-p "\\S-" (buffer-substring (overlay-start o) - (overlay-end o)))) + (not (string-match-p + "\\S-" (buffer-substring (overlay-start o) + (overlay-end o)))) (delete-overlay o)))) (defun org-show-empty-lines-in-parent () @@ -6138,9 +6211,38 @@ Return a non-nil value when toggling is successful." (defun org-hide-drawer-all () "Fold all drawers in the current buffer." + (let ((begin (point-min)) + (end (point-max))) + (org--hide-drawers begin end))) + +(defun org-cycle-hide-drawers (state) + "Re-hide all drawers after a visibility state change. +STATE should be one of the symbols listed in the docstring of +`org-cycle-hook'." + (when (derived-mode-p 'org-mode) + (cond ((not (memq state '(overview folded contents))) + (let* ((global? (eq state 'all)) + (beg (if global? (point-min) (line-beginning-position))) + (end (cond (global? (point-max)) + ((eq state 'children) (org-entry-end-position)) + (t (save-excursion (org-end-of-subtree t t)))))) + (org--hide-drawers beg end))) + ((memq state '(overview contents)) + ;; Hide drawers before first heading. + (let ((beg (point-min)) + (end (save-excursion + (goto-char (point-min)) + (if (org-before-first-heading-p) + (org-entry-end-position) + (point-min))))) + (when (< beg end) + (org--hide-drawers beg end))))))) + +(defun org--hide-drawers (begin end) + "Hide all drawers between BEGIN and END." (save-excursion - (goto-char (point-min)) - (while (re-search-forward org-drawer-regexp nil t) + (goto-char begin) + (while (re-search-forward org-drawer-regexp end t) (let* ((pair (get-char-property-and-overlay (line-beginning-position) 'invisible)) (o (cdr-safe pair))) @@ -6157,32 +6259,6 @@ Return a non-nil value when toggling is successful." ;; `org-drawer-regexp'. (goto-char (org-element-property :end drawer))))))))))) -(defun org-cycle-hide-drawers (state) - "Re-hide all drawers after a visibility state change. -STATE should be one of the symbols listed in the docstring of -`org-cycle-hook'." - (when (and (derived-mode-p 'org-mode) - (not (memq state '(overview folded contents)))) - (let* ((global? (eq state 'all)) - (beg (if global? (point-min) (line-beginning-position))) - (end (cond (global? (point-max)) - ((eq state 'children) (org-entry-end-position)) - (t (save-excursion (org-end-of-subtree t t)))))) - (save-excursion - (goto-char beg) - (while (re-search-forward org-drawer-regexp end t) - (pcase (get-char-property-and-overlay (point) 'invisible) - ;; Do not fold already folded drawers. - (`(outline . ,o) (goto-char (overlay-end o))) - (_ - (let ((drawer (org-element-at-point))) - (when (memq (org-element-type drawer) '(drawer property-drawer)) - (org-hide-drawer-toggle t nil drawer) - ;; Make sure to skip drawer entirely or we might flag - ;; it another time when matching its ending line with - ;; `org-drawer-regexp'. - (goto-char (org-element-property :end drawer))))))))))) - ;;;; Visibility cycling (defvar-local org-cycle-global-status nil) @@ -6475,7 +6551,7 @@ Use `\\[org-edit-special]' to edit table.el tables")) (org-list-set-item-visibility (point-at-bol) struct 'children) (org-show-entry) (org-with-limited-levels (org-show-children)) - (org-show-set-visibility 'canonical) + (org-show-set-visibility 'tree) ;; Fold every list in subtree to top-level items. (when (eq org-cycle-include-plain-lists 'integrate) (save-excursion @@ -6541,6 +6617,14 @@ With a numeric prefix, show all headlines up to that level." (org-overview)) ((eq org-startup-folded 'content) (org-content)) + ((eq org-startup-folded 'show2levels) + (org-content 2)) + ((eq org-startup-folded 'show3levels) + (org-content 3)) + ((eq org-startup-folded 'show4levels) + (org-content 4)) + ((eq org-startup-folded 'show5levels) + (org-content 5)) ((or (eq org-startup-folded 'showeverything) (eq org-startup-folded nil)) (org-show-all))) @@ -6640,8 +6724,8 @@ This function is the default value of the hook `org-cycle-hook'." ;; First, find a reasonable region to look at: ;; Start two siblings above, end three below (let* ((beg (save-excursion - (and (org-get-last-sibling) - (org-get-last-sibling)) + (and (org-get-previous-sibling) + (org-get-previous-sibling)) (point))) (end (save-excursion (and (org-get-next-sibling) @@ -6723,9 +6807,9 @@ be shown." (defun org-show-set-visibility (detail) "Set visibility around point according to DETAIL. -DETAIL is either nil, `minimal', `local', `ancestors', `lineage', -`tree', `canonical' or t. See `org-show-context-detail' for more -information." +DETAIL is either nil, `minimal', `local', `ancestors', +`ancestors-full', `lineage', `tree', `canonical' or t. See +`org-show-context-detail' for more information." ;; Show current heading and possibly its entry, following headline ;; or all children. (if (and (org-at-heading-p) (not (eq detail 'local))) @@ -6740,14 +6824,16 @@ information." (org-with-limited-levels (cl-case detail ((tree canonical t) (org-show-children)) - ((nil minimal ancestors)) + ((nil minimal ancestors ancestors-full)) (t (save-excursion (outline-next-heading) (org-flag-heading nil))))))) + ;; Show whole subtree. + (when (eq detail 'ancestors-full) (org-show-subtree)) ;; Show all siblings. (when (eq detail 'lineage) (org-show-siblings)) ;; Show ancestors, possibly with their children. - (when (memq detail '(ancestors lineage tree canonical t)) + (when (memq detail '(ancestors ancestors-full lineage tree canonical t)) (save-excursion (while (org-up-heading-safe) (org-flag-heading nil) @@ -6945,6 +7031,14 @@ unconditionally." (when (equal arg '(16)) (org-up-heading-safe)) (org-end-of-subtree))) (unless (bolp) (insert "\n")) + (when (and blank? (save-excursion + (backward-char) + (org-before-first-heading-p))) + (insert "\n") + (backward-char)) + (when (and (not level) (not (eobp)) (not (bobp))) + (when (org-at-heading-p) (insert "\n")) + (backward-char)) (unless (and blank? (org-previous-line-empty-p)) (org-N-empty-lines-before-current (if blank? 1 0))) (insert stars " ") @@ -7391,7 +7485,9 @@ Assume point is at a heading or an inlinetask beginning." (col (+ (current-indentation) diff))) (when (wholenump col) (while (< (point) end-marker) - (indent-line-to col) + (if (natnump diff) + (insert (make-string diff 32)) + (delete-char (abs diff))) (forward-line))))) (catch 'no-shift (when (or (zerop diff) (not (eq org-adapt-indentation t))) @@ -7521,7 +7617,7 @@ case." (setq arg (prefix-numeric-value arg)) (org-preserve-local-variables (let ((movfunc (if (> arg 0) 'org-get-next-sibling - 'org-get-last-sibling)) + 'org-get-previous-sibling)) (ins-point (make-marker)) (cnt (abs arg)) (col (current-column)) @@ -7784,7 +7880,8 @@ called immediately, to move the markers with the entries." "Check if MARKER is between BEG and END. If yes, remember the marker and the distance to BEG." (when (and (marker-buffer marker) - (equal (marker-buffer marker) (current-buffer)) + (or (equal (marker-buffer marker) (current-buffer)) + (equal (marker-buffer marker) (buffer-base-buffer (current-buffer)))) (>= marker beg) (< marker end)) (push (cons marker (- marker beg)) org-markers-to-move))) @@ -7875,7 +7972,7 @@ with the original repeater." ""))) ;No time shift (doshift (and (org-string-nw-p shift) - (or (string-match "\\`[ \t]*\\([+-]?[0-9]+\\)\\([dwmy]\\)[ \t]*\\'" + (or (string-match "\\`[ \t]*\\([+-]?[0-9]+\\)\\([hdwmy]\\)[ \t]*\\'" shift) (user-error "Invalid shift specification %s" shift))))) (goto-char end-of-tree) @@ -7885,6 +7982,7 @@ with the original repeater." (shift-n (and doshift (string-to-number (match-string 1 shift)))) (shift-what (pcase (and doshift (match-string 2 shift)) (`nil nil) + ("h" 'hour) ("d" 'day) ("w" (setq shift-n (* 7 shift-n)) 'day) ("m" 'month) @@ -8074,14 +8172,37 @@ Optional argument WITH-CASE means sort case-sensitively." with-case)) (defun org-sort-remove-invisible (s) - "Remove invisible part of links and emphasis markers from string S." - (remove-text-properties 0 (length s) org-rm-props s) - (replace-regexp-in-string - org-verbatim-re (lambda (m) (format "%s " (match-string 4 m))) - (replace-regexp-in-string - org-emph-re (lambda (m) (format " %s " (match-string 4 m))) - (org-link-display-format s) - t t) t t)) + "Remove emphasis markers and any invisible property from string S. +Assume S may contain only objects." + ;; org-element-interpret-data clears any text property, including + ;; invisible part. + (org-element-interpret-data + (let ((tree (org-element-parse-secondary-string + s (org-element-restriction 'paragraph)))) + (org-element-map tree '(bold code italic link strike-through underline verbatim) + (lambda (o) + (pcase (org-element-type o) + ;; Terminal object. Replace it with its value. + ((or `code `verbatim) + (let ((new (org-element-property :value o))) + (org-element-insert-before new o) + (org-element-put-property + new :post-blank (org-element-property :post-blank o)))) + ;; Non-terminal objects. Splice contents. + (type + (let ((contents + (or (org-element-contents o) + (and (eq type 'link) + (list (org-element-property :raw-link o))))) + (c nil)) + (while contents + (setq c (pop contents)) + (org-element-insert-before c o)) + (org-element-put-property + c :post-blank (org-element-property :post-blank o))))) + (org-element-extract-element o))) + ;; Return modified tree. + tree))) (defvar org-after-sorting-entries-or-items-hook nil "Hook that is run after a bunch of entries or items have been sorted. @@ -8222,7 +8343,7 @@ function is being called interactively." ;; The clock marker is lost when using `sort-subr'; mark ;; the clock with temporary `:org-clock-marker-backup' ;; text property. - (when (and (eq (org-clock-is-active) (current-buffer)) + (when (and (eq (org-clocking-buffer) (current-buffer)) (<= start (marker-position org-clock-marker)) (>= end (marker-position org-clock-marker))) (with-silent-modifications @@ -8735,7 +8856,16 @@ If the file does not exist, throw an error." (save-window-excursion (message "Running %s...done" cmd) - (start-process-shell-command cmd nil cmd) + ;; Handlers such as "gio open" and kde-open5 start viewer in background + ;; and exit immediately. Use pipe connection type instead of pty to + ;; avoid killing children processes with SIGHUP when temporary terminal + ;; session is finished. + ;; + ;; TODO: Once minimum Emacs version is 25.1 or above, consider using + ;; the `make-process' invocation from 5db61eb0f929 to get more helpful + ;; error messages. + (let ((process-connection-type nil)) + (start-process-shell-command cmd nil cmd)) (and (boundp 'org-wait) (numberp org-wait) (sit-for org-wait)))) ((or (stringp cmd) (eq cmd 'emacs)) @@ -8832,9 +8962,10 @@ a link." ;; closest one. (org-element-lineage (org-element-context) - '(clock comment comment-block footnote-definition - footnote-reference headline inline-src-block inlinetask - keyword link node-property planning src-block timestamp) + '(citation citation-reference clock comment comment-block + footnote-definition footnote-reference headline + inline-src-block inlinetask keyword link node-property + planning src-block timestamp) t)) (type (org-element-type context)) (value (org-element-property :value context))) @@ -8845,7 +8976,7 @@ a link." ((memq type '(comment comment-block node-property keyword)) (call-interactively #'org-open-at-point-global)) ;; On a headline or an inlinetask, but not on a timestamp, - ;; a link, a footnote reference. + ;; a link, a footnote reference or a citation. ((memq type '(headline inlinetask)) (org-match-line org-complex-heading-regexp) (let ((tags-beg (match-beginning 5)) @@ -8908,6 +9039,7 @@ a link." ((eq type 'inline-src-block) (org-babel-open-src-block-result)) ((eq type 'timestamp) (org-follow-timestamp-link)) ((eq type 'link) (org-link-open context arg)) + ((memq type '(citation citation-reference)) (org-cite-follow context arg)) (t (user-error "No link found"))))) (run-hook-with-args 'org-follow-link-hook)) @@ -9042,26 +9174,29 @@ or to another Org file, automatically push the old position onto the ring." (defvar org-agenda-buffer-tmp-name) (defvar org-agenda-start-on-weekday) +(defvar org-agenda-buffer-name) (defun org-follow-timestamp-link () "Open an agenda view for the time-stamp date/range at point." - (cond - ((org-at-date-range-p t) - (let ((org-agenda-start-on-weekday) - (t1 (match-string 1)) - (t2 (match-string 2)) tt1 tt2) - (setq tt1 (time-to-days (org-time-string-to-time t1)) - tt2 (time-to-days (org-time-string-to-time t2))) + ;; Avoid changing the global value. + (let ((org-agenda-buffer-name org-agenda-buffer-name)) + (cond + ((org-at-date-range-p t) + (let ((org-agenda-start-on-weekday) + (t1 (match-string 1)) + (t2 (match-string 2)) tt1 tt2) + (setq tt1 (time-to-days (org-time-string-to-time t1)) + tt2 (time-to-days (org-time-string-to-time t2))) + (let ((org-agenda-buffer-tmp-name + (format "*Org Agenda(a:%s)" + (concat (substring t1 0 10) "--" (substring t2 0 10))))) + (org-agenda-list nil tt1 (1+ (- tt2 tt1)))))) + ((org-at-timestamp-p 'lax) (let ((org-agenda-buffer-tmp-name - (format "*Org Agenda(a:%s)" - (concat (substring t1 0 10) "--" (substring t2 0 10))))) - (org-agenda-list nil tt1 (1+ (- tt2 tt1)))))) - ((org-at-timestamp-p 'lax) - (let ((org-agenda-buffer-tmp-name - (format "*Org Agenda(a:%s)" (substring (match-string 1) 0 10)))) - (org-agenda-list nil (time-to-days (org-time-string-to-time - (substring (match-string 1) 0 10))) - 1))) - (t (error "This should not happen")))) + (format "*Org Agenda(a:%s)" (substring (match-string 1) 0 10)))) + (org-agenda-list nil (time-to-days (org-time-string-to-time + (substring (match-string 1) 0 10))) + 1))) + (t (error "This should not happen"))))) ;;; Following file links @@ -9427,7 +9562,7 @@ If an element cannot be made unique, an error is raised." (mapcar (apply-partially #'concat (substring key 0 1)) (split-string (substring key 1) "" t))))))) (if (or (not potential-key) (assoc potential-key menu-keys)) - (user-error "Could not make unique key for %s." key) + (user-error "Could not make unique key for `%s'" key) (push (cons potential-key key) menu-keys)))) (mapcar #'car (cl-sort menu-keys #'< @@ -9958,7 +10093,8 @@ all statistics cookies in the buffer." (if all (progn (org-update-checkbox-count 'all) - (org-map-entries 'org-update-parent-todo-statistics)) + (org-map-region 'org-update-parent-todo-statistics + (point-min) (point-max))) (if (not (org-at-heading-p)) (org-update-checkbox-count) (let ((pos (point-marker)) @@ -9967,15 +10103,17 @@ all statistics cookies in the buffer." (if (not (org-at-heading-p)) (org-update-checkbox-count) (setq l1 (org-outline-level)) - (setq end (save-excursion - (outline-next-heading) - (when (org-at-heading-p) (setq l2 (org-outline-level))) - (point))) + (setq end + (save-excursion + (outline-next-heading) + (when (org-at-heading-p) (setq l2 (org-outline-level))) + (point))) (if (and (save-excursion (re-search-forward "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) \\[[- X]\\]" end t)) - (not (save-excursion (re-search-forward - ":COOKIE_DATA:.*\\" end t)))) + (not (save-excursion + (re-search-forward + ":COOKIE_DATA:.*\\" end t)))) (org-update-checkbox-count) (if (and l2 (> l2 l1)) (progn @@ -9996,8 +10134,9 @@ all statistics cookies in the buffer." When `org-hierarchical-todo-statistics' is nil, statistics will cover the entire subtree and this will travel up the hierarchy and update statistics everywhere." - (let* ((prop (save-excursion (org-up-heading-safe) - (org-entry-get nil "COOKIE_DATA" 'inherit))) + (let* ((prop (save-excursion + (org-up-heading-safe) + (org-entry-get nil "COOKIE_DATA" 'inherit))) (recursive (or (not org-hierarchical-todo-statistics) (and prop (string-match "\\" prop)))) (lim (or (and prop (marker-position org-entry-property-inherited-from)) @@ -10242,7 +10381,8 @@ prefer a state in the current sequence over on in another sequence." "Return the TODO keyword of the current subtree." (save-excursion (org-back-to-heading t) - (and (let ((case-fold-search nil)) (looking-at org-todo-line-regexp)) + (and (let ((case-fold-search nil)) + (looking-at org-todo-line-regexp)) (match-end 2) (match-string 2)))) @@ -10280,18 +10420,19 @@ this function is called before first heading. When optional argument TIMESTAMP is a string, extract the repeater from there instead." (save-match-data - (cond (timestamp - (and (string-match org-repeat-re timestamp) - (match-string-no-properties 1 timestamp))) - ((org-before-first-heading-p) nil) - (t - (save-excursion - (org-back-to-heading t) - (let ((end (org-entry-end-position))) - (catch :repeat - (while (re-search-forward org-repeat-re end t) - (when (save-match-data (org-at-timestamp-p 'agenda)) - (throw :repeat (match-string-no-properties 1))))))))))) + (cond + (timestamp + (and (string-match org-repeat-re timestamp) + (match-string-no-properties 1 timestamp))) + ((org-before-first-heading-p) nil) + (t + (save-excursion + (org-back-to-heading t) + (let ((end (org-entry-end-position))) + (catch :repeat + (while (re-search-forward org-repeat-re end t) + (when (save-match-data (org-at-timestamp-p 'agenda)) + (throw :repeat (match-string-no-properties 1))))))))))) (defvar org-last-changed-timestamp) (defvar org-last-inserted-timestamp) @@ -10299,6 +10440,7 @@ repeater from there instead." (defvar org-log-note-purpose) (defvar org-log-note-how nil) (defvar org-log-note-extra) +(defvar org-log-setup nil) (defun org-auto-repeat-maybe (done-word) "Check if the current headline contains a repeated time-stamp. @@ -10317,10 +10459,11 @@ This function is run automatically after each state change to a DONE state." (end (copy-marker (org-entry-end-position)))) (when (and repeat (not (= 0 (string-to-number (substring repeat 1))))) (when (eq org-log-repeat t) (setq org-log-repeat 'state)) - (let ((to-state (or (org-entry-get nil "REPEAT_TO_STATE" 'selective) - (and (stringp org-todo-repeat-to-state) - org-todo-repeat-to-state) - (and org-todo-repeat-to-state org-last-state)))) + (let ((to-state + (or (org-entry-get nil "REPEAT_TO_STATE" 'selective) + (and (stringp org-todo-repeat-to-state) + org-todo-repeat-to-state) + (and org-todo-repeat-to-state org-last-state)))) (org-todo (cond ((and to-state (member to-state org-todo-keywords-1)) to-state) ((eq interpret 'type) org-last-state) @@ -10338,8 +10481,7 @@ This function is run automatically after each state change to a DONE state." (org-entry-put nil "LAST_REPEAT" (format-time-string (org-time-stamp-format t t)))) (when org-log-repeat - (if (or (memq 'org-add-log-note (default-value 'post-command-hook)) - (memq 'org-add-log-note post-command-hook)) + (if org-log-setup ;; We are already setup for some record. (when (eq org-log-repeat 'note) ;; Make sure we take a note, not only a time stamp. @@ -10776,7 +10918,8 @@ narrowing." (let ((beg (point))) (insert ":" drawer ":\n:END:\n") (org-indent-region beg (point)) - (org-flag-region (line-end-position -1) (1- (point)) t 'outline)) + (org-flag-region (line-end-position -1) + (1- (point)) t 'outline)) (end-of-line -1))))) (t (org-end-of-meta-data org-log-state-notes-insert-after-drawers) @@ -10799,7 +10942,8 @@ EXTRA is additional text that will be inserted into the notes buffer." org-log-note-previous-state prev-state org-log-note-how how org-log-note-extra extra - org-log-note-effective-time (org-current-effective-time)) + org-log-note-effective-time (org-current-effective-time) + org-log-setup t) (add-hook 'post-command-hook 'org-add-log-note 'append)) (defun org-skip-over-state-notes () @@ -10828,6 +10972,7 @@ EXTRA is additional text that will be inserted into the notes buffer." (defun org-add-log-note (&optional _purpose) "Pop up a window for taking a note, and add this note later." (remove-hook 'post-command-hook 'org-add-log-note) + (setq org-log-setup nil) (setq org-log-note-window-configuration (current-window-configuration)) (delete-other-windows) (move-marker org-log-note-return-to (point)) @@ -10841,19 +10986,19 @@ EXTRA is additional text that will be inserted into the notes buffer." (insert (format "# Insert note for %s. # Finish with C-c C-c, or cancel with C-c C-k.\n\n" (cl-case org-log-note-purpose - (clock-out "stopped clock") - (done "closed todo item") - (reschedule "rescheduling") - (delschedule "no longer scheduled") - (redeadline "changing deadline") - (deldeadline "removing deadline") - (refile "refiling") - (note "this entry") - (state - (format "state change from \"%s\" to \"%s\"" - (or org-log-note-previous-state "") - (or org-log-note-state ""))) - (t (error "This should not happen"))))) + (clock-out "stopped clock") + (done "closed todo item") + (reschedule "rescheduling") + (delschedule "no longer scheduled") + (redeadline "changing deadline") + (deldeadline "removing deadline") + (refile "refiling") + (note "this entry") + (state + (format "state change from \"%s\" to \"%s\"" + (or org-log-note-previous-state "") + (or org-log-note-state ""))) + (t (error "This should not happen"))))) (when org-log-note-extra (insert org-log-note-extra)) (setq-local org-finish-function 'org-store-log-note) (run-hooks 'org-log-buffer-setup-hook))) @@ -10936,19 +11081,13 @@ EXTRA is additional text that will be inserted into the notes buffer." (indent-line-to ind) (insert line))) (message "Note stored") - (org-back-to-heading t)) - ;; Fix `buffer-undo-list' when `org-store-log-note' is called - ;; from within `org-add-log-note' because `buffer-undo-list' - ;; is then modified outside of `org-with-remote-undo'. - (when (eq this-command 'org-agenda-todo) - (setcdr buffer-undo-list (cddr buffer-undo-list)))))) + (org-back-to-heading t))))) ;; Don't add undo information when called from `org-agenda-todo'. - (let ((buffer-undo-list (eq this-command 'org-agenda-todo))) - (set-window-configuration org-log-note-window-configuration) - (with-current-buffer (marker-buffer org-log-note-return-to) - (goto-char org-log-note-return-to)) - (move-marker org-log-note-return-to nil) - (when org-log-post-message (message "%s" org-log-post-message)))) + (set-window-configuration org-log-note-window-configuration) + (with-current-buffer (marker-buffer org-log-note-return-to) + (goto-char org-log-note-return-to)) + (move-marker org-log-note-return-to nil) + (when org-log-post-message (message "%s" org-log-post-message))) (defun org-remove-empty-drawer-at (pos) "Remove an empty drawer at position POS. @@ -11182,14 +11321,17 @@ or a character." (setq new (if nump - (string-to-number - (read-string (format "Priority %s-%s, SPC to remove: " - (number-to-string org-priority-highest) - (number-to-string org-priority-lowest)))) + (let ((msg (format "Priority %s-%s, SPC to remove: " + (number-to-string org-priority-highest) + (number-to-string org-priority-lowest)))) + (if (< 9 org-priority-lowest) + (string-to-number (read-string msg)) + (message msg) + (string-to-number (char-to-string (read-char-exclusive))))) (progn (message "Priority %c-%c, SPC to remove: " - org-priority-highest org-priority-lowest) - (save-match-data - (setq new (read-char-exclusive))))))) + org-priority-highest org-priority-lowest) + (save-match-data + (setq new (read-char-exclusive))))))) (when (and (= (upcase org-priority-highest) org-priority-highest) (= (upcase org-priority-lowest) org-priority-lowest)) (setq new (upcase new))) @@ -11713,7 +11855,7 @@ an accumulator used in recursive calls." (org--tags-expand-group (cdr group) tag-groups expanded)))))) expanded) -(defun org-tags-expand (match &optional single-as-list downcased) +(defun org-tags-expand (match &optional single-as-list) "Expand group tags in MATCH. This replaces every group tag in MATCH with a regexp tag search. @@ -11740,24 +11882,18 @@ will be replaced like this: When the optional argument SINGLE-AS-LIST is non-nil, MATCH is assumed to be a single group tag, and the function will return -the list of tags in this group. - -When DOWNCASED is non-nil, expand downcased TAGS." +the list of tags in this group." (unless (org-string-nw-p match) (error "Invalid match tag: %S" match)) (let ((tag-groups - (let ((g (or org-tag-groups-alist-for-agenda org-tag-groups-alist))) - (if (not downcased) g - (mapcar (lambda (s) (mapcar #'downcase s)) g))))) + (or org-tag-groups-alist-for-agenda org-tag-groups-alist))) (cond - (single-as-list (org--tags-expand-group - (list (if downcased (downcase match) match)) - tag-groups nil)) + (single-as-list (org--tags-expand-group (list match) tag-groups nil)) (org-group-tags (let* ((case-fold-search t) (tag-syntax org-mode-syntax-table) (group-keys (mapcar #'car tag-groups)) (key-regexp (concat "\\([+-]?\\)" (regexp-opt group-keys 'words))) - (return-match (if downcased (downcase match) match))) + (return-match match)) ;; Mark regexp-expressions in the match-expression so that we ;; do not replace them later on. (let ((s 0)) @@ -11777,7 +11913,7 @@ When DOWNCASED is non-nil, expand downcased TAGS." m ;regexp tag: ignore (let* ((operator (match-string 1 m)) (tag-token (let ((tag (match-string 2 m))) - (list (if downcased (downcase tag) tag)))) + (list tag))) regexp-tags regular-tags) ;; Partition tags between regexp and regular tags. ;; Remove curly bracket syntax from regexp tags. @@ -11928,12 +12064,15 @@ in Lisp code use `org-set-tags' instead." inherited-tags table (and org-fast-tag-selection-include-todo org-todo-key-alist)) - (let ((org-add-colon-after-tag-completion (< 1 (length table)))) - (org-trim (completing-read - "Tags: " - #'org-tags-completion-function - nil nil (org-make-tag-string current-tags) - 'org-tags-history))))))) + (let ((org-add-colon-after-tag-completion (< 1 (length table))) + (crm-separator "[ \t]*:[ \t]*")) + (mapconcat #'identity + (completing-read-multiple + "Tags: " + org-last-tags-completion-table + nil nil (org-make-tag-string current-tags) + 'org-tags-history) + ":")))))) (org-set-tags tags))))) ;; `save-excursion' may not replace the point at the right ;; position. @@ -12013,7 +12152,7 @@ This works in the agenda, and also in an Org buffer." (org-global-tags-completion-table)) (org-global-tags-completion-table)))) (completing-read - "Tag: " 'org-tags-completion-function nil nil nil + "Tag: " org-last-tags-completion-table nil nil nil 'org-tags-history)) (progn (message "[s]et or [r]emove? ") @@ -12109,7 +12248,7 @@ Returns the new tags string, or nil to not change the current settings." fulltable)))) (buf (current-buffer)) (expert (eq org-fast-tag-selection-single-key 'expert)) - (buffer-tags nil) + (tab-tags nil) (fwidth (+ maxlen 3 1 3)) (ncol (/ (- (window-width) 4) fwidth)) (i-face 'org-done) @@ -12244,16 +12383,21 @@ Returns the new tags string, or nil to not change the current settings." (setq current nil) (when exit-after-next (setq exit-after-next 'now))) ((= c ?\t) - (condition-case nil - (setq tg (completing-read - "Tag: " - (or buffer-tags - (with-current-buffer buf - (setq buffer-tags - (org-get-buffer-tags)))))) - (quit (setq tg ""))) + (condition-case nil + (unless tab-tags + (setq tab-tags + (delq nil + (mapcar (lambda (x) + (let ((item (car-safe x))) + (and (stringp item) + (list item)))) + (org--tag-add-to-alist + (with-current-buffer buf + (org-get-buffer-tags)) + table)))))) + (setq tg (completing-read "Tag: " tab-tags)) (when (string-match "\\S-" tg) - (cl-pushnew (list tg) buffer-tags :test #'equal) + (cl-pushnew (list tg) tab-tags :test #'equal) (if (member tg current) (setq current (delete tg current)) (push tg current))) @@ -12361,12 +12505,12 @@ Inherited tags have the `inherited' text property." (defun org-map-entries (func &optional match scope &rest skip) "Call FUNC at each headline selected by MATCH in SCOPE. -FUNC is a function or a lisp form. The function will be called without +FUNC is a function or a Lisp form. The function will be called without arguments, with the cursor positioned at the beginning of the headline. The return values of all calls to the function will be collected and returned as a list. -The call to FUNC will be wrapped into a save-excursion form, so FUNC +The call to FUNC will be wrapped into a `save-excursion' form, so FUNC does not need to preserve point. After evaluation, the cursor will be moved to the end of the line (presumably of the headline of the processed entry) and search continues from there. Under some @@ -12537,12 +12681,12 @@ it will be found. If the drawer does not exist, create it if FORCE is non-nil, or return nil." (org-with-wide-buffer (let ((beg (cond (beg (goto-char beg)) - ((or (not (featurep 'org-inlinetask)) - (org-inlinetask-in-task-p)) - (org-back-to-heading-or-point-min t) (point)) - (t (org-with-limited-levels - (org-back-to-heading-or-point-min t)) - (point))))) + ((or (not (featurep 'org-inlinetask)) + (org-inlinetask-in-task-p)) + (org-back-to-heading-or-point-min t) (point)) + (t (org-with-limited-levels + (org-back-to-heading-or-point-min t)) + (point))))) ;; Move point to its position according to its positional rules. (cond ((org-before-first-heading-p) (while (and (org-at-comment-p) (bolp)) (forward-line))) @@ -13064,62 +13208,63 @@ decreases scheduled or deadline date by one day." ((not (stringp value)) (error "Properties values should be strings")) ((not (org--valid-property-p property)) (user-error "Invalid property name: \"%s\"" property))) - (org-with-point-at pom - (if (or (not (featurep 'org-inlinetask)) (org-inlinetask-in-task-p)) - (org-back-to-heading-or-point-min t) - (org-with-limited-levels (org-back-to-heading-or-point-min t))) - (let ((beg (point))) - (cond - ((equal property "TODO") - (cond ((not (org-string-nw-p value)) (setq value 'none)) - ((not (member value org-todo-keywords-1)) - (user-error "\"%s\" is not a valid TODO state" value))) - (org-todo value) - (org-align-tags)) - ((equal property "PRIORITY") - (org-priority (if (org-string-nw-p value) (string-to-char value) ?\s)) - (org-align-tags)) - ((equal property "SCHEDULED") - (forward-line) - (if (and (looking-at-p org-planning-line-re) - (re-search-forward - org-scheduled-time-regexp (line-end-position) t)) - (cond ((string= value "earlier") (org-timestamp-change -1 'day)) - ((string= value "later") (org-timestamp-change 1 'day)) - ((string= value "") (org-schedule '(4))) - (t (org-schedule nil value))) - (if (member value '("earlier" "later" "")) - (call-interactively #'org-schedule) - (org-schedule nil value)))) - ((equal property "DEADLINE") - (forward-line) - (if (and (looking-at-p org-planning-line-re) - (re-search-forward - org-deadline-time-regexp (line-end-position) t)) - (cond ((string= value "earlier") (org-timestamp-change -1 'day)) - ((string= value "later") (org-timestamp-change 1 'day)) - ((string= value "") (org-deadline '(4))) - (t (org-deadline nil value))) - (if (member value '("earlier" "later" "")) - (call-interactively #'org-deadline) - (org-deadline nil value)))) - ((member property org-special-properties) - (error "The %s property cannot be set with `org-entry-put'" property)) - (t - (let* ((range (org-get-property-block beg 'force)) - (end (cdr range)) - (case-fold-search t)) - (goto-char (car range)) - (if (re-search-forward (org-re-property property nil t) end t) - (progn (delete-region (match-beginning 0) (match-end 0)) - (goto-char (match-beginning 0))) - (goto-char end) - (insert "\n") - (backward-char)) - (insert ":" property ":") - (when value (insert " " value)) - (org-indent-line))))) - (run-hook-with-args 'org-property-changed-functions property value))) + (org-no-read-only + (org-with-point-at pom + (if (or (not (featurep 'org-inlinetask)) (org-inlinetask-in-task-p)) + (org-back-to-heading-or-point-min t) + (org-with-limited-levels (org-back-to-heading-or-point-min t))) + (let ((beg (point))) + (cond + ((equal property "TODO") + (cond ((not (org-string-nw-p value)) (setq value 'none)) + ((not (member value org-todo-keywords-1)) + (user-error "\"%s\" is not a valid TODO state" value))) + (org-todo value) + (org-align-tags)) + ((equal property "PRIORITY") + (org-priority (if (org-string-nw-p value) (string-to-char value) ?\s)) + (org-align-tags)) + ((equal property "SCHEDULED") + (forward-line) + (if (and (looking-at-p org-planning-line-re) + (re-search-forward + org-scheduled-time-regexp (line-end-position) t)) + (cond ((string= value "earlier") (org-timestamp-change -1 'day)) + ((string= value "later") (org-timestamp-change 1 'day)) + ((string= value "") (org-schedule '(4))) + (t (org-schedule nil value))) + (if (member value '("earlier" "later" "")) + (call-interactively #'org-schedule) + (org-schedule nil value)))) + ((equal property "DEADLINE") + (forward-line) + (if (and (looking-at-p org-planning-line-re) + (re-search-forward + org-deadline-time-regexp (line-end-position) t)) + (cond ((string= value "earlier") (org-timestamp-change -1 'day)) + ((string= value "later") (org-timestamp-change 1 'day)) + ((string= value "") (org-deadline '(4))) + (t (org-deadline nil value))) + (if (member value '("earlier" "later" "")) + (call-interactively #'org-deadline) + (org-deadline nil value)))) + ((member property org-special-properties) + (error "The %s property cannot be set with `org-entry-put'" property)) + (t + (let* ((range (org-get-property-block beg 'force)) + (end (cdr range)) + (case-fold-search t)) + (goto-char (car range)) + (if (re-search-forward (org-re-property property nil t) end t) + (progn (delete-region (match-beginning 0) (match-end 0)) + (goto-char (match-beginning 0))) + (goto-char end) + (insert "\n") + (backward-char)) + (insert ":" property ":") + (when value (insert " " value)) + (org-indent-line))))) + (run-hook-with-args 'org-property-changed-functions property value)))) (defun org-buffer-property-keys (&optional specials defaults columns) "Get all property keys in the current buffer. @@ -13309,11 +13454,12 @@ This is computed according to `org-property-set-functions-alist'." (or (cdr (assoc property org-property-set-functions-alist)) 'org-completing-read)) -(defun org-read-property-value (property &optional pom) +(defun org-read-property-value (property &optional pom default) "Read value for PROPERTY, as a string. When optional argument POM is non-nil, completion uses additional information, i.e., allowed or existing values at point or marker -POM." +POM. +Optional argument DEFAULT provides a default value for PROPERTY." (let* ((completion-ignore-case t) (allowed (or (org-property-get-allowed-values nil property 'table) @@ -13329,7 +13475,8 @@ POM." (if allowed (funcall set-function prompt allowed nil - (not (get-text-property 0 'org-unrestricted (caar allowed)))) + (not (get-text-property 0 'org-unrestricted (caar allowed))) + default nil default) (let ((all (mapcar #'list (append (org-property-values property) (and pom @@ -13655,7 +13802,7 @@ If there is already a timestamp at the cursor, it is replaced. With two universal prefix arguments, insert an active timestamp with the current time without prompting the user. -When called from lisp, the timestamp is inactive if INACTIVE is +When called from Lisp, the timestamp is inactive if INACTIVE is non-nil." (interactive "P") (let* ((ts (cond @@ -14047,6 +14194,19 @@ user." (setq ans (replace-match (format "%02d:%02d" hour minute) t t ans)))) + ;; Help matching HHhMM times, similarly as for am/pm times. + (cl-loop for i from 1 to 2 do ; twice, for end time as well + (when (and (not (string-match "\\(\\`\\|[^+]\\)[012]?[0-9]:[0-9][0-9]\\([ \t\n]\\|$\\)" ans)) + (string-match "\\(?:\\(?1:[012]?[0-9]\\)?h\\(?2:[0-5][0-9]\\)\\)\\|\\(?:\\(?1:[012]?[0-9]\\)h\\(?2:[0-5][0-9]\\)?\\)\\>" ans)) + (setq hour (if (match-end 1) + (string-to-number (match-string 1 ans)) + 0) + minute (if (match-end 2) + (string-to-number (match-string 2 ans)) + 0)) + (setq ans (replace-match (format "%02d:%02d" hour minute) + t t ans)))) + ;; Check if a time range is given as a duration (when (string-match "\\([012]?[0-9]\\):\\([0-6][0-9]\\)\\+\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?" ans) (setq hour (string-to-number (match-string 1 ans)) @@ -15306,13 +15466,12 @@ used by the agenda files. If ARCHIVE is `ifmode', do this only if (if (file-directory-p f) (directory-files f t org-agenda-file-regexp) - (list f))) + (list (expand-file-name f org-directory)))) files))) (when org-agenda-skip-unavailable-files (setq files (delq nil - (mapcar (function - (lambda (file) - (and (file-readable-p file) file))) + (mapcar (lambda (file) + (and (file-readable-p file) file)) files)))) (when (or (eq archives t) (and (eq archives 'ifmode) (eq org-agenda-archives-mode t))) @@ -15928,15 +16087,25 @@ Some of the options can be changed using the variable (fg (let ((color (plist-get org-format-latex-options :foreground))) - (if (and forbuffer (eq color 'auto)) - (face-attribute face :foreground nil 'default) - color))) + (if forbuffer + (cond + ((eq color 'auto) + (face-attribute face :foreground nil 'default)) + ((eq color 'default) + (face-attribute 'default :foreground nil)) + (t color)) + color))) (bg (let ((color (plist-get org-format-latex-options :background))) - (if (and forbuffer (eq color 'auto)) - (face-attribute face :background nil 'default) - color))) + (if forbuffer + (cond + ((eq color 'auto) + (face-attribute face :background nil 'default)) + ((eq color 'default) + (face-attribute 'default :background nil)) + (t color)) + color))) (hash (sha1 (prin1-to-string (list org-format-latex-header org-latex-default-packages-alist @@ -16155,10 +16324,10 @@ a HTML file." (if (eq fg 'default) (setq fg (org-latex-color :foreground)) (setq fg (org-latex-color-format fg))) - (if (eq bg 'default) - (setq bg (org-latex-color :background)) - (setq bg (org-latex-color-format - (if (string= bg "Transparent") "white" bg)))) + (setq bg (cond + ((eq bg 'default) (org-latex-color :background)) + ((string= bg "Transparent") nil) + (t (org-latex-color-format bg)))) ;; Remove TeX \par at end of snippet to avoid trailing space. (if (string-suffix-p string "\n") (aset string (1- (length string)) ?%) @@ -16167,8 +16336,10 @@ a HTML file." (insert latex-header) (insert "\n\\begin{document}\n" "\\definecolor{fg}{rgb}{" fg "}%\n" - "\\definecolor{bg}{rgb}{" bg "}%\n" - "\n\\pagecolor{bg}%\n" + (if bg + (concat "\\definecolor{bg}{rgb}{" bg "}%\n" + "\n\\pagecolor{bg}%\n") + "") "\n{\\color{fg}\n" string "\n}\n" @@ -16438,30 +16609,7 @@ buffer boundaries with possible narrowing." (ignore-errors (org-attach-expand path))) (expand-file-name path)))) (when (and file (file-exists-p file)) - (let ((width - ;; Apply `org-image-actual-width' specifications. - (cond - ((eq org-image-actual-width t) nil) - ((listp org-image-actual-width) - (or - ;; First try to find a width among - ;; attributes associated to the paragraph - ;; containing link. - (pcase (org-element-lineage link '(paragraph)) - (`nil nil) - (p - (let* ((case-fold-search t) - (end (org-element-property :post-affiliated p)) - (re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)")) - (when (org-with-point-at - (org-element-property :begin p) - (re-search-forward re end t)) - (string-to-number (match-string 1)))))) - ;; Otherwise, fall-back to provided number. - (car org-image-actual-width))) - ((numberp org-image-actual-width) - org-image-actual-width) - (t nil))) + (let ((width (org-display-inline-image--width link)) (old (get-char-property-and-overlay (org-element-property :begin link) 'org-image-overlay))) @@ -16482,11 +16630,62 @@ buffer boundaries with possible narrowing." (overlay-put ov 'modification-hooks (list 'org-display-inline-remove-overlay)) - (when (<= 26 emacs-major-version) - (cl-assert (boundp 'image-map)) + (when (boundp 'image-map) (overlay-put ov 'keymap image-map)) (push ov org-inline-image-overlays)))))))))))))))) +(defvar visual-fill-column-width) ; Silence compiler warning +(defun org-display-inline-image--width (link) + "Determine the display width of the image LINK, in pixels. +- When `org-image-actual-width' is t, the image's pixel width is used. +- When `org-image-actual-width' is a number, that value will is used. +- When `org-image-actual-width' is nil or a list, the first :width attribute + set (if it exists) is used to set the image width. A width of X% is + divided by 100. + If no :width attribute is given and `org-image-actual-width' is a list with + a number as the car, then that number is used as the default value. + If the value is a float between 0 and 2, it interpreted as that proportion + of the text width in the buffer." + ;; Apply `org-image-actual-width' specifications. + (cond + ((eq org-image-actual-width t) nil) + ((listp org-image-actual-width) + (let* ((case-fold-search t) + (par (org-element-lineage link '(paragraph))) + (attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)") + (par-end (org-element-property :post-affiliated par)) + ;; Try to find an attribute providing a :width. + (attr-width + (when (and par (org-with-point-at + (org-element-property :begin par) + (re-search-forward attr-re par-end t))) + (match-string 1))) + (attr-width-val + (cond + ((null attr-width) nil) + ((string-match-p "\\`[0-9.]+%" attr-width) + (/ (string-to-number attr-width) 100.0)) + (t (string-to-number attr-width)))) + ;; Fallback to `org-image-actual-width' if no explicit width is given. + (width (or attr-width-val (car org-image-actual-width)))) + (if (and (floatp width) (<= 0.0 width 2.0)) + ;; A float in [0,2] should be interpereted as this portion of + ;; the text width in the window. This works well with cases like + ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width, + ;; as the "0.X" is pulled out as a float. We use 2 as the upper + ;; bound as cases such as 1.2\linewidth are feasible. + (round (* width + (window-pixel-width) + (/ (or (and (bound-and-true-p visual-fill-column-mode) + (or visual-fill-column-width auto-fill-function)) + (when auto-fill-function fill-column) + (window-text-width)) + (float (window-total-width))))) + width))) + ((numberp org-image-actual-width) + org-image-actual-width) + (t nil))) + (defun org-display-inline-remove-overlay (ov after _beg _end &optional _len) "Remove inline-display overlay if a corresponding region is modified." (let ((inhibit-modification-hooks t)) @@ -16708,6 +16907,7 @@ because, in this case the deletion might narrow the column." (put 'org-delete-char 'delete-selection 'supersede) (put 'org-delete-backward-char 'delete-selection 'supersede) (put 'org-yank 'delete-selection 'yank) +(put 'org-return 'delete-selection t) ;; Make `flyspell-mode' delay after some commands (put 'org-self-insert-command 'flyspell-delayed t) @@ -16869,7 +17069,8 @@ When ARG is a numeric prefix, show contents of this level." (message "Content view to level: %d" arg) (org-content (prefix-numeric-value arg2)) (org-cycle-show-empty-lines t) - (setq org-cycle-global-status 'overview))) + (setq org-cycle-global-status 'overview) + (run-hook-with-args 'org-cycle-hook 'overview))) (t (call-interactively 'org-global-cycle)))) (defun org-shiftmetaleft () @@ -17061,6 +17262,9 @@ for more information." (transpose-regions a b c d) (goto-char c))) ((org-at-table-p) (org-call-with-arg 'org-table-move-row 'up)) + ((and (featurep 'org-inlinetask) + (org-inlinetask-in-task-p)) + (org-drag-element-backward)) ((org-at-heading-p) (call-interactively 'org-move-subtree-up)) ((org-at-item-p) (call-interactively 'org-move-item-up)) (t (org-drag-element-backward)))) @@ -17091,6 +17295,9 @@ commands for more information." (transpose-regions a b c d) (goto-char d))) ((org-at-table-p) (call-interactively 'org-table-move-row)) + ((and (featurep 'org-inlinetask) + (org-inlinetask-in-task-p)) + (org-drag-element-forward)) ((org-at-heading-p) (call-interactively 'org-move-subtree-down)) ((org-at-item-p) (call-interactively 'org-move-item-down)) (t (org-drag-element-forward)))) @@ -17354,7 +17561,7 @@ When in a source code block, call `org-edit-src-code'. When in a fixed-width region, call `org-edit-fixed-width-region'. When in an export block, call `org-edit-export-block'. When in a LaTeX environment, call `org-edit-latex-environment'. -When at an #+INCLUDE keyword, visit the included file. +When at an INCLUDE, SETUPFILE or BIBLIOGRAPHY keyword, visit the included file. When at a footnote reference, call `org-edit-footnote-reference'. When at a planning line call, `org-deadline' and/or `org-schedule'. When at an active timestamp, call `org-time-stamp'. @@ -17380,14 +17587,14 @@ Otherwise, return a user error." session params)))))) (`keyword (unless (member (org-element-property :key element) - '("INCLUDE" "SETUPFILE")) + '("BIBLIOGRAPHY" "INCLUDE" "SETUPFILE")) (user-error "No special environment to edit here")) (let ((value (org-element-property :value element))) (unless (org-string-nw-p value) (user-error "No file to edit")) (let ((file (and (string-match "\\`\"\\(.*?\\)\"\\|\\S-+" value) (or (match-string 1 value) (match-string 0 value))))) - (when (org-file-url-p file) + (when (org-url-p file) (user-error "Files located with a URL cannot be edited")) (org-link-open-from-string (format "[[%s]]" (expand-file-name file)))))) @@ -17632,28 +17839,35 @@ This command does many different things, depending on context: (`statistics-cookie (call-interactively #'org-update-statistics-cookies)) ((or `table `table-cell `table-row) - ;; At a table, recalculate every field and align it. Also - ;; send the table if necessary. If the table has - ;; a `table.el' type, just give up. At a table row or cell, - ;; maybe recalculate line but always align table. - (if (eq (org-element-property :type context) 'table.el) - (message "%s" (substitute-command-keys "\\\ -Use `\\[org-edit-special]' to edit table.el tables")) - (if (or (eq type 'table) - ;; Check if point is at a TBLFM line. - (and (eq type 'table-row) - (= (point) (org-element-property :end context)))) - (save-excursion - (if (org-at-TBLFM-p) - (progn (require 'org-table) - (org-table-calc-current-TBLFM)) - (goto-char (org-element-property :contents-begin context)) - (org-call-with-arg 'org-table-recalculate (or arg t)) - (orgtbl-send-table 'maybe))) - (org-table-maybe-eval-formula) - (cond (arg (call-interactively #'org-table-recalculate)) - ((org-table-maybe-recalculate-line)) - (t (org-table-align)))))) + ;; At a table, generate a plot if on the #+plot line, + ;; recalculate every field and align it otherwise. Also + ;; send the table if necessary. + (cond + ((and (org-match-line "[ \t]*#\\+plot:") + (< (point) (org-element-property :post-affiliated context))) + (org-plot/gnuplot)) + ;; If the table has a `table.el' type, just give up. + ((eq (org-element-property :type context) 'table.el) + (message "%s" (substitute-command-keys "\\\ +Use `\\[org-edit-special]' to edit table.el tables"))) + ;; At a table row or cell, maybe recalculate line but always + ;; align table. + ((or (eq type 'table) + ;; Check if point is at a TBLFM line. + (and (eq type 'table-row) + (= (point) (org-element-property :end context)))) + (save-excursion + (if (org-at-TBLFM-p) + (progn (require 'org-table) + (org-table-calc-current-TBLFM)) + (goto-char (org-element-property :contents-begin context)) + (org-call-with-arg 'org-table-recalculate (or arg t)) + (orgtbl-send-table 'maybe)))) + (t + (org-table-maybe-eval-formula) + (cond (arg (call-interactively #'org-table-recalculate)) + ((org-table-maybe-recalculate-line)) + (t (org-table-align)))))) ((or `timestamp (and `planning (guard (org-at-timestamp-p 'lax)))) (org-timestamp-change 0 'day)) ((and `nil (guard (org-at-heading-p))) @@ -17668,7 +17882,7 @@ Use `\\[org-edit-special]' to edit table.el tables")) "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))))))) (defun org-mode-restart () -"Restart `org-mode'." + "Restart `org-mode'." (interactive) (let ((indent-status (bound-and-true-p org-indent-mode))) (funcall major-mode) @@ -17783,12 +17997,13 @@ will not happen if point is in a table or on a \"dead\" object (e.g., within a comment). In these case, you need to use `org-open-at-point' directly." (interactive "i\nP\np") - (let ((context (if org-return-follows-link (org-element-context) - (org-element-at-point)))) + (let* ((context (if org-return-follows-link (org-element-context) + (org-element-at-point))) + (element-type (org-element-type context))) (cond ;; In a table, call `org-table-next-row'. However, before first ;; column or after last one, split the table. - ((or (and (eq 'table (org-element-type context)) + ((or (and (eq 'table element-type) (not (eq 'table.el (org-element-property :type context))) (>= (point) (org-element-property :contents-begin context)) (< (point) (org-element-property :contents-end context))) @@ -17802,7 +18017,7 @@ object (e.g., within a comment). In these case, you need to use ;; `org-return-follows-link' allows it. Tolerate fuzzy ;; locations, e.g., in a comment, as `org-open-at-point'. ((and org-return-follows-link - (or (and (eq 'link (org-element-type context)) + (or (and (eq 'link element-type) ;; Ensure point is not on the white spaces after ;; the link. (let ((origin (point))) @@ -17849,12 +18064,13 @@ object (e.g., within a comment). In these case, you need to use (org--newline indent arg interactive)))))) (defun org-return-and-maybe-indent () - "Goto next table row, or insert a newline. + "Goto next table row, or insert a newline, maybe indented. Call `org-table-next-row' or `org-return', depending on context. See the individual commands for more information. -When inserting a newline, indent the new line if -`electric-indent-mode' is disabled." +When inserting a newline, if `org-adapt-indentation' is t: +indent the line if `electric-indent-mode' is disabled, don't +indent it if it is enabled." (interactive) (org-return (not electric-indent-mode))) @@ -17928,15 +18144,14 @@ when a numeric prefix argument is given, its value determines the number of stars to add." (interactive "P") (let ((skip-blanks - (function - ;; Return beginning of first non-blank line, starting from - ;; line at POS. - (lambda (pos) - (save-excursion - (goto-char pos) - (while (org-at-comment-p) (forward-line)) - (skip-chars-forward " \r\t\n") - (point-at-bol))))) + ;; Return beginning of first non-blank line, starting from + ;; line at POS. + (lambda (pos) + (save-excursion + (goto-char pos) + (while (org-at-comment-p) (forward-line)) + (skip-chars-forward " \r\t\n") + (point-at-bol)))) beg end toggled) ;; Determine boundaries of changes. If a universal prefix has ;; been given, put the list in a region. If region ends at a bol, @@ -18023,7 +18238,7 @@ an argument, unconditionally call `org-insert-heading'." (not (org-at-table-p)))) ;; Define the Org mode menus -(easy-menu-define org-org-menu org-mode-map "Org menu" +(easy-menu-define org-org-menu org-mode-map "Org menu." `("Org" ("Show/Hide" ["Cycle Visibility" org-cycle :active (or (bobp) (outline-on-heading-p))] @@ -18208,7 +18423,7 @@ an argument, unconditionally call `org-insert-heading'." ["Reload Org (after update)" org-reload t] ["Reload Org uncompiled" (org-reload t) :active t :keys "C-u C-c C-x !"]))) -(easy-menu-define org-tbl-menu org-mode-map "Org Table menu" +(easy-menu-define org-tbl-menu org-mode-map "Org Table menu." '("Table" ["Align" org-ctrl-c-ctrl-c :active (org-at-table-p)] ["Next Field" org-cycle (org-at-table-p)] @@ -18349,7 +18564,7 @@ Your bug report will be posted to the Org mailing list. ------------------------------------------------------------------------") (save-excursion (when (re-search-backward "^\\(Subject: \\)Org mode version \\(.*?\\);[ \t]*\\(.*\\)" nil t) - (replace-match "\\1Bug: \\3 [\\2]"))))) + (replace-match "\\1[BUG] \\3 [\\2]"))))) (defun org-install-agenda-files-menu () @@ -18823,11 +19038,6 @@ ELEMENT." (t (goto-char start) (current-indentation)))) - ((and - (eq org-adapt-indentation 'headline-data) - (memq type '(planning clock node-property property-drawer drawer))) - (org--get-expected-indentation - (org-element-property :parent element) t)) ((memq type '(headline inlinetask nil)) (if (org-match-line "[ \t]*$") (org--get-expected-indentation element t) @@ -18867,7 +19077,7 @@ ELEMENT." (org--get-expected-indentation (org-element-property :parent previous) t)))))))))) ;; Otherwise, move to the first non-blank line above. - ((not (eq org-adapt-indentation 'headline-data)) + (t (beginning-of-line) (let ((pos (point))) (skip-chars-backward " \r\t\n") @@ -18944,7 +19154,7 @@ Indentation is done according to the following rules: Else, indent like parent's first line. 3. Otherwise, indent relatively to current level, if - `org-adapt-indentation' is non-nil, or to left margin. + `org-adapt-indentation' is t, or to left margin. - On a blank line at the end of an element, indent according to the type of the element. More precisely @@ -18969,7 +19179,15 @@ list structure. Instead, use \\`\\[org-shiftmetaleft]' or \ Also align node properties according to `org-property-format'." (interactive) - (unless (org-at-heading-p) + (unless (or (org-at-heading-p) + (and (eq org-adapt-indentation 'headline-data) + (not (or (org-at-clock-log-p) + (org-at-planning-p))) + (save-excursion + (beginning-of-line 1) + (skip-chars-backward "\n") + (or (org-at-heading-p) + (looking-back ":END:.*" (point-at-bol)))))) (let* ((element (save-excursion (beginning-of-line) (org-element-at-point))) (type (org-element-type element))) (cond ((and (memq type '(plain-list item)) @@ -18991,6 +19209,21 @@ Also align node properties according to `org-property-format'." (org-with-point-at (org-element-property :end element) (skip-chars-backward " \t\n") (line-beginning-position)))) + ;; At the beginning of a blank line, do some preindentation. This + ;; signals org-src--edit-element to preserve the indentation on exit + (when (and (looking-at-p "^[[:space:]]*$") + (not org-src-preserve-indentation)) + (let ((element (org-element-at-point)) + block-content-ind some-ind) + (org-with-point-at (org-element-property :begin element) + (setq block-content-ind (+ (current-indentation) + org-edit-src-content-indentation)) + (forward-line) + (save-match-data (re-search-forward "^[ \t]*\\S-" nil t)) + (backward-char) + (setq some-ind (if (looking-at-p "#\\+end_src") + block-content-ind (current-indentation)))) + (indent-line-to (min block-content-ind some-ind)))) (org-babel-do-key-sequence-in-edit-buffer (kbd "TAB"))) (t (let ((column (org--get-expected-indentation element nil))) @@ -19297,7 +19530,11 @@ a footnote definition, try to fill the first paragraph within." ;; the buffer. In that case, ignore filling. (cl-case (org-element-type element) ;; Use major mode filling function is source blocks. - (src-block (org-babel-do-key-sequence-in-edit-buffer (kbd "M-q"))) + (src-block (org-babel-do-in-edit-buffer + (push-mark (point-min)) + (goto-char (point-max)) + (setq mark-active t) + (funcall-interactively #'fill-paragraph justify 'region))) ;; Align Org tables, leave table.el tables as-is. (table-row (org-table-align) t) (table @@ -19432,7 +19669,9 @@ filling the current element." ;; previously unmodified), then flip the modification status back ;; to "unchanged". (when (and hash (equal hash (org-buffer-hash))) - (set-buffer-modified-p nil)))) + (set-buffer-modified-p nil)) + ;; Return non-nil. + t)) (defun org-auto-fill-function () "Auto-fill function." @@ -19901,7 +20140,7 @@ it has a `diary' type." (defvar org--rds) (defun org-reftex-citation () - "Use reftex-citation to insert a citation into the buffer. + "Use `reftex-citation' to insert a citation into the buffer. This looks for a line like #+BIBLIOGRAPHY: foo plain option:-d @@ -20221,7 +20460,7 @@ interactive command with similar behavior." (call-interactively command)))))) (defun org-yank-folding-would-swallow-text (beg end) - "Would hide-subtree at BEG swallow any text after END?" + "Would `hide-subtree' at BEG swallow any text after END?" (let (level) (org-with-limited-levels (save-excursion @@ -20337,6 +20576,10 @@ This function considers both visible and invisible heading lines. With argument, move up ARG levels." (outline-up-heading arg t)) +(defvar-local org--up-heading-cache nil + "Buffer-local `org-up-heading-safe' cache.") +(defvar-local org--up-heading-cache-tick nil + "Buffer `buffer-chars-modified-tick' in `org--up-heading-cache'.") (defun org-up-heading-safe () "Move to the heading line of which the present line is a subheading. This version will not throw an error. It will return the level of the @@ -20346,10 +20589,28 @@ Also, this function will be a lot faster than `outline-up-heading', because it relies on stars being the outline starters. This can really make a significant difference in outlines with very many siblings." (when (ignore-errors (org-back-to-heading t)) - (let ((level-up (1- (funcall outline-level)))) - (and (> level-up 0) - (re-search-backward (format "^\\*\\{1,%d\\} " level-up) nil t) - (funcall outline-level))))) + (let (level-cache) + (unless org--up-heading-cache + (setq org--up-heading-cache (make-hash-table))) + (if (and (eq (buffer-chars-modified-tick) org--up-heading-cache-tick) + (setq level-cache (gethash (point) org--up-heading-cache))) + (when (<= (point-min) (car level-cache) (point-max)) + ;; Parent is inside accessible part of the buffer. + (progn (goto-char (car level-cache)) + (cdr level-cache))) + ;; Buffer modified. Invalidate cache. + (unless (eq (buffer-chars-modified-tick) org--up-heading-cache-tick) + (setq-local org--up-heading-cache-tick + (buffer-chars-modified-tick)) + (clrhash org--up-heading-cache)) + (let* ((level-up (1- (funcall outline-level))) + (pos (point)) + (result (and (> level-up 0) + (re-search-backward + (format "^\\*\\{1,%d\\} " level-up) nil t) + (funcall outline-level)))) + (when result (puthash pos (cons (point) result) org--up-heading-cache)) + result))))) (defun org-up-heading-or-point-min () "Move to the heading line of which the present is a subheading, or point-min. @@ -20409,10 +20670,10 @@ move point." Return t when a child was found. Otherwise don't move point and return nil." (let (level (pos (point)) (re org-outline-regexp-bol)) - (when (ignore-errors (org-back-to-heading t)) - (setq level (outline-level)) + (when (org-back-to-heading-or-point-min t) + (setq level (org-outline-level)) (forward-char 1) - (if (and (re-search-forward re nil t) (> (outline-level) level)) + (if (and (re-search-forward re nil t) (> (org-outline-level) level)) (progn (goto-char (match-beginning 0)) t) (goto-char pos) nil)))) @@ -20446,7 +20707,7 @@ This is like outline-next-sibling, but invisible headings are ok." (unless (or (eobp) (< (funcall outline-level) level)) (point)))) -(defun org-get-last-sibling () +(defun org-get-previous-sibling () "Move to previous heading of the same level, and return point. If there is no such heading, return nil." (let ((opoint (point)) @@ -20503,8 +20764,7 @@ When optional argument FULL is t, also skip planning information, clocking lines and any kind of drawer. When FULL is non-nil but not t, skip planning information, -clocking lines and only non-regular drawers, i.e. properties and -logbook drawers." +properties, clocking lines and logbook drawers." (org-back-to-heading t) (forward-line) ;; Skip planning information. @@ -20858,7 +21118,11 @@ See `org-backward-paragraph'." (cond ;; There is a blank line above. Move there. ((and (org-previous-line-empty-p) - (not (org-invisible-p (1- (line-end-position 0))))) + (let ((lep (line-end-position 0))) + ;; When the first headline start at point 2, don't choke while + ;; checking with `org-invisible-p'. + (or (= lep 1) + (not (org-invisible-p (1- (line-end-position 0))))))) (forward-line -1)) ;; At the beginning of the first element within a greater ;; element. Move to the beginning of the greater element. diff --git a/lisp/org/ox-ascii.el b/lisp/org/ox-ascii.el index 70bd1c4df2..78e6fb4988 100644 --- a/lisp/org/ox-ascii.el +++ b/lisp/org/ox-ascii.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2012-2021 Free Software Foundation, Inc. ;; Author: Nicolas Goaziou +;; Maintainer: Nicolas Goaziou ;; Keywords: outlines, hypermedia, calendar, wp ;; This file is part of GNU Emacs. @@ -479,6 +480,9 @@ HOW determines the type of justification: it can be `left', (insert s) (goto-char (point-min)) (let ((fill-column text-width) + ;; Ensure that `indent-tabs-mode' is nil so that indentation + ;; will always be achieved using spaces rather than tabs. + (indent-tabs-mode nil) ;; Disable `adaptive-fill-mode' so it doesn't prevent ;; filling lines matching `adaptive-fill-regexp'. (adaptive-fill-mode nil)) @@ -1033,7 +1037,7 @@ INFO is a plist used as a communication channel." ;; Format TITLE. It may be filled if it is too wide, ;; that is wider than the two thirds of the total width. (title-len (min (apply #'max - (mapcar #'length + (mapcar #'string-width (org-split-string (concat title "\n" subtitle) "\n"))) (/ (* 2 text-width) 3))) @@ -1376,7 +1380,7 @@ contextual information." ;;;; Inlinetask (defun org-ascii-format-inlinetask-default - (_todo _type _priority _name _tags contents width inlinetask info) + (_todo _type _priority _name _tags contents width inlinetask info) "Format an inline task element for ASCII export. See `org-ascii-format-inlinetask-function' for a description of the parameters." @@ -1940,33 +1944,32 @@ CONTENTS is the row contents. INFO is a plist used as a communication channel." (when (eq (org-element-property :type table-row) 'standard) (let ((build-hline - (function - (lambda (lcorner horiz vert rcorner) - (concat - (apply - 'concat - (org-element-map table-row 'table-cell - (lambda (cell) - (let ((width (org-ascii--table-cell-width cell info)) - (borders (org-export-table-cell-borders cell info))) - (concat - ;; In order to know if CELL starts the row, do - ;; not compare it with the first cell in the - ;; row as there might be a special column. - ;; Instead, compare it with first exportable - ;; cell, obtained with `org-element-map'. - (when (and (memq 'left borders) - (eq (org-element-map table-row 'table-cell - 'identity info t) - cell)) - lcorner) - (make-string (+ 2 width) (string-to-char horiz)) - (cond - ((not (memq 'right borders)) nil) - ((eq (car (last (org-element-contents table-row))) cell) - rcorner) - (t vert))))) - info)) "\n")))) + (lambda (lcorner horiz vert rcorner) + (concat + (apply + 'concat + (org-element-map table-row 'table-cell + (lambda (cell) + (let ((width (org-ascii--table-cell-width cell info)) + (borders (org-export-table-cell-borders cell info))) + (concat + ;; In order to know if CELL starts the row, do + ;; not compare it with the first cell in the + ;; row as there might be a special column. + ;; Instead, compare it with first exportable + ;; cell, obtained with `org-element-map'. + (when (and (memq 'left borders) + (eq (org-element-map table-row 'table-cell + 'identity info t) + cell)) + lcorner) + (make-string (+ 2 width) (string-to-char horiz)) + (cond + ((not (memq 'right borders)) nil) + ((eq (car (last (org-element-contents table-row))) cell) + rcorner) + (t vert))))) + info)) "\n"))) (utf8p (eq (plist-get info :ascii-charset) 'utf-8)) (borders (org-export-table-cell-borders (org-element-map table-row 'table-cell 'identity info t) @@ -2088,7 +2091,7 @@ a communication channel." ;;;###autoload (defun org-ascii-export-as-ascii - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer to a text buffer. If narrowing is active in the current buffer, only export its @@ -2123,7 +2126,7 @@ is non-nil." ;;;###autoload (defun org-ascii-export-to-ascii - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer to a text file. If narrowing is active in the current buffer, only export its diff --git a/lisp/org/ox-beamer.el b/lisp/org/ox-beamer.el index 6ed95e84d6..ca0f1c71ab 100644 --- a/lisp/org/ox-beamer.el +++ b/lisp/org/ox-beamer.el @@ -4,6 +4,7 @@ ;; Author: Carsten Dominik ;; Nicolas Goaziou +;; Maintainer: Nicolas Goaziou ;; Keywords: org, wp, tex ;; This file is part of GNU Emacs. @@ -149,7 +150,7 @@ which is replaced with the subtitle." (defconst org-beamer-column-widths "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC" -"The column widths that should be installed as allowed property values.") + "The column widths that should be installed as allowed property values.") (defconst org-beamer-environments-special '(("againframe" "A") @@ -379,13 +380,12 @@ used as a communication channel." :parent 'latex :transcoders (let ((protected-output - (function - (lambda (object contents info) - (let ((code (org-export-with-backend - 'beamer object contents info))) - (if (org-string-nw-p code) (concat "\\protect" code) - code)))))) - (mapcar #'(lambda (type) (cons type protected-output)) + (lambda (object contents info) + (let ((code (org-export-with-backend + 'beamer object contents info))) + (if (org-string-nw-p code) (concat "\\protect" code) + code))))) + (mapcar (lambda (type) (cons type protected-output)) '(bold footnote-reference italic strike-through timestamp underline)))) headline @@ -426,16 +426,16 @@ used as a communication channel." ;; Collect nonempty options from default value and ;; headline's properties. (cl-remove-if-not #'org-string-nw-p - (append - (org-split-string - (plist-get info :beamer-frame-default-options) ",") - (and beamer-opt - (org-split-string - ;; Remove square brackets if user provided - ;; them. - (and (string-match "^\\[?\\(.*\\)\\]?$" beamer-opt) - (match-string 1 beamer-opt)) - ","))))) + (append + (org-split-string + (plist-get info :beamer-frame-default-options) ",") + (and beamer-opt + (org-split-string + ;; Remove square brackets if user provided + ;; them. + (and (string-match "^\\[?\\(.*\\)\\]?$" beamer-opt) + (match-string 1 beamer-opt)) + ","))))) (fragile ;; Add "fragile" option if necessary. (and fragilep @@ -812,17 +812,16 @@ holding export options." (org-latex-make-preamble info) ;; Insert themes. (let ((format-theme - (function - (lambda (prop command) - (let ((theme (plist-get info prop))) - (when theme - (concat command - (if (not (string-match "\\[.*\\]" theme)) - (format "{%s}\n" theme) - (format "%s{%s}\n" - (match-string 0 theme) - (org-trim - (replace-match "" nil nil theme))))))))))) + (lambda (prop command) + (let ((theme (plist-get info prop))) + (when theme + (concat command + (if (not (string-match "\\[.*\\]" theme)) + (format "{%s}\n" theme) + (format "%s{%s}\n" + (match-string 0 theme) + (org-trim + (replace-match "" nil nil theme)))))))))) (mapconcat (lambda (args) (apply format-theme args)) '((:beamer-theme "\\usetheme") (:beamer-color-theme "\\usecolortheme") @@ -960,7 +959,7 @@ value." ;;;###autoload (defun org-beamer-export-as-latex - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer as a Beamer buffer. If narrowing is active in the current buffer, only export its @@ -995,7 +994,7 @@ is non-nil." ;;;###autoload (defun org-beamer-export-to-latex - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer as a Beamer presentation (tex). If narrowing is active in the current buffer, only export its @@ -1029,7 +1028,7 @@ Return output file's name." ;;;###autoload (defun org-beamer-export-to-pdf - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer as a Beamer presentation (PDF). If narrowing is active in the current buffer, only export its @@ -1080,7 +1079,7 @@ aid, but the tag does not have any semantic meaning." (org-current-tag-alist (append '((:startgroup)) (mapcar (lambda (e) (cons (concat "B_" (car e)) - (string-to-char (nth 1 e)))) + (string-to-char (nth 1 e)))) envs) '((:endgroup)) '(("BMCOL" . ?|)))) diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el index d8932996eb..60bb77d818 100644 --- a/lisp/org/ox-html.el +++ b/lisp/org/ox-html.el @@ -2,8 +2,9 @@ ;; Copyright (C) 2011-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Jambunathan K +;; Maintainer: TEC ;; Keywords: outlines, hypermedia, calendar, wp ;; This file is part of GNU Emacs. @@ -113,6 +114,7 @@ :options-alist '((:html-doctype "HTML_DOCTYPE" nil org-html-doctype) (:html-container "HTML_CONTAINER" nil org-html-container-element) + (:html-content-class "HTML_CONTENT_CLASS" nil org-html-content-class) (:description "DESCRIPTION" nil nil newline) (:keywords "KEYWORDS" nil nil space) (:html-html5-fancy nil "html5-fancy" org-html-html5-fancy) @@ -192,7 +194,7 @@ (defvar htmlize-buffer-places) ; from htmlize.el (defvar org-html--pre/postamble-class "status" - "CSS class used for pre/postamble") + "CSS class used for pre/postamble.") (defconst org-html-doctype-alist '(("html4-strict" . " -// @license magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt Public Domain - // @license-end " - "Basic JavaScript that is needed by HTML files produced by Org mode.") + "Basic JavaScript to allow highlighting references in code blocks." + :group 'org-export-html + :package-version '(Org . "9.5") + :type 'string) -(defconst org-html-style-default - "" "The default style specification for exported HTML files. You can use `org-html-head' and `org-html-head-extra' to add to this style. If you don't want to include this default style, -customize `org-html-head-include-default-style'.") +customize `org-html-head-include-default-style'." + :group 'org-export-html + :package-version '(Org . "9.5") + :type 'string) ;;; User Configuration Variables @@ -508,17 +514,15 @@ means to use the maximum value consistent with other options." org-html-infojs-opts-table))) (defcustom org-html-infojs-template - " -" "The template for the export style additions when org-info.js is used. @@ -653,9 +657,6 @@ The function must accept two parameters: The function should return the string to be exported. -For example, the variable could be set to the following function -in order to mimic default behavior: - The default value simply returns the value of CONTENTS." :group 'org-export-html :version "24.4" @@ -782,7 +783,7 @@ The function should return the string to be exported." "The MathJax command to use when referencing equations. This is a format control string that expects a single string argument -specifying the label that is being referenced. The argument is +specifying the label that is being referenced. The argument is generated automatically on export. The default is to wrap equations in parentheses (using \"\\eqref{%s}\)\". @@ -825,13 +826,13 @@ e.g. \"tex:mathjax\". Allowed values are: ;;;; Links :: Generic (defcustom org-html-link-org-files-as-html t - "Non-nil means make file links to `file.org' point to `file.html'. -When `org-mode' is exporting an `org-mode' file to HTML, links to -non-html files are directly put into a href tag in HTML. -However, links to other Org files (recognized by the extension -\".org\") should become links to the corresponding HTML -file, assuming that the linked `org-mode' file will also be -converted to HTML. + "Non-nil means make file links to \"file.org\" point to \"file.html\". + +When Org mode is exporting an Org file to HTML, links to non-HTML files +are directly put into a \"href\" tag in HTML. However, links to other Org files +(recognized by the extension \".org\") should become links to the corresponding +HTML file, assuming that the linked Org file will also be converted to HTML. + When nil, the links still point to the plain \".org\" file." :group 'org-export-html :type 'boolean) @@ -848,16 +849,15 @@ link to the image." :type 'boolean) (defcustom org-html-inline-image-rules - `(("file" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg"))) - ("http" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg"))) - ("https" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg")))) + `(("file" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg" ".webp"))) + ("http" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg" ".webp"))) + ("https" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg" ".webp")))) "Rules characterizing image files that can be inlined into HTML. A rule consists in an association whose key is the type of link to consider, and value is a regexp that will be matched against link's path." :group 'org-export-html - :version "24.4" - :package-version '(Org . "8.0") + :package-version '(Org . "9.5") :type '(alist :key-type (string :tag "Type") :value-type (regexp :tag "Path"))) @@ -1060,13 +1060,7 @@ publishing, with :html-doctype." (defcustom org-html-html5-fancy nil "Non-nil means using new HTML5 elements. -This variable is ignored for anything other than HTML5 export. - -For compatibility with Internet Explorer, it's probably a good -idea to download some form of the html5shiv (for instance -https://code.google.com/p/html5shiv/) and add it to your -HTML_HEAD_EXTRA, so that your pages don't break for users of IE -versions 8 and below." +This variable is ignored for anything other than HTML5 export." :group 'org-export-html :version "24.4" :package-version '(Org . "8.0") @@ -1084,6 +1078,16 @@ org-info.js for your website." :package-version '(Org . "8.0") :type 'string) +(defcustom org-html-content-class "content" + "CSS class name to use for the top level content wrapper. +Can be set with the in-buffer HTML_CONTENT_CLASS property or for +publishing, with :html-content-class." + :group 'org-export-html + :version "27.2" + :package-version '(Org . "9.5") + :type 'string) + + (defcustom org-html-divs '((preamble "div" "preamble") (content "div" "content") @@ -1110,15 +1114,15 @@ org-info.js for your website." (defconst org-html-checkbox-types '((unicode . - ((on . "☑") (off . "☐") (trans . "☐"))) + ((on . "☑") (off . "☐") (trans . "☐"))) (ascii . - ((on . "[X]") - (off . "[ ]") - (trans . "[-]"))) + ((on . "[X]") + (off . "[ ]") + (trans . "[-]"))) (html . ((on . "") - (off . "") - (trans . "")))) + (off . "") + (trans . "")))) "Alist of checkbox types. The cdr of each entry is an alist list three checkbox types for HTML export: `on', `off' and `trans'. @@ -1129,7 +1133,7 @@ The choices are: `html' HTML checkboxes Note that only the ascii characters implement tri-state -checkboxes. The other two use the `off' checkbox for `trans'.") +checkboxes. The other two use the `off' checkbox for `trans'.") (defcustom org-html-checkbox-type 'ascii "The type of checkboxes to use for HTML export. @@ -1192,7 +1196,7 @@ You can also customize this for each buffer, using something like For further information about MathJax options, see the MathJax documentation: - http://docs.mathjax.org/" + https://docs.mathjax.org/" :group 'org-export-html :package-version '(Org . "8.3") :type '(list :greedy t @@ -1252,8 +1256,7 @@ For further information about MathJax options, see the MathJax documentation: } }); -" +" "The MathJax template. See also `org-html-mathjax-options'." :group 'org-export-html :type 'string) @@ -1414,10 +1417,9 @@ ignored." ;;;; Template :: Scripts -(defcustom org-html-head-include-scripts t +(defcustom org-html-head-include-scripts nil "Non-nil means include the JavaScript snippets in exported HTML files. -The actual script is defined in `org-html-scripts' and should -not be modified." +The actual script is defined in `org-html-scripts'." :group 'org-export-html :version "24.4" :package-version '(Org . "8.0") @@ -1425,6 +1427,23 @@ not be modified." ;;;; Template :: Styles +(defcustom org-html-meta-tags #'org-html-meta-tags-default + "Form that is used to produce meta tags in the HTML head. + +Can be a list where each item is a list of arguments to be passed +to `org-html--build-meta-entry'. Any nil items are ignored. + +Also accept a function which gives such a list when called with a +single argument (INFO, a communication plist)." + :group 'org-export-html + :package-version '(Org . "9.5") + :type '(choice + (repeat + (list (string :tag "Meta label") + (string :tag "label value") + (string :tag "Content value"))) + function)) + (defcustom org-html-head-include-default-style t "Non-nil means include the default style in exported HTML files. The actual style is defined in `org-html-style-default' and @@ -1447,14 +1466,12 @@ done, timestamp, timestamp-kwd, tag, target. For example, a valid value would be: - If you want to refer to an external style, use something like @@ -1588,7 +1605,7 @@ CSS classes, then this prefix can be very useful." (defun org-html-html5-p (info) (let ((dt (downcase (plist-get info :html-doctype)))) - (member dt '("html5" "xhtml5" "")))) + (member dt '("html5" "xhtml5" "")))) (defun org-html--html5-fancy-p (info) "Non-nil when exporting to HTML5 with fancy elements. @@ -1680,43 +1697,20 @@ SOURCE is a string specifying the location of the image. ATTRIBUTES is a plist, as returned by `org-export-read-attribute'. INFO is a plist used as a communication channel." - (if (string= "svg" (file-name-extension source)) - (org-html--svg-image source attributes info) - (org-html-close-tag - "img" - (org-html--make-attribute-string - (org-combine-plists - (list :src source - :alt (if (string-match-p - (concat "^" org-preview-latex-image-directory) source) - (org-html-encode-plain-text - (org-find-text-property-in-string 'org-latex-src source)) - (file-name-nondirectory source))) - attributes)) - info))) - -(defun org-html--svg-image (source attributes info) - "Return \"object\" embedding svg file SOURCE with given ATTRIBUTES. -INFO is a plist used as a communication channel. - -The special attribute \"fallback\" can be used to specify a -fallback image file to use if the object embedding is not -supported. CSS class \"org-svg\" is assigned as the class of the -object unless a different class is specified with an attribute." - (let ((fallback (plist-get attributes :fallback)) - (attrs (org-html--make-attribute-string - (org-combine-plists - ;; Remove fallback attribute, which is not meant to - ;; appear directly in the attributes string, and - ;; provide a default class if none is set. - '(:class "org-svg") attributes '(:fallback nil))))) - (format "\n%s" - source - attrs - (if fallback - (org-html-close-tag - "img" (format "src=\"%s\" %s" fallback attrs) info) - "Sorry, your browser does not support SVG.")))) + (org-html-close-tag + "img" + (org-html--make-attribute-string + (org-combine-plists + (list :src source + :alt (if (string-match-p + (concat "^" org-preview-latex-image-directory) source) + (org-html-encode-plain-text + (org-find-text-property-in-string 'org-latex-src source)) + (file-name-nondirectory source))) + (if (string= "svg" (file-name-extension source)) + (org-combine-plists '(:class "org-svg") attributes '(:fallback nil)) + attributes))) + info)) (defun org-html--textarea-block (element) "Transcode ELEMENT into a textarea block. @@ -1820,12 +1814,12 @@ INFO is a plist used as a communication channel." (anchor (org-html--anchor (format "fn.%d" n) n - (format " class=\"footnum\" href=\"#fnr.%d\"" n) + (format " class=\"footnum\" href=\"#fnr.%d\" role=\"doc-backlink\"" n) info)) (contents (org-trim (org-export-data def info)))) (format "
%s %s
\n" (format (plist-get info :html-footnote-format) anchor) - (format "
%s
" + (format "
%s
" (if (not inline?) contents (format "

%s

" contents)))))))) @@ -1835,78 +1829,93 @@ INFO is a plist used as a communication channel." ;;; Template +(defun org-html-meta-tags-default (info) + "A default value for `org-html-meta-tags'. + +Generate a list items, each of which is a list of arguments that can +be passed to `org-html--build-meta-entry', to generate meta tags to be +included in the HTML head. + +Use document's plist INFO to derive relevant information for the tags." + (let ((author (and (plist-get info :with-author) + (let ((auth (plist-get info :author))) + ;; Return raw Org syntax. + (and auth (org-element-interpret-data auth)))))) + (list + (when (org-string-nw-p author) + (list "name" "author" author)) + (when (org-string-nw-p (plist-get info :description)) + (list "name" "description" + (plist-get info :description))) + (when (org-string-nw-p (plist-get info :keywords)) + (list "name" "keywords" (plist-get info :keywords))) + '("name" "generator" "Org Mode")))) + +(defun org-html--build-meta-entry + (label identity &optional content-format &rest content-formatters) + "Build a meta tag using the provided information. + +Construct tag of form , or when CONTENT-FORMAT +is present: + +Here {content} is determined by applying any CONTENT-FORMATTERS to the +CONTENT-FORMAT and encoding the result as plain text." + (concat "\n")) + (defun org-html--build-meta-info (info) "Return meta tags for exported document. INFO is a plist used as a communication channel." - (let* ((protect-string - (lambda (str) - (replace-regexp-in-string - "\"" """ (org-html-encode-plain-text str)))) - (title (org-export-data (plist-get info :title) info)) - ;; Set title to an invisible character instead of leaving it - ;; empty, which is invalid. - (title (if (org-string-nw-p title) title "‎")) - (author (and (plist-get info :with-author) - (let ((auth (plist-get info :author))) - ;; Return raw Org syntax. - (and auth (org-element-interpret-data auth))))) - (description (plist-get info :description)) - (keywords (plist-get info :keywords)) - (charset (or (and org-html-coding-system - (fboundp 'coding-system-get) - (coding-system-get org-html-coding-system - 'mime-charset)) - "iso-8859-1"))) + (let* ((title (org-html-plain-text + (org-element-interpret-data (plist-get info :title)) info)) + ;; Set title to an invisible character instead of leaving it + ;; empty, which is invalid. + (title (if (org-string-nw-p title) title "‎")) + (charset (or (and org-html-coding-system + (fboundp 'coding-system-get) + (symbol-name + (coding-system-get org-html-coding-system + 'mime-charset))) + "iso-8859-1"))) (concat (when (plist-get info :time-stamp-file) (format-time-string (concat "\n"))) - (format - (if (org-html-html5-p info) - (org-html-close-tag "meta" "charset=\"%s\"" info) - (org-html-close-tag - "meta" "http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"" - info)) - charset) "\n" + + (if (org-html-html5-p info) + (org-html--build-meta-entry "charset" charset) + (org-html--build-meta-entry "http-equiv" "Content-Type" + (concat "text/html;charset=" charset))) + (let ((viewport-options (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell))) (plist-get info :html-viewport)))) - (and viewport-options - (concat - (org-html-close-tag - "meta" - (format "name=\"viewport\" content=\"%s\"" - (mapconcat - (lambda (elm) (format "%s=%s" (car elm) (cadr elm))) - viewport-options ", ")) - info) - "\n"))) + (if viewport-options + (org-html--build-meta-entry "name" "viewport" + (mapconcat + (lambda (elm) + (format "%s=%s" (car elm) (cadr elm))) + viewport-options ", ")))) + (format "%s\n" title) - (org-html-close-tag "meta" "name=\"generator\" content=\"Org mode\"" info) - "\n" - (and (org-string-nw-p author) - (concat - (org-html-close-tag "meta" - (format "name=\"author\" content=\"%s\"" - (funcall protect-string author)) - info) - "\n")) - (and (org-string-nw-p description) - (concat - (org-html-close-tag "meta" - (format "name=\"description\" content=\"%s\"\n" - (funcall protect-string description)) - info) - "\n")) - (and (org-string-nw-p keywords) - (concat - (org-html-close-tag "meta" - (format "name=\"keywords\" content=\"%s\"" - (funcall protect-string keywords)) - info) - "\n"))))) + + (mapconcat + (lambda (args) (apply #'org-html--build-meta-entry args)) + (delq nil (if (functionp org-html-meta-tags) + (funcall org-html-meta-tags info) + org-html-meta-tags)) + "")))) (defun org-html--build-head (info) "Return information for the .. of the HTML output. @@ -2088,7 +2097,10 @@ holding export options." (org-html--build-pre/postamble 'preamble info) ;; Document contents. (let ((div (assq 'content (plist-get info :html-divs)))) - (format "<%s id=\"%s\">\n" (nth 1 div) (nth 2 div))) + (format "<%s id=\"%s\" class=\"%s\">\n" + (nth 1 div) + (nth 2 div) + (plist-get info :html-content-class))) ;; Document title. (when (plist-get info :with-title) (let ((title (and (plist-get info :with-title) @@ -2104,7 +2116,7 @@ holding export options." (if subtitle (format (if html5-fancy - "

%s

\n" + "

%s

\n" (concat "\n" (org-html-close-tag "br" nil info) "\n" "%s\n")) (org-export-data subtitle info)) @@ -2232,7 +2244,7 @@ is the language used for CODE, as a string, or nil." (if (and beg end) (substring code beg end) code))))))))) (defun org-html-do-format-code - (code &optional lang refs retain-labels num-start wrap-lines) + (code &optional lang refs retain-labels num-start wrap-lines) "Format CODE string as source code. Optional arguments LANG, REFS, RETAIN-LABELS, NUM-START, WRAP-LINES are, respectively, the language of the source code, as a string, an @@ -2305,14 +2317,14 @@ of contents as a string, or nil if it is empty." (org-export-get-relative-level headline info))) (org-export-collect-headlines info depth scope)))) (when toc-entries - (let ((toc (concat "
" + (let ((toc (concat "
" (org-html--toc-text toc-entries) "
\n"))) (if scope toc (let ((outer-tag (if (org-html--html5-fancy-p info) "nav" "div"))) - (concat (format "<%s id=\"table-of-contents\">\n" outer-tag) + (concat (format "<%s id=\"table-of-contents\" role=\"doc-toc\">\n" outer-tag) (let ((top-level (plist-get info :html-toplevel-hlevel))) (format "%s\n" top-level @@ -2585,7 +2597,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." (format (plist-get info :html-footnote-format) (org-html--anchor - id n (format " class=\"footref\" href=\"#fn.%d\"" n) info))))) + id n (format " class=\"footref\" href=\"#fn.%d\" role=\"doc-backlink\"" n) info))))) ;;;; Headline @@ -2650,7 +2662,7 @@ holding contextual information." (format "%s " level - (mapconcat #'number-to-string numbers "."))) + (concat (mapconcat #'number-to-string numbers ".") "."))) formatted-text) level) ;; When there is no section, pretend there is an @@ -2720,7 +2732,7 @@ holding contextual information." todo todo-type priority text tags contents info))) (defun org-html-format-inlinetask-default-function - (todo todo-type priority text tags contents info) + (todo todo-type priority text tags contents info) "Default format function for inlinetasks. See `org-html-format-inlinetask-function' for details." (format "
\n%s%s\n%s
" @@ -3020,7 +3032,8 @@ images, set it to: (`paragraph element) (`link (org-export-get-parent element))))) (and (eq (org-element-type paragraph) 'paragraph) - (or (not (fboundp 'org-html-standalone-image-predicate)) + (or (not (and (boundp 'org-html-standalone-image-predicate) + (fboundp org-html-standalone-image-predicate))) (funcall org-html-standalone-image-predicate paragraph)) (catch 'exit (let ((link-count 0)) @@ -3464,12 +3477,12 @@ contextual information." (if (org-export-read-attribute :attr_html src-block :textarea) (org-html--textarea-block src-block) (let* ((lang (org-element-property :language src-block)) - (code (org-html-format-code src-block info)) - (label (let ((lbl (org-html--reference src-block info t))) - (if lbl (format " id=\"%s\"" lbl) ""))) - (klipsify (and (plist-get info :html-klipsify-src) - (member lang '("javascript" "js" - "ruby" "scheme" "clojure" "php" "html"))))) + (code (org-html-format-code src-block info)) + (label (let ((lbl (org-html--reference src-block info t))) + (if lbl (format " id=\"%s\"" lbl) ""))) + (klipsify (and (plist-get info :html-klipsify-src) + (member lang '("javascript" "js" + "ruby" "scheme" "clojure" "php" "html"))))) (if (not lang) (format "
\n%s
" label code) (format "
\n%s%s\n
" ;; Build caption. @@ -3773,7 +3786,7 @@ contextual information." ;;;###autoload (defun org-html-export-as-html - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer to an HTML buffer. If narrowing is active in the current buffer, only export its @@ -3818,7 +3831,7 @@ to convert it." ;;;###autoload (defun org-html-export-to-html - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer to a HTML file. If narrowing is active in the current buffer, only export its diff --git a/lisp/org/ox-icalendar.el b/lisp/org/ox-icalendar.el index b8834c4ce1..9170059156 100644 --- a/lisp/org/ox-icalendar.el +++ b/lisp/org/ox-icalendar.el @@ -2,8 +2,9 @@ ;; Copyright (C) 2004-2021 Free Software Foundation, Inc. -;; Author: Carsten Dominik +;; Author: Carsten Dominik ;; Nicolas Goaziou +;; Maintainer: Nicolas Goaziou ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: https://orgmode.org @@ -32,6 +33,7 @@ ;;; Code: (require 'cl-lib) +(require 'org-agenda) (require 'ox-ascii) (declare-function org-bbdb-anniv-export-ical "ol-bbdb" nil) @@ -281,7 +283,6 @@ re-read the iCalendar file.") (inlinetask . ignore) (planning . ignore) (section . ignore) - (inner-template . (lambda (c i) c)) (template . org-icalendar-template)) :options-alist '((:exclude-tags @@ -370,7 +371,6 @@ A headline is blocked when either (1- (length org-icalendar-date-time-format))) ?Z)) -(defvar org-agenda-default-appointment-duration) ; From org-agenda.el. (defun org-icalendar-convert-timestamp (timestamp keyword &optional end tz) "Convert TIMESTAMP to iCalendar format. @@ -722,7 +722,7 @@ Return VEVENT component as a string." "END:VEVENT")))) (defun org-icalendar--vtodo - (entry uid summary location description categories timezone class) + (entry uid summary location description categories timezone class) "Create a VTODO component. ENTRY is either a headline or an inlinetask element. UID is the @@ -849,7 +849,7 @@ CALSCALE:GREGORIAN\n" ;;;###autoload (defun org-icalendar-export-to-ics - (&optional async subtreep visible-only body-only) + (&optional async subtreep visible-only body-only) "Export current buffer to an iCalendar file. If narrowing is active in the current buffer, only export its diff --git a/lisp/org/ox-koma-letter.el b/lisp/org/ox-koma-letter.el new file mode 100644 index 0000000000..3bd2f684a6 --- /dev/null +++ b/lisp/org/ox-koma-letter.el @@ -0,0 +1,1013 @@ +;;; ox-koma-letter.el --- KOMA Scrlttr2 Back-End for Org Export Engine + +;; Copyright (C) 2007-2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou +;; Alan Schmitt +;; Viktor Rosenfeld +;; Rasmus Pank Roulund +;; Maintainer: Marco Wahl +;; Keywords: org, wp, tex + +;; This file is part of GNU Emacs. + +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: +;; +;; This library implements a KOMA Scrlttr2 back-end, derived from the +;; LaTeX one. +;; +;; Depending on the desired output format, three commands are provided +;; for export: `org-koma-letter-export-as-latex' (temporary buffer), +;; `org-koma-letter-export-to-latex' ("tex" file) and +;; `org-koma-letter-export-to-pdf' ("pdf" file). +;; +;; On top of buffer keywords supported by `latex' back-end (see +;; `org-latex-options-alist'), this back-end introduces the following +;; keywords: +;; - CLOSING: see `org-koma-letter-closing', +;; - FROM_ADDRESS: see `org-koma-letter-from-address', +;; - LCO: see `org-koma-letter-class-option-file', +;; - OPENING: see `org-koma-letter-opening', +;; - PHONE_NUMBER: see `org-koma-letter-phone-number', +;; - URL: see `org-koma-letter-url', +;; - FROM_LOGO: see `org-koma-letter-from-logo', +;; - SIGNATURE: see `org-koma-letter-signature', +;; - PLACE: see `org-koma-letter-place', +;; - LOCATION: see `org-koma-letter-location', +;; - TO_ADDRESS: If unspecified this is set to "\mbox{}". +;; +;; TO_ADDRESS, FROM_ADDRESS, LOCATION, CLOSING, and SIGNATURE can also +;; be specified using "special headings" with the special tags +;; specified in `org-koma-letter-special-tags-in-letter'. LaTeX line +;; breaks are not necessary for TO_ADDRESS, FROM_ADDRESS and LOCATION. +;; If both a headline and a keyword specify a to or from address the +;; value is determined in accordance with +;; `org-koma-letter-prefer-special-headings'. +;; +;; A number of OPTIONS settings can be set to change which contents is +;; exported. +;; - backaddress (see `org-koma-letter-use-backaddress') +;; - foldmarks (see `org-koma-letter-use-foldmarks') +;; - phone (see `org-koma-letter-use-phone') +;; - url (see `org-koma-letter-use-url') +;; - from-logo (see `org-koma-letter-use-from-logo') +;; - email (see `org-koma-letter-use-email') +;; - place (see `org-koma-letter-use-place') +;; - location (see `org-koma-letter-use-location') +;; - subject, a list of format options +;; (see `org-koma-letter-subject-format') +;; - after-closing-order, a list of the ordering of headings with +;; special tags after closing (see +;; `org-koma-letter-special-tags-after-closing') +;; - after-letter-order, as above, but after the end of the letter +;; (see `org-koma-letter-special-tags-after-letter'). +;; +;; The following variables works differently from the main LaTeX class +;; - AUTHOR: Default to user-full-name but may be disabled. +;; (See also `org-koma-letter-author'.) +;; - EMAIL: Same as AUTHOR. (See also `org-koma-letter-email'.) +;; +;; FROM_LOGO uses LaTeX markup. FROM_LOGO provides the +;; "includegraphics" command to tell LaTeX where to find the logo. +;; This command needs to know the logo's directory and file name. The +;; directory can either be relative or absolute, just as you would +;; expect. LaTeX can use three file types for the logo: PDF, JPEG, or +;; PNG. The logo can either include or exclude its extension, which +;; might surprise you. When you exclude its extension, LaTeX will +;; search the directory for the "best" quality graphics format. For +;; example if it finds both logo.pdf and logo.png then it will +;; identify the PDF as "better", and include "logo.pdf". This can be +;; useful, for example, when you are mocking up a logo in the PNG +;; raster format and then switch over to the higher quality PDF vector +;; format. When you include the file extension then LaTeX will +;; include it without searching for higher quality file types. +;; Whatever file type you choose, it will probably require a few +;; design iterations to get the best looking logo size for your +;; letter. Finally, the directory and file name are specified +;; *without* quotes. Here are some examples with commentary, in the +;; location of your letter, with a logo named "logo", to get you +;; started: +;; +;; Logo in the same directory: \includegraphics{logo} +;; or a sub-directory: \includegraphics{logos/production/logo} +;; +;; Logos specified using absolute paths on Linux or Windows: +;; +;; \includegraphics{~/correspondence/logo} +;; \includegraphics{~/correspondence/logos/production/logo} +;; \includegraphics{c:/you/correspondence/logo} +;; \includegraphics{c:/you/correspondence/logos/production/logo} +;; +;; Logos in the same directory where the "better" quality PDF will +;; be chosen over the JPG: +;; +;; \includegraphics{logo.pdf} +;; \includegraphics{logo.png} +;; +;; Headlines are in general ignored. However, headlines with special +;; tags can be used for specified contents like postscript (ps), +;; carbon copy (cc), enclosures (encl) and code to be inserted after +;; \end{letter} (after_letter). Specials tags are defined in +;; `org-koma-letter-special-tags-after-closing' and +;; `org-koma-letter-special-tags-after-letter'. Currently members of +;; `org-koma-letter-special-tags-after-closing' used as macros and the +;; content of the headline is the argument. +;; +;; Headlines with to and from may also be used rather than the keyword +;; approach described above. If both a keyword and a headline with +;; information is present precedence is determined by +;; `org-koma-letter-prefer-special-headings'. +;; +;; You need an appropriate association in `org-latex-classes' in order +;; to use the KOMA Scrlttr2 class. By default, a sparse scrlttr2 +;; class is provided: "default-koma-letter". You can also add you own +;; letter class. For instance: +;; +;; (add-to-list 'org-latex-classes +;; '("my-letter" +;; "\\documentclass\[% +;; DIV=14, +;; fontsize=12pt, +;; parskip=half, +;; subject=titled, +;; backaddress=false, +;; fromalign=left, +;; fromemail=true, +;; fromphone=true\]\{scrlttr2\} +;; \[DEFAULT-PACKAGES] +;; \[PACKAGES] +;; \[EXTRA]")) +;; +;; Then, in your Org document, be sure to require the proper class +;; with: +;; +;; #+LATEX_CLASS: my-letter +;; +;; Or by setting `org-koma-letter-default-class'. +;; +;; You may have to load (LaTeX) Babel as well, e.g., by adding +;; it to `org-latex-packages-alist', +;; +;; (add-to-list 'org-latex-packages-alist '("AUTO" "babel" nil)) + +;;; Code: + +(require 'cl-lib) +(require 'ox-latex) + +;; Install a default letter class. +(unless (assoc "default-koma-letter" org-latex-classes) + (add-to-list 'org-latex-classes + '("default-koma-letter" "\\documentclass[11pt]{scrlttr2}"))) + + +;;; User-Configurable Variables + +(defgroup org-export-koma-letter nil + "Options for exporting to KOMA scrlttr2 class in LaTeX export." + :tag "Org Koma-Letter" + :group 'org-export) + +(defcustom org-koma-letter-class-option-file "NF" + "Letter Class Option File. +This option can also be set with the LCO keyword." + :group 'org-export-koma-letter + :type 'string) + +(defcustom org-koma-letter-author 'user-full-name + "Sender's name. + +This variable defaults to calling the function `user-full-name' +which just returns the current function `user-full-name'. +Alternatively a string, nil or a function may be given. +Functions must return a string. + +This option can also be set with the AUTHOR keyword." + :group 'org-export-koma-letter + :type '(radio (function-item user-full-name) + (string) + (function) + (const :tag "Do not export author" nil))) + +(defcustom org-koma-letter-email 'org-koma-letter-email + "Sender's email address. + +This variable defaults to the value `org-koma-letter-email' which +returns `user-mail-address'. Alternatively a string, nil or +a function may be given. Functions must return a string. + +This option can also be set with the EMAIL keyword." + :group 'org-export-koma-letter + :type '(radio (function-item org-koma-letter-email) + (string) + (function) + (const :tag "Do not export email" nil))) + +(defcustom org-koma-letter-from-address "" + "Sender's address, as a string. +This option can also be set with one or more FROM_ADDRESS +keywords." + :group 'org-export-koma-letter + :type 'string) + +(defcustom org-koma-letter-phone-number "" + "Sender's phone number, as a string. +This option can also be set with the PHONE_NUMBER keyword." + :group 'org-export-koma-letter + :type 'string) + +(defcustom org-koma-letter-url "" + "Sender's URL, e. g., the URL of her homepage. +This option can also be set with the URL keyword." + :group 'org-export-koma-letter + :type 'string + :safe #'stringp) + +(defcustom org-koma-letter-from-logo "" + "Commands for inserting the sender's logo, e. g., \\includegraphics{logo}. +This option can also be set with the FROM_LOGO keyword." + :group 'org-export-koma-letter + :type 'string + :safe #'stringp) + +(defcustom org-koma-letter-place "" + "Place from which the letter is sent, as a string. +This option can also be set with the PLACE keyword." + :group 'org-export-koma-letter + :type 'string) + +(defcustom org-koma-letter-location "" + "Sender's extension field, as a string. + +This option can also be set with the LOCATION keyword. +Moreover, when: + (1) Either `org-koma-letter-prefer-special-headings' is non-nil + or there is no LOCATION keyword or the LOCATION keyword is + empty; + (2) the letter contains a headline with the special + tag \"location\"; +then the location will be set as the content of the location +special heading. + +The location field is typically printed right of the address +field (See Figure 4.9. in the English manual of 2015-10-03)." + :group 'org-export-koma-letter + :type 'string) + +(defcustom org-koma-letter-opening "" + "Letter's opening, as a string. + +This option can also be set with the OPENING keyword. Moreover, +when: + (1) Either `org-koma-letter-prefer-special-headings' is non-nil + or the CLOSING keyword is empty + (2) `org-koma-letter-headline-is-opening-maybe' is non-nil; + (3) the letter contains a headline without a special + tag (e.g. \"to\" or \"ps\"); +then the opening will be implicitly set as the untagged headline title." + :group 'org-export-koma-letter + :type 'string) + +(defcustom org-koma-letter-closing "" + "Letter's closing, as a string. +This option can also be set with the CLOSING keyword. Moreover, +when: + (1) Either `org-koma-letter-prefer-special-headings' is non-nil + or the CLOSING keyword is empty; + (2) `org-koma-letter-headline-is-opening-maybe' is non-nil; + (3) the letter contains a headline with the special + tag \"closing\"; +then the opening will be set as the title of the closing special +heading title." + :group 'org-export-koma-letter + :type 'string) + +(defcustom org-koma-letter-signature "" + "Signature, as a string. +This option can also be set with the SIGNATURE keyword. +Moreover, when: + (1) Either `org-koma-letter-prefer-special-headings' is non-nil + or there is no CLOSING keyword or the CLOSING keyword is empty; + (2) `org-koma-letter-headline-is-opening-maybe' is non-nil; + (3) the letter contains a headline with the special + tag \"closing\"; +then the signature will be set as the content of the +closing special heading. + +Note if the content is empty the signature will not be set." + :group 'org-export-koma-letter + :type 'string) + +(defcustom org-koma-letter-prefer-special-headings nil + "Non-nil means prefer headlines over keywords for TO and FROM. +This option can also be set with the OPTIONS keyword, e.g.: +\"special-headings:t\"." + :group 'org-export-koma-letter + :type 'boolean) + +(defcustom org-koma-letter-subject-format t + "Non-nil means include the subject. + +Support formatting options. + +When t, insert a subject using default options. When nil, do not +insert a subject at all. It can also be a list of symbols among +the following ones: + + `afteropening' Subject after opening + `beforeopening' Subject before opening + `centered' Subject centered + `left' Subject left-justified + `right' Subject right-justified + `titled' Add title/description to subject + `underlined' Set subject underlined + `untitled' Do not add title/description to subject + +Please refer to the KOMA-script manual (Table 4.16. in the +English manual of 2012-07-22). + +This option can also be set with the OPTIONS keyword, e.g.: +\"subject:(underlined centered)\"." + :type + '(choice + (const :tag "No export" nil) + (const :tag "Default options" t) + (set :tag "Configure options" + (const :tag "Subject after opening" afteropening) + (const :tag "Subject before opening" beforeopening) + (const :tag "Subject centered" centered) + (const :tag "Subject left-justified" left) + (const :tag "Subject right-justified" right) + (const :tag "Add title or description to subject" underlined) + (const :tag "Set subject underlined" titled) + (const :tag "Do not add title or description to subject" untitled))) + :group 'org-export-koma-letter) + +(defcustom org-koma-letter-use-backaddress nil + "Non-nil prints return address in line above to address. +This option can also be set with the OPTIONS keyword, e.g.: +\"backaddress:t\"." + :group 'org-export-koma-letter + :type 'boolean) + +(defcustom org-koma-letter-use-foldmarks t + "Configure appearance of folding marks. + +When t, activate default folding marks. When nil, do not insert +folding marks at all. It can also be a list of symbols among the +following ones: + + `B' Activate upper horizontal mark on left paper edge + `b' Deactivate upper horizontal mark on left paper edge + + `H' Activate all horizontal marks on left paper edge + `h' Deactivate all horizontal marks on left paper edge + + `L' Activate left vertical mark on upper paper edge + `l' Deactivate left vertical mark on upper paper edge + + `M' Activate middle horizontal mark on left paper edge + `m' Deactivate middle horizontal mark on left paper edge + + `P' Activate punch or center mark on left paper edge + `p' Deactivate punch or center mark on left paper edge + + `T' Activate lower horizontal mark on left paper edge + `t' Deactivate lower horizontal mark on left paper edge + + `V' Activate all vertical marks on upper paper edge + `v' Deactivate all vertical marks on upper paper edge + +This option can also be set with the OPTIONS keyword, e.g.: +\"foldmarks:(b l m t)\"." + :group 'org-export-koma-letter + :type '(choice + (const :tag "Activate default folding marks" t) + (const :tag "Deactivate folding marks" nil) + (set + :tag "Configure folding marks" + (const :tag "Activate upper horizontal mark on left paper edge" B) + (const :tag "Deactivate upper horizontal mark on left paper edge" b) + (const :tag "Activate all horizontal marks on left paper edge" H) + (const :tag "Deactivate all horizontal marks on left paper edge" h) + (const :tag "Activate left vertical mark on upper paper edge" L) + (const :tag "Deactivate left vertical mark on upper paper edge" l) + (const :tag "Activate middle horizontal mark on left paper edge" M) + (const :tag "Deactivate middle horizontal mark on left paper edge" m) + (const :tag "Activate punch or center mark on left paper edge" P) + (const :tag "Deactivate punch or center mark on left paper edge" p) + (const :tag "Activate lower horizontal mark on left paper edge" T) + (const :tag "Deactivate lower horizontal mark on left paper edge" t) + (const :tag "Activate all vertical marks on upper paper edge" V) + (const :tag "Deactivate all vertical marks on upper paper edge" v)))) + +(defcustom org-koma-letter-use-phone nil + "Non-nil prints sender's phone number. +This option can also be set with the OPTIONS keyword, e.g.: +\"phone:t\"." + :group 'org-export-koma-letter + :type 'boolean) + +(defcustom org-koma-letter-use-url nil + "Non-nil prints sender's URL. +This option can also be set with the OPTIONS keyword, e.g.: +\"url:t\"." + :group 'org-export-koma-letter + :type 'boolean + :safe #'booleanp) + +(defcustom org-koma-letter-use-from-logo nil + "Non-nil prints sender's FROM_LOGO. +This option can also be set with the OPTIONS keyword, e.g.: +\"from-logo:t\"." + :group 'org-export-koma-letter + :type 'boolean + :safe #'booleanp) + +(defcustom org-koma-letter-use-email nil + "Non-nil prints sender's email address. +This option can also be set with the OPTIONS keyword, e.g.: +\"email:t\"." + :group 'org-export-koma-letter + :type 'boolean) + +(defcustom org-koma-letter-use-place t + "Non-nil prints the letter's place next to the date. +This option can also be set with the OPTIONS keyword, e.g.: +\"place:nil\"." + :group 'org-export-koma-letter + :type 'boolean) + +(defcustom org-koma-letter-default-class "default-koma-letter" + "Default class for `org-koma-letter'. +The value must be a member of `org-latex-classes'." + :group 'org-export-koma-letter + :type 'string) + +(defcustom org-koma-letter-headline-is-opening-maybe t + "Non-nil means a headline may be used as an opening and closing. +See also `org-koma-letter-opening' and +`org-koma-letter-closing'." + :group 'org-export-koma-letter + :type 'boolean) + +(defcustom org-koma-letter-prefer-subject nil + "Non-nil means title should be interpreted as subject if subject is missing. +This option can also be set with the OPTIONS keyword, +e.g. \"title-subject:t\"." + :group 'org-export-koma-letter + :type 'boolean) + +(defconst org-koma-letter-special-tags-in-letter '(to from closing location) + "Header tags related to the letter itself.") + +(defconst org-koma-letter-special-tags-after-closing '(after_closing ps encl cc) + "Header tags to be inserted in the letter after closing.") + +(defconst org-koma-letter-special-tags-as-macro '(ps encl cc) + "Header tags to be inserted as macros.") + +(defconst org-koma-letter-special-tags-after-letter '(after_letter) + "Header tags to be inserted after the letter.") + +(defvar org-koma-letter-special-contents nil + "Holds special content temporarily.") + + +;;; Define Back-End + +(org-export-define-derived-backend 'koma-letter 'latex + :options-alist + '((:latex-class "LATEX_CLASS" nil org-koma-letter-default-class t) + (:lco "LCO" nil org-koma-letter-class-option-file) + (:author "AUTHOR" nil (org-koma-letter--get-value org-koma-letter-author) parse) + (:author-changed-in-buffer-p "AUTHOR" nil nil t) + (:from-address "FROM_ADDRESS" nil org-koma-letter-from-address newline) + (:phone-number "PHONE_NUMBER" nil org-koma-letter-phone-number) + (:url "URL" nil org-koma-letter-url) + (:from-logo "FROM_LOGO" nil org-koma-letter-from-logo) + (:email "EMAIL" nil (org-koma-letter--get-value org-koma-letter-email) t) + (:to-address "TO_ADDRESS" nil nil newline) + (:place "PLACE" nil org-koma-letter-place) + (:location "LOCATION" nil org-koma-letter-location) + (:subject "SUBJECT" nil nil parse) + (:opening "OPENING" nil org-koma-letter-opening parse) + (:closing "CLOSING" nil org-koma-letter-closing parse) + (:signature "SIGNATURE" nil org-koma-letter-signature newline) + (:special-headings nil "special-headings" org-koma-letter-prefer-special-headings) + (:special-tags-as-macro nil nil org-koma-letter-special-tags-as-macro) + (:special-tags-in-letter nil nil org-koma-letter-special-tags-in-letter) + (:special-tags-after-closing nil "after-closing-order" + org-koma-letter-special-tags-after-closing) + (:special-tags-after-letter nil "after-letter-order" + org-koma-letter-special-tags-after-letter) + (:with-backaddress nil "backaddress" org-koma-letter-use-backaddress) + (:with-email nil "email" org-koma-letter-use-email) + (:with-foldmarks nil "foldmarks" org-koma-letter-use-foldmarks) + (:with-phone nil "phone" org-koma-letter-use-phone) + (:with-url nil "url" org-koma-letter-use-url) + (:with-from-logo nil "from-logo" org-koma-letter-use-from-logo) + (:with-place nil "place" org-koma-letter-use-place) + (:with-subject nil "subject" org-koma-letter-subject-format) + (:with-title-as-subject nil "title-subject" org-koma-letter-prefer-subject) + (:with-headline-opening nil nil org-koma-letter-headline-is-opening-maybe) + ;; Special properties non-nil when a setting happened in buffer. + ;; They are used to prioritize in-buffer settings over "lco" + ;; files. See `org-koma-letter-template'. + (:inbuffer-author "AUTHOR" nil 'koma-letter:empty) + (:inbuffer-from "FROM" nil 'koma-letter:empty) + (:inbuffer-email "EMAIL" nil 'koma-letter:empty) + (:inbuffer-phone-number "PHONE_NUMBER" nil 'koma-letter:empty) + (:inbuffer-url "URL" nil 'koma-letter:empty) + (:inbuffer-from-logo "FROM_LOGO" nil 'koma-letter:empty) + (:inbuffer-place "PLACE" nil 'koma-letter:empty) + (:inbuffer-location "LOCATION" nil 'koma-letter:empty) + (:inbuffer-signature "SIGNATURE" nil 'koma-letter:empty) + (:inbuffer-with-backaddress nil "backaddress" 'koma-letter:empty) + (:inbuffer-with-email nil "email" 'koma-letter:empty) + (:inbuffer-with-foldmarks nil "foldmarks" 'koma-letter:empty) + (:inbuffer-with-phone nil "phone" 'koma-letter:empty) + (:inbuffer-with-url nil "url" 'koma-letter:empty) + (:inbuffer-with-from-logo nil "from-logo" 'koma-letter:empty) + (:inbuffer-with-place nil "place" 'koma-letter:empty)) + :translate-alist '((export-block . org-koma-letter-export-block) + (export-snippet . org-koma-letter-export-snippet) + (headline . org-koma-letter-headline) + (keyword . org-koma-letter-keyword) + (template . org-koma-letter-template)) + :menu-entry + '(?k "Export with KOMA Scrlttr2" + ((?L "As LaTeX buffer" org-koma-letter-export-as-latex) + (?l "As LaTeX file" org-koma-letter-export-to-latex) + (?p "As PDF file" org-koma-letter-export-to-pdf) + (?o "As PDF file and open" + (lambda (a s v b) + (if a (org-koma-letter-export-to-pdf t s v b) + (org-open-file (org-koma-letter-export-to-pdf nil s v b)))))))) + + + +;;; Helper functions + +(defun org-koma-letter-email () + "Return the current `user-mail-address'." + user-mail-address) + +;; The following is taken from/inspired by ox-grof.el +;; Thanks, Luis! + +(defun org-koma-letter--get-tagged-contents (key) + "Get contents from a headline tagged with KEY. +The contents is stored in `org-koma-letter-special-contents'." + (let ((value (cdr (assoc-string (org-koma-letter--get-value key) + org-koma-letter-special-contents)))) + (when value (org-string-nw-p (org-trim value))))) + +(defun org-koma-letter--get-value (value) + "Turn value into a string whenever possible. +Determines if VALUE is nil, a string, a function or a symbol and +return a string or nil." + (when value + (cond ((stringp value) value) + ((functionp value) (funcall value)) + ((symbolp value) (symbol-name value)) + (t value)))) + +(defun org-koma-letter--special-contents-inline (keywords info) + "Process KEYWORDS members of `org-koma-letter-special-contents'. + +KEYWORDS is a list of symbols. Return them as a string to be +formatted. + +The function is used for inserting content of special headings +such as the one tagged with PS." + (mapconcat + (lambda (keyword) + (let* ((name (org-koma-letter--get-value keyword)) + (value (org-koma-letter--get-tagged-contents name)) + (macrop (memq keyword (plist-get info :special-tags-as-macro)))) + (cond ((not value) nil) + (macrop (format "\\%s{%s}\n" name value)) + (t value)))) + keywords + "\n")) + + +(defun org-koma-letter--add-latex-newlines (string) + "Replace regular newlines with LaTeX newlines (i.e. `\\\\')." + (let ((str (org-trim string))) + (when (org-string-nw-p str) + (replace-regexp-in-string "\n" "\\\\\\\\\n" str)))) + + + +;;; Transcode Functions + +;;;; Export Block + +(defun org-koma-letter-export-block (export-block contents info) + "Transcode an EXPORT-BLOCK element into KOMA Scrlttr2 code. +CONTENTS is nil. INFO is a plist used as a communication +channel." + (when (member (org-element-property :type export-block) + '("KOMA-LETTER" "LATEX")) + (org-remove-indentation (org-element-property :value export-block)))) + +;;;; Export Snippet + +(defun org-koma-letter-export-snippet (export-snippet contents info) + "Transcode an EXPORT-SNIPPET object into KOMA Scrlttr2 code. +CONTENTS is nil. INFO is a plist used as a communication +channel." + (when (memq (org-export-snippet-backend export-snippet) '(latex koma-letter)) + (org-element-property :value export-snippet))) + +;;;; Keyword + +(defun org-koma-letter-keyword (keyword contents info) + "Transcode a KEYWORD element into KOMA Scrlttr2 code. +CONTENTS is nil. INFO is a plist used as a communication +channel." + (let ((key (org-element-property :key keyword)) + (value (org-element-property :value keyword))) + ;; Handle specifically KOMA-LETTER keywords. Otherwise, fallback + ;; to `latex' back-end. + (if (equal key "KOMA-LETTER") value + (org-export-with-backend 'latex keyword contents info)))) + +;; Headline + +(defun org-koma-letter-headline (headline contents info) + "Transcode a HEADLINE element from Org to LaTeX. +CONTENTS holds the contents of the headline. INFO is a plist +holding contextual information. + +Note that if a headline is tagged with a tag from +`org-koma-letter-special-tags' it will not be exported, but +stored in `org-koma-letter-special-contents' and included at the +appropriate place." + (let ((special-tag (org-koma-letter--special-tag headline info))) + (if (not special-tag) + contents + (push (cons special-tag contents) org-koma-letter-special-contents) + ""))) + +(defun org-koma-letter--special-tag (headline info) + "Non-nil if HEADLINE is a special headline. +INFO is a plist holding contextual information. Return first +special tag headline." + (let ((special-tags (append + (plist-get info :special-tags-in-letter) + (plist-get info :special-tags-after-closing) + (plist-get info :special-tags-after-letter)))) + (cl-some (lambda (tag) (and (assoc-string tag special-tags) tag)) + (org-export-get-tags headline info)))) + +(defun org-koma-letter--keyword-or-headline (plist-key pred info) + "Return the correct version of opening or closing. +PLIST-KEY should be a key in info, typically :opening +or :closing. PRED is a predicate run on headline to determine +which title to use which takes two arguments, a headline element +and an info plist. INFO is a plist holding contextual +information. Return the preferred candidate for the exported of +PLIST-KEY." + (let* ((keyword-candidate (plist-get info plist-key)) + (headline-candidate (when (and (plist-get info :with-headline-opening) + (or (plist-get info :special-headings) + (not keyword-candidate))) + (org-element-map (plist-get info :parse-tree) + 'headline + (lambda (h) + (and (funcall pred h info) + (org-element-property :title h))) + info t)))) + (org-export-data (or headline-candidate keyword-candidate "") info))) + +;;;; Template + +(defun org-koma-letter-template (contents info) + "Return complete document string after KOMA Scrlttr2 conversion. +CONTENTS is the transcoded contents string. INFO is a plist +holding export options." + (concat + ;; Time-stamp. + (and (plist-get info :time-stamp-file) + (format-time-string "%% Created %Y-%m-%d %a %H:%M\n")) + ;; LaTeX compiler + (org-latex--insert-compiler info) + ;; Document class and packages. + (org-latex-make-preamble info) + ;; Settings. They can come from three locations, in increasing + ;; order of precedence: global variables, LCO files and in-buffer + ;; settings. Thus, we first insert settings coming from global + ;; variables, then we insert LCO files, and, eventually, we insert + ;; settings coming from buffer keywords. + (org-koma-letter--build-settings 'global info) + (mapconcat (lambda (file) (format "\\LoadLetterOption{%s}\n" file)) + (split-string (or (plist-get info :lco) "")) + "") + (org-koma-letter--build-settings 'buffer info) + ;; Date. + (format "\\date{%s}\n" (org-export-data (org-export-get-date info) info)) + ;; Hyperref, document start, and subject and title. + (let* ((with-subject (plist-get info :with-subject)) + (with-title (plist-get info :with-title)) + (title-as-subject (and with-subject + (plist-get info :with-title-as-subject))) + (subject* (org-string-nw-p + (org-export-data (plist-get info :subject) info))) + (title* (and with-title + (org-string-nw-p + (org-export-data (plist-get info :title) info)))) + (subject (cond ((not with-subject) nil) + (title-as-subject (or subject* title*)) + (t subject*))) + (title (cond ((not with-title) nil) + (title-as-subject (and subject* title*)) + (t title*))) + (hyperref-template (plist-get info :latex-hyperref-template)) + (spec (append (list (cons ?t (or title subject ""))) + (org-latex--format-spec info)))) + (concat + (when (and with-subject (not (eq with-subject t))) + (format "\\KOMAoption{subject}{%s}\n" + (if (symbolp with-subject) with-subject + (mapconcat #'symbol-name with-subject ",")))) + ;; Hyperref. + (and (stringp hyperref-template) + (format-spec hyperref-template spec)) + ;; Document start. + "\\begin{document}\n\n" + ;; Subject and title. + (when subject (format "\\setkomavar{subject}{%s}\n" subject)) + (when title (format "\\setkomavar{title}{%s}\n" title)) + (when (or (org-string-nw-p title) (org-string-nw-p subject)) "\n"))) + ;; Letter start. + (let ((keyword-val (plist-get info :to-address)) + (heading-val (org-koma-letter--get-tagged-contents 'to))) + (format "\\begin{letter}{%%\n%s}\n\n" + (org-koma-letter--add-latex-newlines + (or (if (plist-get info :special-headings) + (or heading-val keyword-val) + (or keyword-val heading-val)) + "\\mbox{}")))) + ;; Opening. + (format "\\opening{%s}\n\n" + (org-koma-letter--keyword-or-headline + :opening + (lambda (h i) + (not (org-koma-letter--special-tag h i))) + info)) + ;; Letter body. + contents + ;; Closing. + (format "\\closing{%s}\n" + (org-koma-letter--keyword-or-headline + :closing + (lambda (h i) + (let ((special-tag (org-koma-letter--special-tag h i))) + (and special-tag + (string= "closing" special-tag)))) + info)) + (org-koma-letter--special-contents-inline + (plist-get info :special-tags-after-closing) info) + ;; Letter end. + "\n\\end{letter}\n" + (org-koma-letter--special-contents-inline + (plist-get info :special-tags-after-letter) info) + ;; Document end. + "\n\\end{document}")) + +(defun org-koma-letter--build-settings (scope info) + "Build settings string according to type. +SCOPE is either `global' or `buffer'. INFO is a plist used as +a communication channel." + (let* ((check-scope + ;; Non-nil value when SETTING was defined in SCOPE. + (lambda (setting) + (let ((property (intern (format ":inbuffer-%s" setting)))) + (if (eq scope 'global) + (eq (plist-get info property) 'koma-letter:empty) + (not (eq (plist-get info property) 'koma-letter:empty)))))) + (heading-or-key-value + (lambda (heading key &optional scoped) + (let* ((heading-val + (org-koma-letter--get-tagged-contents heading)) + (key-val (org-string-nw-p (plist-get info key))) + (scopedp (funcall check-scope (or scoped heading)))) + (and (or (and key-val scopedp) heading-val) + (not (and (eq scope 'global) heading-val)) + (if scopedp key-val heading-val)))))) + (concat + ;; Name. + (let ((author (plist-get info :author))) + (and author + (funcall check-scope 'author) + (format "\\setkomavar{fromname}{%s}\n" + (org-export-data author info)))) + ;; From. + (let ((from (funcall heading-or-key-value 'from :from-address))) + (and from + (format "\\setkomavar{fromaddress}{%s}\n" + (org-koma-letter--add-latex-newlines from)))) + ;; Email. + (let ((email (plist-get info :email))) + (and email + (funcall check-scope 'email) + (format "\\setkomavar{fromemail}{%s}\n" email))) + (and (funcall check-scope 'with-email) + (format "\\KOMAoption{fromemail}{%s}\n" + (if (plist-get info :with-email) "true" "false"))) + ;; Phone number. + (let ((phone-number (plist-get info :phone-number))) + (and (org-string-nw-p phone-number) + (funcall check-scope 'phone-number) + (format "\\setkomavar{fromphone}{%s}\n" phone-number))) + (and (funcall check-scope 'with-phone) + (format "\\KOMAoption{fromphone}{%s}\n" + (if (plist-get info :with-phone) "true" "false"))) + ;; URL + (let ((url (plist-get info :url))) + (and (org-string-nw-p url) + (funcall check-scope 'url) + (format "\\setkomavar{fromurl}{%s}\n" url))) + (and (funcall check-scope 'with-url) + (format "\\KOMAoption{fromurl}{%s}\n" + (if (plist-get info :with-url) "true" "false"))) + ;; From Logo + (let ((from-logo (plist-get info :from-logo))) + (and (org-string-nw-p from-logo) + (funcall check-scope 'from-logo) + (format "\\setkomavar{fromlogo}{%s}\n" from-logo))) + (and (funcall check-scope 'with-from-logo) + (format "\\KOMAoption{fromlogo}{%s}\n" + (if (plist-get info :with-from-logo) "true" "false"))) + ;; Signature. + (let* ((heading-val + (and (plist-get info :with-headline-opening) + (pcase (org-koma-letter--get-tagged-contents 'closing) + ((and (pred org-string-nw-p) closing) (org-trim closing)) + (_ nil)))) + (signature (org-string-nw-p (plist-get info :signature))) + (signature-scope (funcall check-scope 'signature))) + (and (or (and signature signature-scope) + heading-val) + (not (and (eq scope 'global) heading-val)) + (format "\\setkomavar{signature}{%s}\n" + (if signature-scope signature heading-val)))) + ;; Back address. + (and (funcall check-scope 'with-backaddress) + (format "\\KOMAoption{backaddress}{%s}\n" + (if (plist-get info :with-backaddress) "true" "false"))) + ;; Place. + (let ((with-place-set (funcall check-scope 'with-place)) + (place-set (funcall check-scope 'place))) + (and (or (and with-place-set place-set) + (and (eq scope 'buffer) (or with-place-set place-set))) + (format "\\setkomavar{place}{%s}\n" + (if (plist-get info :with-place) (plist-get info :place) + "")))) + ;; Location. + (let ((location (funcall heading-or-key-value 'location :location))) + (and location + (format "\\setkomavar{location}{%s}\n" location))) + ;; Folding marks. + (and (funcall check-scope 'with-foldmarks) + (let ((foldmarks (plist-get info :with-foldmarks))) + (cond ((consp foldmarks) + (format "\\KOMAoptions{foldmarks=true,foldmarks=%s}\n" + (mapconcat #'symbol-name foldmarks ""))) + (foldmarks "\\KOMAoptions{foldmarks=true}\n") + (t "\\KOMAoptions{foldmarks=false}\n"))))))) + + + +;;; Commands + +;;;###autoload +(defun org-koma-letter-export-as-latex + (&optional async subtreep visible-only body-only ext-plist) + "Export current buffer as a KOMA Scrlttr2 letter. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Export is done in a buffer named \"*Org KOMA-LETTER Export*\". It +will be displayed if `org-export-show-temporary-export-buffer' is +non-nil." + (interactive) + (let (org-koma-letter-special-contents) + (org-export-to-buffer 'koma-letter "*Org KOMA-LETTER Export*" + async subtreep visible-only body-only ext-plist + (lambda () (LaTeX-mode))))) + +;;;###autoload +(defun org-koma-letter-export-to-latex + (&optional async subtreep visible-only body-only ext-plist) + "Export current buffer as a KOMA Scrlttr2 letter (tex). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +When optional argument PUB-DIR is set, use it as the publishing +directory. + +Return output file's name." + (interactive) + (let ((outfile (org-export-output-file-name ".tex" subtreep)) + (org-koma-letter-special-contents)) + (org-export-to-file 'koma-letter outfile + async subtreep visible-only body-only ext-plist))) + +;;;###autoload +(defun org-koma-letter-export-to-pdf + (&optional async subtreep visible-only body-only ext-plist) + "Export current buffer as a KOMA Scrlttr2 letter (pdf). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return PDF file's name." + (interactive) + (let ((file (org-export-output-file-name ".tex" subtreep)) + (org-koma-letter-special-contents)) + (org-export-to-file 'koma-letter file + async subtreep visible-only body-only ext-plist + (lambda (file) (org-latex-compile file))))) + + +(provide 'ox-koma-letter) +;;; ox-koma-letter.el ends here diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el index 149492fa84..993c2c6431 100644 --- a/lisp/org/ox-latex.el +++ b/lisp/org/ox-latex.el @@ -121,6 +121,7 @@ (:latex-classes nil nil org-latex-classes) (:latex-default-figure-position nil nil org-latex-default-figure-position) (:latex-default-table-environment nil nil org-latex-default-table-environment) + (:latex-default-quote-environment nil nil org-latex-default-quote-environment) (:latex-default-table-mode nil nil org-latex-default-table-mode) (:latex-diary-timestamp-format nil nil org-latex-diary-timestamp-format) (:latex-footnote-defined-format nil nil org-latex-footnote-defined-format) @@ -296,7 +297,7 @@ ("uk" "ukrainian") ("ur" "urdu") ("vi" "vietnamese")) - "Alist between language code and corresponding Polyglossia option") + "Alist between language code and corresponding Polyglossia option.") (defconst org-latex-table-matrix-macros '(("bordermatrix" . "\\cr") ("qbordermatrix" . "\\cr") @@ -307,14 +308,14 @@ (format "\\`[ \t]*\\\\begin{%s\\*?}" (regexp-opt - '("equation" "eqnarray" "math" "displaymath" - "align" "gather" "multline" "flalign" "alignat" - "xalignat" "xxalignat" - "subequations" - ;; breqn - "dmath" "dseries" "dgroup" "darray" - ;; empheq - "empheq"))) + '("equation" "eqnarray" "math" "displaymath" + "align" "gather" "multline" "flalign" "alignat" + "xalignat" "xxalignat" + "subequations" + ;; breqn + "dmath" "dseries" "dgroup" "darray" + ;; empheq + "empheq"))) "Regexp of LaTeX math environments.") @@ -345,7 +346,7 @@ symbols are: `image', `table', `src-block' and `special-block'." (const :tag "Special blocks" special-block)))) (defcustom org-latex-prefer-user-labels nil - "Use user-provided labels instead of internal ones when non-nil. + "Use user-provided labels instead of internal ones when non-nil. When this variable is non-nil, Org will use the value of CUSTOM_ID property, NAME keyword or Org target as the key for the @@ -380,6 +381,9 @@ will be exported to LaTeX as: This is section \\ref{sec:foo}. And this is still section \\ref{sec:foo}. +A non-default value of `org-latex-reference-command' will change the +command (\\ref by default) used to create label references. + Note, however, that setting this variable introduces a limitation on the possible values for CUSTOM_ID and NAME. When this variable is non-nil, Org passes their value to \\label unchanged. @@ -399,6 +403,18 @@ references." :version "26.1" :package-version '(Org . "8.3")) +(defcustom org-latex-reference-command "\\ref{%s}" + "Format string that takes a reference to produce a LaTeX reference command. + +The reference is a label such as sec:intro. A format string of \"\\ref{%s}\" +produces numbered references and will always work. It may be desirable to make +use of a package such as hyperref or cleveref and then change the format string +to \"\\autoref{%s}\" or \"\\cref{%s}\" for example." + :group 'org-export-latex + :type 'string + :package-version '(Org . "9.5") + :safe t) + ;;;; Preamble (defcustom org-latex-default-class "article" @@ -772,6 +788,13 @@ default we use here encompasses both." :package-version '(Org . "8.0") :type 'string) +(defcustom org-latex-default-quote-environment "quote" + "Default environment used to `quote' blocks." + :group 'org-export-latex + :package-version '(Org . "9.5") + :type 'string + :safe t) + (defcustom org-latex-default-table-mode 'table "Default mode for tables. @@ -932,7 +955,7 @@ using customize, or with (add-to-list \\='org-latex-packages-alist \\='(\"newfloat\" \"minted\")) In addition, it is necessary to install pygments -\(URL `http://pygments.org>'), and to configure the variable +\(URL `https://pygments.org>'), and to configure the variable `org-latex-pdf-process' so that the -shell-escape option is passed to pdflatex. @@ -956,7 +979,7 @@ URL `https://orgmode.org/worg/org-tutorials/org-latex-preview.html'." (tex "TeX") (latex "[LaTeX]TeX") (shell-script "bash") (gnuplot "Gnuplot") - (ocaml "Caml") (caml "Caml") + (ocaml "[Objective]Caml") (caml "Caml") (sql "SQL") (sqlite "sql") (makefile "make") (R "r")) @@ -1157,9 +1180,11 @@ A better approach is to use a compiler suit such as `latexmk'." :package-version '(Org . "9.0")) (defcustom org-latex-pdf-process - '("%latex -interaction nonstopmode -output-directory %o %f" - "%latex -interaction nonstopmode -output-directory %o %f" - "%latex -interaction nonstopmode -output-directory %o %f") + (if (executable-find "latexmk") + '("latexmk -f -pdf -%latex -interaction=nonstopmode -output-directory=%o %f") + '("%latex -interaction nonstopmode -output-directory %o %f" + "%latex -interaction nonstopmode -output-directory %o %f" + "%latex -interaction nonstopmode -output-directory %o %f")) "Commands to process a LaTeX file to a PDF file. This is a list of strings, each of them will be given to the @@ -1203,7 +1228,7 @@ file name as its single argument." (const :tag "texi2dvi" ("cd %o; LATEX=\"%latex\" texi2dvi -p -b -V %b.tex")) (const :tag "latexmk" - ("latexmk -g -pdf -pdflatex=\"%latex\" -outdir=%o %f")) + ("latexmk -f -pdf -%latex -interaction=nonstopmode -output-directory=%o %f")) (function))) (defcustom org-latex-logfiles-extensions @@ -1486,7 +1511,10 @@ nil." (pcase-let ((`(,keyword ,value) pair)) (concat keyword (and (> (length value) 0) - (concat "=" value))))) + (concat "=" + (if (string-match-p (rx (any "[]")) value) + (format "{%s}" value) + value)))))) options ",")) @@ -1521,22 +1549,23 @@ INFO is a plist used as a communication channel. See separator (replace-regexp-in-string "\n" " " text) separator))) - ;; Handle the `protectedtexttt' special case: Protect some - ;; special chars and use "\texttt{%s}" format string. - (protectedtexttt - (format "\\texttt{%s}" - (replace-regexp-in-string - "--\\|[\\{}$%&_#~^]" - (lambda (m) - (cond ((equal m "--") "-{}-") - ((equal m "\\") "\\textbackslash{}") - ((equal m "~") "\\textasciitilde{}") - ((equal m "^") "\\textasciicircum{}") - (t (org-latex--protect-text m)))) - text nil t))) + (protectedtexttt (org-latex--protect-texttt text)) ;; Else use format string. (t (format fmt text))))) +(defun org-latex--protect-texttt (text) + "Protect special chars, then wrap TEXT in \"\\texttt{}\"." + (format "\\texttt{%s}" + (replace-regexp-in-string + "--\\|[\\{}$%&_#~^]" + (lambda (m) + (cond ((equal m "--") "-{}-") + ((equal m "\\") "\\textbackslash{}") + ((equal m "~") "\\textasciitilde{}") + ((equal m "^") "\\textasciicircum{}") + (t (org-latex--protect-text m)))) + text nil t))) + (defun org-latex--delayed-footnotes-definitions (element info) "Return footnotes definitions in ELEMENT as a string. @@ -1604,9 +1633,9 @@ INFO is a plist used as a communication channel." "Insert LaTeX_compiler info into the document. INFO is a plist used as a communication channel." (let ((compiler (plist-get info :latex-compiler))) - (and (org-string-nw-p org-latex-compiler-file-string) - (member (or compiler "") org-latex-compilers) - (format org-latex-compiler-file-string compiler)))) + (and (org-string-nw-p org-latex-compiler-file-string) + (member (or compiler "") org-latex-compilers) + (format org-latex-compiler-file-string compiler)))) ;;; Filters @@ -1888,10 +1917,11 @@ CONTENTS is nil. INFO is a plist holding contextual information." (org-export-get-footnote-definition footnote-reference info) info t))) ;; Use \footnotemark if reference is within another footnote - ;; reference, footnote definition, table cell or item's tag. + ;; reference, footnote definition, table cell, verse block, or + ;; item's tag. ((or (org-element-lineage footnote-reference '(footnote-reference footnote-definition - table-cell)) + table-cell verse-block)) (eq 'item (org-element-type (org-export-get-parent-element footnote-reference)))) "\\footnotemark") @@ -1903,7 +1933,8 @@ CONTENTS is nil. INFO is a plist holding contextual information." ;; Only insert a \label if there exist another ;; reference to def. (cond ((not label) "") - ((org-element-map (plist-get info :parse-tree) 'footnote-reference + ((org-element-map (plist-get info :parse-tree) + 'footnote-reference (lambda (f) (and (not (eq f footnote-reference)) (equal (org-element-property :label f) label) @@ -1952,10 +1983,16 @@ holding contextual information." ;; Create a temporary export back-end that hard-codes ;; "\underline" within "\section" and alike. (section-back-end - (org-export-create-backend - :parent 'latex - :transcoders - '((underline . (lambda (o c i) (format "\\underline{%s}" c)))))) + (org-export-create-backend + :parent 'latex + :transcoders + '((underline . (lambda (o c i) (format "\\underline{%s}" c))) + ;; LaTeX isn't happy when you try to use \verb inside the argument of other + ;; commands (like \section, etc.), and this causes compilation to fail. + ;; So, within headings it's a good idea to replace any instances of \verb + ;; with \texttt. + (code . (lambda (o _ _) (org-latex--protect-texttt (org-element-property :value o)))) + (verbatim . (lambda (o _ _) (org-latex--protect-texttt (org-element-property :value o))))))) (text (org-export-data-with-backend (org-element-property :title headline) section-back-end info)) @@ -2089,8 +2126,8 @@ contextual information." (let* ((code (org-element-property :value inline-src-block)) (separator (org-latex--find-verb-separator code))) (cl-case (plist-get info :latex-listings) - ;; Do not use a special package: transcode it verbatim. - ((nil) (format "\\texttt{%s}" (org-latex--text-markup code 'code info))) + ;; Do not use a special package: transcode it verbatim, as code. + ((nil) (org-latex--text-markup code 'code info)) ;; Use minted package. (minted (let* ((org-lang (org-element-property :language inline-src-block)) @@ -2375,8 +2412,8 @@ used as a communication channel." ((string= float "sideways") 'sideways) ((string= float "multicolumn") 'multicolumn) ((and (plist-member attr :float) (not float)) 'nonfloat) - ((or float - (org-element-property :caption parent) + (float float) + ((or (org-element-property :caption parent) (org-string-nw-p (plist-get attr :caption))) 'figure) (t 'nonfloat)))) @@ -2468,6 +2505,18 @@ used as a communication channel." nil t)))) ;; Return proper string, depending on FLOAT. (pcase float + ((and (pred stringp) env-string) + (format "\\begin{%s}%s +%s%s +%s%s +%s\\end{%s}" + env-string + placement + (if caption-above-p caption "") + (if center "\\centering" "") + comment-include image-code + (if caption-above-p "" caption) + env-string)) (`wrap (format "\\begin{wrapfigure}%s %s%s %s%s @@ -2574,7 +2623,7 @@ INFO is a plist holding contextual information. See (let ((label (org-latex--label destination info t))) (if (and (not desc) (org-export-numbered-headline-p destination info)) - (format "\\ref{%s}" label) + (format org-latex-reference-command label) (format "\\hyperref[%s]{%s}" label (or desc (org-export-data @@ -2582,7 +2631,7 @@ INFO is a plist holding contextual information. See ;; Fuzzy link points to a target. Do as above. (otherwise (let ((ref (org-latex--label destination info t))) - (if (not desc) (format "\\ref{%s}" ref) + (if (not desc) (format org-latex-reference-command ref) (format "\\hyperref[%s]{%s}" ref desc))))))) ;; Coderef: replace link with the reference name or the ;; equivalent line number. @@ -2874,9 +2923,19 @@ channel." "Transcode a QUOTE-BLOCK element from Org to LaTeX. CONTENTS holds the contents of the block. INFO is a plist holding contextual information." - (org-latex--wrap-label - quote-block (format "\\begin{quote}\n%s\\end{quote}" contents) info)) - + (let ((environment + (or (org-export-read-attribute :attr_latex quote-block :environment) + (plist-get info :latex-default-quote-environment))) + (options + (or (org-export-read-attribute :attr_latex quote-block :options) + ""))) + (org-latex--wrap-label + quote-block (format "\\begin{%s}%s\n%s\\end{%s}" + environment + options + contents + environment) + info))) ;;;; Radio Target @@ -2935,22 +2994,20 @@ contextual information." (cond ;; Case 1. No source fontification. ((or (not lang) (not listings)) - (let* ((caption-str (org-latex--caption/label-string src-block info)) - (float-env - (cond ((string= "multicolumn" float) - (format "\\begin{figure*}[%s]\n%s%%s\n%s\\end{figure*}" - (plist-get info :latex-default-figure-position) - (if caption-above-p caption-str "") - (if caption-above-p "" caption-str))) - (caption (concat - (if caption-above-p caption-str "") - "%s" - (if caption-above-p "" (concat "\n" caption-str)))) - (t "%s")))) - (format - float-env - (concat (format "\\begin{verbatim}\n%s\\end{verbatim}" - (org-export-format-code-default src-block info)))))) + (let ((caption-str (org-latex--caption/label-string src-block info)) + (verbatim (format "\\begin{verbatim}\n%s\\end{verbatim}" + (org-export-format-code-default src-block info)))) + (cond ((string= "multicolumn" float) + (format "\\begin{figure*}[%s]\n%s%s\n%s\\end{figure*}" + (plist-get info :latex-default-figure-position) + (if caption-above-p caption-str "") + verbatim + (if caption-above-p "" caption-str))) + (caption (concat + (if caption-above-p caption-str "") + verbatim + (if caption-above-p "" (concat "\n" caption-str)))) + (t verbatim)))) ;; Case 2. Custom environment. (custom-env (let ((caption-str (org-latex--caption/label-string src-block info)) @@ -3198,9 +3255,9 @@ centered." (defun org-latex--decorate-table (table attributes caption above? info) "Decorate TABLE string with caption and float environment. -ATTRIBUTES is the plist containing is LaTeX attributes. CAPTION -is its caption, as a string or nil. It is located above the -table if ABOVE? is non-nil. INFO is the plist containing current +ATTRIBUTES is the plist containing LaTeX attributes. CAPTION is +its caption, as a string or nil. It is located above the table +if ABOVE? is non-nil. INFO is the plist containing current export parameters. Return new environment, as a string." @@ -3209,7 +3266,8 @@ Return new environment, as a string." (cond ((and (not float) (plist-member attributes :float)) nil) ((member float '("sidewaystable" "sideways")) "sidewaystable") ((equal float "multicolumn") "table*") - ((or float (org-string-nw-p caption)) "table") + (float float) + ((org-string-nw-p caption) "table") (t nil)))) (placement (or (plist-get attributes :placement) @@ -3504,29 +3562,44 @@ channel." "Transcode a VERSE-BLOCK element from Org to LaTeX. CONTENTS is verse block contents. INFO is a plist holding contextual information." - (org-latex--wrap-label - verse-block - ;; In a verse environment, add a line break to each newline - ;; character and change each white space at beginning of a line - ;; into a space of 1 em. Also change each blank line with - ;; a vertical space of 1 em. - (format "\\begin{verse}\n%s\\end{verse}" - (replace-regexp-in-string - "^[ \t]+" (lambda (m) (format "\\hspace*{%dem}" (length m))) - (replace-regexp-in-string - "^[ \t]*\\\\\\\\$" "\\vspace*{1em}" - (replace-regexp-in-string - "\\([ \t]*\\\\\\\\\\)?[ \t]*\n" "\\\\\n" - contents nil t) nil t) nil t)) - info)) - + (let* ((lin (org-export-read-attribute :attr_latex verse-block :lines)) + (latcode (org-export-read-attribute :attr_latex verse-block :latexcode)) + (cent (org-export-read-attribute :attr_latex verse-block :center)) + (attr (concat + (if cent "[\\versewidth]" "") + (if lin (format "\n\\poemlines{%s}" lin) "") + (if latcode (format "\n%s" latcode) ""))) + (versewidth (org-export-read-attribute :attr_latex verse-block :versewidth)) + (vwidth (if versewidth (format "\\settowidth{\\versewidth}{%s}\n" versewidth) "")) + (linreset (if lin "\n\\poemlines{0}" ""))) + (concat + (org-latex--wrap-label + verse-block + ;; In a verse environment, add a line break to each newline + ;; character and change each white space at beginning of a line + ;; into a space of 1 em. Also change each blank line with + ;; a vertical space of 1 em. + (format "%s\\begin{verse}%s\n%s\\end{verse}%s" + vwidth + attr + (replace-regexp-in-string + "^[ \t]+" (lambda (m) (format "\\hspace*{%dem}" (length m))) + (replace-regexp-in-string + "^[ \t]*\\\\\\\\$" "\\vspace*{1em}" + (replace-regexp-in-string + "\\([ \t]*\\\\\\\\\\)?[ \t]*\n" "\\\\\n" + contents nil t) nil t) nil t) linreset) + info) + ;; Insert footnote definitions, if any, after the environment, so + ;; the special formatting above is not applied to them. + (org-latex--delayed-footnotes-definitions verse-block info)))) ;;; End-user functions ;;;###autoload (defun org-latex-export-as-latex - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer as a LaTeX buffer. If narrowing is active in the current buffer, only export its @@ -3570,7 +3643,7 @@ command to convert it." ;;;###autoload (defun org-latex-export-to-latex - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer to a LaTeX file. If narrowing is active in the current buffer, only export its @@ -3602,7 +3675,7 @@ file-local settings." ;;;###autoload (defun org-latex-export-to-pdf - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer to LaTeX then process through to PDF. If narrowing is active in the current buffer, only export its @@ -3660,12 +3733,12 @@ produced." (match-string 0))) "pdflatex")) (process (if (functionp org-latex-pdf-process) org-latex-pdf-process - ;; Replace "%latex" and "%bibtex" with, - ;; respectively, "%L" and "%B" so as to adhere to - ;; `format-spec' specifications. + ;; Replace "%latex" with "%L" and "%bib" and + ;; "%bibtex" with "%B" to adhere to `format-spec' + ;; specifications. (mapcar (lambda (command) (replace-regexp-in-string - "%\\(?:bib\\|la\\)tex\\>" + "%\\(?:\\(?:bib\\|la\\)tex\\|bib\\)\\>" (lambda (m) (upcase (substring m 0 2))) command)) org-latex-pdf-process))) diff --git a/lisp/org/ox-man.el b/lisp/org/ox-man.el index 27d2dedb8e..6d3476cdae 100644 --- a/lisp/org/ox-man.el +++ b/lisp/org/ox-man.el @@ -186,7 +186,7 @@ When nil, no transformation is made." (ldap "ldap") (opa "opa") (php "php") (postscript "postscript") (prolog "prolog") (properties "properties") (makefile "makefile") - (tml "tml") (vala "vala") (vbscript "vbscript") (xorg "xorg")) + (tml "tml") (vbscript "vbscript") (xorg "xorg")) "Alist mapping languages to their listing language counterpart. The key is a symbol, the major mode symbol without the \"-mode\". The value is the string that should be inserted as the language @@ -301,12 +301,12 @@ CONTENTS is the transcoded contents string. INFO is a plist holding export options." (let* ((title (when (plist-get info :with-title) (org-export-data (plist-get info :title) info))) - (attr (read (format "(%s)" - (mapconcat - #'identity - (list (plist-get info :man-class-options)) - " ")))) - (section-item (plist-get attr :section-id))) + (attr (read (format "(%s)" + (mapconcat + #'identity + (list (plist-get info :man-class-options)) + " ")))) + (section-item (plist-get attr :section-id))) (concat @@ -365,9 +365,9 @@ holding contextual information." (defun org-man-drawer (_drawer contents _info) "Transcode a DRAWER element from Org to Man. - DRAWER holds the drawer information - CONTENTS holds the contents of the block. - INFO is a plist holding contextual information. " +DRAWER holds the drawer information +CONTENTS holds the contents of the block. +INFO is a plist holding contextual information." contents) @@ -825,10 +825,10 @@ contextual information." ;; Case 1: verbatim table. ((or (plist-get info :man-tables-verbatim) (let ((attr (read (format "(%s)" - (mapconcat - #'identity - (org-element-property :attr_man table) - " "))))) + (mapconcat + #'identity + (org-element-property :attr_man table) + " "))))) (and attr (plist-get attr :verbatim)))) @@ -1053,7 +1053,7 @@ contextual information." ;;; Interactive functions (defun org-man-export-to-man - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer to a Man file. If narrowing is active in the current buffer, only export its @@ -1086,7 +1086,7 @@ Return output file's name." async subtreep visible-only body-only ext-plist))) (defun org-man-export-to-pdf - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer to Groff then process through to PDF. If narrowing is active in the current buffer, only export its diff --git a/lisp/org/ox-md.el b/lisp/org/ox-md.el index f4afe6b30e..348b6d01dc 100644 --- a/lisp/org/ox-md.el +++ b/lisp/org/ox-md.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2012-2021 Free Software Foundation, Inc. ;; Author: Nicolas Goaziou +;; Maintainer: Nicolas Goaziou ;; Keywords: org, wp, markdown ;; This file is part of GNU Emacs. @@ -57,10 +58,10 @@ This variable can be set to either `atx' or `setext'." "Format string for the footnotes section. The first %s placeholder will be replaced with the localized Footnotes section heading, the second with the contents of the Footnotes section." - :group 'org-export-md - :type 'string - :version "26.1" - :package-version '(Org . "9.0")) + :group 'org-export-md + :type 'string + :version "26.1" + :package-version '(Org . "9.0")) (defcustom org-md-footnote-format "%s" "Format string for the footnote reference. @@ -100,6 +101,8 @@ The %s will be replaced by the footnote reference itself." (italic . org-md-italic) (item . org-md-item) (keyword . org-md-keyword) + (latex-environment . org-md-latex-environment) + (latex-fragment . org-md-latex-fragment) (line-break . org-md-line-break) (link . org-md-link) (node-property . org-md-node-property) @@ -210,9 +213,9 @@ the section." (underline (concat (make-string (length title) underline-char) "\n"))) (concat "\n" anchor-lines title tags "\n" underline "\n")) - ;; Use "Atx" style - (let ((level-mark (make-string level ?#))) - (concat "\n" anchor-lines level-mark " " title tags "\n\n"))))) + ;; Use "Atx" style + (let ((level-mark (make-string level ?#))) + (concat "\n" anchor-lines level-mark " " title tags "\n\n"))))) (defun org-md--build-toc (info &optional n _keyword scope) "Return a table of contents. @@ -460,6 +463,35 @@ channel." (_ (org-export-with-backend 'html keyword contents info)))) +;;;; Latex Environment + +(defun org-md-latex-environment (latex-environment _contents info) + "Transcode a LATEX-ENVIRONMENT object from Org to Markdown. +CONTENTS is nil. INFO is a plist holding contextual information." + (when (plist-get info :with-latex) + (let ((latex-frag (org-remove-indentation + (org-element-property :value latex-environment))) + (label (org-html--reference latex-environment info t))) + (if (org-string-nw-p label) + (replace-regexp-in-string "\\`.*" + (format "\\&\n\\\\label{%s}" label) + latex-frag) + latex-frag)))) + +;;;; Latex Fragment + +(defun org-md-latex-fragment (latex-fragment _contents info) + "Transcode a LATEX-FRAGMENT object from Org to Markdown. +CONTENTS is nil. INFO is a plist holding contextual information." + (when (plist-get info :with-latex) + (let ((frag (org-element-property :value latex-fragment))) + (cond + ((string-match-p "^\\\\(" frag) + (concat "$" (substring frag 2 -2) "$")) + ((string-match-p "^\\\\\\[" frag) + (concat "$$" (substring frag 2 -2) "$$")) + (t frag))))) ; either already $-deliminated or a macro + ;;;; Line Break (defun org-md-line-break (_line-break _contents _info) @@ -543,7 +575,12 @@ INFO is a plist holding contextual information. See ((string= type "coderef") (format (org-export-get-coderef-format path desc) (org-export-resolve-coderef path info))) - ((equal type "radio") desc) + ((string= type "radio") + (let ((destination (org-export-resolve-radio-link link info))) + (if (not destination) desc + (format "%s" + (org-export-get-reference destination info) + desc)))) (t (if (not desc) (format "<%s>" path) (format "[%s](%s)" desc path)))))) diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el index a076d15978..f186ebb16a 100644 --- a/lisp/org/ox-odt.el +++ b/lisp/org/ox-odt.el @@ -251,7 +251,7 @@ Use `org-odt-add-automatic-style' to add update this variable.'") (defvar org-odt-object-counters nil "Running counters for various OBJECT-TYPEs. -Use this to generate automatic names and style-names. See +Use this to generate automatic names and style-names. See `org-odt-add-automatic-style'.") (defvar org-odt-src-block-paragraph-format @@ -277,8 +277,7 @@ according to the default face identified by the `htmlfontify'.") (defvar org-odt-default-image-sizes-alist '(("as-char" . (5 . 0.4)) ("paragraph" . (5 . 5))) - "Hardcoded image dimensions one for each of the anchor - methods.") + "Hardcoded image dimensions one for each of the anchor methods.") ;; A4 page size is 21.0 by 29.7 cms ;; The default page settings has 2cm margin on each of the sides. So @@ -450,7 +449,7 @@ Valid values are one of: 4. list of the form (ODT-OR-OTT-FILE (FILE-MEMBER-1 FILE-MEMBER-2 ...)) -In case of option 1, an in-built styles.xml is used. See +In case of option 1, an in-built styles.xml is used. See `org-odt-styles-dir' for more information. In case of option 3, the specified file is unzipped and the @@ -982,7 +981,7 @@ See `org-odt--build-date-styles' for implementation details." ;;;; Frame (defun org-odt--frame (text width height style &optional extra - anchor-type &rest title-and-desc) + anchor-type &rest title-and-desc) (let ((frame-attrs (concat (if width (format " svg:width=\"%0.2fcm\"" width) "") @@ -1044,7 +1043,7 @@ See `org-odt--build-date-styles' for implementation details." ;;;; Textbox (defun org-odt--textbox (text width height style &optional - extra anchor-type) + extra anchor-type) (org-odt--frame (format "\n%s\n" (concat (format " fo:min-height=\"%0.2fcm\"" (or height .2)) @@ -1778,8 +1777,8 @@ INFO is a plist holding contextual information." (if (functionp format-function) format-function (cl-function (lambda (todo todo-type priority text tags - &key _level _section-number _headline-label - &allow-other-keys) + &key _level _section-number _headline-label + &allow-other-keys) (funcall (plist-get info :odt-format-headline-function) todo todo-type priority text tags)))))) (apply format-function @@ -1852,7 +1851,7 @@ holding contextual information." contents)))))) (defun org-odt-format-headline-default-function - (todo todo-type priority text tags) + (todo todo-type priority text tags) "Default format function for a headline. See `org-odt-format-headline-function' for details." (concat @@ -1930,7 +1929,7 @@ holding contextual information." todo todo-type priority text tags contents))) (defun org-odt-format-inlinetask-default-function - (todo todo-type priority name tags contents) + (todo todo-type priority name tags contents) "Default format function for inlinetasks. See `org-odt-format-inlinetask-function' for details." (format "\n%s" @@ -2176,7 +2175,7 @@ SHORT-CAPTION are strings." ;;;; Links :: Inline Images (defun org-odt--copy-image-file (path) - "Return the internal name of the file" + "Return the internal name of the file." (let* ((image-type (file-name-extension path)) (media-type (format "image/%s" image-type)) (target-dir "Images/") @@ -2199,7 +2198,7 @@ SHORT-CAPTION are strings." (declare-function image-size "image.c" (spec &optional pixels frame)) (defun org-odt--image-size - (file info &optional user-width user-height scale dpi embed-as) + (file info &optional user-width user-height scale dpi embed-as) (let* ((--pixels-to-cms (lambda (pixels dpi) (let ((cms-per-inch 2.54) @@ -2380,7 +2379,7 @@ used as a communication channel." (concat equation "" label)))))) (defun org-odt--copy-formula-file (src-file) - "Return the internal name of the file" + "Return the internal name of the file." (let* ((target-dir (format "Formula-%04d/" (cl-incf org-odt-embedded-formulas-count))) (target-file (concat target-dir "content.xml"))) @@ -2400,7 +2399,7 @@ used as a communication channel." ;; Case 2: OpenDocument formula. ((string= ext "odf") (org-odt--zip-extract src-file "content.xml" - (concat org-odt-zip-dir target-dir))) + (concat org-odt-zip-dir target-dir))) (t (error "%s is not a formula file" src-file)))) ;; Enter the formula file in to manifest. (org-odt-create-manifest-file-entry "text/xml" target-file) @@ -2468,15 +2467,14 @@ used as a communication channel." (outer (nth 2 frame-cfg)) ;; User-specified frame params (from #+ATTR_ODT spec) (user user-frame-params) - (--merge-frame-params (function - (lambda (default user) - "Merge default and user frame params." - (if (not user) default - (cl-assert (= (length default) 3)) - (cl-assert (= (length user) 3)) - (cl-loop for u in user - for d in default - collect (or u d))))))) + (--merge-frame-params (lambda (default user) + "Merge default and user frame params." + (if (not user) default + (cl-assert (= (length default) 3)) + (cl-assert (= (length user) 3)) + (cl-loop for u in user + for d in default + collect (or u d)))))) (cond ;; Case 1: Image/Formula has no caption. ;; There is only one frame, one that surrounds the image @@ -2652,7 +2650,7 @@ Return nil, otherwise." (format "%s" label (mapconcat (lambda (n) (if (not n) " " - (concat (number-to-string n) "."))) + (concat (number-to-string n) "."))) item-numbers ""))))) ;; Case 2: Locate a regular and numbered headline in the ;; hierarchy. Display its section number. @@ -3032,7 +3030,7 @@ holding contextual information." (anchor (plist-get attributes :anchor))) (format "\n%s" "Text_20_body" (org-odt--textbox contents width height - style extra anchor)))) + style extra anchor)))) (t contents)))) @@ -3773,13 +3771,13 @@ contextual information." ;; paragraph. (latex-environment (org-element-adopt-elements - (list 'paragraph - (list :style "OrgFormula" - :name - (org-element-property :name latex-*) - :caption - (org-element-property :caption latex-*))) - link)) + (list 'paragraph + (list :style "OrgFormula" + :name + (org-element-property :name latex-*) + :caption + (org-element-property :caption latex-*))) + link)) ;; LaTeX fragment. No special action. (latex-fragment link)))) ;; Note down the object that link replaces. @@ -3842,15 +3840,15 @@ contextual information." (mapcar (lambda (item) (org-element-adopt-elements - (list 'item (list :checkbox (org-element-property - :checkbox item))) - (list 'paragraph (list :style "Text_20_body_20_bold") - (or (org-element-property :tag item) "(no term)")) - (org-element-adopt-elements - (list 'plain-list (list :type 'descriptive-2)) - (apply 'org-element-adopt-elements - (list 'item nil) - (org-element-contents item))))) + (list 'item (list :checkbox (org-element-property + :checkbox item))) + (list 'paragraph (list :style "Text_20_body_20_bold") + (or (org-element-property :tag item) "(no term)")) + (org-element-adopt-elements + (list 'plain-list (list :type 'descriptive-2)) + (apply 'org-element-adopt-elements + (list 'item nil) + (org-element-contents item))))) (org-element-contents el))))) nil) info) diff --git a/lisp/org/ox-org.el b/lisp/org/ox-org.el index 26259d8752..11d9c09ebf 100644 --- a/lisp/org/ox-org.el +++ b/lisp/org/ox-org.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2013-2021 Free Software Foundation, Inc. ;; Author: Nicolas Goaziou +;; Maintainer: Nicolas Goaziou ;; Keywords: org, wp ;; This file is part of GNU Emacs. @@ -140,7 +141,7 @@ CONTENTS and INFO are ignored." CONTENTS is its contents, as a string or nil. INFO is ignored." (let ((case-fold-search t)) (replace-regexp-in-string - "^[ \t]*#\\+ATTR_[-_A-Za-z0-9]+:\\(?: .*\\)?\n" "" + "^[ \t]*#\\+attr_[-_a-za-z0-9]+:\\(?: .*\\)?\n" "" (org-export-expand blob contents t)))) (defun org-org-headline (headline contents info) @@ -184,26 +185,26 @@ as a communication channel." (org-element-map (plist-get info :parse-tree) 'keyword (lambda (k) (and (string-equal (org-element-property :key k) "OPTIONS") - (concat "#+OPTIONS: " + (concat "#+options: " (org-element-property :value k))))) "\n")) (and (plist-get info :with-title) - (format "#+TITLE: %s\n" (org-export-data (plist-get info :title) info))) + (format "#+title: %s\n" (org-export-data (plist-get info :title) info))) (and (plist-get info :with-date) (let ((date (org-export-data (org-export-get-date info) info))) (and (org-string-nw-p date) - (format "#+DATE: %s\n" date)))) + (format "#+date: %s\n" date)))) (and (plist-get info :with-author) (let ((author (org-export-data (plist-get info :author) info))) (and (org-string-nw-p author) - (format "#+AUTHOR: %s\n" author)))) + (format "#+author: %s\n" author)))) (and (plist-get info :with-email) (let ((email (org-export-data (plist-get info :email) info))) (and (org-string-nw-p email) - (format "#+EMAIL: %s\n" email)))) + (format "#+email: %s\n" email)))) (and (plist-get info :with-creator) (org-string-nw-p (plist-get info :creator)) - (format "#+CREATOR: %s\n" (plist-get info :creator))) + (format "#+creator: %s\n" (plist-get info :creator))) contents)) (defun org-org-timestamp (timestamp _contents _info) @@ -238,7 +239,7 @@ a communication channel." ;;;###autoload (defun org-org-export-as-org - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer to an Org buffer. If narrowing is active in the current buffer, only export its @@ -273,7 +274,7 @@ non-nil." ;;;###autoload (defun org-org-export-to-org - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer to an Org file. If narrowing is active in the current buffer, only export its diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el index 6f82b48572..bc9b17ab3e 100644 --- a/lisp/org/ox-publish.el +++ b/lisp/org/ox-publish.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2006-2021 Free Software Foundation, Inc. ;; Author: David O'Toole -;; Maintainer: Carsten Dominik +;; Maintainer: Nicolas Goaziou ;; Keywords: hypermedia, outlines, wp ;; This file is part of GNU Emacs. @@ -358,7 +358,7 @@ You can overwrite this default per project in your (concat "X" (if (fboundp 'sha1) (sha1 filename) (md5 filename)))) (defun org-publish-needed-p - (filename &optional pub-dir pub-func _true-pub-dir base-dir) + (filename &optional pub-dir pub-func _true-pub-dir base-dir) "Non-nil if FILENAME should be published in PUB-DIR using PUB-FUNC. TRUE-PUB-DIR is where the file will truly end up. Currently we are not using this - maybe it can eventually be used to check if @@ -375,7 +375,7 @@ still decide about that independently." rtn)) (defun org-publish-update-timestamp - (filename &optional pub-dir pub-func _base-dir) + (filename &optional pub-dir pub-func _base-dir) "Update publishing timestamp for file FILENAME. If there is no timestamp, create one." (let ((key (org-publish-timestamp-filename filename pub-dir pub-func)) @@ -617,7 +617,8 @@ files, when entire projects are published (see (abbreviate-file-name filename)))) (project-plist (cdr project)) (publishing-function - (pcase (org-publish-property :publishing-function project) + (pcase (org-publish-property :publishing-function project + 'org-html-publish-to-html) (`nil (user-error "No publishing function chosen")) ((and f (pred listp)) f) (f (list f)))) @@ -1064,7 +1065,7 @@ publishing directory." (setq full-index (sort (nreverse full-index) (lambda (a b) (string< (downcase (car a)) - (downcase (car b))))))) + (downcase (car b))))))) (let ((index (org-publish-cache-get-file-property file :index))) (dolist (term index) (unless (member term full-index) (push term full-index))))) @@ -1270,7 +1271,7 @@ If FREE-CACHE, empty the cache." org-publish-cache) (defun org-publish-reset-cache () - "Empty org-publish-cache and reset it nil." + "Empty `org-publish-cache' and reset it nil." (message "%s" "Resetting org-publish-cache") (when (hash-table-p org-publish-cache) (clrhash org-publish-cache)) @@ -1290,29 +1291,28 @@ the file including them will be republished as well." (org-inhibit-startup t) included-files-ctime) (when (equal (file-name-extension filename) "org") - (let ((visiting (find-buffer-visiting filename)) - (buf (find-file-noselect filename)) - (case-fold-search t)) - (unwind-protect - (with-current-buffer buf - (goto-char (point-min)) - (while (re-search-forward "^[ \t]*#\\+INCLUDE:" nil t) - (let ((element (org-element-at-point))) - (when (eq 'keyword (org-element-type element)) - (let* ((value (org-element-property :value element)) - (filename - (and (string-match "\\`\\(\".+?\"\\|\\S-+\\)" value) - (let ((m (org-strip-quotes - (match-string 1 value)))) - ;; Ignore search suffix. - (if (string-match "::.*?\\'" m) - (substring m 0 (match-beginning 0)) - m))))) - (when filename - (push (org-publish-cache-ctime-of-src - (expand-file-name filename)) - included-files-ctime))))))) - (unless visiting (kill-buffer buf))))) + (let ((case-fold-search t)) + (with-temp-buffer + (delay-mode-hooks + (org-mode) + (insert-file-contents filename) + (goto-char (point-min)) + (while (re-search-forward "^[ \t]*#\\+INCLUDE:" nil t) + (let ((element (org-element-at-point))) + (when (eq 'keyword (org-element-type element)) + (let* ((value (org-element-property :value element)) + (include-filename + (and (string-match "\\`\\(\".+?\"\\|\\S-+\\)" value) + (let ((m (org-strip-quotes + (match-string 1 value)))) + ;; Ignore search suffix. + (if (string-match "::.*?\\'" m) + (substring m 0 (match-beginning 0)) + m))))) + (when include-filename + (push (org-publish-cache-ctime-of-src + (expand-file-name include-filename (file-name-directory filename))) + included-files-ctime)))))))))) (or (null pstamp) (let ((ctime (org-publish-cache-ctime-of-src filename))) (or (time-less-p pstamp ctime) @@ -1320,7 +1320,7 @@ the file including them will be republished as well." included-files-ctime)))))) (defun org-publish-cache-set-file-property - (filename property value &optional project-name) + (filename property value &optional project-name) "Set the VALUE for a PROPERTY of file FILENAME in publishing cache to VALUE. Use cache file of PROJECT-NAME. If the entry does not exist, it will be created. Return VALUE." diff --git a/lisp/org/ox-texinfo.el b/lisp/org/ox-texinfo.el index 6e8d0d6214..8b949b361a 100644 --- a/lisp/org/ox-texinfo.el +++ b/lisp/org/ox-texinfo.el @@ -2,6 +2,7 @@ ;; Copyright (C) 2012-2021 Free Software Foundation, Inc. ;; Author: Jonathan Leech-Pepin +;; Maintainer: Nicolas Goaziou ;; Keywords: outlines, hypermedia, calendar, wp ;; This file is part of GNU Emacs. @@ -420,8 +421,8 @@ If two strings share the same prefix (e.g. \"ISO-8859-1\" and (defun org-texinfo--normalize-headlines (tree _backend info) "Normalize headlines in TREE. -BACK-END is the symbol specifying back-end used for export. INFO -is a plist used as a communication channel. +BACK-END is the symbol specifying back-end used for export. +INFO is a plist used as a communication channel. Make sure every headline in TREE contains a section, since those are required to install a menu. Also put exactly one blank line @@ -489,16 +490,18 @@ node or anchor name is unique." ;; Org exports deeper elements before their parents. If two ;; node names collide -- e.g., they have the same title -- ;; within the same hierarchy, the second one would get the - ;; shorter node name. This is counter-intuitive. - ;; Consequently, we ensure that every parent headline get - ;; its node beforehand. As a recursive operation, this + ;; smaller node name. This is counter-intuitive. + ;; Consequently, we ensure that every parent headline gets + ;; its node beforehand. As a recursive operation, this ;; achieves the desired effect. (let ((parent (org-element-lineage datum '(headline)))) (when (and parent (not (assq parent cache))) (org-texinfo--get-node parent info) (setq cache (plist-get info :texinfo-node-cache)))) - ;; Ensure NAME is unique and not reserved node name "Top". - (while (or (equal name "Top") (rassoc name cache)) + ;; Ensure NAME is unique and not reserved node name "Top", + ;; no matter what case is used. + (while (or (string-equal "Top" (capitalize name)) + (rassoc name cache)) (setq name (concat basename (format " (%d)" (cl-incf salt))))) (plist-put info :texinfo-node-cache (cons (cons datum name) cache)) name)))) @@ -559,6 +562,14 @@ strings (e.g., returned by `org-export-get-caption')." (format "@float %s%s\n%s\n%s%s@end float" type (if label (concat "," label) "") value caption-str short-str))) +(defun org-texinfo--sectioning-structure (info) + "Return sectioning structure used in the document. +INFO is a plist holding export options." + (let ((class (plist-get info :texinfo-class))) + (pcase (assoc class (plist-get info :texinfo-classes)) + (`(,_ ,_ . ,sections) sections) + (_ (user-error "Unknown Texinfo class: %S" class))))) + ;;; Template (defun org-texinfo-template (contents info) @@ -838,9 +849,17 @@ CONTENTS is nil. INFO is a plist holding contextual information." FOOTNOTE is the footnote to define. CONTENTS is nil. INFO is a plist holding contextual information." - (let ((def (org-export-get-footnote-definition footnote info))) + (let* ((contents (org-export-get-footnote-definition footnote info)) + (data (org-export-data contents info))) (format "@footnote{%s}" - (org-trim (org-export-data def info))))) + ;; It is invalid to close a footnote on a line starting + ;; with "@end". As a safety net, we leave a newline + ;; character before the closing brace. However, when the + ;; footnote ends with a paragraph, it is visually pleasing + ;; to move the brace right after its end. + (if (eq 'paragraph (org-element-type (org-last contents))) + (org-trim data) + data)))) ;;;; Headline @@ -858,25 +877,22 @@ holding contextual information." (notoc? (org-export-excluded-from-toc-p headline info)) (command (and - (not (org-export-low-level-p headline info)) - (let ((class (plist-get info :texinfo-class))) - (pcase (assoc class (plist-get info :texinfo-classes)) - (`(,_ ,_ . ,sections) - (pcase (nth (1- (org-export-get-relative-level headline info)) - sections) - (`(,numbered ,unnumbered ,unnumbered-no-toc ,appendix) - (cond - ((org-not-nil - (org-export-get-node-property :APPENDIX headline t)) - appendix) - (numbered? numbered) - (index unnumbered) - (notoc? unnumbered-no-toc) - (t unnumbered))) - (`nil nil) - (_ (user-error "Invalid Texinfo class specification: %S" - class)))) - (_ (user-error "Unknown Texinfo class: %S" class)))))) + (not (org-export-low-level-p headline info)) + (let ((sections (org-texinfo--sectioning-structure info))) + (pcase (nth (1- (org-export-get-relative-level headline info)) + sections) + (`(,numbered ,unnumbered ,unnumbered-no-toc ,appendix) + (cond + ((org-not-nil + (org-export-get-node-property :APPENDIX headline t)) + appendix) + (numbered? numbered) + (index unnumbered) + (notoc? unnumbered-no-toc) + (t unnumbered))) + (`nil nil) + (_ (user-error "Invalid Texinfo class specification: %S" + (plist-get info :texinfo-class))))))) (todo (and (plist-get info :with-todo-keywords) (let ((todo (org-element-property :todo-keyword headline))) @@ -894,11 +910,12 @@ holding contextual information." (contents (concat "\n" (if (org-string-nw-p contents) (concat "\n" contents) "") - (and index (format "\n@printindex %s\n" index))))) + (and index (format "\n@printindex %s\n" index)))) + (node (org-texinfo--get-node headline info))) (if (not command) (concat (and (org-export-first-sibling-p headline info) (format "@%s\n" (if numbered? 'enumerate 'itemize))) - "@item\n" full-text "\n" + (format "@item\n@anchor{%s}%s\n" node full-text) contents (if (org-export-last-sibling-p headline info) (format "@end %s" (if numbered? 'enumerate 'itemize)) @@ -906,13 +923,12 @@ holding contextual information." (concat ;; Even if HEADLINE is using @subheading and al., leave an ;; anchor so cross-references in the Org document still work. - (format (if notoc? "@anchor{%s}\n" "@node %s\n") - (org-texinfo--get-node headline info)) + (format (if notoc? "@anchor{%s}\n" "@node %s\n") node) (format command full-text) contents)))))) (defun org-texinfo-format-headline-default-function - (todo _todo-type priority text tags) + (todo _todo-type priority text tags) "Default format function for a headline. See `org-texinfo-format-headline-function' for details." (concat (and todo (format "@strong{%s} " todo)) @@ -949,7 +965,7 @@ holding contextual information." todo todo-type priority title tags contents))) (defun org-texinfo-format-inlinetask-default-function - (todo _todo-type priority title tags contents) + (todo _todo-type priority title tags contents) "Default format function for inlinetasks. See `org-texinfo-format-inlinetask-function' for details." (let ((full-title @@ -1111,7 +1127,9 @@ current state of the export, as a plist." (path (org-element-property :path link)) (filename (file-name-sans-extension - (if (file-name-absolute-p path) (expand-file-name path) path))) + (if (file-name-absolute-p path) + (expand-file-name path) + (file-relative-name path)))) (extension (file-name-extension path)) (attributes (org-export-read-attribute :attr_texinfo parent)) (height (or (plist-get attributes :height) "")) @@ -1192,7 +1210,7 @@ a plist containing contextual information." ;; Colons are used as a separator between title and node ;; name. Remove them. (replace-regexp-in-string - "[ \t]+:+" "" + "[ \t]*:+" "" (org-texinfo--sanitize-title (org-export-get-alt-title h info) info))) (node (org-texinfo--get-node h info)) @@ -1215,12 +1233,15 @@ holding contextual information." :texinfo-entries-cache))) (cached-entries (gethash scope cache 'no-cache))) (if (not (eq cached-entries 'no-cache)) cached-entries - (puthash scope - (cl-remove-if - (lambda (h) - (org-not-nil (org-export-get-node-property :COPYING h t))) - (org-export-collect-headlines info 1 scope)) - cache)))) + (let* ((sections (org-texinfo--sectioning-structure info)) + (max-depth (length sections))) + (puthash scope + (cl-remove-if + (lambda (h) + (or (org-not-nil (org-export-get-node-property :COPYING h t)) + (< max-depth (org-export-get-relative-level h info)))) + (org-export-collect-headlines info 1 scope)) + cache))))) ;;;; Node Property @@ -1585,7 +1606,7 @@ channel." (defun org-texinfo-verse-block (_verse-block contents _info) "Transcode a VERSE-BLOCK element from Org to Texinfo. -CONTENTS is verse block contents. INFO is a plist holding +CONTENTS is verse block contents. INFO is a plist holding contextual information." (format "@display\n%s@end display" contents)) @@ -1594,7 +1615,7 @@ contextual information." ;;;###autoload (defun org-texinfo-export-to-texinfo - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer to a Texinfo file. If narrowing is active in the current buffer, only export its @@ -1645,7 +1666,7 @@ Usage: emacs -batch -f org-texinfo-export-to-texinfo-batch INFILE OUTFILE" ;;;###autoload (defun org-texinfo-export-to-info - (&optional async subtreep visible-only body-only ext-plist) + (&optional async subtreep visible-only body-only ext-plist) "Export current buffer to Texinfo then process through to INFO. If narrowing is active in the current buffer, only export its diff --git a/lisp/org/ox.el b/lisp/org/ox.el index d412f57360..9ab813a1b1 100644 --- a/lisp/org/ox.el +++ b/lisp/org/ox.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2012-2021 Free Software Foundation, Inc. ;; Author: Nicolas Goaziou +;; Maintainer: Nicolas Goaziou ;; Keywords: outlines, hypermedia, calendar, wp ;; This file is part of GNU Emacs. @@ -73,6 +74,8 @@ (require 'cl-lib) (require 'ob-exp) +(require 'oc) +(require 'oc-basic) ;default value for `org-cite-export-processors' (require 'ol) (require 'org-element) (require 'org-macro) @@ -139,7 +142,9 @@ (:with-tasks nil "tasks" org-export-with-tasks) (:with-timestamps nil "<" org-export-with-timestamps) (:with-title nil "title" org-export-with-title) - (:with-todo-keywords nil "todo" org-export-with-todo-keywords)) + (:with-todo-keywords nil "todo" org-export-with-todo-keywords) + ;; Citations processing. + (:cite-export "CITE_EXPORT" nil org-cite-export-processors)) "Alist between export properties and ways to set them. The key of the alist is the property name, and the value is a list @@ -1207,12 +1212,12 @@ keywords are understood: or \\='(?l \"Export to LaTeX\" - (?p \"As PDF file\" org-latex-export-to-pdf) - (?o \"As PDF file and open\" - (lambda (a s v b) - (if a (org-latex-export-to-pdf t s v b) - (org-open-file - (org-latex-export-to-pdf nil s v b))))))) + ((?p \"As PDF file\" org-latex-export-to-pdf) + (?o \"As PDF file and open\" + (lambda (a s v b) + (if a (org-latex-export-to-pdf t s v b) + (org-open-file + (org-latex-export-to-pdf nil s v b))))))) or the following, which will be added to the previous sub-menu, @@ -1386,11 +1391,13 @@ e.g., `org-export-create-backend'. It specifies which back-end specific items to read, if any." (let ((line (let ((s 0) alist) - (while (string-match "\\(.+?\\):\\((.*?)\\|\\S-*\\)[ \t]*" options s) + (while (string-match "\\(.+?\\):\\((.*?)\\|\\S-+\\)?[ \t]*" options s) (setq s (match-end 0)) - (push (cons (match-string 1 options) - (read (match-string 2 options))) - alist)) + (let ((value (match-string 2 options))) + (when value + (push (cons (match-string 1 options) + (read value)) + alist)))) alist)) ;; Priority is given to back-end specific options. (all (append (org-export-get-all-options backend) @@ -1569,7 +1576,7 @@ process." plist prop ;; Evaluate default value provided. - (let ((value (eval (nth 3 cell)))) + (let ((value (eval (nth 3 cell) t))) (if (eq (nth 4 cell) 'parse) (org-element-parse-secondary-string value (org-element-restriction 'keyword)) @@ -1878,6 +1885,8 @@ Return a string." (cond ;; Ignored element/object. ((memq data (plist-get info :ignore-list)) nil) + ;; Raw code. + ((eq type 'raw) (car (org-element-contents data))) ;; Plain text. ((eq type 'plain-text) (org-export-filter-apply-functions @@ -1944,7 +1953,7 @@ Return a string." data (cond ((not results) "") - ((memq type '(org-data plain-text nil)) results) + ((memq type '(nil org-data plain-text raw)) results) ;; Append the same white space between elements or objects ;; as in the original buffer, and call appropriate filters. (t @@ -2559,16 +2568,16 @@ another buffer, effectively cloning the original buffer there. The function assumes BUFFER's major mode is `org-mode'." (with-current-buffer buffer - `(lambda () - (let ((inhibit-modification-hooks t)) - ;; Set major mode. Ignore `org-mode-hook' as it has been run - ;; already in BUFFER. - (let ((org-mode-hook nil) (org-inhibit-startup t)) (org-mode)) - ;; Copy specific buffer local variables and variables set - ;; through BIND keywords. - ,@(let ((bound-variables (org-export--list-bound-variables)) - vars) - (dolist (entry (buffer-local-variables (buffer-base-buffer)) vars) + (let ((str (org-with-wide-buffer (buffer-string))) + (narrowing + (if (org-region-active-p) + (list (region-beginning) (region-end)) + (list (point-min) (point-max)))) + (pos (point)) + (varvals + (let ((bound-variables (org-export--list-bound-variables)) + (varvals nil)) + (dolist (entry (buffer-local-variables (buffer-base-buffer))) (when (consp entry) (let ((var (car entry)) (val (cdr entry))) @@ -2583,27 +2592,35 @@ The function assumes BUFFER's major mode is `org-mode'." ;; Skip unreadable values, as they cannot be ;; sent to external process. (or (not val) (ignore-errors (read (format "%S" val)))) - (push `(set (make-local-variable (quote ,var)) - (quote ,val)) - vars)))))) - ;; Whole buffer contents. - (insert ,(org-with-wide-buffer (buffer-string))) - ;; Narrowing. - ,(if (org-region-active-p) - `(narrow-to-region ,(region-beginning) ,(region-end)) - `(narrow-to-region ,(point-min) ,(point-max))) - ;; Current position of point. - (goto-char ,(point)) - ;; Overlays with invisible property. - ,@(let (ov-set) - (dolist (ov (overlays-in (point-min) (point-max)) ov-set) + (push (cons var val) varvals))))) + varvals)) + (ols + (let (ov-set) + (dolist (ov (overlays-in (point-min) (point-max))) (let ((invis-prop (overlay-get ov 'invisible))) (when invis-prop - (push `(overlay-put - (make-overlay ,(overlay-start ov) - ,(overlay-end ov)) - 'invisible (quote ,invis-prop)) - ov-set))))))))) + (push (list (overlay-start ov) (overlay-end ov) + invis-prop) + ov-set)))) + ov-set))) + (lambda () + (let ((inhibit-modification-hooks t)) + ;; Set major mode. Ignore `org-mode-hook' as it has been run + ;; already in BUFFER. + (let ((org-mode-hook nil) (org-inhibit-startup t)) (org-mode)) + ;; Copy specific buffer local variables and variables set + ;; through BIND keywords. + (pcase-dolist (`(,var . ,val) varvals) + (set (make-local-variable var) val)) + ;; Whole buffer contents. + (insert str) + ;; Narrowing. + (apply #'narrow-to-region narrowing) + ;; Current position of point. + (goto-char pos) + ;; Overlays with invisible property. + (pcase-dolist (`(,start ,end ,invis) ols) + (overlay-put (make-overlay start end) 'invisible invis))))))) (defun org-export--delete-comment-trees () "Delete commented trees and commented inlinetasks in the buffer. @@ -2709,8 +2726,8 @@ a list of footnote definitions or in the widened buffer." ) ;; seen (dolist (l (funcall list-labels tree)) (cond ;; ((member l seen)) - ((member l known-definitions) (push l defined)) - (t (push l undefined))))) + ((member l known-definitions) (push l defined)) + (t (push l undefined))))) ;; Complete MISSING-DEFINITIONS by finding the definition of every ;; undefined label, first by looking into DEFINITIONS, then by ;; searching the widened buffer. This is a recursive process @@ -2722,7 +2739,7 @@ a list of footnote definitions or in the widened buffer." (cond ((cl-some (lambda (d) (and (equal (org-element-property :label d) label) - d)) + d)) definitions)) ((pcase (org-footnote-get-definition label) (`(,_ ,beg . ,_) @@ -2785,16 +2802,16 @@ containing their first reference." ;; the definitions at the end of the tree. (org-footnote-section (org-element-adopt-elements - tree - (org-element-create 'headline - (list :footnote-section-p t - :level 1 - :title org-footnote-section - :raw-value org-footnote-section) - (apply #'org-element-create - 'section - nil - (nreverse definitions))))) + tree + (org-element-create 'headline + (list :footnote-section-p t + :level 1 + :title org-footnote-section + :raw-value org-footnote-section) + (apply #'org-element-create + 'section + nil + (nreverse definitions))))) ;; Otherwise add each definition at the end of the section where it ;; is first referenced. (t @@ -2817,8 +2834,8 @@ containing their first reference." d)) definitions))) (org-element-adopt-elements - (org-element-lineage reference '(section)) - definition) + (org-element-lineage reference '(section)) + definition) ;; Also insert definitions for nested ;; references, if any. (funcall insert-definitions definition)))))))))) @@ -2947,10 +2964,8 @@ Return code as a string." (org-export-backend-name backend)) (org-export-expand-include-keyword) (org-export--delete-comment-trees) - (org-macro-initialize-templates) - (org-macro-replace-all (append org-macro-templates - org-export-global-macros) - parsed-keywords) + (org-macro-initialize-templates org-export-global-macros) + (org-macro-replace-all org-macro-templates parsed-keywords) ;; Refresh buffer properties and radio targets after previous ;; potentially invasive changes. (org-set-regexps-and-options) @@ -2977,6 +2992,10 @@ Return code as a string." (setq info (org-combine-plists info (org-export-get-environment backend subtreep ext-plist))) + ;; Pre-process citations environment, i.e. install + ;; bibliography list, and citation processor in INFO. + (org-cite-store-bibliography info) + (org-cite-store-export-processor info) ;; De-activate uninterpreted data from parsed keywords. (dolist (entry (append (org-export-get-all-options backend) org-export-options-alist)) @@ -3010,6 +3029,11 @@ Return code as a string." ;; Now tree is complete, compute its properties and add them ;; to communication channel. (setq info (org-export--collect-tree-properties tree info)) + ;; Process citations and bibliography. Replace each citation + ;; and "print_bibliography" keyword in the parse tree with + ;; the output of the selected citation export processor. + (org-cite-process-citations info) + (org-cite-process-bibliography info) ;; Eventually transcode TREE. Wrap the resulting string into ;; a template. (let* ((body (org-element-normalize-string @@ -3022,16 +3046,19 @@ Return code as a string." (funcall inner-template body info)) info)) (template (cdr (assq 'template - (plist-get info :translate-alist))))) + (plist-get info :translate-alist)))) + (output + (if (or (not (functionp template)) body-only) full-body + (funcall template full-body info)))) + ;; Call citation export finalizer. + (setq output (org-cite-finalize-export output info)) ;; Remove all text properties since they cannot be ;; retrieved from an external process. Finally call ;; final-output filter and return result. (org-no-properties (org-export-filter-apply-functions (plist-get info :filter-final-output) - (if (or (not (functionp template)) body-only) full-body - (funcall template full-body info)) - info)))))))) + output info)))))))) ;;;###autoload (defun org-export-string-as (string backend &optional body-only ext-plist) @@ -3104,22 +3131,22 @@ locally for the subtree through node properties." (keyword (unless (assoc keyword keywords) (let ((value (if (eq (nth 4 entry) 'split) - (mapconcat #'identity (eval (nth 3 entry)) " ") - (eval (nth 3 entry))))) + (mapconcat #'identity (eval (nth 3 entry) t) " ") + (eval (nth 3 entry) t)))) (push (cons keyword value) keywords)))) (option (unless (assoc option options) - (push (cons option (eval (nth 3 entry))) options)))))) + (push (cons option (eval (nth 3 entry) t)) options)))))) ;; Move to an appropriate location in order to insert options. (unless subtreep (beginning-of-line)) ;; First (multiple) OPTIONS lines. Never go past fill-column. (when options (let ((items (mapcar - #'(lambda (opt) (format "%s:%S" (car opt) (cdr opt))) + (lambda (opt) (format "%s:%S" (car opt) (cdr opt))) (sort options (lambda (k1 k2) (string< (car k1) (car k2))))))) (if subtreep (org-entry-put - node "EXPORT_OPTIONS" (mapconcat 'identity items " ")) + node "EXPORT_OPTIONS" (mapconcat #'identity items " ")) (while items (insert "#+options:") (let ((width 10)) @@ -3609,7 +3636,7 @@ will become the empty string." (attributes (let ((value (org-element-property attribute element))) (when value - (let ((s (mapconcat 'identity value " ")) result) + (let ((s (mapconcat #'identity value " ")) result) (while (string-match "\\(?:^\\|[ \t]+\\)\\(:[-a-zA-Z0-9_]+\\)\\([ \t]+\\|$\\)" s) @@ -3659,7 +3686,8 @@ the communication channel used for export, as a plist." (when (symbolp backend) (setq backend (org-export-get-backend backend))) (org-export-barf-if-invalid-backend backend) (let ((type (org-element-type data))) - (when (memq type '(nil org-data)) (error "No foreign transcoder available")) + (when (memq type '(nil org-data raw)) + (error "No foreign transcoder available")) (let* ((all-transcoders (org-export-get-all-transcoders backend)) (transcoder (cdr (assq type all-transcoders)))) (unless (functionp transcoder) (error "No foreign transcoder available")) @@ -4194,10 +4222,10 @@ Return modified DATA." (or rules org-export-default-inline-image-rule)) ;; Replace contents with image link. (org-element-adopt-elements - (org-element-set-contents l nil) - (with-temp-buffer - (save-excursion (insert contents)) - (org-element-link-parser)))))))) + (org-element-set-contents l nil) + (with-temp-buffer + (save-excursion (insert contents)) + (org-element-link-parser)))))))) info nil nil t)) data) @@ -4553,6 +4581,17 @@ objects of the same type." ((funcall predicate el info) (cl-incf counter) nil))) info 'first-match))))) +;;;; For Raw objects +;; +;; `org-export-raw-string' builds a pseudo-object out of a string +;; that any export back-end returns as-is. + +(defun org-export-raw-string (s) + "Return a raw object containing string S. +A raw string is exported as-is, with no additional processing +from the export back-end." + (unless (stringp s) (error "Wrong raw contents type: %S" s)) + (org-element-create 'raw nil s)) ;;;; For Src-Blocks ;; @@ -4702,7 +4741,7 @@ code." ;; should start six columns after the widest line of code, ;; wrapped with parenthesis. (max-width - (+ (apply 'max (mapcar 'length code-lines)) + (+ (apply #'max (mapcar #'length code-lines)) (if (not num-start) 0 (length (format num-fmt num-start)))))) (org-export-format-code code @@ -5082,8 +5121,8 @@ INFO is a plist used as a communication channel." ;; A cell ends a column group either when it is at the end of a row ;; or when it has a right border. (or (eq (car (last (org-element-contents - (org-export-get-parent table-cell)))) - table-cell) + (org-export-get-parent table-cell)))) + table-cell) (memq 'right (org-export-table-cell-borders table-cell info)))) (defun org-export-table-row-starts-rowgroup-p (table-row info) @@ -5398,6 +5437,16 @@ transcoding it." (secondary-closing :utf-8 "‘" :html "‘" :latex "\\grq{}" :texinfo "@quoteleft{}") (apostrophe :utf-8 "’" :html "’")) + ("el" + (primary-opening + :utf-8 "«" :html "«" :latex "\\guillemotleft{}" + :texinfo "@guillemetleft{}") + (primary-closing + :utf-8 "»" :html "»" :latex "\\guillemotright{}" + :texinfo "@guillemetright{}") + (secondary-opening :utf-8 "“" :html "“" :latex "``" :texinfo "``") + (secondary-closing :utf-8 "”" :html "”" :latex "''" :texinfo "''") + (apostrophe :utf-8 "’" :html "’")) ("en" (primary-opening :utf-8 "“" :html "“" :latex "``" :texinfo "``") (primary-closing :utf-8 "”" :html "”" :latex "''" :texinfo "''") @@ -5437,6 +5486,12 @@ transcoding it." (secondary-closing :utf-8 "‘" :html "‘" :latex "\\grq{}" :texinfo "@quoteleft{}") (apostrophe :utf-8 "’" :html "’")) + ("it" + (primary-opening :utf-8 "“" :html "“" :latex "``" :texinfo "``") + (primary-closing :utf-8 "”" :html "”" :latex "''" :texinfo "''") + (secondary-opening :utf-8 "‘" :html "‘" :latex "`" :texinfo "`") + (secondary-closing :utf-8 "’" :html "’" :latex "'" :texinfo "'") + (apostrophe :utf-8 "’" :html "’")) ("no" ;; https://nn.wikipedia.org/wiki/Sitatteikn (primary-opening @@ -5483,7 +5538,7 @@ transcoding it." (apostrophe :utf-8 "’" :html "’")) ("ru" ;; https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%B2%D1%8B%D1%87%D0%BA%D0%B8#.D0.9A.D0.B0.D0.B2.D1.8B.D1.87.D0.BA.D0.B8.2C_.D0.B8.D1.81.D0.BF.D0.BE.D0.BB.D1.8C.D0.B7.D1.83.D0.B5.D0.BC.D1.8B.D0.B5_.D0.B2_.D1.80.D1.83.D1.81.D1.81.D0.BA.D0.BE.D0.BC_.D1.8F.D0.B7.D1.8B.D0.BA.D0.B5 - ;; http://www.artlebedev.ru/kovodstvo/sections/104/ + ;; https://www.artlebedev.ru/kovodstvo/sections/104/ (primary-opening :utf-8 "«" :html "«" :latex "{}<<" :texinfo "@guillemetleft{}") (primary-closing :utf-8 "»" :html "»" :latex ">>{}" @@ -5745,6 +5800,7 @@ them." ("ru" :html "Автор" :utf-8 "Автор") ("sl" :default "Avtor") ("sv" :html "Författare") + ("tr" :default "Yazar") ("uk" :html "Автор" :utf-8 "Автор") ("zh-CN" :html "作者" :utf-8 "作者") ("zh-TW" :html "作者" :utf-8 "作者")) @@ -5757,12 +5813,14 @@ them." ("it" :default "Continua da pagina precedente") ("ja" :default "前ページからの続き") ("nl" :default "Vervolg van vorige pagina") + ("pl" :default "Ciąg dalszy poprzedniej strony") ("pt" :default "Continuação da página anterior") ("pt_BR" :html "Continuação da página anterior" :ascii "Continuacao da pagina anterior" :default "Continuação da página anterior") ("ro" :default "Continuare de pe pagina precedentă") ("ru" :html "(Продолжение)" :utf-8 "(Продолжение)") - ("sl" :default "Nadaljevanje s prejšnje strani")) + ("sl" :default "Nadaljevanje s prejšnje strani") + ("tr" :default "Önceki sayfadan devam ediyor")) ("Continued on next page" ("ar" :default "التتمة في الصفحة التالية") ("cs" :default "Pokračuje na další stránce") @@ -5772,18 +5830,21 @@ them." ("it" :default "Continua alla pagina successiva") ("ja" :default "次ページに続く") ("nl" :default "Vervolg op volgende pagina") + ("pl" :default "Kontynuacja na następnej stronie") ("pt" :default "Continua na página seguinte") ("pt_BR" :html "Continua na próxima página" :ascii "Continua na proxima pagina" :default "Continua na próxima página") ("ro" :default "Continuare pe pagina următoare") ("ru" :html "(Продолжение следует)" :utf-8 "(Продолжение следует)") - ("sl" :default "Nadaljevanje na naslednji strani")) + ("sl" :default "Nadaljevanje na naslednji strani") + ("tr" :default "Devamı sonraki sayfada")) ("Created" ("cs" :default "Vytvořeno") ("nl" :default "Gemaakt op") ;; must be followed by a date or date+time ("pt_BR" :default "Criado em") ("ro" :default "Creat") - ("sl" :default "Ustvarjeno")) + ("sl" :default "Ustvarjeno") + ("tr" :default "Oluşturuldu")) ("Date" ("ar" :default "بتاريخ") ("ca" :default "Data") @@ -5808,6 +5869,7 @@ them." ("ru" :html "Дата" :utf-8 "Дата") ("sl" :default "Datum") ("sv" :default "Datum") + ("tr" :default "Tarih") ("uk" :html "Дата" :utf-8 "Дата") ("zh-CN" :html "日期" :utf-8 "日期") ("zh-TW" :html "日期" :utf-8 "日期")) @@ -5831,6 +5893,7 @@ them." :utf-8 "Уравнение") ("sl" :default "Enačba") ("sv" :default "Ekvation") + ("tr" :default "Eşitlik") ("zh-CN" :html "方程" :utf-8 "方程")) ("Figure" ("ar" :default "شكل") @@ -5850,6 +5913,7 @@ them." ("ro" :default "Imaginea") ("ru" :html "Рисунок" :utf-8 "Рисунок") ("sv" :default "Illustration") + ("tr" :default "Şekil") ("zh-CN" :html "图" :utf-8 "图")) ("Figure %d:" ("ar" :default "شكل %d:") @@ -5871,6 +5935,7 @@ them." ("ru" :html "Рис. %d.:" :utf-8 "Рис. %d.:") ("sl" :default "Slika %d") ("sv" :default "Illustration %d") + ("tr" :default "Şekil %d:") ("zh-CN" :html "图%d " :utf-8 "图%d ")) ("Footnotes" ("ar" :default "الهوامش") @@ -5879,7 +5944,7 @@ them." ("da" :default "Fodnoter") ("de" :html "Fußnoten" :default "Fußnoten") ("eo" :default "Piednotoj") - ("es" :ascii "Nota al pie de pagina" :html "Nota al pie de página" :default "Nota al pie de página") + ("es" :ascii "Notas al pie de pagina" :html "Notas al pie de página" :default "Notas al pie de página") ("et" :html "Allmärkused" :utf-8 "Allmärkused") ("fi" :default "Alaviitteet") ("fr" :default "Notes de bas de page") @@ -5897,6 +5962,7 @@ them." ("ru" :html "Сноски" :utf-8 "Сноски") ("sl" :default "Opombe") ("sv" :default "Fotnoter") + ("tr" :default "Dipnotlar") ("uk" :html "Примітки" :utf-8 "Примітки") ("zh-CN" :html "脚注" :utf-8 "脚注") @@ -5917,6 +5983,7 @@ them." ("ru" :html "Список распечаток" :utf-8 "Список распечаток") ("sl" :default "Seznam programskih izpisov") + ("tr" :default "Program Listesi") ("zh-CN" :html "代码目录" :utf-8 "代码目录")) ("List of Tables" ("ar" :default "قائمة بالجداول") @@ -5939,6 +6006,7 @@ them." :utf-8 "Список таблиц") ("sl" :default "Seznam tabel") ("sv" :default "Tabeller") + ("tr" :default "Tablo Listesi") ("zh-CN" :html "表格目录" :utf-8 "表格目录")) ("Listing" ("ar" :default "برنامج") @@ -5958,6 +6026,7 @@ them." ("ru" :html "Распечатка" :utf-8 "Распечатка") ("sl" :default "Izpis programa") + ("tr" :default "Program") ("zh-CN" :html "代码" :utf-8 "代码")) ("Listing %d:" ("ar" :default "برنامج %d:") @@ -5977,6 +6046,7 @@ them." ("ru" :html "Распечатка %d.:" :utf-8 "Распечатка %d.:") ("sl" :default "Izpis programa %d") + ("tr" :default "Program %d:") ("zh-CN" :html "代码%d " :utf-8 "代码%d ")) ("References" ("ar" :default "المراجع") @@ -5988,7 +6058,8 @@ them." ("nl" :default "Bronverwijzingen") ("pt_BR" :html "Referências" :default "Referências" :ascii "Referencias") ("ro" :default "Bibliografie") - ("sl" :default "Reference")) + ("sl" :default "Reference") + ("tr" :default "Referanslar")) ("See figure %s" ("cs" :default "Viz obrázek %s") ("fr" :default "cf. figure %s" @@ -5998,7 +6069,8 @@ them." :html "Zie figuur %s" :latex "Zie figuur~%s") ("pt_BR" :default "Veja a figura %s") ("ro" :default "Vezi figura %s") - ("sl" :default "Glej sliko %s")) + ("sl" :default "Glej sliko %s") + ("tr" :default "bkz. şekil %s")) ("See listing %s" ("cs" :default "Viz program %s") ("fr" :default "cf. programme %s" @@ -6007,7 +6079,8 @@ them." :html "Zie programma %s" :latex "Zie programma~%s") ("pt_BR" :default "Veja a listagem %s") ("ro" :default "Vezi tabelul %s") - ("sl" :default "Glej izpis programa %s")) + ("sl" :default "Glej izpis programa %s") + ("tr" :default "bkz. program %s")) ("See section %s" ("ar" :default "انظر قسم %s") ("cs" :default "Viz sekce %s") @@ -6026,6 +6099,7 @@ them." ("ru" :html "См. раздел %s" :utf-8 "См. раздел %s") ("sl" :default "Glej poglavje %d") + ("tr" :default "bkz. bölüm %s") ("zh-CN" :html "参见第%s节" :utf-8 "参见第%s节")) ("See table %s" ("cs" :default "Viz tabulka %s") @@ -6036,7 +6110,8 @@ them." :html "Zie tabel %s" :latex "Zie tabel~%s") ("pt_BR" :default "Veja a tabela %s") ("ro" :default "Vezi tabelul %s") - ("sl" :default "Glej tabelo %s")) + ("sl" :default "Glej tabelo %s") + ("tr" :default "bkz. tablo %s")) ("Table" ("ar" :default "جدول") ("cs" :default "Tabulka") @@ -6052,6 +6127,7 @@ them." ("ro" :default "Tabel") ("ru" :html "Таблица" :utf-8 "Таблица") + ("tr" :default "Tablo") ("zh-CN" :html "表" :utf-8 "表")) ("Table %d:" ("ar" :default "جدول %d:") @@ -6074,6 +6150,7 @@ them." :utf-8 "Таблица %d.:") ("sl" :default "Tabela %d") ("sv" :default "Tabell %d") + ("tr" :default "Tablo %d") ("zh-CN" :html "表%d " :utf-8 "表%d ")) ("Table of Contents" ("ar" :default "قائمة المحتويات") @@ -6101,6 +6178,7 @@ them." :utf-8 "Содержание") ("sl" :default "Kazalo") ("sv" :html "Innehåll") + ("tr" :default "İçindekiler") ("uk" :html "Зміст" :utf-8 "Зміст") ("zh-CN" :html "目录" :utf-8 "目录") ("zh-TW" :html "目錄" :utf-8 "目錄")) @@ -6119,6 +6197,7 @@ them." ("ru" :html "Неизвестная ссылка" :utf-8 "Неизвестная ссылка") ("sl" :default "Neznana referenca") + ("tr" :default "Bilinmeyen referans") ("zh-CN" :html "未知引用" :utf-8 "未知引用"))) "Dictionary for export engine. @@ -6176,97 +6255,93 @@ to `:default' encoding. If it fails, return S." ;; For back-ends, `org-export-add-to-stack' add a new source to stack. ;; It should be used whenever `org-export-async-start' is called. -(defmacro org-export-async-start (fun &rest body) +(defun org-export-async-start (fun body) "Call function FUN on the results returned by BODY evaluation. -FUN is an anonymous function of one argument. BODY evaluation -happens in an asynchronous process, from a buffer which is an -exact copy of the current one. +FUN is an anonymous function of one argument. BODY should be a valid +ELisp source expression. BODY evaluation happens in an asynchronous process, +from a buffer which is an exact copy of the current one. Use `org-export-add-to-stack' in FUN in order to register results in the stack. This is a low level function. See also `org-export-to-buffer' and `org-export-to-file' for more specialized functions." - (declare (indent 1) (debug t)) - (org-with-gensyms (process temp-file copy-fun proc-buffer coding) - ;; Write the full sexp evaluating BODY in a copy of the current - ;; buffer to a temporary file, as it may be too long for program - ;; args in `start-process'. - `(with-temp-message "Initializing asynchronous export process" - (let ((,copy-fun (org-export--generate-copy-script (current-buffer))) - (,temp-file (make-temp-file "org-export-process")) - (,coding buffer-file-coding-system)) - (with-temp-file ,temp-file - (insert - ;; Null characters (from variable values) are inserted - ;; within the file. As a consequence, coding system for - ;; buffer contents will not be recognized properly. So, - ;; we make sure it is the same as the one used to display - ;; the original buffer. - (format ";; -*- coding: %s; -*-\n%S" - ,coding - `(with-temp-buffer - (when org-export-async-debug '(setq debug-on-error t)) - ;; Ignore `kill-emacs-hook' and code evaluation - ;; queries from Babel as we need a truly - ;; non-interactive process. - (setq kill-emacs-hook nil - org-babel-confirm-evaluate-answer-no t) - ;; Initialize export framework. - (require 'ox) - ;; Re-create current buffer there. - (funcall ,,copy-fun) - (restore-buffer-modified-p nil) - ;; Sexp to evaluate in the buffer. - (print (progn ,,@body)))))) - ;; Start external process. - (let* ((process-connection-type nil) - (,proc-buffer (generate-new-buffer-name "*Org Export Process*")) - (,process - (apply - #'start-process - (append - (list "org-export-process" - ,proc-buffer - (expand-file-name invocation-name invocation-directory) - "--batch") - (if org-export-async-init-file - (list "-Q" "-l" org-export-async-init-file) - (list "-l" user-init-file)) - (list "-l" ,temp-file))))) - ;; Register running process in stack. - (org-export-add-to-stack (get-buffer ,proc-buffer) nil ,process) - ;; Set-up sentinel in order to catch results. - (let ((handler ,fun)) - (set-process-sentinel - ,process - `(lambda (p status) - (let ((proc-buffer (process-buffer p))) - (when (eq (process-status p) 'exit) - (unwind-protect - (if (zerop (process-exit-status p)) - (unwind-protect - (let ((results - (with-current-buffer proc-buffer - (goto-char (point-max)) - (backward-sexp) - (read (current-buffer))))) - (funcall ,handler results)) - (unless org-export-async-debug - (and (get-buffer proc-buffer) - (kill-buffer proc-buffer)))) - (org-export-add-to-stack proc-buffer nil p) - (ding) - (message "Process `%s' exited abnormally" p)) - (unless org-export-async-debug - (delete-file ,,temp-file))))))))))))) + (declare (indent 1)) + ;; Write the full sexp evaluating BODY in a copy of the current + ;; buffer to a temporary file, as it may be too long for program + ;; args in `start-process'. + (with-temp-message "Initializing asynchronous export process" + (let ((copy-fun (org-export--generate-copy-script (current-buffer))) + (temp-file (make-temp-file "org-export-process"))) + (let ((coding-system-for-write 'utf-8-emacs-unix)) + (write-region + ;; Null characters (from variable values) are inserted + ;; within the file. As a consequence, coding system for + ;; buffer contents could fail to be recognized properly. + (format ";; -*- coding: utf-8-emacs-unix; lexical-binding:t -*-\n%S" + `(with-temp-buffer + ,(when org-export-async-debug '(setq debug-on-error t)) + ;; Ignore `kill-emacs-hook' and code evaluation + ;; queries from Babel as we need a truly + ;; non-interactive process. + (setq kill-emacs-hook nil + org-babel-confirm-evaluate-answer-no t) + ;; Initialize export framework. + (require 'ox) + ;; Re-create current buffer there. + (funcall ',copy-fun) + (restore-buffer-modified-p nil) + ;; Sexp to evaluate in the buffer. + (print ,body))) + nil temp-file nil 'silent)) + ;; Start external process. + (let* ((process-connection-type nil) + (proc-buffer (generate-new-buffer-name "*Org Export Process*")) + (process + (apply + #'start-process + (append + (list "org-export-process" + proc-buffer + (expand-file-name invocation-name invocation-directory) + "--batch") + (if org-export-async-init-file + (list "-Q" "-l" org-export-async-init-file) + (list "-l" user-init-file)) + (list "-l" temp-file))))) + ;; Register running process in stack. + (org-export-add-to-stack (get-buffer proc-buffer) nil process) + ;; Set-up sentinel in order to catch results. + (let ((handler fun)) + (set-process-sentinel + process + (lambda (p _status) + (let ((proc-buffer (process-buffer p))) + (when (eq (process-status p) 'exit) + (unwind-protect + (if (zerop (process-exit-status p)) + (unwind-protect + (let ((results + (with-current-buffer proc-buffer + (goto-char (point-max)) + (backward-sexp) + (read (current-buffer))))) + (funcall handler results)) + (unless org-export-async-debug + (and (get-buffer proc-buffer) + (kill-buffer proc-buffer)))) + (org-export-add-to-stack proc-buffer nil p) + (ding) + (message "Process `%s' exited abnormally" p)) + (unless org-export-async-debug + (delete-file temp-file)))))))))))) ;;;###autoload (defun org-export-to-buffer - (backend buffer - &optional async subtreep visible-only body-only ext-plist - post-process) + (backend buffer + &optional async subtreep visible-only body-only ext-plist + post-process) "Call `org-export-as' with output to a specified buffer. BACKEND is either an export back-end, as returned by, e.g., @@ -6301,14 +6376,15 @@ This function returns BUFFER." (declare (indent 2)) (if async (org-export-async-start - `(lambda (output) - (with-current-buffer (get-buffer-create ,buffer) - (erase-buffer) - (setq buffer-file-coding-system ',buffer-file-coding-system) - (insert output) - (goto-char (point-min)) - (org-export-add-to-stack (current-buffer) ',backend) - (ignore-errors (funcall ,post-process)))) + (let ((cs buffer-file-coding-system)) + (lambda (output) + (with-current-buffer (get-buffer-create buffer) + (erase-buffer) + (setq buffer-file-coding-system cs) + (insert output) + (goto-char (point-min)) + (org-export-add-to-stack (current-buffer) backend) + (ignore-errors (funcall post-process))))) `(org-export-as ',backend ,subtreep ,visible-only ,body-only ',ext-plist)) (let ((output @@ -6329,8 +6405,8 @@ This function returns BUFFER." ;;;###autoload (defun org-export-to-file - (backend file &optional async subtreep visible-only body-only ext-plist - post-process) + (backend file &optional async subtreep visible-only body-only ext-plist + post-process) "Call `org-export-as' with output to a specified file. BACKEND is either an export back-end, as returned by, e.g., @@ -6364,11 +6440,12 @@ or FILE." (declare (indent 2)) (if (not (file-writable-p file)) (error "Output file not writable") (let ((ext-plist (org-combine-plists `(:output-file ,file) ext-plist)) - (encoding (or org-export-coding-system buffer-file-coding-system))) + (encoding (or org-export-coding-system buffer-file-coding-system)) + auto-mode-alist) (if async (org-export-async-start - `(lambda (file) - (org-export-add-to-stack (expand-file-name file) ',backend)) + (lambda (file) + (org-export-add-to-stack (expand-file-name file) backend)) `(let ((output (org-export-as ',backend ,subtreep ,visible-only ,body-only @@ -6422,7 +6499,10 @@ Return file name as a string." (throw :found (org-element-property :value element)))))))) ;; Extract from buffer's associated file, if any. - (and visited-file (file-name-nondirectory visited-file)) + (and visited-file + (file-name-nondirectory + ;; For a .gpg visited file, remove the .gpg extension: + (replace-regexp-in-string "\\.gpg\\'" "" visited-file))) ;; Can't determine file name on our own: ask user. (read-file-name "Output file: " pub-dir nil nil nil @@ -6483,7 +6563,7 @@ If optional argument SOURCE is non-nil, remove it instead." (let ((source (or source (org-export--stack-source-at-point)))) (setq org-export-stack-contents (cl-remove-if (lambda (el) (equal (car el) source)) - org-export-stack-contents)))) + org-export-stack-contents)))) (defun org-export-stack-view (&optional in-emacs) "View export results at point in stack. @@ -6499,16 +6579,16 @@ within Emacs." (defvar org-export-stack-mode-map (let ((km (make-sparse-keymap))) (set-keymap-parent km tabulated-list-mode-map) - (define-key km " " 'next-line) - (define-key km "\C-n" 'next-line) - (define-key km [down] 'next-line) - (define-key km "\C-p" 'previous-line) - (define-key km "\C-?" 'previous-line) - (define-key km [up] 'previous-line) - (define-key km "C" 'org-export-stack-clear) - (define-key km "v" 'org-export-stack-view) - (define-key km (kbd "RET") 'org-export-stack-view) - (define-key km "d" 'org-export-stack-remove) + (define-key km " " #'next-line) + (define-key km "\C-n" #'next-line) + (define-key km [down] #'next-line) + (define-key km "\C-p" #'previous-line) + (define-key km "\C-?" #'previous-line) + (define-key km [up] #'previous-line) + (define-key km "C" #'org-export-stack-clear) + (define-key km "v" #'org-export-stack-view) + (define-key km (kbd "RET") #'org-export-stack-view) + (define-key km "d" #'org-export-stack-remove) km) "Keymap for Org Export Stack.") @@ -6706,7 +6786,7 @@ back to standard interface." ;; on the first key, if any. A nil value means KEY will ;; only be activated at first level. (if (or (eq access-key t) (eq access-key first-key)) - (propertize key 'face 'org-warning) + (propertize key 'face 'org-dispatcher-highlight) key))) (fontify-value (lambda (value) @@ -6725,16 +6805,16 @@ back to standard interface." (cond ((and (numberp key-a) (numberp key-b)) (< key-a key-b)) ((numberp key-b) t))))) - 'car-less-than-car)) + #'car-less-than-car)) ;; Compute a list of allowed keys based on the first key ;; pressed, if any. Some keys ;; (?^B, ?^V, ?^S, ?^F, ?^A, ?&, ?# and ?q) are always ;; available. (allowed-keys (nconc (list 2 22 19 6 1) - (if (not first-key) (org-uniquify (mapcar 'car entries)) + (if (not first-key) (org-uniquify (mapcar #'car entries)) (let (sub-menu) - (dolist (entry entries (sort (mapcar 'car sub-menu) '<)) + (dolist (entry entries (sort (mapcar #'car sub-menu) #'<)) (when (eq (car entry) first-key) (setq sub-menu (append (nth 2 entry) sub-menu)))))) (cond ((eq first-key ?P) (list ?f ?p ?x ?a)) commit dc94ca7b2b878c9a88be72fea118bf6557259ffd Author: Amin Bandali Date: Wed Sep 29 23:11:49 2021 -0400 Add new '/wii' convenience ERC command * etc/NEWS: Announce the addition of the command. * lisp/erc/erc.el (erc-cmd-WII): Add '/wii' convenience command which calls the '/whois' command with the given nick as both arguments, which is useful for displaying the whois information for the nick along with idle time, even if the nick is on a different server than the one we are currently connected to. diff --git a/etc/NEWS b/etc/NEWS index d57f67ea40..c75ec35ff1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2881,6 +2881,15 @@ The new '/opme' convenience command asks ChanServ to set the operator status for the current nick in the current channel, and '/deopme' unsets it. +--- +*** Add '/wii' convenience command for whois with idle time. +The new '/wii' convenience command calls the '/whois' command with the +given nick as both arguments, which is useful for displaying the whois +information for the nick along with idle time, even if the nick is on +a different server than the one the current user is connected to. +Using the given nick itself instead of the server it is connected to +is not standardized, but is widely supported across IRC networks. + ** xwidget-webkit mode --- diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index ccb1f63bc3..2427332189 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -3321,6 +3321,18 @@ the idle time of that user." t)) (defalias 'erc-cmd-WI #'erc-cmd-WHOIS) +(defun erc-cmd-WII (nick) + "Display whois information for NICK, including idle time. + +This is a convenience function which calls `erc-cmd-WHOIS' with +the given NICK for both arguments. Using NICK in place of the +server argument -- effectively delegating to the IRC network the +looking up of the server to which NICK is connected -- is not +standardized, but is widely supported across IRC networks. + +See `erc-cmd-WHOIS' for more details." + (erc-cmd-WHOIS nick nick)) + (defun erc-cmd-WHOAMI () "Display whois information about yourself." (erc-cmd-WHOIS (erc-current-nick)) commit 9fc1fdcbf330b0a85cd019bb75afcb8d36243524 Author: Amin Bandali Date: Wed Sep 29 22:15:07 2021 -0400 Restore the previous order of ERC's '/whois' arguments * etc/NEWS: Remove unneeded entry. * lisp/erc/erc.el (erc-cmd-WHOIS): Restore the previous order of arguments sent to the server, so that there's no change in the function's behavior. Instead, rename the arguments to be more accurate, and expand upon them in the doc string. diff --git a/etc/NEWS b/etc/NEWS index 25164d5364..d57f67ea40 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2881,11 +2881,6 @@ The new '/opme' convenience command asks ChanServ to set the operator status for the current nick in the current channel, and '/deopme' unsets it. ---- -*** Fix the order of '/whois' arguments sent to the server. -Per RFC 1459 and RFC 2812, when given, the optional 'server' argument -for the WHOIS command must come before the 'user' argument, not after. - ** xwidget-webkit mode --- diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 7fa2d37c9f..ccb1f63bc3 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -3298,17 +3298,24 @@ a script after exceeding the flood threshold." t) (t nil))) -(defun erc-cmd-WHOIS (user &optional server) - "Display whois information for USER. - -If SERVER is non-nil, use that, rather than the current server. -This is useful for getting the time USER has been idle for, if -USER is on a different server of the network than the current -user, since only the server the user is connected to knows this -information." - (let ((send (if server - (format "WHOIS %s %s" server user) - (format "WHOIS %s" user)))) +(defun erc-cmd-WHOIS (nick-or-server &optional nick-if-server) + "Display whois information for the given user. + +If NICK-IF-SERVER is nil, NICK-OR-SERVER should be the nick of +the user about whom the whois information is to be requested. +Otherwise, if NICK-IF-SERVER is non-nil, NICK-OR-SERVER should be +the server to which the user with the nick NICK-IF-USER is +connected to. + +Specifying the server NICK-OR-SERVER that the nick NICK-IF-SERVER +is connected to is useful for getting the time the NICK-IF-SERVER +user has been idle for, when the user NICK-IF-SERVER is connected +to a different server of the network than the one current user is +connected to, since only the server a user is connected to knows +the idle time of that user." + (let ((send (if nick-if-server + (format "WHOIS %s %s" nick-or-server nick-if-server) + (format "WHOIS %s" nick-or-server)))) (erc-log (format "cmd: %s" send)) (erc-server-send send) t)) commit 758753431af51f7ac79a55d426b915443e66a077 Author: Stefan Kangas Date: Thu Sep 30 01:17:24 2021 +0200 New command mpc-goto-playing-song * lisp/mpc.el (mpc-goto-playing-song): New command to go to the currently playing song. (mpc-mode-map): Bind it to "o". diff --git a/etc/NEWS b/etc/NEWS index 0c5a1004e7..25164d5364 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3025,6 +3025,11 @@ See 'rcirc-reconnect-attempts'. ** MPC +--- +*** New command 'mpc-goto-playing-song'. +This command, bound to 'o' in any 'mpc-mode' buffer, moves point to +the currently playing song in the "*Songs*" buffer. + --- *** New user option 'mpc-cover-image-re'. If non-nil, it is a regexp that should match a valid cover image. diff --git a/lisp/mpc.el b/lisp/mpc.el index c7ae08baee..913146415e 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -1150,6 +1150,7 @@ If PLAYLIST is t or nil or missing, use the main playlist." (define-key map ">" #'mpc-next) (define-key map "<" #'mpc-prev) (define-key map "g" #'mpc-seek-current) + (define-key map "o" #'mpc-goto-playing-song) map)) (easy-menu-define mpc-mode-menu mpc-mode-map @@ -2670,6 +2671,18 @@ If stopped, start playback." (mpc-select event) (mpc-play)) +(defun mpc-goto-playing-song () + "Move point to the currently playing song in the \"*Songs*\" buffer." + (interactive) + (let* ((buf (mpc-proc-buffer (mpc-proc) 'songs)) + (win (get-buffer-window buf))) + (when (and (buffer-live-p buf) win) + (select-window win) + (with-current-buffer buf + (when (and overlay-arrow-position + (eq (marker-buffer overlay-arrow-position) buf)) + (goto-char (marker-position overlay-arrow-position))))))) + ;; (defun mpc-play-tagval () ;; "Play all the songs of the tag at point." ;; (interactive) commit 49c748e336ee3c50e28d2aeda6396efc358d961b Author: Stefan Kangas Date: Wed Sep 29 20:33:45 2021 +0200 * lisp/linum.el: Recommend `display-line-numbers-mode'. diff --git a/lisp/linum.el b/lisp/linum.el index c78f596d76..1e029e508e 100644 --- a/lisp/linum.el +++ b/lisp/linum.el @@ -28,6 +28,9 @@ ;; ;; Toggle display of line numbers with M-x linum-mode. To enable ;; line numbering in all buffers, use M-x global-linum-mode. +;; +;; Consider using native line numbers instead: +;; M-x display-line-numbers-mode ;;; Code: commit 6fecf6ef2552a9b44c4311b7d5af3af0a5a54dbe Author: Dmitry Gutov Date: Wed Sep 29 22:44:40 2021 +0300 Add bindings for 'undo-redo' * etc/NEWS: Describe the change. * lisp/bindings.el (global-map): Add bindings for 'undo-redo'. * lisp/simple.el (undo-no-redo): Turn into a user option. diff --git a/etc/NEWS b/etc/NEWS index 0a8249e298..0c5a1004e7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -957,7 +957,11 @@ for CJK text mixed with Latin text. +++ ** New command 'undo-redo'. It undoes previous undo commands, but doesn't record itself as an -undoable command. +undoable command. It is bound to 'C-?' and 'C-M-_', the first binding +works well in graphical mode, and the second one is easy to hit on tty. + +For full conventional undo/redo behavior, you can also customize the +user option 'undo-no-redo' to t. +++ ** New commands 'copy-matching-lines' and 'kill-matching-lines'. diff --git a/lisp/bindings.el b/lisp/bindings.el index 343f1ba0fa..9a3505058c 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -994,6 +994,9 @@ if `inhibit-field-text-motion' is non-nil." "Keymap to repeat undo key sequences `C-x u u'. Used in `repeat-mode'.") (put 'undo 'repeat-map 'undo-repeat-map) +(define-key global-map (kbd "C-?") 'undo-redo) +(define-key global-map [?\C-\M-_] 'undo-redo) + (define-key esc-map "!" 'shell-command) (define-key esc-map "|" 'shell-command-on-region) (define-key esc-map "&" 'async-shell-command) diff --git a/lisp/simple.el b/lisp/simple.el index dd480396f6..7eba33116d 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2942,8 +2942,9 @@ undo record: if we undo from 4, `pending-undo-list' will be at 3, (defvar undo-in-region nil "Non-nil if `pending-undo-list' is not just a tail of `buffer-undo-list'.") -(defvar undo-no-redo nil - "If t, `undo' doesn't go through redo entries.") +(defcustom undo-no-redo nil + "If t, `undo' doesn't go through redo entries." + :type 'boolean) (defvar pending-undo-list nil "Within a run of consecutive undo commands, list remaining to be undone. commit fd244c9e46f52d8b2de4adeb457cd3b021bebfff Author: Juri Linkov Date: Wed Sep 29 22:40:20 2021 +0300 * lisp/tab-bar.el (tab-bar-move-tab-to-frame): Delete frame with last tab. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 9f64e2d1ee..634328e223 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1201,6 +1201,7 @@ Interactively, ARG selects the ARGth different frame to move to." (nthcdr to-index to-tabs)) (with-selected-frame from-frame (let ((inhibit-message t) ; avoid message about deleted tab + (tab-bar-close-last-tab-choice 'delete-frame) tab-bar-closed-tabs) (tab-bar-close-tab from-number))) (tab-bar-tabs-set to-tabs to-frame) commit ab1e11fe796c404cad2d73dafd81da8b4329ca90 Author: Adam Porter Date: Wed Sep 29 22:37:38 2021 +0300 * lisp/tab-bar.el: (tab-bar-detach-tab) New command (tab-bar-detach-tab): New command. (tab-bar-mouse-context-menu): Add menu entry. With thanks to Matt Beshara for his feedback. https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg02141.html diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index abf0e814c4..9f64e2d1ee 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -312,6 +312,11 @@ that closes only when clicked on the close button." (tab-bar-duplicate-tab nil ,tab-number)) :help "Duplicate the tab")) + (define-key-after menu [detach-tab] + `(menu-item "Detach" (lambda () (interactive) + (tab-bar-detach-tab + ,tab-number)) + :help "Detach the tab to new frame")) (define-key-after menu [close] `(menu-item "Close" (lambda () (interactive) (tab-bar-close-tab ,tab-number)) @@ -1201,6 +1206,17 @@ Interactively, ARG selects the ARGth different frame to move to." (tab-bar-tabs-set to-tabs to-frame) (force-mode-line-update t)))) +(defun tab-bar-detach-tab (&optional from-number) + "Detach tab number FROM-NUMBER to a new frame. +Interactively or without argument, detach current tab." + (interactive (list (1+ (tab-bar--current-tab-index)))) + (let* ((tab (nth (1- (or from-number 1)) (funcall tab-bar-tabs-function))) + (tab-name (alist-get 'name tab)) + (new-frame (make-frame `((name . ,tab-name))))) + (tab-bar-move-tab-to-frame nil nil from-number new-frame nil) + (with-selected-frame new-frame + (tab-bar-close-tab)))) + (defcustom tab-bar-new-tab-to 'right "Defines where to create a new tab. commit b0f7a27a919a5770a05ac774a4ed980588d37993 Author: Lars Ingebrigtsen Date: Wed Sep 29 20:48:41 2021 +0200 Tweak previous message-newline-and-reformat change * lisp/gnus/message.el (message-newline-and-reformat): Only search for previous/next cited lines that have space, because it's the space we're trying to find. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index f51f5c0dd0..d460f9bd92 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -3577,7 +3577,7 @@ Prefix arg means justify as well." ;; case, the trailing space is commonly not present, so look ;; around for other lines that have some data. (when (looking-at-p "\n") - (let ((regexp (concat "^" message-cite-prefix-regexp "."))) + (let ((regexp (concat "^" message-cite-prefix-regexp "[ \t]"))) (when (or (re-search-backward regexp nil t) (re-search-forward regexp nil t)) (goto-char (1- (match-end 0)))))) commit 923b89248cb79d3185264f1175099d549fdaa5bf Author: Lars Ingebrigtsen Date: Wed Sep 29 19:10:00 2021 +0200 Cross reference `dired-do-revert-buffer' * lisp/dired-aux.el (dired-do-copy): (dired-do-symlink): (dired-do-hardlink): (dired-do-rename): Mention `dired-do-revert-buffer'. diff --git a/etc/NEWS b/etc/NEWS index 4726827b7a..0a8249e298 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1206,6 +1206,7 @@ If set to non-nil, Dired will dereference symbolic links when copying. This can be switched off on a per-usage basis by providing 'dired-do-copy' with a 'C-u' prefix. +--- *** New user option 'dired-do-revert-buffer'. Non-nil reverts the destination Dired buffer after performing one of these operations: 'dired-do-copy', 'dired-do-rename', diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 397c5c67cb..4b8d271071 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2398,7 +2398,9 @@ But if `dired-copy-dereference' is non-nil, the symbolic links are dereferenced and then copied, similar to the \"-L\" option for the \"cp\" shell command. If ARG is a cons with element 4 (`\\[universal-argument]'), the inverted value of -`dired-copy-dereference' will be used." +`dired-copy-dereference' will be used. + +Also see `dired-do-revert-buffer'." (interactive "P") (let ((dired-recursive-copies dired-recursive-copies) (dired-copy-dereference (if (equal arg '(4)) @@ -2419,7 +2421,9 @@ with the same names that the files currently have. The default suggested for the target directory depends on the value of `dired-dwim-target', which see. -For relative symlinks, use \\[dired-do-relsymlink]." +For relative symlinks, use \\[dired-do-relsymlink]. + +Also see `dired-do-revert-buffer'." (interactive "P") (dired-do-create-files 'symlink #'make-symbolic-link "Symlink" arg dired-keep-marker-symlink)) @@ -2432,7 +2436,9 @@ When operating on multiple or marked files, you specify a directory and new hard links are made in that directory with the same names that the files currently have. The default suggested for the target directory depends on the value of -`dired-dwim-target', which see." +`dired-dwim-target', which see. + +Also see `dired-do-revert-buffer'." (interactive "P") (dired-do-create-files 'hardlink #'dired-hardlink "Hardlink" arg dired-keep-marker-hardlink)) @@ -2451,7 +2457,9 @@ When renaming just the current file, you specify the new name. When renaming multiple or marked files, you specify a directory. This command also renames any buffers that are visiting the files. The default suggested for the target directory depends on the value -of `dired-dwim-target', which see." +of `dired-dwim-target', which see. + +Also see `dired-do-revert-buffer'." (interactive "P") (dired-do-create-files 'move #'dired-rename-file "Move" arg dired-keep-marker-rename "Rename")) commit 78649d7198c19b8aab2bc1e524d0cb5657891611 Author: Lars Ingebrigtsen Date: Wed Sep 29 19:07:08 2021 +0200 Do some NEWS taggin diff --git a/etc/NEWS b/etc/NEWS index 475d294270..4726827b7a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1185,6 +1185,7 @@ for a list of supported suffixes. --- *** Broken and circular links are shown with the 'dired-broken-symlink' face. +--- *** '=' ('dired-diff') will now put all backup files into the 'M-n' history. When using '=' on a file with backup files, the default file to use for diffing is the newest backup file. You can now use 'M-n' to quickly @@ -1624,8 +1625,10 @@ either an internal or external browser. If a remote file is specified, a local temporary copy of that file is passed to the browser. +--- *** Support for the conkeror browser is now obsolete. +--- *** Support for the Mosaic browser has been removed. This support has been obsolete since 25.1. commit aa3a1cee65376cb34906151a9a8c1224352ae35c Author: Stefan Kangas Date: Wed Sep 29 18:59:28 2021 +0200 * etc/TODO: Delete ImageMagick items. (Bug#50891) diff --git a/etc/TODO b/etc/TODO index e2d1c19a00..792552f1dd 100644 --- a/etc/TODO +++ b/etc/TODO @@ -1184,45 +1184,6 @@ Instead, if B has not been customized it should be re-initialized See the places where we manually call custom-reevaluate-setting, such as for mail-host-address and user-mail-address in startup.el. -** ImageMagick support - -*** Image priority -'image-type-header-regexps' prioritizes the jpeg loader over the -ImageMagick one. This is not wrong, but how should a user go about -preferring the ImageMagick loader? The user might like zooming etc in jpegs. - -Try (setq image-type-header-regexps nil) for a quick hack to prefer -ImageMagick over the jpg loader. - -*** Slow display -For some reason it's unbearably slow to look at a page in a large -image bundle using the :index feature. The ImageMagick "display" -command is also a bit slow, but nowhere near as slow as the Emacs -code. It seems ImageMagick tries to unpack every page when loading the -bundle. This feature is not the primary usecase in Emacs though. - -ImageMagick 6.6.2-9 introduced a bugfix for single page djvu load. It -is now much faster to use the :index feature, but still not very fast. - -*** Try to cache the num pages calculation -It can take a while to calculate the number of pages, and if you need -to do it for each page view, page-flipping becomes uselessly slow. - -*** Integrate with image-dired - -*** Integrate with docview - -*** Integrate with image-mode -Some work has been done, e.g. "M-x image-transform-fit-to-height" will -fit the image to the height of the Emacs window. - -*** Look for optimizations for handling images with low depth -Currently the code seems to default to 24 bit RGB which is costly for -images with lower bit depth. - -*** Decide what to do with some uncommitted imagemagick support -Functions for image size etc. - ** nxml mode *** High priority commit 6788d7b01528ebe2d6d6c4b93f24db175b5ab1e7 Author: Lars Ingebrigtsen Date: Wed Sep 29 18:44:41 2021 +0200 Make `M-q' in message-mode work better * lisp/gnus/message.el (message-newline-and-reformat): Fix bug#43299 differently. (message-newline-and-reformat): Revert change for bug#43299. This fixes bug#50842. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 4a754b9856..f51f5c0dd0 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -3572,8 +3572,18 @@ Prefix arg means justify as well." (when (looking-at message-cite-prefix-regexp) (setq quoted (match-string 0)) (goto-char (match-end 0)) - (looking-at "[ \t]*") - (setq leading-space (match-string 0))) + (let ((after (point))) + ;; This is a line with no text after the cite prefix. In that + ;; case, the trailing space is commonly not present, so look + ;; around for other lines that have some data. + (when (looking-at-p "\n") + (let ((regexp (concat "^" message-cite-prefix-regexp "."))) + (when (or (re-search-backward regexp nil t) + (re-search-forward regexp nil t)) + (goto-char (1- (match-end 0)))))) + (looking-at "[ \t]*") + (setq leading-space (match-string 0)) + (goto-char after))) (if (and quoted (not not-break) (not bolp) @@ -3590,7 +3600,7 @@ Prefix arg means justify as well." (equal quoted (match-string 0))) (goto-char (match-end 0)) (looking-at "[ \t]*") - (when (< (length leading-space) (length (match-string 0))) + (when (> (length leading-space) (length (match-string 0))) (setq leading-space (match-string 0))) (forward-line 1)) (setq end (point)) commit e72a8c6426b1fa50b2f1554797877a35569bb246 Author: Stefan Kangas Date: Wed Sep 29 18:22:43 2021 +0200 Force volume to an integer divisible by mpc-volume-step * lisp/mpc.el (mpc-volume-mouse-set): Force volume to an integer divisible by 'mpc-volume-step'. (mpc-volume-step): Add docstring. diff --git a/lisp/mpc.el b/lisp/mpc.el index ad32ce8d33..c7ae08baee 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -1881,7 +1881,8 @@ A value of t means the main playlist.") (when (buffer-live-p status-buf) (with-current-buffer status-buf (force-mode-line-update))))) -(defvar mpc-volume-step 5) +(defvar mpc-volume-step 5 + "Change volume in increments of this integer.") (defun mpc-volume-mouse-set (&optional event) "Change volume setting." @@ -1895,7 +1896,7 @@ A value of t means the main playlist.") '(?◁ ?<)) (- mpc-volume-step) mpc-volume-step)) (curvol (string-to-number (cdr (assq 'volume mpc-status)))) - (newvol (max 0 (min 100 (+ curvol diff))))) + (newvol (max 0 (min 100 (+ (- curvol (mod curvol diff)) diff))))) (if (= newvol curvol) (progn (message "MPD volume already at %s%%" newvol) commit 1aaeed903a1a9bdb60c745180e13a2e0a313a9bc Author: Lars Ingebrigtsen Date: Wed Sep 29 17:43:16 2021 +0200 Signal an error in `search-forward-help-for-help' * lisp/help.el (search-forward-help-for-help): Error out instead of showing an empty buffer (bug#50881). diff --git a/lisp/help.el b/lisp/help.el index b794751eca..02e9b9e8e4 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -952,8 +952,11 @@ current buffer." (describe-function-1 defn))))))) (defun search-forward-help-for-help () - "Search forward \"help window\"." + "Search forward in the help-for-help window. +This command is meant to be used after issuing the `C-h C-h' command." (interactive) + (unless (get-buffer help-for-help-buffer-name) + (error "No %s buffer; use `C-h C-h' first" help-for-help-buffer-name)) ;; Move cursor to the "help window". (pop-to-buffer help-for-help-buffer-name) ;; Do incremental search forward. commit dab846e04ff9e4524a730936306ead149f9b9760 Author: Lars Ingebrigtsen Date: Wed Sep 29 17:27:20 2021 +0200 Add a comment about bug#50877 for gnus-set-difference diff --git a/lisp/gnus/gnus-range.el b/lisp/gnus/gnus-range.el index 456209f3d9..a8f09b6371 100644 --- a/lisp/gnus/gnus-range.el +++ b/lisp/gnus/gnus-range.el @@ -40,6 +40,8 @@ If RANGE is a single range, return (RANGE). Otherwise, return RANGE." (define-obsolete-function-alias 'gnus-copy-sequence 'copy-tree "27.1") +;;; We could be using `seq-difference' here, but it's much slower +;;; on these data sets. See bug#50877. (defun gnus-set-difference (list1 list2) "Return a list of elements of LIST1 that do not appear in LIST2." (let ((hash2 (make-hash-table :test 'eq)) commit b4b4cc98ac271d079916a4c412e134fe5b4ba4d8 Author: Lars Ingebrigtsen Date: Wed Sep 29 17:25:01 2021 +0200 Revert "Obsolete local set difference functions in favor of seq-difference" This reverts commit 20f7fa691b7c2859b96550d9ccb326bf394e160d. gnus-set-difference is orders of magnitude faster than seq-difference (on these sets), and using seq-difference makes nnimap too slow. diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 52c080388b..451ff19631 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -490,7 +490,6 @@ Equality is defined by TESTFN if non-nil or by `equal' if nil." (seq-reverse sequence1) '())) -;;;###autoload (cl-defgeneric seq-difference (sequence1 sequence2 &optional testfn) "Return a list of the elements that appear in SEQUENCE1 but not in SEQUENCE2. Equality is defined by TESTFN if non-nil or by `equal' if nil." diff --git a/lisp/gnus/gnus-cite.el b/lisp/gnus/gnus-cite.el index 34947cece8..e9c912109e 100644 --- a/lisp/gnus/gnus-cite.el +++ b/lisp/gnus/gnus-cite.el @@ -839,7 +839,7 @@ See also the documentation for `gnus-article-highlight-citation'." (setq current (car loop) loop (cdr loop)) (setcdr current - (seq-difference (cdr current) numbers #'eq))))))))) + (gnus-set-difference (cdr current) numbers))))))))) (defun gnus-cite-parse-attributions () (let (al-alist) @@ -999,7 +999,7 @@ See also the documentation for `gnus-article-highlight-citation'." loop (cdr loop)) (if (eq current best) () - (setcdr current (seq-difference (cdr current) numbers #'eq)) + (setcdr current (gnus-set-difference (cdr current) numbers)) (when (null (cdr current)) (setq gnus-cite-loose-prefix-alist (delq current gnus-cite-loose-prefix-alist) diff --git a/lisp/gnus/gnus-range.el b/lisp/gnus/gnus-range.el index 7d12ae9fdc..456209f3d9 100644 --- a/lisp/gnus/gnus-range.el +++ b/lisp/gnus/gnus-range.el @@ -42,8 +42,13 @@ If RANGE is a single range, return (RANGE). Otherwise, return RANGE." (defun gnus-set-difference (list1 list2) "Return a list of elements of LIST1 that do not appear in LIST2." - (declare (obsolete seq-difference "28.1")) - (seq-difference list1 list2 #'eq)) + (let ((hash2 (make-hash-table :test 'eq)) + (result nil)) + (dolist (elt list2) (puthash elt t hash2)) + (dolist (elt list1) + (unless (gethash elt hash2) + (setq result (cons elt result)))) + (nreverse result))) (defun gnus-range-nconcat (&rest ranges) "Return a range comprising all the RANGES, which are pre-sorted. diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index b3d0460032..d790655aa9 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -8590,9 +8590,8 @@ If UNREPLIED (the prefix), limit to unreplied articles." (interactive "P" gnus-summary-mode) (if unreplied (gnus-summary-limit - (seq-difference gnus-newsgroup-articles - gnus-newsgroup-replied - #'eq)) + (gnus-set-difference gnus-newsgroup-articles + gnus-newsgroup-replied)) (gnus-summary-limit gnus-newsgroup-replied)) (gnus-summary-position-point)) diff --git a/lisp/gnus/gnus-uu.el b/lisp/gnus/gnus-uu.el index f7b761ee33..778a8a3ea0 100644 --- a/lisp/gnus/gnus-uu.el +++ b/lisp/gnus/gnus-uu.el @@ -579,7 +579,7 @@ didn't work, and overwrite existing files. Otherwise, ask each time." (defun gnus-new-processable (unmarkp articles) (if unmarkp (nreverse (seq-intersection gnus-newsgroup-processable articles #'eq)) - (seq-difference articles gnus-newsgroup-processable #'eq))) + (gnus-set-difference articles gnus-newsgroup-processable))) (defun gnus-uu-mark-by-regexp (regexp &optional unmark) "Set the process mark on articles whose subjects match REGEXP. diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 8a48cd87db..059101c890 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -1638,15 +1638,13 @@ If LIMIT, first try to limit the search to the N last articles." (setq start-article 1)) (let* ((unread (gnus-compress-sequence - (seq-difference - (seq-difference + (gnus-set-difference + (gnus-set-difference existing (gnus-sorted-union (cdr (assoc '%Seen flags)) - (cdr (assoc '%Deleted flags))) - #'eq) - (cdr (assoc '%Flagged flags)) - #'eq))) + (cdr (assoc '%Deleted flags)))) + (cdr (assoc '%Flagged flags))))) (read (gnus-range-difference (cons start-article high) unread))) (when (> start-article 1) diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el index 3f978918b9..d00f0a60b6 100644 --- a/lisp/gnus/spam.el +++ b/lisp/gnus/spam.el @@ -710,8 +710,16 @@ finds ham or spam.") (defun spam-set-difference (list1 list2) "Return a set difference of LIST1 and LIST2. When either list is nil, the other is returned." - (declare (obsolete seq-difference "28.1")) - (seq-difference list1 list2 #'eq)) + (if (and list1 list2) + ;; we have two non-nil lists + (progn + (dolist (item (append list1 list2)) + (when (and (memq item list1) (memq item list2)) + (setq list1 (delq item list1)) + (setq list2 (delq item list2)))) + (append list1 list2)) + ;; if either of the lists was nil, return the other one + (if list1 list1 list2))) (defun spam-group-ham-mark-p (group mark &optional spam) "Checks if MARK is considered a ham mark in GROUP." @@ -1319,7 +1327,7 @@ In the case of mover backends, checks the setting of (new-articles (spam-list-articles gnus-newsgroup-articles classification)) - (changed-articles (seq-difference new-articles old-articles #'eq))) + (changed-articles (spam-set-difference new-articles old-articles))) ;; now that we have the changed articles, we go through the processors (dolist (backend (spam-backend-list)) (let (unregister-list) commit e457cff3f48b6fc3fe9efc30b9896181c59011da Author: Michael Albinus Date: Wed Sep 29 14:51:39 2021 +0200 * test/Makefile.in (WRITE_LOG): Add emacs-module-tests as problematic. diff --git a/test/Makefile.in b/test/Makefile.in index e0a2b7799a..d82f53157b 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -167,7 +167,7 @@ lisp/net/tramp-tests.log \ : WRITE_LOG = 2>&1 | tee $@ endif ifdef EMACS_EMBA_CI -lisp/filenotify-tests.log lisp/net/tramp-tests.log \ +lisp/filenotify-tests.log lisp/net/tramp-tests.log src/emacs-module-tests.el \ : WRITE_LOG = 2>&1 | tee $@ endif commit 7c79eea51dbbe84e6ee01db30dae87ff373b7f3b Author: Protesilaos Stavrou Date: Wed Sep 29 11:40:32 2021 +0300 Update modus-themes to version 1.6.0 * doc/misc/modus-themes.org (Customization Options): Document new user options in code sample. (Option for inhibiting theme reload): Remove trailing space. (Option for mode line presentation): Include new possible value. (Option for Org agenda constructs): Include new symbols for the 'modus-themes-org-agenda' alist. (Control the scale of headings): Document 'modus-themes-scale-small'. (Override color saturation (DIY)): Fix markup for proper texi output. (Custom Org user faces (DIY)): Update code samples. (Full support for packages or face groups): Note names of newly supported packages or face groups. (Indirectly covered packages): Document indirectly supported packages. (Note on highlight-parentheses.el): Provide detailed instructions on how to use 'highlight-parentheses' with the Modus themes. (Note on prism.el): Refine code samples. (What is the best setup for legibility?): Minor rewording. (Sources of the themes): Mention only Emacs28 without explaining that it is the development target---in preparation of the emacs-28 branch cut. (Acknowledgements): Name new contributors to code/ideas. Stephen Gildea's patch was a couple lines long. The others have assigned copyright to the FSF. (Meta): Include another link to the development notes of the themes about 'modus-themes-org-agenda'. * etc/themes/modus-operandi-theme.el, etc/themes/modus-vivendi-theme.el: Bump file version. * etc/themes/modus-themes.el (modus-themes-operandi-colors) (modus-themes-vivendi-colors): Recalibrate some colour values and add a few new ones. (modus-themes-slanted-constructs): Remove obsolete user option. Superseded by the alias 'modus-themes-italic-constructs'. (modus-themes-org-agenda, modus-themes-mode-line): Update user option. (modus-themes-scale-headings, modus-themes-scale-4): Update doc string. (modus-themes-scale-5): Remove obsolete user option. Superseded by the alias 'modus-themes-scale-title'. (modus-themes-scale-small, modus-themes-tabs-accented): Add new user option. (modus-themes--agenda-date, modus-themes--mode-line-attrs) (modus-themes--tab): Update internal functions. (modus-themes-faces): Update variousface attributes. Detailed change log here: . diff --git a/doc/misc/modus-themes.org b/doc/misc/modus-themes.org index 6c3692b826..675144d517 100644 --- a/doc/misc/modus-themes.org +++ b/doc/misc/modus-themes.org @@ -5,9 +5,9 @@ #+options: ':t toc:nil author:t email:t num:t #+startup: content -#+macro: stable-version 1.5.0 -#+macro: release-date 2021-07-15 -#+macro: development-version 1.6.0-dev +#+macro: stable-version 1.6.0 +#+macro: release-date 2021-09-29 +#+macro: development-version 1.7.0-dev #+macro: file @@texinfo:@file{@@$1@@texinfo:}@@ #+macro: space @@texinfo:@: @@ #+macro: kbd @@texinfo:@kbd{@@$1@@texinfo:}@@ @@ -383,6 +383,7 @@ this manual. modus-themes-no-mixed-fonts nil modus-themes-subtle-line-numbers nil modus-themes-success-deuteranopia t + modus-themes-tabs-accented t modus-themes-inhibit-reload t ; only applies to `customize-set-variable' and related modus-themes-fringes nil ; {nil,'subtle,'intense} @@ -395,9 +396,8 @@ this manual. ;; Options for `modus-themes-mode-line' are either nil, or a list ;; that can combine any of `3d' OR `moody', `borderless', - ;; `accented'. The variable's doc string shows all possible - ;; combinations. - modus-themes-mode-line '(3d accented) + ;; `accented', `padded'. + modus-themes-mode-line '(padded accented borderless) ;; Options for `modus-themes-syntax' are either nil (the default), ;; or a list of properties that may include any of those symbols: @@ -443,6 +443,7 @@ this manual. modus-themes-org-agenda ; this is an alist: read the manual or its doc string '((header-block . (variable-pitch scale-title)) (header-date . (grayscale workaholic bold-today)) + (event . (accented scale-small)) (scheduled . uniform) (habit . traffic-light-deuteranopia)) @@ -473,7 +474,7 @@ Symbol: ~modus-themes-inhibit-reload~ Possible values: -1. ~nil~ +1. ~nil~ 2. ~t~ (default) By default, customizing a theme-related user option through the Custom @@ -803,6 +804,7 @@ effect, color, and border visibility: - ~moody~ + ~accented~ + ~borderless~ ++ ~padded~ The default (a nil value or an empty list) is a two-dimensional rectangle with a border around it. The active and the inactive @@ -829,6 +831,13 @@ the same as the background, effectively creating some padding. The ~accented~ property ensures that the active mode line uses a colored background instead of the standard shade of gray. +The ~padded~ property increases the apparent height of the mode line. +This is done by applying box effects and combining them with an +underline and overline. To ensure that the underline is placed at the +bottom, set ~x-underline-at-descent-line~ to non-nil. The ~padded~ property +has no effect when the ~moody~ property is also used, because Moody +already applies its own padding. + Combinations of any of those properties are expressed as a list, like in these examples: @@ -843,7 +852,7 @@ The order in which the properties are set is not significant. In user configuration files the form may look like this: #+begin_src emacs-lisp -(setq modus-themes-prompts '(borderless accented)) +(setq modus-themes-mode-line '(borderless accented)) #+end_src Note that Moody does not expose any faces that the themes could style @@ -868,6 +877,27 @@ Furthermore, because Moody expects an underline and overline instead of a box style, it is advised to set ~x-underline-at-descent-line~ to a non-nil value. +** Option for accented background in tab interfaces +:properties: +:alt_title: Tab style +:description: Toggle accented background for tabs +:custom_id: h:27cef8f5-dc4e-4c93-ba41-b899e650d936 +:end: +#+vindex: modus-themes-tabs-accented + +Symbol: ~modus-themes-tabs-accented~ + +Possible values: + ++ ~nil~ (default) ++ ~t~ + +By default, all tab interfaces use backgrounds which are shades of gray. +When this option is set to non-nil, the backgrounds become colorful. + +This affects the built-in ~tab-bar-mode~ and ~tab-line-mode~, as well as the +Centaur tabs package. + ** Option for completion framework aesthetics :properties: :alt_title: Completion UIs @@ -1305,6 +1335,7 @@ all possible combinations: (setq modus-themes-org-agenda '((header-block . (variable-pitch scale-title)) (header-date . (grayscale workaholic bold-today)) + (event . (accented scale-small)) (scheduled . uniform) (habit . traffic-light))) #+end_src @@ -1346,6 +1377,11 @@ the following properties: - ~bold-today~ to apply a bold typographic weight to the current date; - ~bold-all~ to render all date headings in a bold weight. +- ~scale-heading~ increases the height of the date headings to the value + of ~modus-themes-scale-1~ (which is the first step in the scale for + regular headings). +- ~underline-today~ applies an underline to the current date while + removing the background it has by default. For example: @@ -1355,6 +1391,31 @@ For example: (header-date . (grayscale bold-all)) (header-date . (grayscale workaholic)) (header-date . (grayscale workaholic bold-today)) +(header-date . (grayscale workaholic bold-today scale-heading)) +#+end_src + +An ~event~ key covers events from the diary and other entries that derive +from a symbolic expression or sexp (e.g. phases of the moon, holidays). +This key accepts a list of values. By default (a nil value or an empty +list) those have a gray foreground, while sexp events are additionally +presented using slanted text (italics). The properties that can form a +list of possible values are: + +- ~scale-small~ reduces the height of the entries to the value of the user + option ~modus-themes-scale-small~ (0.9 the height of the main font size + by default). +- ~accented~ applies an accent value to the event's foreground, replacing + the original gray. +- ~italic~ adds a slant to the font's forms (italic or oblique forms, + depending on the typeface). + +For example: + +#+begin_src emacs-lisp +(event . nil) +(event . (scale-small)) +(event . (scale-small accented)) +(event . (scale-small accented italic)) #+end_src A ~scheduled~ key applies to tasks with a scheduled date. By default (a @@ -1416,6 +1477,7 @@ Putting it all together, the alist can look like this: #+begin_src emacs-lisp '((header-block . (scale-title variable-pitch)) (header-date . (grayscale workaholic bold-today)) + (event . (accented scale-small)) (scheduled . uniform) (habit . traffic-light)) @@ -1423,6 +1485,7 @@ Putting it all together, the alist can look like this: (setq modus-themes-org-agenda '((header-block . (scale-title variable-pitch)) (header-date . (grayscale workaholic bold-today)) + (event . (accented scale-small)) (scheduled . uniform) (habit . traffic-light))) #+end_src @@ -1574,7 +1637,8 @@ resource for finding a consistent scale: modus-themes-scale-2 1.1 modus-themes-scale-3 1.15 modus-themes-scale-4 1.2 - modus-themes-scale-title 1.3) + modus-themes-scale-title 1.3 + modus-themes-scale-small 0.9) #+end_src As for the application of that scale, the variables that range from @@ -1593,6 +1657,11 @@ supposed to signify the primary header. Similarly, the Org Agenda's structure headings are not part of a recognisable scale and so they also get ~modus-themes-scale-title~ ([[#h:68f481bc-5904-4725-a3e6-d7ecfa7c3dbc][Option for Org agenda constructs]]). +Similarly ~modus-themes-scale-small~ is not applied to regular headings, +but reserved for special contexts where the user is presented with an +option to use a smaller font height than the base size. It is only +implemented for the Org agenda. + Users who wish to maintain scaled headings for the normal syntax while preventing special headings from standing out, can assign a value of =1.0= to ~modus-themes-scale-title~ to make it the same as body text (or @@ -2321,8 +2390,8 @@ Using the above has an immediate effect, as it reloads the active Modus theme. The =my-modus-themes-saturate= function stores new color values in the -variables =modus-themes-operandi-color-overrides= and -=modus-themes-vivendi-color-overrides=, meaning that it undoes changes +variables ~modus-themes-operandi-color-overrides~ and +~modus-themes-vivendi-color-overrides~, meaning that it undoes changes implemented by the user on individual colors. To have both automatic saturation adjustment across the board and retain per-case edits to the palette, some tweaks to the above function are required. For example: @@ -2574,9 +2643,9 @@ two): #+begin_src emacs-lisp (setq org-todo-keyword-faces - '(("MEET" . '(font-lock-preprocessor-face org-todo)) - ("STUDY" . '(font-lock-variable-name-face org-todo)) - ("WRITE" . '(font-lock-type-face org-todo)))) + '(("MEET" . '(bold org-todo)) + ("STUDY" . '(warning org-todo)) + ("WRITE" . '(shadow org-todo)))) #+end_src This will refashion the keywords you specify, while letting the other @@ -2607,7 +2676,7 @@ configuration of the priority cookies: #+begin_src emacs-lisp (setq org-priority-faces - '((?A . '(org-scheduled-today org-priority)) + '((?A . '(bold org-priority)) (?B . org-priority) (?C . '(shadow org-priority)))) #+end_src @@ -2904,6 +2973,7 @@ have lots of extensions, so the "full support" may not be 100% true… + alert + all-the-icons + annotate ++ ansi-color + anzu + apropos + apt-sources-list @@ -2943,6 +3013,7 @@ have lots of extensions, so the "full support" may not be 100% true… + css-mode + csv-mode + ctrlf ++ cursor-flash + custom (what you get with {{{kbd(M-x customize)}}}) + dap-mode + dashboard (emacs-dashboard) @@ -2977,6 +3048,7 @@ have lots of extensions, so the "full support" may not be 100% true… + eldoc-box + elfeed + elfeed-score ++ elpher + embark + emms + enh-ruby-mode (enhanced-ruby-mode) @@ -3033,6 +3105,7 @@ have lots of extensions, so the "full support" may not be 100% true… + highlight-escape-sequences (~hes-mode~) + highlight-indentation + highlight-numbers ++ highlight-parentheses ([[#h:24bab397-dcb2-421d-aa6e-ec5bd622b913][Note on highlight-parentheses.el]]) + highlight-symbol + highlight-tail + highlight-thing @@ -3225,6 +3298,7 @@ These do not require any extra styles because they are configured to inherit from some basic faces or their dependencies which are directly supported by the themes. ++ bufler + counsel-notmuch + edit-indirect + evil-owl @@ -3234,8 +3308,13 @@ supported by the themes. + perl-mode + php-mode + rjsx-mode ++ side-hustle + swift-mode + tab-bar-echo-area ++ tide ++ vertico-indexed ++ vertico-mouse ++ vertico-quick * Notes on individual packages :properties: @@ -3415,6 +3494,135 @@ and have the foreground be indistinguishable from it. For example: [[#h:51ba3547-b8c8-40d6-ba5a-4586477fd4ae][Face specs at scale using the themes' palette]]. +** Note on highlight-parentheses.el +:PROPERTIES: +:CUSTOM_ID: h:24bab397-dcb2-421d-aa6e-ec5bd622b913 +:END: + +The =highlight-parentheses= package provides contextual coloration of +surrounding parentheses, highlighting only those which are around the +point. The package expects users to customize the applicable colors on +their own by configuring certain variables. + +To make the Modus themes work as expected with this, we need to use some +of the techniques that are discussed at length in the various +"Do-It-Yourself" (DIY) sections, which provide insight into the more +advanced customization options of the themes. + +[[#h:f4651d55-8c07-46aa-b52b-bed1e53463bb][Advanced customization (do-it-yourself)]]. + +In the following example, we are assuming that the user wants to (i) +re-use color variables provided by the themes, (ii) be able to retain +their tweaks while switching between ~modus-operandi~ and ~modus-vivendi~, +and (iii) have the option to highlight either the foreground of the +parentheses or the background as well. + +We start by defining our own variable, which will serve as a toggle +between foreground and background coloration styles: + +#+begin_src emacs-lisp +(defvar my-highlight-parentheses-use-background t + "Prefer `highlight-parentheses-background-colors'.") +#+end_src + +Then we can update our preference with this: + +#+begin_src emacs-lisp +;; Set to nil to disable backgrounds. +(setq my-highlight-parentheses-use-background nil) +#+end_src + +To re-use colors from the themes, we must wrap our code in the +~modus-themes-with-colors~ macro. Our implementation must interface with +the variables ~highlight-parentheses-background-colors~ and/or +~highlight-parentheses-colors~. + +So we can have something like this (the doc string of +~modus-themes-with-colors~ explains where the names of the colors can be +found): + +#+begin_src emacs-lisp +(modus-themes-with-colors + ;; Our preference for setting either background or foreground + ;; styles, depending on `my-highlight-parentheses-use-background'. + (if my-highlight-parentheses-use-background + + ;; Here we set color combinations that involve both a background + ;; and a foreground value. + (setq highlight-parentheses-background-colors (list cyan-refine-bg + magenta-refine-bg + green-refine-bg + yellow-refine-bg) + highlight-parentheses-colors (list cyan-refine-fg + magenta-refine-fg + green-refine-fg + yellow-refine-fg)) + + ;; And here we pass only foreground colors while disabling any + ;; backgrounds. + (setq highlight-parentheses-colors (list green-intense + magenta-intense + blue-intense + red-intense) + highlight-parentheses-background-colors nil))) + +;; Include this if you also want to make the parentheses bold: +(set-face-attribute 'highlight-parentheses-highlight nil :inherit 'bold) + +;; Our changes must be evaluated before enabling the relevant mode, so +;; this comes last. +(global-highlight-parentheses-mode 1) +#+end_src + +For our changes to persist while switching between the Modus themes, we +need to include them in a function which can then get passed to +~modus-themes-after-load-theme-hook~. This is the complete +implementation: + +#+begin_src emacs-lisp +;; Configurations for `highlight-parentheses': +(require 'highlight-parentheses) + +(defvar my-highlight-parentheses-use-background t + "Prefer `highlight-parentheses-background-colors'.") + +(setq my-highlight-parentheses-use-background nil) ; Set to nil to disable backgrounds + +(defun my-modus-themes-highlight-parentheses () + (modus-themes-with-colors + ;; Our preference for setting either background or foreground + ;; styles, depending on `my-highlight-parentheses-use-background'. + (if my-highlight-parentheses-use-background + + ;; Here we set color combinations that involve both a background + ;; and a foreground value. + (setq highlight-parentheses-background-colors (list cyan-refine-bg + magenta-refine-bg + green-refine-bg + yellow-refine-bg) + highlight-parentheses-colors (list cyan-refine-fg + magenta-refine-fg + green-refine-fg + yellow-refine-fg)) + + ;; And here we pass only foreground colors while disabling any + ;; backgrounds. + (setq highlight-parentheses-colors (list green-intense + magenta-intense + blue-intense + red-intense) + highlight-parentheses-background-colors nil))) + + ;; Include this if you also want to make the parentheses bold: + (set-face-attribute 'highlight-parentheses-highlight nil :inherit 'bold) + + ;; Our changes must be evaluated before enabling the relevant mode, so + ;; this comes last. + (global-highlight-parentheses-mode 1)) + +(add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-highlight-parentheses) +#+end_src + ** Note on mmm-mode.el background colors :properties: :custom_id: h:99cf0d6c-e478-4e26-9932-3bf3427d13f6 @@ -3520,7 +3728,7 @@ With 8 colors: :desaturations '(0) ; do not change---may lower the contrast ratio :lightens '(0) ; same :colors (modus-themes-with-colors - (list fg-special-cold + (list blue magenta magenta-alt-other cyan-alt-other @@ -3540,10 +3748,10 @@ to the themes' default aesthetic: :desaturations '(0) ; do not change---may lower the contrast ratio :lightens '(0) ; same :colors (modus-themes-with-colors - (list fg-main - cyan-alt-other + (list blue + magenta magenta-alt-other - magenta))) + green-alt))) #+end_src If you need to apply desaturation and lightening, you can use what the @@ -3958,7 +4166,7 @@ latter case. ~modus-operandi~ is best used outdoors or in a room that either gets direct sunlight or has plenty of light. Whereas ~modus-vivendi~ works better when there is not a lot of sunshine or the room has a source of -light, preferably a faint or warm one. It is possible to use +light that is preferably a faint and/or warm one. It is possible to use ~modus-operandi~ at night and ~modus-vivendi~ during the day, though that will depend on several variables, such as one's overall perception of color, the paint on the walls and how that contributes to the impression @@ -4005,9 +4213,7 @@ in which you can contribute to their ongoing development. :end: #+cindex: Sources of the themes -The ~modus-operandi~ and ~modus-vivendi~ themes are built into Emacs. -Currently they are in Emacs' git main branch (trunk), which is tracking -the next development release target. +The ~modus-operandi~ and ~modus-vivendi~ themes are built into Emacs 28. The source code of the themes is [[https://gitlab.com/protesilaos/modus-themes/][available on Gitlab]], for the time being. A [[https://github.com/protesilaos/modus-themes/][mirror on Github]] is also on offer. @@ -4118,31 +4324,31 @@ The Modus themes are a collective effort. Every bit of work matters. + Contributions to code or documentation :: Anders Johansson, Basil L.{{{space()}}} Contovounesios, Carlo Zancanaro, Eli Zaretskii, Fritz Grabo, - Kostadin Ninev, Madhavan Krishnan, Markus Beppler, Matthew Stevenson, - Mauro Aranda, Nicolas De Jaeghere, Philip Kaludercic, Rudolf - Adamkovič, Shreyas Ragavan, Stefan Kangas, Vincent Murphy, Xinglu - Chen. - -+ Ideas and user feedback :: Aaron Jensen, Adam Spiers, Adrian Manea, - Alex Griffin, Alex Peitsinis, Alexey Shmalko, Alok Singh, Anders - Johansson, André Alexandre Gomes, Arif Rezai, Basil L.{{{space()}}} - Contovounesios, Burgess Chang, Christian Tietze, Christopher Dimech, - Damien Cassou, Daniel Mendler, Dario Gjorgjevski, David Edmondson, - Davor Rotim, Divan Santana, Emanuele Michele Alberto Monterosso, - Farasha Euker, Gautier Ponsinet, Gerry Agbobada, Gianluca Recchia, - Gustavo Barros, Hörmetjan Yiltiz, Ilja Kocken, Iris Garcia, Jeremy - Friesen, Jerry Zhang, John Haman, Joshua O'Connor, Kevin Fleming, - Kévin Le Gouguec, Kostadin Ninev, Len Trigg, Manuel Uberti, Mark - Burton, Markus Beppler, Mauro Aranda, Michael Goldenberg, Morgan - Smith, Murilo Pereira, Nicky van Foreest, Nicolas De Jaeghere, Paul - Poloskov, Pengji Zhang, Pete Kazmier, Peter Wu, Philip Kaludercic, - Pierre Téchoueyres, Roman Rudakov, Ryan Phillips, Rudolf Adamkovič, - Sam Kleinman, Shreyas Ragavan, Simon Pugnet, Tassilo Horn, Thibaut - Verron, Thomas Heartman, Trey Merkley, Togan Muftuoglu, Toon Claes, - Uri Sharf, Utkarsh Singh, Vincent Foley. As well as users: Ben, - CsBigDataHub1, Emacs Contrib, Eugene, Fourchaux, Fredrik, Moesasji, - Nick, TheBlob42, Trey, bepolymathe, doolio, fleimgruber, iSeeU, - jixiuf, okamsn, pRot0ta1p. + Kévin Le Gouguec, Kostadin Ninev, Madhavan Krishnan, Markus Beppler, + Matthew Stevenson, Mauro Aranda, Nicolas De Jaeghere, Philip + Kaludercic, Rudolf Adamkovič, Stephen Gildea, Shreyas Ragavan, Stefan + Kangas, Vincent Murphy, Xinglu Chen. + ++ Ideas and user feedback :: Aaron Jensen, Adam Porter, Adam Spiers, + Adrian Manea, Alex Griffin, Alex Peitsinis, Alexey Shmalko, Alok + Singh, Anders Johansson, André Alexandre Gomes, Arif Rezai, Basil + L.{{{space()}}} Contovounesios, Burgess Chang, Christian Tietze, Christopher + Dimech, Damien Cassou, Daniel Mendler, Dario Gjorgjevski, David + Edmondson, Davor Rotim, Divan Santana, Eliraz Kedmi, Emanuele Michele + Alberto Monterosso, Farasha Euker, Feng Shu, Gautier Ponsinet, Gerry + Agbobada, Gianluca Recchia, Gustavo Barros, Hörmetjan Yiltiz, Ilja + Kocken, Iris Garcia, Jeremy Friesen, Jerry Zhang, John Haman, Joshua + O'Connor, Kevin Fleming, Kévin Le Gouguec, Kostadin Ninev, Len Trigg, + Manuel Uberti, Mark Burton, Markus Beppler, Mauro Aranda, Michael + Goldenberg, Morgan Smith, Murilo Pereira, Nicky van Foreest, Nicolas + De Jaeghere, Paul Poloskov, Pengji Zhang, Pete Kazmier, Peter Wu, + Philip Kaludercic, Pierre Téchoueyres, Roman Rudakov, Ryan Phillips, + Rudolf Adamkovič, Sam Kleinman, Shreyas Ragavan, Simon Pugnet, Tassilo + Horn, Thibaut Verron, Thomas Heartman, Trey Merkley, Togan Muftuoglu, + Toon Claes, Uri Sharf, Utkarsh Singh, Vincent Foley. As well as + users: Ben, CsBigDataHub1, Emacs Contrib, Eugene, Fourchaux, Fredrik, + Moesasji, Nick, TheBlob42, Trey, bepolymathe, doolio, fleimgruber, + iSeeU, jixiuf, okamsn, pRot0ta1p. + Packaging :: Basil L.{{{space()}}} Contovounesios, Eli Zaretskii, Glenn Morris, Mauro Aranda, Richard Stallman, Stefan Kangas (core Emacs), @@ -4178,6 +4384,7 @@ of this sort): + [[https://protesilaos.com/codelog/2020-12-27-modus-themes-review-rainbow-delimiters/][Modus themes: review rainbow-delimiters faces]] (2020-12-27) + [[https://protesilaos.com/codelog/2021-01-11-modus-themes-review-select-faint-colours/][Modus themes: review of select "faint" colours]] (2021-01-11) + [[https://protesilaos.com/codelog/2021-02-25-modus-themes-diffs-deuteranopia/][The Modus themes now cover deuteranopia in diffs]] (2021-02-25) ++ [[https://protesilaos.com/codelog/2021-06-02-modus-themes-org-agenda/][Introducing the variable modus-themes-org-agenda]] (2021-06-02) And here are the canonical sources of this project's documentation: diff --git a/etc/themes/modus-operandi-theme.el b/etc/themes/modus-operandi-theme.el index a946d747e8..350524779d 100644 --- a/etc/themes/modus-operandi-theme.el +++ b/etc/themes/modus-operandi-theme.el @@ -4,7 +4,7 @@ ;; Author: Protesilaos Stavrou ;; URL: https://gitlab.com/protesilaos/modus-themes -;; Version: 1.5.0 +;; Version: 1.6.0 ;; Package-Requires: ((emacs "26.1")) ;; Keywords: faces, theme, accessibility diff --git a/etc/themes/modus-themes.el b/etc/themes/modus-themes.el index b9fe4a3272..7ab985c077 100644 --- a/etc/themes/modus-themes.el +++ b/etc/themes/modus-themes.el @@ -4,9 +4,9 @@ ;; Author: Protesilaos Stavrou ;; URL: https://gitlab.com/protesilaos/modus-themes -;; Version: 1.5.0 -;; Last-Modified: <2021-07-15 13:21:55 +0300> -;; Package-Requires: ((emacs "26.1")) +;; Version: 1.6.0 +;; Last-Modified: <2021-09-29 08:47:03 +0300> +;; Package-Requires: ((emacs "27.1")) ;; Keywords: faces, theme, accessibility ;; This file is part of GNU Emacs. @@ -35,30 +35,30 @@ ;; ;; The themes share the following customization variables: ;; +;; modus-themes-headings (alist) +;; modus-themes-org-agenda (alist) +;; modus-themes-bold-constructs (boolean) ;; modus-themes-inhibit-reload (boolean) ;; modus-themes-italic-constructs (boolean) -;; modus-themes-bold-constructs (boolean) -;; modus-themes-variable-pitch-headings (boolean) -;; modus-themes-variable-pitch-ui (boolean) +;; modus-themes-no-mixed-fonts (boolean) ;; modus-themes-scale-headings (boolean) ;; modus-themes-subtle-line-numbers (boolean) ;; modus-themes-success-deuteranopia (boolean) -;; modus-themes-no-mixed-fonts (boolean) -;; modus-themes-headings (alist) +;; modus-themes-variable-pitch-headings (boolean) +;; modus-themes-variable-pitch-ui (boolean) +;; modus-themes-completions (choice) +;; modus-themes-diffs (choice) ;; modus-themes-fringes (choice) +;; modus-themes-hl-line (choice) ;; modus-themes-lang-checkers (choice) -;; modus-themes-org-agenda (alist) -;; modus-themes-org-blocks (choice) -;; modus-themes-prompts (choice) +;; modus-themes-links (choice) +;; modus-themes-mail-citations (choice) ;; modus-themes-mode-line (choice) -;; modus-themes-diffs (choice) -;; modus-themes-syntax (choice) -;; modus-themes-hl-line (choice) +;; modus-themes-org-blocks (choice) ;; modus-themes-paren-match (choice) +;; modus-themes-prompts (choice) ;; modus-themes-region (choice) -;; modus-themes-links (choice) -;; modus-themes-completions (choice) -;; modus-themes-mail-citations (choice) +;; modus-themes-syntax (choice) ;; ;; The default scale for headings is as follows (it can be customized as ;; well---remember, no scaling takes place by default): @@ -69,6 +69,11 @@ ;; modus-themes-scale-4 1.2 ;; modus-themes-scale-title 1.3 ;; +;; There is another scaling-related option, which however is reserved +;; for special cases and is not used for headings: +;; +;; modus-themes-scale-small 0.9 +;; ;; There also exist two unique customization variables for overriding ;; color palette values. The specifics are documented in the manual. ;; The symbols are: @@ -86,6 +91,7 @@ ;; alert ;; all-the-icons ;; annotate +;; ansi-color ;; anzu ;; apropos ;; apt-sources-list @@ -125,6 +131,7 @@ ;; css-mode ;; csv-mode ;; ctrlf +;; cursor-flash ;; custom (M-x customize) ;; dap-mode ;; dashboard (emacs-dashboard) @@ -160,6 +167,7 @@ ;; eldoc-box ;; elfeed ;; elfeed-score +;; elpher ;; embark ;; emms ;; enh-ruby-mode (enhanced-ruby-mode) @@ -615,8 +623,10 @@ cover the blue-cyan-magenta side of the spectrum." (bg-tab-bar . "#d5d5d5") (bg-tab-active . "#f6f6f6") - (bg-tab-inactive . "#bdbdbd") - (bg-tab-inactive-alt . "#999999") + (bg-tab-inactive . "#b7b7b7") + (bg-tab-inactive-accent . "#a9b4f6") + (bg-tab-inactive-alt . "#9f9f9f") + (bg-tab-inactive-alt-accent . "#9fa6d0") (red-tab . "#680000") (green-tab . "#003900") @@ -858,8 +868,10 @@ symbol and the latter as a string.") (bg-tab-bar . "#2c2c2c") (bg-tab-active . "#0e0e0e") - (bg-tab-inactive . "#3d3d3d") + (bg-tab-inactive . "#424242") + (bg-tab-inactive-accent . "#35398f") (bg-tab-inactive-alt . "#595959") + (bg-tab-inactive-alt-accent . "#505588") (red-tab . "#ffc0bf") (green-tab . "#88ef88") @@ -1724,16 +1736,6 @@ For form, see `modus-themes-vivendi-colors'." (put 'modus-themes-vivendi-color-overrides 'custom-options (copy-sequence colors))) -(defcustom modus-themes-slanted-constructs nil - "Use slanted text in more code constructs (italics or oblique)." - :group 'modus-themes - :package-version '(modus-themes . "1.0.0") - :version "28.1" - :type 'boolean - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Slanted constructs")) - (define-obsolete-variable-alias 'modus-themes-slanted-constructs 'modus-themes-italic-constructs @@ -1907,6 +1909,7 @@ combinations: (setq modus-themes-org-agenda '((header-block . (variable-pitch scale-title)) (header-date . (grayscale workaholic bold-today)) + (event . (accented scale-small)) (scheduled . uniform) (habit . traffic-light))) @@ -1945,6 +1948,11 @@ that can include any of the following properties: - `bold-today' to apply a bold typographic weight to the current date; - `bold-all' to render all date headings in a bold weight. +- `scale-heading' increases the height of the date headings to + the value of `modus-themes-scale-1' (which is the first step in + the scale for regular headings). +- `underline-today' applies an underline to the current date + while removing the background it has by default. For example: @@ -1953,6 +1961,28 @@ For example: (header-date . (grayscale bold-all)) (header-date . (grayscale workaholic)) (header-date . (grayscale workaholic bold-today)) + (header-date . (grayscale workaholic bold-today scale-heading)) + +An `event' key covers events from the diary and other entries +that derive from a symbolic expression or sexp (e.g. phases of +the moon, holidays). By default those have a gray +foreground (the default is a nil value or an empty list). This +key accepts a list of properties. Those are: + +- `scale-small' reduces the height of the entries to the value of + the user option `modus-themes-scale-small' (0.9 the height of + the main font size by default). +- `accented' applies an accent value to the event's foreground, + replacing the original gray. +- `italic' adds a slant to the font's forms (italic or oblique + forms, depending on the typeface) + +For example: + + (event . nil) + (event . (scale-small)) + (event . (scale-small accented)) + (event . (scale-small accented italic)) A `scheduled' key applies to tasks with a scheduled date. By default (a nil value), these use varying shades of yellow to @@ -2008,7 +2038,7 @@ For example: (habit . simplified) (habit . traffic-light)" :group 'modus-themes - :package-version '(modus-themes . "1.5.0") + :package-version '(modus-themes . "1.6.0") :version "28.1" :type '(set (cons :tag "Block header" @@ -2027,7 +2057,15 @@ For example: (const :tag "Use grayscale for date headers" grayscale) (const :tag "Do not differentiate weekdays from weekends" workaholic) (const :tag "Make today bold" bold-today) - (const :tag "Make all dates bold" bold-all))) + (const :tag "Make all dates bold" bold-all) + (const :tag "Increase font size (`modus-themes-scale-1')" scale-heading) + (const :tag "Make today underlined; remove the background" underline-today))) + (cons :tag "Event entry" :greedy t + (const event) + (set :tag "Text presentation" :greedy t + (const :tag "Use smaller font size (`modus-themes-scale-small')" scale-small) + (const :tag "Apply an accent color" accented) + (const :tag "Italic font slant (oblique forms)" italic))) (cons :tag "Scheduled tasks" (const scheduled) (choice (const :tag "Yellow colors to distinguish current and future tasks (default)" nil) @@ -2047,8 +2085,8 @@ For example: "Use font scaling for headings. For regular headings the scale is controlled by the variables -`modus-themes-scale-1' (smallest) and its variants all the way up -to `modus-themes-scale-4' (larger). +`modus-themes-scale-1' (smallest increase) and its variants all +the way up to `modus-themes-scale-4' (largest increase). While `modus-themes-scale-title' is reserved for special headings that nominally are the largest on the scale (though that is not a @@ -2163,12 +2201,14 @@ accordance with it in cases where it changes, such as while using :initialize #'custom-initialize-default :link '(info-link "(modus-themes) Scaled heading sizes")) -(defcustom modus-themes-scale-5 1.3 +(define-obsolete-variable-alias 'modus-themes-scale-5 'modus-themes-scale-title "1.5.0") + +(defcustom modus-themes-scale-title 1.3 "Font size slightly larger than `modus-themes-scale-4'. This size is only used for 'special' top level headings, such as Org's file title heading, denoted by the #+title key word, and -the Org agenda structure headers. +the Org agenda structure headers (see `modus-themes-org-agenda'). The default value is a floating point that is interpreted as a multiple of the base font size. It is recommended to use such a @@ -2181,21 +2221,19 @@ This will ignore the base font size and, thus, will not scale in accordance with it in cases where it changes, such as while using `text-scale-adjust'." :group 'modus-themes - :package-version '(modus-themes . "1.2.0") + :package-version '(modus-themes . "1.5.0") :version "28.1" :type 'number :set #'modus-themes--set-option :initialize #'custom-initialize-default :link '(info-link "(modus-themes) Scaled heading sizes")) -(define-obsolete-variable-alias 'modus-themes-scale-5 'modus-themes-scale-title "1.5.0") +(defcustom modus-themes-scale-small 0.9 + "Font size smaller than the default value. -(defcustom modus-themes-scale-title 1.3 - "Font size slightly larger than `modus-themes-scale-4'. - -This size is only used for 'special' top level headings, such as -Org's file title heading, denoted by the #+title key word, and -the Org agenda structure headers (see `modus-themes-org-agenda'). +This size is only used in special contexts where users are +presented with the option to have smaller text on display (see +`modus-themes-org-agenda'). The default value is a floating point that is interpreted as a multiple of the base font size. It is recommended to use such a @@ -2208,7 +2246,7 @@ This will ignore the base font size and, thus, will not scale in accordance with it in cases where it changes, such as while using `text-scale-adjust'." :group 'modus-themes - :package-version '(modus-themes . "1.5.0") + :package-version '(modus-themes . "1.6.0") :version "28.1" :type 'number :set #'modus-themes--set-option @@ -2404,6 +2442,14 @@ the same as the background, effectively creating some padding. The `accented' property ensures that the active mode line uses a colored background instead of the standard shade of gray. +The `padded' property increases the apparent height of the mode +line. This is done by applying box effects and combining them +with an underline and overline. To ensure that the underline is +placed at the bottom, set `x-underline-at-descent-line' to +non-nil. The `padded' property has no effect when the `moody' +property is also used, because Moody already applies its own +padding. + Combinations of any of those properties are expressed as a list, like in these examples: @@ -2442,7 +2488,7 @@ Furthermore, because Moody expects an underline and overline instead of a box style, it is advised to set `x-underline-at-descent-line' to a non-nil value." :group 'modus-themes - :package-version '(modus-themes . "1.5.0") + :package-version '(modus-themes . "1.6.0") :version "28.1" :type '(set :tag "Properties" :greedy t (choice :tag "Overall style" @@ -2450,7 +2496,8 @@ instead of a box style, it is advised to set (const :tag "3d borders" 3d) (const :tag "No box effects (Moody-compatible)" moody)) (const :tag "Colored background" accented) - (const :tag "Without border color" borderless)) + (const :tag "Without border color" borderless) + (const :tag "With extra padding" padded)) :set #'modus-themes--set-option :initialize #'custom-initialize-default :link '(info-link "(modus-themes) Mode line")) @@ -2905,6 +2952,18 @@ colored into a uniform shade of shade of gray." :initialize #'custom-initialize-default :link '(info-link "(modus-themes) Mail citations")) +(defcustom modus-themes-tabs-accented nil + "Toggle accented tab backgrounds, instead of the default gray. +This affects the built-in tab-bar mode and tab-line mode, as well +as the Centaur tabs package." + :group 'modus-themes + :package-version '(modus-themes . "1.6.0") + :version "28.1" + :type 'boolean + :set #'modus-themes--set-option + :initialize #'custom-initialize-default + :link '(info-link "(modus-themes) Tab style")) + ;;; Internal functions @@ -3333,30 +3392,64 @@ FG is the foreground color to use." :height height :foreground fg))) -(defun modus-themes--agenda-date (defaultfg grayscalefg &optional bold workaholicfg grayscaleworkaholicfg) +(defun modus-themes--agenda-date (defaultfg grayscalefg &optional workaholicfg grayscaleworkaholicfg bg bold ul) "Control the style of date headings in Org agenda buffers. DEFAULTFG is the original accent color for the foreground. -GRAYSCALEFG is a neutral color. Optional BOLD applies a bold -weight. Optional WORKAHOLICFG and GRAYSCALEWORKAHOLICFG are -alternative foreground colors." - (let* ((properties (modus-themes--key-cdr 'header-date modus-themes-org-agenda)) - (weight (cond ((memq 'bold-all properties) - 'bold) - ((and bold (memq 'bold-today properties)) - 'bold) - (t - nil))) - (fg (cond ((and (memq 'grayscale properties) - (memq 'workaholic properties)) - (or grayscaleworkaholicfg grayscalefg)) - ((memq 'grayscale properties) - grayscalefg) - ((memq 'workaholic properties) - (or workaholicfg defaultfg)) - (t - defaultfg)))) - (list :inherit weight - :foreground fg))) +GRAYSCALEFG is a neutral color. Optional WORKAHOLICFG and +GRAYSCALEWORKAHOLICFG are alternative foreground colors. +Optional BG is a background color. Optional BOLD applies a bold +weight. Optional UL applies an underline." + (let ((properties (modus-themes--key-cdr 'header-date modus-themes-org-agenda))) + (list :inherit + (cond + ((or (memq 'bold-all properties) + (and bold (memq 'bold-today properties))) + 'bold) + (t + 'unspecified)) + :background + (unless (memq 'underline-today properties) + bg) + :foreground + (cond + ((and (memq 'grayscale properties) + (memq 'workaholic properties)) + (or grayscaleworkaholicfg grayscalefg)) + ((memq 'grayscale properties) + grayscalefg) + ((memq 'workaholic properties) + (or workaholicfg defaultfg)) + (t + defaultfg)) + :height + (if (memq 'scale-heading properties) + modus-themes-scale-1 + 'unspecified) + :underline + (if (and ul (memq 'underline-today properties)) + t + 'unspecified)))) + +(defun modus-themes--agenda-event (fg) + "Control the style of the Org agenda events. +FG is the accent color to use." + (let ((properties (modus-themes--key-cdr 'event modus-themes-org-agenda))) + (list :height + (if (memq 'scale-small properties) + modus-themes-scale-small + 'unspecified) + :foreground + (if (memq 'accented properties) + fg + 'unspecified) + :inherit + (cond + ((and (memq 'accented properties) + (memq 'italic properties)) + 'italic) + ((memq 'italic properties) + '(shadow italic)) + ('shadow))))) (defun modus-themes--agenda-scheduled (defaultfg uniformfg rainbowfg) "Control the style of the Org agenda scheduled tasks. @@ -3420,7 +3513,7 @@ set to `rainbow'." (_ (list :background bg :foreground fg)))) (defun modus-themes--mode-line-attrs - (fg bg fg-alt bg-alt fg-accent bg-accent border border-3d &optional alt-style border-width fg-distant) + (fg bg fg-alt bg-alt fg-accent bg-accent border border-3d &optional alt-style fg-distant) "Color combinations for `modus-themes-mode-line'. FG and BG are the default colors. FG-ALT and BG-ALT are meant to @@ -3432,9 +3525,6 @@ three-dimensional effect, where BORDER-3D is used instead. Optional ALT-STYLE applies an appropriate style to the mode line's box property. -Optional BORDER-WIDTH specifies an integer for the width of the -rectangle that produces the box effect. - Optional FG-DISTANT should be close to the main background values. It is intended to be used as a distant-foreground property." @@ -3463,20 +3553,39 @@ property." ((cons fg bg)))) (box (cond ((memq 'moody modus-themes-mode-line) nil) + ((and (memq '3d modus-themes-mode-line) + (memq 'padded modus-themes-mode-line)) + (list :line-width 4 + :color + (cond ((and (memq 'accented modus-themes-mode-line) + (memq 'borderless modus-themes-mode-line)) + bg-accent) + ((or (memq 'accented modus-themes-mode-line) + (memq 'borderless modus-themes-mode-line)) + bg) + (bg-alt)) + :style (when alt-style 'released-button))) + ((and (memq 'accented modus-themes-mode-line) + (memq 'padded modus-themes-mode-line)) + (list :line-width 6 :color bg-accent)) + ((memq 'padded modus-themes-mode-line) + (list :line-width 6 :color bg)) ((memq '3d modus-themes-mode-line) - (list :line-width (or border-width 1) + (list :line-width 1 :color (cond ((and (memq 'accented modus-themes-mode-line) (memq 'borderless modus-themes-mode-line)) bg-accent) ((memq 'borderless modus-themes-mode-line) bg) (border-3d)) - :style (and alt-style 'released-button))) - ((or (memq 'borderless modus-themes-mode-line) - (memq 'moody modus-themes-mode-line)) + :style (when alt-style 'released-button))) + ((memq 'borderless modus-themes-mode-line) bg) + ((memq 'padded modus-themes-mode-line) + (list :line-width 6 :color bg)) (border))) - (line (cond ((not (memq 'moody modus-themes-mode-line)) + (line (cond ((not (or (memq 'moody modus-themes-mode-line) + (memq 'padded modus-themes-mode-line))) nil) ((and (memq 'borderless modus-themes-mode-line) (memq 'accented modus-themes-mode-line)) @@ -3490,8 +3599,8 @@ property." :overline line :underline line :distant-foreground - (and (memq 'moody modus-themes-mode-line) - fg-distant))))) + (when (memq 'moody modus-themes-mode-line) + fg-distant))))) (defun modus-themes--diff (fg-only-bg fg-only-fg mainbg mainfg altbg altfg &optional deuteranbg deuteranfg bg-only-fg) @@ -3759,6 +3868,30 @@ desaturated counterpart." ('desaturated (list :foreground subtlefg)) (_ (list :foreground mainfg)))) +(defun modus-themes--tab (bg &optional bgaccent fg fgaccent box-p bold-p var-p) + "Helper function for tabs. +BG is the default background, while BGACCENT is its more colorful +alternative. Optional FG is a foreground color that combines +with BG. Same principle FGACCENT. + +BOX-P and BOLD-P determine the use of a box property and the +application of a bold weight, respectively. VAR-P controls the +application of a variable-pitch font." + (let ((background (if modus-themes-tabs-accented (or bgaccent bg) bg)) + (foreground (if modus-themes-tabs-accented (or fgaccent fg) fg))) + (list + :inherit (cond + ((and bold-p var-p) + (if modus-themes-variable-pitch-ui + '(variable-pitch bold) + '(bold))) + (bold-p 'bold) + (var-p (when modus-themes-variable-pitch-ui 'variable-pitch)) + ('unspecified)) + :background background + :foreground (or foreground 'unspecified) + :box (if box-p (list :line-width 2 :color background) 'unspecified)))) + ;;;; Utilities for DIY users @@ -4107,7 +4240,9 @@ by virtue of calling either of `modus-themes-load-operandi' and bg-region blue-intense-bg fg-alt cyan-intense) :extend t))) - `(modus-themes-key-binding ((,class :inherit bold :foreground ,blue-alt-other))) + `(modus-themes-key-binding ((,class ,@(if (facep 'help-key-binding) ; check emacs28 face + (list :inherit 'help-key-binding) + (list :inherit 'bold :foreground blue-alt-other))))) `(modus-themes-prompt ((,class ,@(modus-themes--prompt cyan-alt-other blue-alt-other fg-alt cyan-nuanced-bg blue-refine-bg fg-main @@ -4233,6 +4368,25 @@ by virtue of calling either of `modus-themes-load-operandi' and `(annotate-annotation-secondary ((,class :inherit modus-themes-subtle-green))) `(annotate-highlight ((,class :background ,blue-nuanced-bg :underline ,blue-intense))) `(annotate-highlight-secondary ((,class :background ,green-nuanced-bg :underline ,green-intense))) +;;;;; ansi-color + ;; Those are in Emacs28. + `(ansi-color-black ((,class :background "black" :foreground "black"))) + `(ansi-color-blue ((,class :background ,blue :foreground ,blue))) + `(ansi-color-bold ((,class :inherit bold))) + `(ansi-color-bright-black ((,class :background "gray35" :foreground "gray35"))) + `(ansi-color-bright-blue ((,class :background ,blue-alt :foreground ,blue-alt))) + `(ansi-color-bright-cyan ((,class :background ,cyan-alt-other :foreground ,cyan-alt-other))) + `(ansi-color-bright-green ((,class :background ,green-alt-other :foreground ,green-alt-other))) + `(ansi-color-bright-magenta ((,class :background ,magenta-alt-other :foreground ,magenta-alt-other))) + `(ansi-color-bright-red ((,class :background ,red-alt :foreground ,red-alt))) + `(ansi-color-bright-white ((,class :background "white" :foreground "white"))) + `(ansi-color-bright-yellow ((,class :background ,yellow-alt :foreground ,yellow-alt))) + `(ansi-color-cyan ((,class :background ,cyan :foreground ,cyan))) + `(ansi-color-green ((,class :background ,green :foreground ,green))) + `(ansi-color-magenta ((,class :background ,magenta :foreground ,magenta))) + `(ansi-color-red ((,class :background ,red :foreground ,red))) + `(ansi-color-white ((,class :background "gray65" :foreground "gray65"))) + `(ansi-color-yellow ((,class :background ,yellow :foreground ,yellow))) ;;;;; anzu `(anzu-match-1 ((,class :inherit modus-themes-subtle-cyan))) `(anzu-match-2 ((,class :inherit modus-themes-search-success))) @@ -4251,7 +4405,7 @@ by virtue of calling either of `modus-themes-load-operandi' and `(apropos-keybinding ((,class :inherit modus-themes-key-binding))) `(apropos-misc-button ((,class :inherit button ,@(modus-themes--link-color - cyan-alt-other cyan-alt-other-faint)))) + green-alt-other green-alt-other-faint)))) `(apropos-property ((,class :inherit modus-themes-bold :foreground ,magenta-alt))) `(apropos-symbol ((,class :inherit modus-themes-pseudo-header))) `(apropos-user-option-button ((,class :inherit button @@ -4275,7 +4429,7 @@ by virtue of calling either of `modus-themes-load-operandi' and `(font-latex-bold-face ((,class :inherit bold :foreground ,fg-special-calm))) `(font-latex-doctex-documentation-face ((,class :inherit modus-themes-slant :foreground ,fg-special-cold))) `(font-latex-doctex-preprocessor-face ((,class :inherit modus-themes-bold :foreground ,red-alt-other))) - `(font-latex-italic-face ((,class :inherit italic :foreground ,fg-special-calm))) + `(font-latex-italic-face ((,class :inherit italic))) `(font-latex-math-face ((,class :foreground ,cyan-alt-other))) `(font-latex-script-char-face ((,class :foreground ,cyan-alt-other))) `(font-latex-sectioning-0-face ((,class :inherit modus-themes-variable-pitch :foreground ,blue-nuanced-fg))) @@ -4360,7 +4514,8 @@ by virtue of calling either of `modus-themes-load-operandi' and `(boon-modeline-off ((,class :inherit modus-themes-active-yellow))) `(boon-modeline-spc ((,class :inherit modus-themes-active-green))) ;;;;; bookmark - `(bookmark-face ((,class :inherit modus-themes-special-warm :extend t))) + `(bookmark-face ((,class :inherit modus-themes-fringe-cyan))) + `(bookmark-menu-bookmark ((,class :inherit bold))) ;;;;; breakpoint (built-in gdb-mi.el) `(breakpoint-disabled ((,class :inherit shadow))) `(breakpoint-enabled ((,class :inherit bold :foreground ,red))) @@ -4406,11 +4561,11 @@ by virtue of calling either of `modus-themes-load-operandi' and `(centaur-tabs-close-unselected ((,class :inherit centaur-tabs-unselected))) `(centaur-tabs-modified-marker-selected ((,class :inherit centaur-tabs-selected))) `(centaur-tabs-modified-marker-unselected ((,class :inherit centaur-tabs-unselected))) - `(centaur-tabs-default ((,class :background ,bg-main :foreground ,bg-main))) - `(centaur-tabs-selected ((,class :inherit bold :background ,bg-tab-active :foreground ,fg-main))) - `(centaur-tabs-selected-modified ((,class :inherit italic :background ,bg-tab-active :foreground ,fg-main))) - `(centaur-tabs-unselected ((,class :background ,bg-tab-inactive :foreground ,fg-dim))) - `(centaur-tabs-unselected-modified ((,class :inherit italic :background ,bg-tab-inactive :foreground ,fg-dim))) + `(centaur-tabs-default (( ))) + `(centaur-tabs-selected ((,class ,@(modus-themes--tab bg-tab-active nil nil nil t t)))) + `(centaur-tabs-selected-modified ((,class :inherit (italic centaur-tabs-selected)))) + `(centaur-tabs-unselected ((,class ,@(modus-themes--tab bg-tab-inactive bg-tab-inactive-accent fg-dim nil t)))) + `(centaur-tabs-unselected-modified ((,class :inherit (italic centaur-tabs-unselected)))) ;;;;; cfrs `(cfrs-border-color ((,class :background ,fg-window-divider-inner))) ;;;;; change-log and log-view (`vc-print-log' and `vc-print-root-log') @@ -4590,6 +4745,8 @@ by virtue of calling either of `modus-themes-load-operandi' and `(ctrlf-highlight-active ((,class :inherit (modus-themes-search-success bold)))) `(ctrlf-highlight-line ((,class :inherit modus-themes-hl-line))) `(ctrlf-highlight-passive ((,class :inherit modus-themes-search-success-lazy))) +;;;;; cursor-flash + `(cursor-flash-face ((,class :inherit modus-themes-intense-blue))) ;;;;; custom (M-x customize) `(custom-button ((,class :box (:line-width 2 :color nil :style released-button) :background ,bg-active :foreground ,fg-main))) @@ -4765,24 +4922,24 @@ by virtue of calling either of `modus-themes-load-operandi' and `(diredfl-autofile-name ((,class :inherit modus-themes-special-cold))) `(diredfl-compressed-file-name ((,class :foreground ,fg-special-warm))) `(diredfl-compressed-file-suffix ((,class :foreground ,red-alt))) - `(diredfl-date-time ((,class :foreground ,cyan-alt-other))) + `(diredfl-date-time ((,class :foreground ,cyan))) `(diredfl-deletion ((,class :inherit modus-themes-mark-del))) `(diredfl-deletion-file-name ((,class :inherit modus-themes-mark-del))) `(diredfl-dir-heading ((,class :inherit modus-themes-pseudo-header))) `(diredfl-dir-name ((,class :inherit dired-directory))) `(diredfl-dir-priv ((,class :foreground ,blue-alt))) - `(diredfl-exec-priv ((,class :foreground ,magenta))) + `(diredfl-exec-priv ((,class :foreground ,magenta-alt))) `(diredfl-executable-tag ((,class :foreground ,magenta-alt))) `(diredfl-file-name ((,class :foreground ,fg-main))) - `(diredfl-file-suffix ((,class :foreground ,cyan))) + `(diredfl-file-suffix ((,class :foreground ,magenta-alt-other))) `(diredfl-flag-mark ((,class :inherit modus-themes-mark-sel))) `(diredfl-flag-mark-line ((,class :inherit modus-themes-mark-sel))) `(diredfl-ignored-file-name ((,class :inherit shadow))) `(diredfl-link-priv ((,class :foreground ,blue-alt-other))) - `(diredfl-no-priv ((,class :inherit shadow))) - `(diredfl-number ((,class :foreground ,cyan-alt))) + `(diredfl-no-priv ((,class :foreground "gray50"))) + `(diredfl-number ((,class :foreground ,cyan-alt-other-faint))) `(diredfl-other-priv ((,class :foreground ,yellow))) - `(diredfl-rare-priv ((,class :foreground ,red-alt))) + `(diredfl-rare-priv ((,class :foreground ,red))) `(diredfl-read-priv ((,class :foreground ,fg-main))) `(diredfl-symlink ((,class :inherit dired-symlink))) `(diredfl-tagged-autofile-name ((,class :inherit modus-themes-refine-magenta))) @@ -4791,27 +4948,27 @@ by virtue of calling either of `modus-themes-load-operandi' and `(diredp-autofile-name ((,class :inherit modus-themes-special-cold))) `(diredp-compressed-file-name ((,class :foreground ,fg-special-warm))) `(diredp-compressed-file-suffix ((,class :foreground ,red-alt))) - `(diredp-date-time ((,class :foreground ,cyan-alt-other))) + `(diredp-date-time ((,class :foreground ,cyan))) `(diredp-deletion ((,class :inherit modus-themes-mark-del))) `(diredp-deletion-file-name ((,class :inherit modus-themes-mark-del))) `(diredp-dir-heading ((,class :inherit modus-themes-pseudo-header))) `(diredp-dir-name ((,class :inherit dired-directory))) `(diredp-dir-priv ((,class :foreground ,blue-alt))) - `(diredp-exec-priv ((,class :foreground ,magenta))) + `(diredp-exec-priv ((,class :foreground ,magenta-alt))) `(diredp-executable-tag ((,class :foreground ,magenta-alt))) `(diredp-file-name ((,class :foreground ,fg-main))) - `(diredp-file-suffix ((,class :foreground ,cyan))) + `(diredp-file-suffix ((,class :foreground ,magenta-alt-other))) `(diredp-flag-mark ((,class :inherit modus-themes-mark-sel))) `(diredp-flag-mark-line ((,class :inherit modus-themes-mark-sel))) `(diredp-ignored-file-name ((,class :inherit shadow))) `(diredp-link-priv ((,class :foreground ,blue-alt-other))) `(diredp-mode-line-flagged ((,class :foreground ,red-active))) `(diredp-mode-line-marked ((,class :foreground ,green-active))) - `(diredp-no-priv ((,class :inherit shadow))) - `(diredp-number ((,class :foreground ,cyan-alt))) + `(diredp-no-priv ((,class :foreground "gray50"))) + `(diredp-number ((,class :foreground ,cyan-alt-other-faint))) `(diredp-omit-file-name ((,class :inherit shadow :strike-through t))) `(diredp-other-priv ((,class :foreground ,yellow))) - `(diredp-rare-priv ((,class :foreground ,red-alt))) + `(diredp-rare-priv ((,class :foreground ,red))) `(diredp-read-priv ((,class :foreground ,fg-main))) `(diredp-symlink ((,class :inherit dired-symlink))) `(diredp-tagged-autofile-name ((,class :inherit modus-themes-refine-magenta))) @@ -4887,13 +5044,13 @@ by virtue of calling either of `modus-themes-load-operandi' and `(ebdb-phone-default ((,class :foreground ,cyan))) `(eieio-custom-slot-tag-face ((,class :foreground ,red-alt))) ;;;;; ediff - `(ediff-current-diff-A ((,class :inherit modus-themes-diff-focus-removed))) + `(ediff-current-diff-A ((,class :inherit modus-themes-diff-removed))) `(ediff-current-diff-Ancestor ((,class ,@(modus-themes--diff bg-alt fg-special-cold bg-special-cold fg-special-cold blue-nuanced-bg blue)))) - `(ediff-current-diff-B ((,class :inherit modus-themes-diff-focus-added))) - `(ediff-current-diff-C ((,class :inherit modus-themes-diff-focus-changed))) + `(ediff-current-diff-B ((,class :inherit modus-themes-diff-added))) + `(ediff-current-diff-C ((,class :inherit modus-themes-diff-changed))) `(ediff-even-diff-A ((,class :background ,bg-alt))) `(ediff-even-diff-Ancestor ((,class :background ,bg-alt))) `(ediff-even-diff-B ((,class :background ,bg-alt))) @@ -4939,9 +5096,19 @@ by virtue of calling either of `modus-themes-load-operandi' and `(elfeed-score-error-level-face ((,class :foreground ,red))) `(elfeed-score-info-level-face ((,class :foreground ,cyan))) `(elfeed-score-warn-level-face ((,class :foreground ,yellow))) +;;;;; elpher + `(elpher-gemini-heading1 ((,class :inherit modus-themes-heading-1))) + `(elpher-gemini-heading2 ((,class :inherit modus-themes-heading-2))) + `(elpher-gemini-heading3 ((,class :inherit modus-themes-heading-3))) ;;;;; embark `(embark-keybinding ((,class :inherit modus-themes-key-binding))) ;;;;; emms + `(emms-browser-album-face ((,class :foreground ,magenta-alt-other ,@(modus-themes--scale modus-themes-scale-2)))) + `(emms-browser-artist-face ((,class :foreground ,cyan ,@(modus-themes--scale modus-themes-scale-3)))) + `(emms-browser-composer-face ((,class :foreground ,magenta-alt ,@(modus-themes--scale modus-themes-scale-3)))) + `(emms-browser-performer-face ((,class :inherit emms-browser-artist-face))) + `(emms-browser-track-face ((,class :inherit emms-playlist-track-face))) + `(emms-browser-year/genre-face ((,class :foreground ,cyan-alt-other ,@(modus-themes--scale modus-themes-scale-4)))) `(emms-playlist-track-face ((,class :foreground ,blue-alt))) `(emms-playlist-selected-face ((,class :inherit bold :foreground ,blue-alt-other))) `(emms-metaplaylist-mode-current-face ((,class :inherit emms-playlist-selected-face))) @@ -5659,6 +5826,10 @@ by virtue of calling either of `modus-themes-load-operandi' and ,@(modus-themes--standard-completions magenta bg-alt bg-active fg-main)))) + `(icomplete-selected-match ((,class :inherit bold :foreground ,fg-main + :background ,@(pcase modus-themes-completions + ('opinionated (list bg-active)) + (_ (list bg-inactive)))))) ;;;;; icomplete-vertical `(icomplete-vertical-separator ((,class :inherit shadow))) ;;;;; ido-mode @@ -6074,27 +6245,41 @@ by virtue of calling either of `modus-themes-load-operandi' and `(Man-reverse ((,class :inherit modus-themes-subtle-magenta))) `(Man-underline ((,class :foreground ,cyan :underline t))) ;;;;; marginalia - `(marginalia-archive ((,class :foreground ,green-nuanced-fg))) - `(marginalia-date ((,class :foreground ,blue-nuanced-fg))) - `(marginalia-char ((,class :foreground ,red-active))) - `(marginalia-documentation ((,class :foreground ,fg-special-cold :inherit modus-themes-slant))) - `(marginalia-file-modes ((,class :inherit shadow))) - `(marginalia-file-name ((,class :foreground ,fg-special-mild))) - `(marginalia-file-owner ((,class :foreground ,red-nuanced-fg))) + `(marginalia-archive ((,class :foreground ,cyan-alt-other))) + `(marginalia-char ((,class :foreground ,magenta))) + `(marginalia-date ((,class :foreground ,cyan))) + `(marginalia-documentation ((,class :inherit modus-themes-slant :foreground ,fg-docstring))) + `(marginalia-file-name ((,class :foreground ,blue-faint))) + `(marginalia-file-owner ((,class :foreground ,red-faint))) + `(marginalia-file-priv-dir ((,class :foreground ,blue-alt))) + `(marginalia-file-priv-exec ((,class :foreground ,magenta-alt))) + `(marginalia-file-priv-link ((,class :foreground ,blue-alt-other))) + `(marginalia-file-priv-no ((,class :foreground "gray50"))) + `(marginalia-file-priv-other ((,class :foreground ,yellow))) + `(marginalia-file-priv-rare ((,class :foreground ,red))) + `(marginalia-file-priv-read ((,class :foreground ,fg-main))) + `(marginalia-file-priv-write ((,class :foreground ,cyan))) ;; Here we make an exception of not applying the bespoke ;; `modus-themes-key-binding' for two reasons: (1) completion ;; highlights can be fairly intense, so we do not want more ;; components to compete with them for attention, (2) the ;; `marginalia-key' may not be used for key bindings specifically, ;; so we might end up applying styles in places we should not. - `(marginalia-key ((,class :foreground ,magenta-active))) - `(marginalia-mode ((,class :foreground ,cyan-active))) - `(marginalia-modified ((,class :foreground ,yellow-active))) - `(marginalia-number ((,class :foreground ,blue-active))) - `(marginalia-size ((,class :foreground ,green-active))) - `(marginalia-type ((,class :foreground ,fg-special-warm))) - `(marginalia-variable ((,class :foreground ,yellow-nuanced-fg))) - `(marginalia-version ((,class :foreground ,cyan-active))) + `(marginalia-function ((,class :foreground ,magenta-alt-faint))) + `(marginalia-key ((,class :foreground ,magenta-alt-other))) + `(marginalia-lighter ((,class :foreground ,blue-alt))) + `(marginalia-list ((,class :foreground ,magenta-alt-other-faint))) + `(marginalia-mode ((,class :foreground ,cyan))) + `(marginalia-modified ((,class :foreground ,magenta-alt-faint))) + `(marginalia-null ((,class :inherit shadow))) + `(marginalia-number ((,class :foreground ,cyan))) + `(marginalia-size ((,class :foreground ,cyan-alt-other-faint))) + `(marginalia-string ((,class :foreground ,blue-alt))) + `(marginalia-symbol ((,class :foreground ,blue-alt-other-faint))) + `(marginalia-true ((,class :foreground ,fg-main))) + `(marginalia-type ((,class :foreground ,cyan-alt-other))) + `(marginalia-value ((,class :foreground ,cyan))) + `(marginalia-version ((,class :foreground ,cyan))) ;;;;; markdown-mode `(markdown-blockquote-face ((,class :inherit modus-themes-slant :foreground ,fg-special-cold))) `(markdown-bold-face ((,class :inherit bold))) @@ -6125,7 +6310,7 @@ by virtue of calling either of `modus-themes-load-operandi' and :foreground ,magenta-alt))) `(markdown-inline-code-face ((,class :inherit modus-themes-fixed-pitch :background ,bg-alt :foreground ,fg-special-calm))) - `(markdown-italic-face ((,class :inherit italic :foreground ,fg-special-cold))) + `(markdown-italic-face ((,class :inherit italic))) `(markdown-language-info-face ((,class :inherit modus-themes-fixed-pitch :foreground ,fg-special-cold))) `(markdown-language-keyword-face ((,class :inherit modus-themes-fixed-pitch @@ -6159,7 +6344,7 @@ by virtue of calling either of `modus-themes-load-operandi' and `(markup-error-face ((,class :inherit error))) `(markup-gen-face ((,class :foreground ,magenta-alt))) `(markup-internal-reference-face ((,class :foreground ,fg-alt :underline ,bg-region))) - `(markup-italic-face ((,class :inherit italic :foreground ,fg-special-cold))) + `(markup-italic-face ((,class :inherit italic))) `(markup-list-face ((,class :inherit modus-themes-special-cold))) `(markup-meta-face ((,class :inherit shadow))) `(markup-meta-hide-face ((,class :foreground "gray50"))) @@ -6236,7 +6421,7 @@ by virtue of calling either of `modus-themes-load-operandi' and fg-dim bg-active fg-main bg-active-accent fg-alt bg-active - 'alt-style nil bg-main)))) + 'alt-style bg-main)))) `(mode-line-buffer-id ((,class :inherit bold))) `(mode-line-emphasis ((,class :inherit bold :foreground ,blue-active))) `(mode-line-highlight ((,class :inherit modus-themes-active-blue :box (:line-width -1 :style pressed-button)))) @@ -6273,7 +6458,7 @@ by virtue of calling either of `modus-themes-load-operandi' and `(mu4e-contact-face ((,class :inherit message-header-to))) `(mu4e-context-face ((,class :foreground ,blue-active))) `(mu4e-draft-face ((,class :foreground ,magenta-alt))) - `(mu4e-flagged-face ((,class :foreground ,red-alt))) + `(mu4e-flagged-face ((,class :foreground ,red-alt-other))) `(mu4e-footer-face ((,class :inherit modus-themes-slant :foreground ,fg-special-cold))) `(mu4e-forwarded-face ((,class :foreground ,magenta-alt-other))) `(mu4e-header-face ((,class :inherit shadow))) @@ -6343,10 +6528,11 @@ by virtue of calling either of `modus-themes-load-operandi' and `(notmuch-crypto-signature-good-key ((,class :inherit bold :foreground ,cyan))) `(notmuch-crypto-signature-unknown ((,class :inherit warning))) `(notmuch-hello-logo-background ((,class :background "gray50"))) + `(notmuch-jump-key ((,class :inherit modus-themes-key-binding))) `(notmuch-message-summary-face ((,class :inherit (bold modus-themes-nuanced-cyan)))) `(notmuch-search-count ((,class :inherit shadow))) `(notmuch-search-date ((,class :foreground ,cyan))) - `(notmuch-search-flagged-face ((,class :foreground ,red-alt))) + `(notmuch-search-flagged-face ((,class :foreground ,red-alt-other))) `(notmuch-search-matching-authors ((,class :foreground ,fg-special-cold))) `(notmuch-search-non-matching-authors ((,class :inherit shadow))) `(notmuch-search-subject ((,class :foreground ,fg-main))) @@ -6414,16 +6600,18 @@ by virtue of calling either of `modus-themes-load-operandi' and yellow yellow-nuanced-bg yellow-refine-bg yellow-refine-fg)))) ;;;;; org - `(org-agenda-calendar-event ((,class :inherit shadow))) - `(org-agenda-calendar-sexp ((,class :inherit (modus-themes-slant shadow)))) + `(org-agenda-calendar-event ((,class ,@(modus-themes--agenda-event blue-alt)))) + `(org-agenda-calendar-sexp ((,class :inherit org-agenda-calendar-event))) `(org-agenda-clocking ((,class :inherit modus-themes-special-cold :extend t))) `(org-agenda-column-dateline ((,class :background ,bg-alt))) `(org-agenda-current-time ((,class :foreground ,blue-alt-other-faint))) - `(org-agenda-date ((,class ,@(modus-themes--agenda-date cyan fg-main nil)))) - `(org-agenda-date-today ((,class :background ,bg-active - ,@(modus-themes--agenda-date blue-active fg-main t cyan-active)))) - `(org-agenda-date-weekend ((,class ,@(modus-themes--agenda-date cyan-alt-other fg-alt nil cyan fg-main)))) - `(org-agenda-diary ((,class :inherit shadow))) + `(org-agenda-date ((,class ,@(modus-themes--agenda-date cyan fg-main)))) + `(org-agenda-date-today ((,class ,@(modus-themes--agenda-date blue-active fg-main + cyan-active fg-main + bg-active t t)))) + `(org-agenda-date-weekend ((,class ,@(modus-themes--agenda-date cyan-alt-other fg-alt + cyan fg-main)))) + `(org-agenda-diary ((,class :inherit org-agenda-calendar-event))) `(org-agenda-dimmed-todo-face ((,class :inherit shadow))) `(org-agenda-done ((,class :foreground ,@(modus-themes--success-deuteran blue-nuanced-fg @@ -6448,7 +6636,8 @@ by virtue of calling either of `modus-themes-load-operandi' and `(org-checkbox-statistics-todo ((,class :inherit org-todo))) `(org-clock-overlay ((,class :inherit modus-themes-special-cold))) `(org-code ((,class :inherit modus-themes-fixed-pitch - :background ,bg-alt :foreground ,fg-special-mild))) + :background ,bg-alt :foreground ,fg-special-mild + :extend t))) `(org-column ((,class :background ,bg-alt))) `(org-column-title ((,class :inherit bold :underline t :background ,bg-alt))) `(org-date ((,class :inherit ,(if modus-themes-no-mixed-fonts @@ -6708,9 +6897,9 @@ by virtue of calling either of `modus-themes-load-operandi' and `(proced-marked ((,class :inherit modus-themes-mark-alt))) `(proced-sort-header ((,class :inherit bold :foreground ,fg-special-calm :underline t))) ;;;;; prodigy - `(prodigy-green-face ((,class :foreground ,green))) - `(prodigy-red-face ((,class :foreground ,red))) - `(prodigy-yellow-face ((,class :foreground ,yellow))) + `(prodigy-green-face ((,class :inherit success))) + `(prodigy-red-face ((,class :inherit error))) + `(prodigy-yellow-face ((,class :inherit warning))) ;;;;; pulse `(pulse-highlight-start-face ((,class :background ,bg-active-accent :extend t))) ;;;;; quick-peek @@ -7018,7 +7207,7 @@ by virtue of calling either of `modus-themes-load-operandi' and `(spray-accent-face ((,class :foreground ,red-intense))) `(spray-base-face ((,class :inherit default :foreground ,fg-special-cold))) ;;;;; stripes - `(stripes ((,class :inherit modus-themes-hl-line))) + `(stripes ((,class :background ,bg-alt))) ;;;;; success `(suggest-heading ((,class :inherit bold :foreground ,yellow-alt-other))) ;;;;; switch-window @@ -7100,24 +7289,24 @@ by virtue of calling either of `modus-themes-load-operandi' and `(tab-bar-groups-tab-7 ((,class ,@(modus-themes--variable-pitch-ui) :foreground ,yellow-tab))) `(tab-bar-groups-tab-8 ((,class ,@(modus-themes--variable-pitch-ui) :foreground ,magenta-tab))) ;;;;; tab-bar-mode - `(tab-bar ((,class ,@(modus-themes--variable-pitch-ui) - :background ,bg-tab-bar :foreground ,fg-main))) - `(tab-bar-tab ((,class :inherit bold :box (:line-width 2 :color ,bg-tab-active) - :background ,bg-tab-active :foreground ,fg-main))) - `(tab-bar-tab-inactive ((,class :box (:line-width 2 :color ,bg-tab-inactive) - :background ,bg-tab-inactive :foreground ,fg-dim))) + `(tab-bar ((,class ,@(modus-themes--tab bg-active bg-active-accent nil nil nil nil t)))) + `(tab-bar-tab-group-current ((,class ,@(modus-themes--tab bg-tab-active) + :box (:line-width (2 . -2) :color "gray50")))) + `(tab-bar-tab-group-inactive ((,class ,@(modus-themes--tab bg-tab-inactive bg-tab-inactive-accent fg-dim) + :box (:line-width (2 . -2) :color "gray50")))) + `(tab-bar-tab ((,class ,@(modus-themes--tab bg-tab-active nil nil nil t t)))) + `(tab-bar-tab-inactive ((,class ,@(modus-themes--tab bg-tab-inactive bg-tab-inactive-accent fg-dim nil t)))) ;;;;; tab-line-mode - `(tab-line ((,class ,@(modus-themes--variable-pitch-ui) - :height 0.95 :background ,bg-tab-bar :foreground ,fg-main))) + `(tab-line ((,class ,@(modus-themes--tab bg-active bg-active-accent nil nil nil nil t) + :height 0.95))) `(tab-line-close-highlight ((,class :foreground ,red))) - `(tab-line-highlight ((,class :background ,blue-subtle-bg :foreground ,fg-dim))) - `(tab-line-tab ((,class :inherit bold :box (:line-width 2 :color ,bg-tab-active) - :background ,bg-tab-active :foreground ,fg-main))) + `(tab-line-highlight ((,class :inherit modus-themes-active-blue))) + `(tab-line-tab ((,class ,@(modus-themes--tab bg-tab-active nil nil nil t t)))) `(tab-line-tab-current ((,class :inherit tab-line-tab))) - `(tab-line-tab-inactive ((,class :box (:line-width 2 :color ,bg-tab-inactive) - :background ,bg-tab-inactive :foreground ,fg-dim))) - `(tab-line-tab-inactive-alternate ((,class :box (:line-width 2 :color ,bg-tab-inactive-alt) - :background ,bg-tab-inactive-alt :foreground ,fg-main))) + `(tab-line-tab-inactive ((,class ,@(modus-themes--tab bg-tab-inactive bg-tab-inactive-accent fg-dim nil t)))) + `(tab-line-tab-inactive-alternate ((,class ,@(modus-themes--tab bg-tab-inactive-alt + bg-tab-inactive-alt-accent fg-main nil t)))) + `(tab-line-tab-modified ((,class :foreground ,red-alt-other-faint))) ;;;;; table (built-in table.el) `(table-cell ((,class :background ,blue-nuanced-bg))) ;;;;; telega @@ -7194,7 +7383,10 @@ by virtue of calling either of `modus-themes-load-operandi' and `(transient-heading ((,class :inherit bold :foreground ,fg-main))) `(transient-inactive-argument ((,class :inherit shadow))) `(transient-inactive-value ((,class :inherit shadow))) - `(transient-key ((,class :inherit modus-themes-key-binding))) + ;; FIXME 2021-08-28: using `modus-themes-key-binding' leads to + ;; misalignments because of the added box property. + ;; `(transient-key ((,class :inherit modus-themes-key-binding))) + `(transient-key ((,class :inherit bold :foreground ,blue-alt-other))) `(transient-mismatched-key ((,class :underline t))) `(transient-nonstandard-key ((,class :underline t))) `(transient-pink ((,class :inherit bold :foreground ,magenta-alt-faint))) @@ -7397,7 +7589,7 @@ by virtue of calling either of `modus-themes-load-operandi' and `(web-mode-jsx-depth-3-face ((,class :background ,bg-special-cold :foreground ,fg-special-cold))) `(web-mode-jsx-depth-4-face ((,class :background ,bg-alt :foreground ,blue-refine-fg))) `(web-mode-jsx-depth-5-face ((,class :background ,bg-alt :foreground ,blue-nuanced-fg))) - `(web-mode-keyword-face ((,class :inherit :inherit font-lock-keyword-face))) + `(web-mode-keyword-face ((,class :inherit font-lock-keyword-face))) `(web-mode-param-name-face ((,class :inherit font-lock-function-name-face))) `(web-mode-part-comment-face ((,class :inherit web-mode-comment-face))) `(web-mode-part-face ((,class :inherit web-mode-block-face))) @@ -7590,9 +7782,7 @@ by virtue of calling either of `modus-themes-load-operandi' and (provide 'modus-themes) ;; Local Variables: -;; time-stamp-start: "Last-Modified:[ \t]+\\\\?[\"<]" -;; time-stamp-end: "\\\\?[\">]" -;; time-stamp-format: "%Y-%02m-%02d %02H:%02M:%02S %5z" +;; time-stamp-pattern: "Last-Modified: <%Y-%02m-%02d %02H:%02M:%02S %5z>" ;; End: ;;; modus-themes.el ends here diff --git a/etc/themes/modus-vivendi-theme.el b/etc/themes/modus-vivendi-theme.el index 6ff359d341..919009278b 100644 --- a/etc/themes/modus-vivendi-theme.el +++ b/etc/themes/modus-vivendi-theme.el @@ -4,7 +4,7 @@ ;; Author: Protesilaos Stavrou ;; URL: https://gitlab.com/protesilaos/modus-themes -;; Version: 1.5.0 +;; Version: 1.6.0 ;; Package-Requires: ((emacs "26.1")) ;; Keywords: faces, theme, accessibility commit 1a0f4b3f2352ea5efeac8b3ad704304ed0244f25 Author: Philip Kaludercic Date: Wed Sep 29 12:15:18 2021 +0200 Remove rcirc-omit-responses-after-join option The implementation does not work as expected and behaves unpredictably. * rcirc.el (rcirc-omit-responses-after-join): Remove option (rcirc-joined): Remove variable (rcirc-reconnect): Remove rcirc-joined code (rcirc-get-buffer-create): Remove rcirc-joined code (rcirc-print): Remove rcirc-omit-responses-after-join check * doc/misc/rcirc.texi (Notices): Remove documentation * etc/NEWS: Remove mention diff --git a/doc/misc/rcirc.texi b/doc/misc/rcirc.texi index cbf94cab19..20971293ed 100644 --- a/doc/misc/rcirc.texi +++ b/doc/misc/rcirc.texi @@ -823,18 +823,6 @@ active and only omits a message if the nick has not been active. The window @code{rcirc} considers is controlled by the @code{rcirc-omit-threshold} variable. -@vindex rcirc-omit-responses-after-join -Right after connecting to a server, rcirc will also hide all messages -in @code{rcirc-omit-responses-after-join}, next to -@code{rcirc-omit-responses}. For example, - -@example -(setq rcirc-omit-responses-after-join '("TOPIC" "NICK")) -@end example - -would hide the topic message and the list of users in the current -channel right after joining a new channel. - @node Hacking and Tweaking @chapter Hacking and Tweaking @cindex hacking and tweaking diff --git a/etc/NEWS b/etc/NEWS index c42539a7aa..475d294270 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3011,10 +3011,6 @@ This includes support for the capabilities: 'server-time', 'batch', --- *** Check 'auth-sources' for server passwords. ---- -*** Allow for channels to hide certain message types right after connecting. -Set 'rcirc-omit-responses-after-join' analogously to 'rcirc-omit-responses'. - +++ *** Implement repeated reconnection strategy. See 'rcirc-reconnect-attempts'. diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index e02d85e21a..ba7fbbf6b7 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -195,16 +195,6 @@ If nil, no maximum is applied." "Responses which will be hidden when `rcirc-omit-mode' is enabled." :type '(repeat string)) -(defcustom rcirc-omit-responses-after-join '() - "Types of messages to hide right after joining a channel." - :type '(repeat string) - :version "28.1") - -(defvar-local rcirc-joined nil - "Non-nil means we have just connected. -This is used to hide the message types enumerated in -`rcirc-omit-responses-after-join'.") - (defvar-local rcirc-prompt-start-marker nil "Marker indicating the beginning of the message prompt.") @@ -841,8 +831,7 @@ If QUIET is non-nil, no not emit a message." (dolist (buffer (mapcar #'cdr rcirc-buffer-alist)) (when (buffer-live-p buffer) (with-current-buffer buffer - (setq rcirc-joined (current-time) - mode-line-process ":connecting")))) + (setq mode-line-process ":connecting")))) (let ((nprocess (apply #'rcirc-connect conn-info))) (when (and (< rcirc-failed-attempts rcirc-reconnect-attempts) (eq (process-status nprocess) 'failed)) @@ -1568,8 +1557,7 @@ Create the buffer if it doesn't exist." (with-current-buffer new-buffer (unless (eq major-mode 'rcirc-mode) (rcirc-mode process target)) - (setq mode-line-process nil) - (setq rcirc-joined (current-time))) + (setq mode-line-process nil)) (rcirc-put-nick-channel process (rcirc-nick process) target rcirc-current-line) new-buffer))))) @@ -1970,10 +1958,7 @@ connection." ;; make text omittable (let ((last-activity-lines (rcirc-elapsed-lines process sender target))) (if (and (not (string= (rcirc-nick process) sender)) - (or (member response rcirc-omit-responses) - (and (member response rcirc-omit-responses-after-join) - (< (time-to-seconds (time-since rcirc-joined)) - 1))) + (member response rcirc-omit-responses) (or (not last-activity-lines) (< rcirc-omit-threshold last-activity-lines))) (put-text-property (point-min) (point-max) commit f11f358213da381899a0843559ba2ac9dd014359 Author: Stefan Kangas Date: Wed Sep 29 07:04:07 2021 +0200 ; * etc/NEWS: Re-arrange slightly and fix formatting. diff --git a/etc/NEWS b/etc/NEWS index fb3d79bb3a..c42539a7aa 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1444,6 +1444,13 @@ is t by default; set to nil to get back the old behavior. If 'numeric', calendar functions (eg 'calendar-sunrise-sunset') that display time zones will use a form like "+0100" instead of "CET". +** Imenu + ++++ +*** New user option 'imenu-max-index-time'. +If creating the imenu index takes longer than specified by this +option (default 5 seconds), imenu indexing is stopped. + ** ido --- @@ -1637,28 +1644,6 @@ to make better use of the horizontal space, in particular eliminating the truncation of function names. There is no way to get the former layout back. -** Python mode - ---- -*** New user option 'python-forward-sexp-function'. -This allows the user easier customization of whether to use block-based -navigation or not. - ---- -*** 'python-shell-interpreter' now defaults to python3 on systems with python3. - ---- -*** 'C-c C-r' can now be used on arbitrary regions. -The command previously extended the start of the region to the start -of the line, but will now actually send the marked region, as -documented. - -** Perl mode - ---- -*** New face 'perl-non-scalar-variable'. -This is used to fontify non-scalar variables. - ** Icomplete --- @@ -2719,6 +2704,35 @@ The old names are now obsolete. *** 'world-clock-mode' can no longer be turned on interactively. Use 'world-clock' to turn on that mode. +** Python mode + +--- +*** New user option 'python-forward-sexp-function'. +This allows the user easier customization of whether to use block-based +navigation or not. + +--- +*** 'python-shell-interpreter' now defaults to python3 on systems with python3. + +--- +*** 'C-c C-r' can now be used on arbitrary regions. +The command previously extended the start of the region to the start +of the line, but will now actually send the marked region, as +documented. + +** Ruby Mode + +--- +*** 'ruby-use-smie' is declared obsolete. +SMIE is now always enabled and 'ruby-use-smie' only controls whether +indentation is done using SMIE or with the old ad-hoc code. + +--- +*** Indentation has changed when 'ruby-align-chained-calls' is non-nil. +This previously used to align subsequent lines with the last sibling, +but it now aligns with the first sibling (which is the preferred style +in Ruby). + ** CPerl Mode --- @@ -2730,6 +2744,12 @@ This value customizes Emacs to use the style recommended in Damian Conway's book "Perl Best Practices" for indentation and formatting of conditionals. +** Perl mode + +--- +*** New face 'perl-non-scalar-variable'. +This is used to fontify non-scalar variables. + ** Octave Mode +++ @@ -2967,37 +2987,37 @@ Face 'mh-folder-whitelisted' is renamed 'mh-folder-allowlisted'. *** rcirc now supports SASL authentication. --- -*** rcirc connects asynchronously +*** rcirc connects asynchronously. --- -*** Integrate formatting into rcirc-send-string +*** Integrate formatting into 'rcirc-send-string'. The function now accepts a variable number of arguments. +++ -*** Deprecate defun-rcirc-command in favour of rcirc-define-command +*** Deprecate 'defun-rcirc-command' in favour of 'rcirc-define-command'. The new macro handles multiple and optional arguments. --- -*** Add basic IRCv3 support -This includes support for the capabilities: server-time, batch, -message-ids, invite-notify, multi-prefix and standard-replies. +*** Add basic IRCv3 support. +This includes support for the capabilities: 'server-time', 'batch', +'message-ids', 'invite-notify', 'multi-prefix' and 'standard-replies'. --- -*** Add mouse property support to rcirc-track-minor-mode +*** Add mouse property support to 'rcirc-track-minor-mode'. --- -*** Improve support for IRC markup codes +*** Improve support for IRC markup codes. --- -*** Check auth-sources for server passwords +*** Check 'auth-sources' for server passwords. --- *** Allow for channels to hide certain message types right after connecting. -Set rcirc-omit-responses-after-join analogously to rcirc-omit-responses. +Set 'rcirc-omit-responses-after-join' analogously to 'rcirc-omit-responses'. +++ -*** Implement repeated reconnection strategy -See rcirc-reconnect-attempts. +*** Implement repeated reconnection strategy. +See 'rcirc-reconnect-attempts'. ** MPC @@ -3107,26 +3127,6 @@ different timezone causing a difference in the date. Instead you need to do "emacs -f dun-batch" to start the game in batch mode. -** Ruby Mode - ---- -** 'ruby-use-smie' is declared obsolete. -SMIE is now always enabled and 'ruby-use-smie' only controls whether -indentation is done using SMIE or with the old ad-hoc code. - ---- -** Indentation has changed when 'ruby-align-chained-calls' is non-nil. -This previously used to align subsequent lines with the last sibling, -but it now aligns with the first sibling (which is the preferred style -in Ruby). - -** Imenu - -+++ -*** New user option 'imenu-max-index-time'. -If creating the imenu index takes longer than specified by this -option (default 5 seconds), imenu indexing is stopped. - * New Modes and Packages in Emacs 28.1 commit 902f31d32b61d0e7e73d5429334fa945e2eece37 Author: Stefan Kangas Date: Wed Sep 29 07:12:37 2021 +0200 New user option mpc-cover-image-re * lisp/mpc.el (mpc-cover-image-re): New user option. (mpc-format): Find cover image based on regexp given by above new user option. Treat "folder.png" as a valid cover image name. diff --git a/etc/NEWS b/etc/NEWS index bf942cb187..fb3d79bb3a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2999,6 +2999,12 @@ Set rcirc-omit-responses-after-join analogously to rcirc-omit-responses. *** Implement repeated reconnection strategy See rcirc-reconnect-attempts. +** MPC + +--- +*** New user option 'mpc-cover-image-re'. +If non-nil, it is a regexp that should match a valid cover image. + ** Miscellaneous --- diff --git a/lisp/mpc.el b/lisp/mpc.el index 494a4b9d88..ad32ce8d33 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -962,6 +962,11 @@ If PLAYLIST is t or nil or missing, use the main playlist." ;;; Formatter ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defcustom mpc-cover-image-re nil ; (rx (or ".jpg" ".jpeg" ".png") string-end) + "If non-nil, it is a regexp that should match a valid cover image." + :type '(regexp) + :version "28.1") + (defun mpc-secs-to-time (secs) ;; We could use `format-seconds', but it doesn't seem worth the trouble ;; because we'd still need to check (>= secs (* 60 100)) since the special @@ -1034,15 +1039,18 @@ If PLAYLIST is t or nil or missing, use the main playlist." (and (funcall oldpred info) (equal dir (file-name-directory (cdr (assq 'file info)))))))) - (if-let* ((covers '(".folder.png" "cover.jpg" "folder.jpg")) + (if-let* ((covers '(".folder.png" "folder.png" "cover.jpg" "folder.jpg")) (cover (cl-loop for file in (directory-files (mpc-file-local-copy dir)) - if (member (downcase file) covers) + if (or (member (downcase file) covers) + (and mpc-cover-image-re + (string-match mpc-cover-image-re file))) return (concat dir file))) (file (with-demoted-errors "MPC: %s" (mpc-file-local-copy cover)))) (let (image) (if (null size) (setq image (create-image file)) (let ((tempfile (make-temp-file "mpc" nil ".jpg"))) + ;; FIXME: Use native image scaling instead. (call-process "convert" nil nil nil "-scale" size file tempfile) (setq image (create-image tempfile)) commit dcabf95275dfa8681ba3a5e732906de98951436a Author: Martin Rudalics Date: Wed Sep 29 10:43:29 2021 +0200 Fix 'window-toggle-side-windows' (Bug#50867) * lisp/window.el (window-toggle-side-windows): Bind 'window-combination-resize' to t around 'window-state-put' calls (Bug#50867). diff --git a/lisp/window.el b/lisp/window.el index b240b16f24..971264b634 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -1212,7 +1212,8 @@ it is found." ((setq state (frame-parameter frame 'window-state)) ;; A window state was saved for FRAME. Restore it and put the ;; current root window into its main window. - (let ((main-state (window-state-get (frame-root-window frame)))) + (let ((window-combination-resize t) + (main-state (window-state-get (frame-root-window frame)))) (window-state-put state (frame-root-window frame) t) (window-state-put main-state (window-main-window frame))) (window--sides-reverse-frame frame)) commit 0d72beec9bb8d6131824aab22cab7fe4020027cf Author: Michael Albinus Date: Wed Sep 29 09:48:01 2021 +0200 Some inmprovements in emba CI files * test/infra/Dockerfile.emba: Remove superfluous "make -j4". * test/infra/gitlab-ci.yml (.test-template): Add 'allow_failure' clause. (test-all-inotify): Add 'needs' clause. diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba index 0b69a71992..f7cd183e53 100644 --- a/test/infra/Dockerfile.emba +++ b/test/infra/Dockerfile.emba @@ -45,7 +45,6 @@ RUN ./autogen.sh autoconf RUN ./configure # 'make -j4 bootstrap' does not work reliably. RUN make bootstrap -RUN make -j4 FROM emacs-base as emacs-filenotify-gio @@ -59,7 +58,6 @@ WORKDIR /checkout RUN ./autogen.sh autoconf RUN ./configure --with-file-notification=gfile RUN make bootstrap -RUN make -j4 FROM emacs-base as emacs-gnustep @@ -73,7 +71,6 @@ WORKDIR /checkout RUN ./autogen.sh autoconf RUN ./configure --with-ns RUN make bootstrap -RUN make -j4 FROM emacs-base as emacs-native-comp-speed0 @@ -90,4 +87,3 @@ RUN ./autogen.sh autoconf RUN ./configure --with-native-compilation RUN make bootstrap -j2 \ NATIVE_FULL_AOT=1 BYTE_COMPILE_EXTRA_FLAGS='--eval "(setq comp-speed 0)"' -RUN make -j4 diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index b6243e1063..a004705ec6 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -147,6 +147,7 @@ default: - if: '$CI_JOB_STAGE =~ "fast|normal" && $CI_PIPELINE_SOURCE == "schedule"' when: never - when: always + allow_failure: true artifacts: name: ${test_name} public: true @@ -199,7 +200,6 @@ default: timeout: 8 hours stages: -# - prep-images - build-images # - fast - normal @@ -209,16 +209,9 @@ stages: - native-comp - slow -# prep-image-base: -# stage: prep-images -# extends: [.job-template, .build-template] -# variables: -# target: emacs-base - build-image-inotify: stage: build-images extends: [.job-template, .build-template] -# needs: [prep-image-base] variables: target: emacs-inotify @@ -246,14 +239,12 @@ test-lisp-net-inotify: build-image-filenotify-gio: stage: platform-images extends: [.job-template, .build-template, .filenotify-gio-template] -# needs: [prep-image-base] variables: target: emacs-filenotify-gio build-image-gnustep: stage: platform-images extends: [.job-template, .build-template, .gnustep-template] -# needs: [prep-image-base] variables: target: emacs-gnustep @@ -278,7 +269,6 @@ test-gnustep: build-native-bootstrap-speed0: stage: native-comp-images extends: [.job-template, .build-template, .native-comp-template] -# needs: [prep-image-base] variables: target: emacs-native-comp-speed0 @@ -317,6 +307,7 @@ build-native-bootstrap-speed0: test-all-inotify: # This tests also file monitor libraries inotify and inotifywatch. stage: slow + needs: [build-image-inotify] extends: [.job-template, .test-template] rules: # note there's no "changes" section, so this always runs on a schedule commit afee49fa0842f21ac008995a288be3f71c55800e Author: Juri Linkov Date: Wed Sep 29 10:19:22 2021 +0300 * lisp/net/dictionary.el (context-menu-dictionary): Add autoload cookie. (context-menu-functions): Remove context-menu-dictionary from hook (bug#50552) diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 09d250fd7b..86447c2c35 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -1375,8 +1375,12 @@ any buffer where (dictionary-tooltip-mode 1) has been called." (current-word))))) (dictionary-search word))) +;;;###autoload (defun context-menu-dictionary (menu click) - "Populate MENU with dictionary commands at CLICK." + "Populate MENU with dictionary commands at CLICK. +When you add this function to `context-menu-functions', +the context menu will contain an item that searches +the word at mouse click." (when (thing-at-mouse click 'word) (define-key menu [dictionary-separator] menu-bar-separator) (define-key menu [dictionary-search-word-at-mouse] @@ -1384,7 +1388,5 @@ any buffer where (dictionary-tooltip-mode 1) has been called." :help "Search the word at mouse click in dictionary"))) menu) -(add-hook 'context-menu-functions 'context-menu-dictionary 15) - (provide 'dictionary) ;;; dictionary.el ends here commit c4866ad1ac856b5c34c38b7dd5818c5ef2a2b885 Author: Lars Ingebrigtsen Date: Wed Sep 29 08:25:14 2021 +0200 Tweak the whitespace before "This is a generic function" * lisp/emacs-lisp/cl-generic.el (cl--generic-describe): Make the number of blank lines before this section consistent (whether there's an indented section before it or not). diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index 1640975b84..4834fb13c6 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -1026,7 +1026,10 @@ MET-NAME is as returned by `cl--generic-load-hist-format'." (when generic (require 'help-mode) ;Needed for `help-function-def' button! (save-excursion - (insert "\n\nThis is a generic function.\n\n") + ;; Ensure that we have two blank lines (but not more). + (unless (looking-back "\n\n" (- (point) 2)) + (insert "\n")) + (insert "This is a generic function.\n\n") (insert (propertize "Implementations:\n\n" 'face 'bold)) ;; Loop over fanciful generics (dolist (method (cl--generic-method-table generic)) commit 3efa45849ab02b4c331d6d3d8a41ba03a1ef016a Author: Lars Ingebrigtsen Date: Wed Sep 29 07:53:10 2021 +0200 Improve the max-specpdl-size doc string * src/eval.c (syms_of_eval): Mention what "specpdl" means. diff --git a/src/eval.c b/src/eval.c index 66d34808f8..0f792b487e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -4311,13 +4311,19 @@ syms_of_eval (void) { DEFVAR_INT ("max-specpdl-size", max_specpdl_size, doc: /* Limit on number of Lisp variable bindings and `unwind-protect's. -If Lisp code tries to increase the total number past this amount, -an error is signaled. -You can safely use a value considerably larger than the default value, -if that proves inconveniently small. However, if you increase it too far, -Emacs could run out of memory trying to make the stack bigger. -Note that this limit may be silently increased by the debugger -if `debug-on-error' or `debug-on-quit' is set. */); + +If Lisp code tries to use more bindings than this amount, an error is +signaled. + +You can safely increase this variable substantially if the default +value proves inconveniently small. However, if you increase it too +much, Emacs could run out of memory trying to make the stack bigger. +Note that this limit may be silently increased by the debugger if +`debug-on-error' or `debug-on-quit' is set. + +\"spec\" is short for \"special variables\", i.e., dynamically bound +variables. \"PDL\" is short for \"push-down list\", which is an old +term for \"stack\". */); DEFVAR_INT ("max-lisp-eval-depth", max_lisp_eval_depth, doc: /* Limit on depth in `eval', `apply' and `funcall' before error. commit 081eb52e4d8441a82134db5b34848474a1d01acf Author: Amin Bandali Date: Wed Sep 29 00:44:43 2021 -0400 Switch the order of ERC's '/whois' arguments sent to the server * lisp/erc/erc.el (erc-cmd-WHOIS): Switch the order of 'server' and 'user' arguments sent to the server. Per RFC 1459 and RFC 2812, the optional 'server' argument command comes before the 'user' argument, not after. While at it, update the doc string to explain why one may want to specify the 'server' argument. * etc/NEWS: Announce the change. diff --git a/etc/NEWS b/etc/NEWS index 6d039bac4a..bf942cb187 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2853,6 +2853,11 @@ The new '/opme' convenience command asks ChanServ to set the operator status for the current nick in the current channel, and '/deopme' unsets it. +--- +*** Fix the order of '/whois' arguments sent to the server. +Per RFC 1459 and RFC 2812, when given, the optional 'server' argument +for the WHOIS command must come before the 'user' argument, not after. + ** xwidget-webkit mode --- diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index ac0c08bd3a..7fa2d37c9f 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -3301,10 +3301,13 @@ a script after exceeding the flood threshold." (defun erc-cmd-WHOIS (user &optional server) "Display whois information for USER. -If SERVER is non-nil, use that, rather than the current server." - ;; FIXME: is the above docstring correct? -- Lawrence 2004-01-08 +If SERVER is non-nil, use that, rather than the current server. +This is useful for getting the time USER has been idle for, if +USER is on a different server of the network than the current +user, since only the server the user is connected to knows this +information." (let ((send (if server - (format "WHOIS %s %s" user server) + (format "WHOIS %s %s" server user) (format "WHOIS %s" user)))) (erc-log (format "cmd: %s" send)) (erc-server-send send) commit fcfcb35791495ea842d30efc3d87a088ecd57977 Author: Stefan Kangas Date: Wed Sep 29 06:54:52 2021 +0200 * lisp/mpc.el (mpc-format): Fix printing after last format spec. diff --git a/lisp/mpc.el b/lisp/mpc.el index 1f4cb4fe9c..494a4b9d88 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -1111,6 +1111,9 @@ If PLAYLIST is t or nil or missing, use the main playlist." (if (null size) (setq col (+ col textwidth postwidth)) (insert space) (setq col (+ col size)))))) + ;; Print the rest of format-spec, in case there is text after the + ;; last actual format specifier. + (insert (substring format-spec pos)) (put-text-property start (point) 'mpc--uptodate-p pred))) ;;; The actual UI code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; commit cbb0b5d8d5c823357951689ea4f14994e0399992 Author: Amin Bandali Date: Tue Sep 28 23:44:48 2021 -0400 Unobsolete erc-compat.el * lisp/obsolete/erc-compat.el: Move from here... * lisp/erc/erc-compat.el: ...back to here. ERC will soon be added to GNU ELPA, and erc-compat.el will be used to provide compatibility functions and/or variables for using ERC on older Emacsen. * etc/NEWS: Remove the previously added obsoletion news item. diff --git a/etc/NEWS b/etc/NEWS index 15614da742..6d039bac4a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2817,11 +2817,6 @@ Allowed inputs are seconds or ISO8601-like periods like "1h" or "4h30m". *** ERC now recognizes 'C-]' for italic text. Italic text is displayed in the new 'erc-italic-face'. ---- -*** The erc-compat.el library is now marked obsolete. -This file contained ERC compatibility code for Emacs 21 and XEmacs -which is no longer needed. - --- *** erc-match.el now supports 'message' highlight type (not including the nick). The 'erc-current-nick-highlight-type', 'erc-pal-highlight-type', diff --git a/lisp/obsolete/erc-compat.el b/lisp/erc/erc-compat.el similarity index 98% rename from lisp/obsolete/erc-compat.el rename to lisp/erc/erc-compat.el index ef47ab793a..6b1da2f905 100644 --- a/lisp/obsolete/erc-compat.el +++ b/lisp/erc/erc-compat.el @@ -1,11 +1,10 @@ -;;; erc-compat.el --- ERC compatibility code for XEmacs -*- lexical-binding: t; -*- +;;; erc-compat.el --- ERC compatibility code for older Emacsen -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc. ;; Author: Alex Schroeder ;; Maintainer: Amin Bandali ;; URL: https://www.emacswiki.org/emacs/ERC -;; Obsolete-since: 28.1 ;; This file is part of GNU Emacs. commit b9fa57e5b06a826744fee5b4af9cc45d0ee2ff26 Author: Stefan Kangas Date: Wed Sep 29 03:48:35 2021 +0200 * etc/NEWS: Announce Eshell bookmarks. diff --git a/etc/NEWS b/etc/NEWS index 38a8f3015d..15614da742 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1565,6 +1565,10 @@ This allows users to use (define-key eshell-mode-map ...) as usual. Some modules have their own minor mode now to account for these changes. +*** Support for bookmark.el. +The command `bookmark-set' (bound to `C-x r m') is now supported, and +will create a bookmark that opens the current directory in Eshell. + ** Archive mode --- diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index a9775b7c56..98e89037f3 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -993,8 +993,6 @@ This function could be in the list `eshell-output-filter-functions'." ;;; Bookmark support: -(declare-function bookmark-make-record-default - "bookmark" (&optional no-file no-context posn)) (declare-function bookmark-prop-get "bookmark" (bookmark prop)) (defun eshell-bookmark-name () commit da89bdde2e3aa941594a112db884ede1beaac658 Author: Stefan Kangas Date: Wed Sep 29 03:24:10 2021 +0200 Add bookmark.el support to eww * lisp/net/eww.el (eww-bookmark-name, eww-bookmark-make-record) (eww-bookmark-jump): New defuns. (eww-mode): Set up bookmark handler. diff --git a/etc/NEWS b/etc/NEWS index 21cc3c50cd..38a8f3015d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2391,6 +2391,11 @@ The function that is invoked when clicking on or otherwise following a 'mailto:' link in an EWW buffer can now be customized. For more information, see the related entry about 'shr-browse-url' above. +--- +*** Support for bookmark.el. +The command `bookmark-set' (bound to `C-x r m') is now supported, and +will create a bookmark that opens the current URL in EWW. + ** SHR --- diff --git a/lisp/net/eww.el b/lisp/net/eww.el index e9b3185807..bb6583c2a9 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1101,6 +1101,7 @@ the like." (setq-local thing-at-point-provider-alist (append thing-at-point-provider-alist '((url . eww--url-at-point)))) + (setq-local bookmark-make-record-function #'eww-bookmark-make-record) (buffer-disable-undo) (setq buffer-read-only t)) @@ -2419,6 +2420,28 @@ Otherwise, the restored buffer will contain a prompt to do so by using (eww-previous-url)))) (current-buffer)) +;;; bookmark.el support + +(declare-function bookmark-make-record-default + "bookmark" (&optional no-file no-context posn)) +(declare-function bookmark-prop-get "bookmark" (bookmark prop)) + +(defun eww-bookmark-name () + "Create a default bookmark name for the current EWW buffer." + (plist-get eww-data :title)) + +(defun eww-bookmark-make-record () + "Create a bookmark for the current EWW buffer." + `(,(eww-bookmark-name) + ,@(bookmark-make-record-default t) + (location . ,(plist-get eww-data :url)) + (handler . eww-bookmark-jump))) + +;;;###autoload +(defun eww-bookmark-jump (bookmark) + "Default bookmark handler for EWW buffers." + (eww (bookmark-prop-get bookmark 'location))) + (provide 'eww) ;;; eww.el ends here commit ee856b76ff6a241cefec1f448a2c5528ad0f1c56 Author: Dmitry Gutov Date: Wed Sep 29 03:48:27 2021 +0300 Enable show-paren-mode by default * etc/NEWS (https): Mention the change. * lisp/paren.el (show-paren-mode): Enable by default, as discussed on emacs-devel. diff --git a/etc/NEWS b/etc/NEWS index 4fd5036c3b..21cc3c50cd 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1077,10 +1077,17 @@ This command is bound to 'C-x C-k d'. It used to be enabled when Emacs is started in GUI mode but not when started in text mode. The cursor still only actually blinks in GUI frames. +** 'show-paren-mode' is now enabled by default. +To go back to the previous behavior, customize the user option by the +same name to nil. + +++ ** New minor mode 'show-paren-local-mode'. It serves as a local counterpart for 'show-paren-mode', allowing you -to toggle it separately in different buffers. +to toggle it separately in different buffers. To use it only in +programming modes, for example, add the following to your init file: + +(add-hook 'prog-mode-hook #'show-paren-local-mode) * Changes in Specialized Modes and Packages in Emacs 28.1 diff --git a/lisp/paren.el b/lisp/paren.el index 708605f794..ce6aa9ae13 100644 --- a/lisp/paren.el +++ b/lisp/paren.el @@ -107,6 +107,8 @@ after `show-paren-delay' seconds of Emacs idle time. This is a global minor mode. To toggle the mode in a single buffer, use `show-paren-local-mode'." :global t :group 'paren-showing + :initialize 'custom-initialize-delay + :init-value t ;; Enable or disable the mechanism. ;; First get rid of the old idle timer. (when show-paren--idle-timer commit 568b8b977fc6b702655b2f9ca9f358aa1e6f12c4 Author: Stefan Kangas Date: Wed Sep 29 01:37:26 2021 +0200 * lisp/net/eww.el (eww-mode): Show keybindings in docstring. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 701dc4fade..e9b3185807 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1083,7 +1083,9 @@ the like." ;; Autoload cookie needed by desktop.el. ;;;###autoload (define-derived-mode eww-mode special-mode "eww" - "Mode for browsing the web." + "Mode for browsing the web. + +\\{eww-mode-map}" :interactive nil (setq-local eww-data (list :title "")) (setq-local browse-url-browser-function #'eww-browse-url) commit 2d1564103e2024eeb4377b473f28e1523a5206bc Author: Juri Linkov Date: Tue Sep 28 22:00:41 2021 +0300 * lisp/mouse.el (context-menu-map): Fix when menu is a command (bug#50851) * lisp/help.el (help--analyze-key): Get information at the position of mouse click such as 'C-h k' on a context menu item (bug#50067). diff --git a/lisp/help.el b/lisp/help.el index 8f77167040..b794751eca 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -695,7 +695,7 @@ Returns a list of the form (BRIEF-DESC DEFN EVENT MOUSE-MSG)." (mouse-msg (if (or (memq 'click modifiers) (memq 'down modifiers) (memq 'drag modifiers)) " at that spot" "")) - (defn (key-binding key t))) + (defn (save-excursion (mouse-set-point event) (key-binding key t)))) ;; Handle the case where we faked an entry in "Select and Paste" menu. (when (and (eq defn nil) (stringp (aref key (1- (length key)))) diff --git a/lisp/mouse.el b/lisp/mouse.el index d80b241af5..5d4e05fa25 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -328,7 +328,7 @@ the function `context-menu-filter-function'." ;; Remove duplicate separators (let ((l menu)) - (while l + (while (consp l) (when (and (equal (cdr-safe (car l)) menu-bar-separator) (equal (cdr-safe (cadr l)) menu-bar-separator)) (setcdr l (cddr l))) commit 7cc6e1dda73946c9a75e50a198bdbce0cd19cd4d Author: Stefan Kangas Date: Tue Sep 28 20:45:08 2021 +0200 Add shortdoc for text properties * lisp/emacs-lisp/shortdoc.el (text-properties): New shortdoc. e for your changes. Lines starting diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index d4838ff0f8..51c822d21e 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -1158,6 +1158,49 @@ There can be any number of :example/:result elements." (sqrt :eval (sqrt -1))) +(define-short-documentation-group text-properties + "Examining Text Properties" + (get-text-property + :eval (get-text-property 0 'foo (propertize "x" 'foo t))) + (get-char-property + :eval (get-char-property 0 'foo (propertize "x" 'foo t))) + (get-pos-property + :eval (get-pos-property 0 'foo (propertize "x" 'foo t))) + (get-char-property-and-overlay + :eval (get-char-property-and-overlay 0 'foo (propertize "x" 'foo t))) + (text-properties-at + :eval (text-properties-at (point))) + "Changing Text Properties" + (put-text-property + :eval (let ((s "abc")) (put-text-property 0 1 'foo t s) s) + :no-eval (put-text-property (point) (1+ (point)) 'face 'error)) + (add-text-properties + :no-eval (add-text-properties (point) (1+ (point)) '(face error))) + (remove-text-properties + :no-eval (remove-text-properties (point) (1+ (point)) '(face nil))) + (remove-list-of-text-properties + :no-eval (remove-list-of-text-properties (point) (1+ (point)) '(face font-lock-face))) + (set-text-properties + :no-eval (set-text-properties (point) (1+ (point)) '(face error))) + (add-face-text-property + (add-face-text-property START END '(:foreground "green"))) + (propertize + :eval (propertize "foo" 'face 'italic 'mouse-face 'bold-italic)) + "Searching for Text Properties" + (next-property-change + :no-eval (next-property-change (point) (current-buffer))) + (previous-property-change + :no-eval (previous-property-change (point) (current-buffer))) + (next-single-property-change + :no-eval (next-single-property-change (point) 'face (current-buffer))) + (previous-single-property-change + :no-eval (previous-single-property-change (point) 'face (current-buffer))) + ;; TODO: There are some more that could be added here. + (text-property-search-forward + :no-eval (text-property-search-forward 'face nil t)) + (text-property-search-backward + :no-eval (text-property-search-backward 'face nil t))) + ;;;###autoload (defun shortdoc-display-group (group &optional function) "Pop to a buffer with short documentation summary for functions in GROUP. commit ccb35fb8fb9de5f069fd0103f24e3048d716febc Author: Stefan Kangas Date: Tue Sep 28 18:38:10 2021 +0200 Mention describe-symbol in cl-defstruct docstring * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Mention 'describe-symbol' in docstring. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 74210ac632..527720c6e8 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2889,7 +2889,7 @@ Supported keywords for slots are: - `:type': the type of the field; currently only used for documentation. To see the documentation for a defined struct type, use -\\[cl-describe-type]. +\\[describe-symbol] or \\[cl-describe-type]. \(fn NAME &optional DOCSTRING &rest SLOTS)" (declare (doc-string 2) (indent 1) commit b9611e9c7e34b8b8ca2a5a9bba1252f4d8392583 Author: Stefan Kangas Date: Tue Sep 28 18:08:47 2021 +0200 Mention cl-describe-type in cl-defstruct docstring * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Mention 'cl-describe-type' in docstring. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 4e0e323cfa..74210ac632 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2888,6 +2888,9 @@ Supported keywords for slots are: - `:documentation': this is a docstring describing the slot. - `:type': the type of the field; currently only used for documentation. +To see the documentation for a defined struct type, use +\\[cl-describe-type]. + \(fn NAME &optional DOCSTRING &rest SLOTS)" (declare (doc-string 2) (indent 1) (debug commit 29022571289dc3c21a49be127bab76976828137c Author: Mattias Engdegård Date: Tue Sep 28 17:00:11 2021 +0200 ; * test/lisp/electric-tests.el: Reduce python-mode log spam. diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index 4e7cbf5419..f59f9d9cca 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el @@ -54,17 +54,18 @@ expected-point mode bindings fixture-fn &optional doc-string) (with-temp-buffer - (funcall mode) - (insert fixture) - (save-electric-modes - (let ((last-command-event char) - (transient-mark-mode 'lambda)) - (goto-char where) - (funcall fixture-fn) - (cl-progv - (mapcar #'car bindings) - (mapcar #'cdr bindings) - (call-interactively (key-binding `[,last-command-event]))))) + (dlet ((python-indent-guess-indent-offset-verbose nil)) + (funcall mode) + (insert fixture) + (save-electric-modes + (let ((last-command-event char) + (transient-mark-mode 'lambda)) + (goto-char where) + (funcall fixture-fn) + (cl-progv + (mapcar #'car bindings) + (mapcar #'cdr bindings) + (call-interactively (key-binding `[,last-command-event])))))) (when (and doc-string (not @@ -98,21 +99,22 @@ ;; FIXME: avoid `eval' (mapcar #'car (eval bindings)) (mapcar #'cdr (eval bindings)) - (funcall mode) - (insert fixture) - (goto-char (1+ pos)) - (insert char) - (cond ((eq (aref skip-pair-string pos) - ?p) - (insert (cadr (electric-pair-syntax-info char))) - (backward-char 1)) - ((eq (aref skip-pair-string pos) - ?s) - (delete-char -1) - (forward-char 1))) - (list - (buffer-substring-no-properties (point-min) (point-max)) - (point)))) + (dlet ((python-indent-guess-indent-offset-verbose nil)) + (funcall mode) + (insert fixture) + (goto-char (1+ pos)) + (insert char) + (cond ((eq (aref skip-pair-string pos) + ?p) + (insert (cadr (electric-pair-syntax-info char))) + (backward-char 1)) + ((eq (aref skip-pair-string pos) + ?s) + (delete-char -1) + (forward-char 1))) + (list + (buffer-substring-no-properties (point-min) (point-max)) + (point))))) (list expected-string expected-point))) (expected-string (car expected-string-and-point)) (expected-point (cadr expected-string-and-point)) @@ -191,11 +193,13 @@ The buffer's contents should %s: for (prefix suffix extra-desc) in (append (if test-in-comments `((,(with-temp-buffer - (funcall mode) - (insert "z") - (comment-region (point-min) (point-max)) - (buffer-substring-no-properties (point-min) - (1- (point-max)))) + (dlet ((python-indent-guess-indent-offset-verbose + nil)) + (funcall mode) + (insert "z") + (comment-region (point-min) (point-max)) + (buffer-substring-no-properties (point-min) + (1- (point-max))))) "" "-in-comments"))) (if test-in-strings commit fa92b040c6738de7278605cadeace0c5380a0814 Author: Stefan Monnier Date: Tue Sep 28 10:29:27 2021 -0400 * lisp/emacs-lisp/map.el: Restore compatibility with Emacs-26 Don't use the new `eql` syntax. diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index e0af448eaf..da4502f9ed 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el @@ -5,7 +5,7 @@ ;; Author: Nicolas Petton ;; Maintainer: emacs-devel@gnu.org ;; Keywords: extensions, lisp -;; Version: 3.2 +;; Version: 3.2.1 ;; Package-Requires: ((emacs "26")) ;; This file is part of GNU Emacs. @@ -427,15 +427,15 @@ See `map-into' for all supported values of TYPE." "Convert MAP into a map of TYPE.") ;; FIXME: I wish there was a way to avoid this η-redex! -(cl-defmethod map-into (map (_type (eql 'list))) +(cl-defmethod map-into (map (_type (eql list))) "Convert MAP into an alist." (map-pairs map)) -(cl-defmethod map-into (map (_type (eql 'alist))) +(cl-defmethod map-into (map (_type (eql alist))) "Convert MAP into an alist." (map-pairs map)) -(cl-defmethod map-into (map (_type (eql 'plist))) +(cl-defmethod map-into (map (_type (eql plist))) "Convert MAP into a plist." (let (plist) (map-do (lambda (k v) (setq plist `(,v ,k ,@plist))) map) @@ -530,7 +530,7 @@ KEYWORD-ARGS are forwarded to `make-hash-table'." map) ht)) -(cl-defmethod map-into (map (_type (eql 'hash-table))) +(cl-defmethod map-into (map (_type (eql hash-table))) "Convert MAP into a hash-table with keys compared with `equal'." (map--into-hash map (list :size (map-length map) :test #'equal))) commit 2c3c4446cf14f2c2604df979bb5969a7b41a35bd Author: Michael Albinus Date: Tue Sep 28 15:47:01 2021 +0200 Adapt tramp-tests.el for macOS * test/lisp/net/tramp-tests.el (tramp-test29-start-file-process) (tramp-test30-make-process): Adapt for macOS. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 55396c5079..9a1c9d659b 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4586,18 +4586,16 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (while (< (- (point-max) (point-min)) (length "66\n6F\n6F\n0D\n0A\n")) (while (accept-process-output proc 0 nil t)))) - (if (tramp--test-macos-p) - (tramp--test-message - "process-connection-type %s\n%s" - process-connection-type (pp-to-string (buffer-string))) (should (string-match-p - (if (memq process-connection-type '(nil pipe)) + (if (and (memq process-connection-type '(nil pipe)) + (not (tramp--test-macos-p))) + ;; On macOS, there is always newline conversion. ;; `telnet' converts \r to if `crlf' ;; flag is FALSE. See telnet(1) man page. "66\n6F\n6F\n0D\\(\n00\\)?\n0A\n" "66\n6F\n6F\n0A\\(\n00\\)?\n0A\n") - (buffer-string))))) + (buffer-string)))) ;; Cleanup. (ignore-errors (delete-process proc))))) @@ -4855,19 +4853,17 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." (while (< (- (point-max) (point-min)) (length "66\n6F\n6F\n0D\n0A\n")) (while (accept-process-output proc 0 nil t)))) - (if (tramp--test-macos-p) - (tramp--test-message - "process-connection-type %s\n%s" - process-connection-type (pp-to-string (buffer-string))) (should (string-match-p - (if (memq (or connection-type process-connection-type) - '(nil pipe)) + (if (and (memq (or connection-type process-connection-type) + '(nil pipe)) + (not (tramp--test-macos-p))) + ;; On macOS, there is always newline conversion. ;; `telnet' converts \r to if `crlf' ;; flag is FALSE. See telnet(1) man page. "66\n6F\n6F\n0D\\(\n00\\)?\n0A\n" "66\n6F\n6F\n0A\\(\n00\\)?\n0A\n") - (buffer-string))))) + (buffer-string)))) ;; Cleanup. (ignore-errors (delete-process proc))))))))) commit c8478990812fc3e7d71861aebbc96a62d2f54fb7 Author: Stefan Kangas Date: Tue Sep 28 15:45:27 2021 +0200 * doc/man/emacs.1.in: Add --no-x-resources. (Bug#50855) diff --git a/doc/man/emacs.1.in b/doc/man/emacs.1.in index 290be604e3..b2be8bb07b 100644 --- a/doc/man/emacs.1.in +++ b/doc/man/emacs.1.in @@ -1,5 +1,5 @@ .\" See section COPYING for copyright and redistribution information. -.TH EMACS 1 "2020-04-05" "GNU Emacs @version@" "GNU" +.TH EMACS 1 "2021-09-28" "GNU Emacs @version@" "GNU" . . .SH NAME @@ -215,6 +215,9 @@ Specify the name which should be assigned to the initial window. This controls looking up X resources as well as the window title. .TP +.BR \-\-no\-x\-resources +Do not load X resources. +.TP .BI \-T " name\fR,\fP " \-\-title= "name" Specify the title for the initial X window. .TP commit 9a5a35c5a65c88ae79c2dce8d5fa63df38418450 Author: Stefan Kangas Date: Tue Sep 28 15:33:39 2021 +0200 ; * doc/lispref/tips.texi (Programming Tips): Fix markup. diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index e8f7a3c6bb..fa764f18b5 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi @@ -396,9 +396,9 @@ An error message should start with a capital letter but should not end with a period or other punctuation. It is occasionally useful to tell the user where an error originated, -even if @code{debug-on-error} is nil. In such cases, a lower-case -Lisp symbol can be prepended to the error message. For example, the -error message ``Invalid input'' could be extended to say +even if @code{debug-on-error} is @code{nil}. In such cases, a +lower-case Lisp symbol can be prepended to the error message. For +example, the error message ``Invalid input'' could be extended to say ``some-function: Invalid input''. @item commit e9c7ef3348b8acad25162fa91ee2156816722317 Author: Stefan Kangas Date: Tue Sep 28 14:56:07 2021 +0200 Improve coding conventions for error messages * doc/lispref/tips.texi (Programming Tips): Clarify coding conventions for error messages to say that an error message can start with a Lisp symbol. (Bug#50658) diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index e56ddf3c28..e8f7a3c6bb 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi @@ -393,7 +393,13 @@ Don't use @code{message}, @code{throw}, @code{sleep-for}, or @item An error message should start with a capital letter but should not end -with a period. +with a period or other punctuation. + +It is occasionally useful to tell the user where an error originated, +even if @code{debug-on-error} is nil. In such cases, a lower-case +Lisp symbol can be prepended to the error message. For example, the +error message ``Invalid input'' could be extended to say +``some-function: Invalid input''. @item A question asked in the minibuffer with @code{yes-or-no-p} or commit a5b8140d4e5866b7e9e3fe88c0cd4b7914c949a5 Author: Stefan Kangas Date: Tue Sep 28 14:32:06 2021 +0200 Improve docstrings of ert-resource-{directory,file} * lisp/emacs-lisp/ert-x.el (ert-resource-directory) (ert-resource-file): Improve docstrings. diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index 59ec4d2484..3fc57d5182 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -361,10 +361,11 @@ in the same directory as the test file this is called from. If that directory doesn't exist, find a directory based on the test file name. If the file is named \"foo-tests.el\", return -the absolute file name for \"foo-resources\". If you want a -different resource directory naming scheme, set the variable -`ert-resource-directory-format'. Before formatting, the file -name will be trimmed using `string-trim' with arguments +the absolute file name for \"foo-resources\". + +If you want a different resource directory naming scheme, set the +variable `ert-resource-directory-format'. Before formatting, the +file name will be trimmed using `string-trim' with arguments `ert-resource-directory-trim-left-regexp' and `ert-resource-directory-trim-right-regexp'." `(let* ((testfile ,(or (macroexp-file-name) @@ -380,9 +381,9 @@ name will be trimmed using `string-trim' with arguments ert-resource-directory-trim-right-regexp))))))) (defmacro ert-resource-file (file) - "Return file name of resource file named FILE. -A resource file is in the resource directory as per -`ert-resource-directory'." + "Return absolute file name of resource (test data) file named FILE. +A resource file is defined as any file placed in the resource +directory as returned by `ert-resource-directory'." `(expand-file-name ,file (ert-resource-directory))) (provide 'ert-x) commit b27a8f15549f12b363acfde8101849af10e9b401 Author: Stefan Kangas Date: Tue Sep 28 13:30:02 2021 +0200 Signal error on newline in internal--format-docstring-line * lisp/subr.el (internal--format-docstring-line): Signal error when trying to fill a line containing a newline. * lisp/cedet/semantic/decorate/mode.el (define-semantic-decoration-style): * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Don't pass newlines to 'internal--format-docstring-line'. diff --git a/lisp/cedet/semantic/decorate/mode.el b/lisp/cedet/semantic/decorate/mode.el index 27634102df..6271fb1ced 100644 --- a/lisp/cedet/semantic/decorate/mode.el +++ b/lisp/cedet/semantic/decorate/mode.el @@ -409,9 +409,11 @@ decoration API found in this library." ;; Create an override method to specify if a given tag belongs ;; to this type of decoration (define-overloadable-function ,predicate (tag) - ,(internal--format-docstring-line - "Return non-nil to decorate TAG with `%s' style.\n%s" - name doc)) + ,(concat + (internal--format-docstring-line + "Return non-nil to decorate TAG with `%s' style." + name) + "\n" doc)) ;; Create an override method that will perform the highlight ;; operation if the -p method returns non-nil. (define-overloadable-function ,highlighter (tag) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 0e4d6eeb7b..d37bca24a0 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -496,15 +496,17 @@ on if the hook has explicitly disabled it. (define-minor-mode ,global-mode ,(concat (format "Toggle %s in all buffers.\n" pretty-name) (internal--format-docstring-line - "With prefix ARG, enable %s if ARG is positive; otherwise, \ -disable it.\n\n" + (concat "With prefix ARG, enable %s if ARG is positive; " + "otherwise, disable it.") pretty-global-name) + "\n\n" "If called from Lisp, toggle the mode if ARG is `toggle'. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.\n\n" (internal--format-docstring-line - "%s is enabled in all buffers where `%s' would do it.\n\n" + "%s is enabled in all buffers where `%s' would do it." pretty-name turn-on) + "\n\n" (internal--format-docstring-line "See `%s' for more information on %s." mode pretty-name) diff --git a/lisp/subr.el b/lisp/subr.el index 8cb79b290b..1d2980802e 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6435,8 +6435,11 @@ of fill.el (for example `fill-region')." (concat fst (internal--fill-string-single-line lst))))) (defun internal--format-docstring-line (string &rest objects) - "Format a documentation string out of STRING and OBJECTS. + "Format a single line from a documentation string out of STRING and OBJECTS. +Signal an error if STRING contains a newline. This is intended for internal use only." + (when (string-match "\n" string) + (error "Unable to fill string containing newline: %S" string)) (internal--fill-string-single-line (apply #'format string objects))) (defun json-available-p () commit 73b2b9f67acd82571ed0d250c5ba3282a4f6752a Author: Eli Zaretskii Date: Tue Sep 28 15:03:38 2021 +0300 ; * lisp/emacs-lisp/comp.el (batch-native-compile): Don't use non-ASCII. diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 83605ca5a7..94753ec3d9 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -4195,7 +4195,7 @@ form, return the compiled function." "Perform batch native compilation of remaining command-line arguments. Native compilation equivalent of `batch-byte-compile'. -Use this from the command line, with ‘-batch’; it won’t work +Use this from the command line, with `-batch'; it won't work in an interactive Emacs session. Optional argument FOR-TARBALL non-nil means the file being compiled as part of building the source tarball, in which case the .eln file commit 90655e4bc01ba8d00be3281d13cc771b53e75b43 Author: Eli Zaretskii Date: Tue Sep 28 15:00:50 2021 +0300 Make the build of source tarball produce *.eln files * lisp/emacs-lisp/comp.el (batch-native-compile): Accept an optional argument; if non-nil, place the .eln file as appropriate for building a source tarball. * doc/lispref/compile.texi (Native-Compilation Functions): Document the new optional argument of 'batch-native-compile'. * lisp/Makefile.in (.PHONY, $(THEFILE)n) [HAVE_NATIVE_COMP]: New targets. * src/Makefile.in (%.eln) [HAVE_NATIVE_COMP]: New recipe. (all) [HAVE_NATIVE_COMP]: Add ../native-lisp to prerequisites. (elnlisp) [HAVE_NATIVE_COMP]: New list of *.eln files. (../native-lisp) [HAVE_NATIVE_COMP]: New recipe. * src/verbose.mk.in (AM_V_ELN): New macro. diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi index f48f4f47e8..15d1f4ce53 100644 --- a/doc/lispref/compile.texi +++ b/doc/lispref/compile.texi @@ -904,13 +904,20 @@ invokes the same Emacs executable as the process that called this function. @end defun -@defun batch-native-compile +@defun batch-native-compile &optional for-tarball This function runs native-compilation on files specified on the Emacs command line in batch mode. It must be used only in a batch execution of Emacs, as it kills Emacs upon completion of the compilation. If one or more of the files fail to compile, the Emacs process will attempt to compile all the other files, and will terminate with a -non-zero status code. +non-zero status code. The optional argument @var{for-tarball}, if +non-@code{nil}, tells the function to place the resulting @file{.eln} +files in the last directory mentioned in +@code{native-comp-eln-load-path} (@pxref{Library Search}); this is +meant to be used as part of building an Emacs source tarball for the +first time, when the natively-compiled files, which are absent from +the source tarball, should be generated in the build tree instead of +the user's cache directory. @end defun Native compilation can be run entirely asynchronously, in a subprocess diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 431217a9da..60d1d10e5b 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -281,6 +281,14 @@ else -f batch-byte-compile $(THEFILE) endif +ifeq ($(HAVE_NATIVE_COMP),yes) +.PHONY: $(THEFILE)n +$(THEFILE)n: + $(AM_V_ELN)$(emacs) $(BYTE_COMPILE_FLAGS) \ + -l comp -f byte-compile-refresh-preloaded \ + --eval '(batch-native-compile t)' $(THEFILE) +endif + # Files MUST be compiled one by one. If we compile several files in a # row (i.e., in the same instance of Emacs) we can't make sure that # the compilation environment is clean. We also set the load-path of diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 7c93ebd630..83605ca5a7 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -4191,20 +4191,27 @@ form, return the compiled function." (comp--native-compile function-or-file nil output)) ;;;###autoload -(defun batch-native-compile () +(defun batch-native-compile (&optional for-tarball) "Perform batch native compilation of remaining command-line arguments. Native compilation equivalent of `batch-byte-compile'. Use this from the command line, with ‘-batch’; it won’t work -in an interactive Emacs session." +in an interactive Emacs session. +Optional argument FOR-TARBALL non-nil means the file being compiled +as part of building the source tarball, in which case the .eln file +will be placed under the native-lisp/ directory (actually, in the +last directory in `native-comp-eln-load-path')." (comp-ensure-native-compiler) - (cl-loop for file in command-line-args-left - if (or (null byte+native-compile) - (cl-notany (lambda (re) (string-match re file)) - native-comp-bootstrap-deny-list)) - do (comp--native-compile file) - else - do (byte-compile-file file))) + (let ((native-compile-target-directory + (if for-tarball + (car (last native-comp-eln-load-path))))) + (cl-loop for file in command-line-args-left + if (or (null byte+native-compile) + (cl-notany (lambda (re) (string-match re file)) + native-comp-bootstrap-deny-list)) + do (comp--native-compile file) + else + do (byte-compile-file file)))) ;;;###autoload (defun batch-byte+native-compile () diff --git a/src/Makefile.in b/src/Makefile.in index c11d96d2c4..34335cfa96 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -448,7 +448,15 @@ FIRSTFILE_OBJ=@FIRSTFILE_OBJ@ ALLOBJS = $(FIRSTFILE_OBJ) $(VMLIMIT_OBJ) $(obj) $(otherobj) # Must be first, before dep inclusion! +ifeq ($(HAVE_NATIVE_COMP),yes) +ifeq ($(NATIVE_DISABLED),) +all: emacs$(EXEEXT) $(pdmp) $(OTHER_FILES) ../native-lisp +else +all: emacs$(EXEEXT) $(pdmp) $(OTHER_FILES) +endif +else all: emacs$(EXEEXT) $(pdmp) $(OTHER_FILES) +endif .PHONY: all dmpstruct_headers=$(srcdir)/lisp.h $(srcdir)/buffer.h \ @@ -775,6 +783,38 @@ tags: TAGS ../lisp/TAGS $(lwlibdir)/TAGS @$(MAKE) $(AM_V_NO_PD) -C ../lisp EMACS="$(bootstrap_exe)"\ THEFILE=$< $ Date: Tue Sep 28 11:18:17 2021 +0300 ; * lisp/emacs-lisp/comp.el (batch-native-compile): Doc fix. diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 4060fc97d0..7c93ebd630 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -4192,10 +4192,11 @@ form, return the compiled function." ;;;###autoload (defun batch-native-compile () - "Perform native compilation on remaining command-line arguments. -Use this from the command line, with ‘-batch’; -it won’t work in an interactive Emacs. -Native compilation equivalent to `batch-byte-compile'." + "Perform batch native compilation of remaining command-line arguments. + +Native compilation equivalent of `batch-byte-compile'. +Use this from the command line, with ‘-batch’; it won’t work +in an interactive Emacs session." (comp-ensure-native-compiler) (cl-loop for file in command-line-args-left if (or (null byte+native-compile) commit 7c21d2c7f56c82a72850408db6681dfbc3e45e95 Author: Eli Zaretskii Date: Tue Sep 28 11:15:43 2021 +0300 ; * src/lisp.h (enum char_bits): Update the comment. diff --git a/src/lisp.h b/src/lisp.h index 09e0b8e9bd..480c389a3b 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2827,9 +2827,8 @@ enum Lisp_Compiled }; /* Flag bits in a character. These also get used in termhooks.h. - Richard Stallman thinks that MULE - (MUlti-Lingual Emacs) might need 22 bits for the character value - itself, so we probably shouldn't use any bits lower than 0x0400000. */ + Emacs needs 22 bits for the character value itself, see MAX_CHAR, + so we shouldn't use any bits lower than 0x0400000. */ enum char_bits { CHAR_ALT = 0x0400000, commit 76e846f92a3c625fe524c81aa996327fba5a9e65 Author: Lars Ingebrigtsen Date: Tue Sep 28 08:06:31 2021 +0200 Adjust ispell-look-command type * lisp/textmodes/ispell.el (ispell-look-command): Adjust :type after previous change. diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 9aad567115..0a3a49d868 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -253,7 +253,8 @@ Should probably be \"-Ei\"." (defcustom ispell-look-command (executable-find "look") "Name of the look command for search processes. This must be an absolute file name." - :type 'file + :type '(choice (const :tag "None" nil) + file) :version "28.1") (defcustom ispell-look-p (and ispell-look-command commit 213aed0691193dfbdf952c22b300d646f62a3eb9 Author: André A. Gomes Date: Tue Sep 28 07:51:14 2021 +0200 Fix search of the look program * lisp/textmodes/ispell.el (ispell-look-command): Fix logic concerning the existence of the look program (bug#50852) -- search through the executable path. (ispell-look-p): Adjust logic. diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 27a60c376c..9aad567115 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -250,16 +250,14 @@ Always stores Fcc copy of message when nil." Should probably be \"-Ei\"." :type 'string) -(defcustom ispell-look-command - (cond ((file-exists-p "/bin/look") "/bin/look") - ((file-exists-p "/usr/local/bin/look") "/usr/local/bin/look") - ((file-exists-p "/usr/bin/look") "/usr/bin/look") - (t "look")) +(defcustom ispell-look-command (executable-find "look") "Name of the look command for search processes. This must be an absolute file name." - :type 'file) + :type 'file + :version "28.1") -(defcustom ispell-look-p (file-exists-p ispell-look-command) +(defcustom ispell-look-p (and ispell-look-command + (file-exists-p ispell-look-command)) "Non-nil means use `look' rather than `grep'. Default is based on whether `look' seems to be available." :type 'boolean) commit 7757e9b204e58419897874265a448d599dd9c69f Author: Lars Ingebrigtsen Date: Tue Sep 28 06:49:03 2021 +0200 Use ert-resource-file in the shorthand tests Also move to the standard directory naming. diff --git a/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el b/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el similarity index 100% rename from test/lisp/progmodes/elisp-resources/simple-shorthand-test.el rename to test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index e0e2cb112e..a2bd1b8b27 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -23,6 +23,7 @@ ;;; Code: (require 'ert) +(require 'ert-x) (require 'xref) (eval-when-compile (require 'cl-lib)) @@ -1047,15 +1048,8 @@ evaluation of BODY." expected)) (should (not (intern-soft shorthand-sname))))) -(defvar elisp--test-resources-dir - (expand-file-name "elisp-resources/" - (file-name-directory - (or load-file-name - (error "this file needs to be loaded"))))) - (ert-deftest elisp-shorthand-load-a-file () - (let ((test-file (expand-file-name "simple-shorthand-test.el" - elisp--test-resources-dir))) + (let ((test-file (ert-resource-file "simple-shorthand-test.el"))) (mapatoms (lambda (s) (when (string-match "^elisp--foo-" (symbol-name s)) (unintern s obarray)))) @@ -1065,10 +1059,8 @@ evaluation of BODY." (ert-deftest elisp-shorthand-byte-compile-a-file () - (let ((test-file (expand-file-name "simple-shorthand-test.el" - elisp--test-resources-dir)) - (byte-compiled (expand-file-name "simple-shorthand-test.elc" - elisp--test-resources-dir))) + (let ((test-file (ert-resource-file "simple-shorthand-test.el")) + (byte-compiled (ert-resource-file "simple-shorthand-test.elc"))) (mapatoms (lambda (s) (when (string-match "^elisp--foo-" (symbol-name s)) (unintern s obarray)))) @@ -1081,8 +1073,7 @@ evaluation of BODY." (should-not (intern-soft "f-test")))) (ert-deftest elisp-shorthand-completion-at-point () - (let ((test-file (expand-file-name "simple-shorthand-test.el" - elisp--test-resources-dir))) + (let ((test-file (ert-resource-file "simple-shorthand-test.el"))) (load test-file) (with-current-buffer (find-file-noselect test-file) (revert-buffer t t) @@ -1097,8 +1088,7 @@ evaluation of BODY." (revert-buffer t t)))) (ert-deftest elisp-shorthand-escape () - (let ((test-file (expand-file-name "simple-shorthand-test.el" - elisp--test-resources-dir))) + (let ((test-file (ert-resource-file "simple-shorthand-test.el"))) (load test-file) (should (intern-soft "f-test4---")) (should-not (intern-soft "elisp--foo-test4---")) commit 3cabf64131b93e1b0510a01bcce8efde38b20bc4 Author: Stefan Kangas Date: Sun Sep 26 01:20:55 2021 +0200 checkdoc: Allow Lisp symbols to start a message * lisp/emacs-lisp/checkdoc.el (checkdoc-message-text-engine): Allow Lisp symbols to start a message. (checkdoc--error-bad-format-p): New helper function. * test/lisp/emacs-lisp/checkdoc-tests.el (checkdoc-test-error-format-is-good) (checkdoc-test-error-format-is-bad): New helper functions. (checkdoc-tests-error-message-bad-format-p) (checkdoc-tests-error-message-bad-format-p/defined-symbols) (checkdoc-tests-error-message-bad-format-p/not-capitalized): New tests. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index b3707bb786..5ea2f59ee6 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -164,6 +164,7 @@ (require 'cl-lib) (require 'help-mode) ;; for help-xref-info-regexp (require 'thingatpt) ;; for handy thing-at-point-looking-at +(require 'lisp-mode) ;; for lisp-mode-symbol-regexp (require 'dired) ;; for dired-get-filename and dired-map-over-marks (require 'lisp-mnt) @@ -2575,6 +2576,30 @@ Argument END is the maximum bounds to search in." (setq return type)))) return)) +(defun checkdoc--error-bad-format-p () + "Return non-nil if the start of error message at point has the wrong format. +The correct format is \"Foo\" or \"some-symbol: Foo\". See also +`error' and Info node `(elisp) Documentation Tips'." + (save-excursion + ;; Skip the first quote character in string. + (forward-char 1) + ;; A capital letter is always okay. + (unless (let ((case-fold-search nil)) + (looking-at (rx (or upper-case "%s")))) + ;; A defined Lisp symbol is always okay. + (unless (and (looking-at (rx (group (regexp lisp-mode-symbol-regexp)))) + (or (fboundp (intern (match-string 1))) + (boundp (intern (match-string 1))))) + ;; Other Lisp symbols are sometimes okay. + (rx-let ((c (? "\\\n"))) ; `c' is for a continued line + (let ((case-fold-search nil) + (some-symbol (rx (regexp lisp-mode-symbol-regexp) + c ":" c (+ (any " \t\n")))) + (lowercase-str (rx c (group (any "a-z") (+ wordchar))))) + (if (looking-at some-symbol) + (looking-at (concat some-symbol lowercase-str)) + (looking-at lowercase-str)))))))) + (defun checkdoc--fix-y-or-n-p () "Fix `y-or-n-p' prompt to end with \"?\" or \"? \". The space is technically redundant, but also more compatible with @@ -2622,16 +2647,14 @@ Argument TYPE specifies the type of question, such as `error' or `y-or-n-p'." ;; In Emacs, the convention is that error messages start with a capital ;; letter but *do not* end with a period. Please follow this convention ;; for the sake of consistency. - (if (and (save-excursion (forward-char 1) - (looking-at "[a-z]\\w+")) + (if (and (checkdoc--error-bad-format-p) (not (checkdoc-autofix-ask-replace - (match-beginning 0) (match-end 0) + (match-beginning 1) (match-end 1) "Capitalize your message text?" - (capitalize (match-string 0)) + (capitalize (match-string 1)) t))) - (checkdoc-create-error - "Messages should start with a capital letter" - (match-beginning 0) (match-end 0)) + (checkdoc-create-error "Messages should start with a capital letter" + (match-beginning 1) (match-end 1)) nil) ;; In general, sentences should have two spaces after the period. (checkdoc-sentencespace-region-engine (point) diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el b/test/lisp/emacs-lisp/checkdoc-tests.el index d452024b8f..ef49e71599 100644 --- a/test/lisp/emacs-lisp/checkdoc-tests.el +++ b/test/lisp/emacs-lisp/checkdoc-tests.el @@ -151,6 +151,43 @@ See the comments in Bug#24998." (ert-deftest checkdoc-tests-in-abbrevation-p/incorrect-abbreviation () (should-not (checkdoc-tests--abbrev-test "foo bar a.b.c." "a.b.c"))) +(defun checkdoc-test-error-format-is-good (msg &optional reverse literal) + (with-temp-buffer + (erase-buffer) + (emacs-lisp-mode) + (let ((standard-output (current-buffer))) + (if literal + (print (format "(error \"%s\")" msg)) + (prin1 `(error ,msg)))) + (goto-char (length "(error \"")) + (if reverse + (should (checkdoc--error-bad-format-p)) + (should-not (checkdoc--error-bad-format-p))))) + +(defun checkdoc-test-error-format-is-bad (msg &optional literal) + (checkdoc-test-error-format-is-good msg t literal)) + +(ert-deftest checkdoc-tests-error-message-bad-format-p () + (checkdoc-test-error-format-is-good "Foo") + (checkdoc-test-error-format-is-good "Foo: bar baz") + (checkdoc-test-error-format-is-good "some-symbol: Foo") + (checkdoc-test-error-format-is-good "`some-symbol' foo bar") + (checkdoc-test-error-format-is-good "%sfoo") + (checkdoc-test-error-format-is-good "avl-tree-enter:\\ + Updated data does not match existing data" nil 'literal)) + +(ert-deftest checkdoc-tests-error-message-bad-format-p/defined-symbols () + (defvar checkdoc-tests--var-symbol nil) + (checkdoc-test-error-format-is-good "checkdoc-tests--var-symbol foo bar baz") + (defun checkdoc-tests--fun-symbol ()) + (checkdoc-test-error-format-is-good "checkdoc-tests--fun-symbol foo bar baz")) + +(ert-deftest checkdoc-tests-error-message-bad-format-p/not-capitalized () + (checkdoc-test-error-format-is-bad "foo") + (checkdoc-test-error-format-is-bad "some-symbol: foo") + (checkdoc-test-error-format-is-bad "avl-tree-enter:\ + updated data does not match existing data")) + (ert-deftest checkdoc-tests-fix-y-or-n-p () (with-temp-buffer (emacs-lisp-mode) commit 6bec21243d20df015875ee8576bc722224480acb Author: Ken Brown Date: Mon Sep 27 14:46:41 2021 -0400 Make .eln files executable on Cygwin * Makefile.in (INSTALL_ELN): New variable, equal to $(INSTALL) on Cygwin and $(INSTALL_DATA) on other platforms. (install-eln): Use INSTALL_ELN instead of INSTALL_DATA. (Bug#50818) diff --git a/Makefile.in b/Makefile.in index 235b707673..5fc1edc7a3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -285,10 +285,16 @@ use_gamedir=$(gameuser)$(gamegroup) # not use an absolute path. So we must take care to always run # INSTALL-type commands from the directory containing the Makefile. # This explains (I think) the cd thisdir seen in several install rules. +SYSTEM_TYPE = @SYSTEM_TYPE@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_INFO = @INSTALL_INFO@ +ifeq ($(SYSTEM_TYPE),cygwin) + INSTALL_ELN = $(INSTALL) +else + INSTALL_ELN = $(INSTALL_DATA) +endif # By default, we uphold the dignity of our programs. INSTALL_STRIP = MKDIR_P = @MKDIR_P@ @@ -791,7 +797,7 @@ install-eln: lisp ifeq ($(HAVE_NATIVE_COMP),yes) umask 022 ; \ find native-lisp -type d -exec $(MKDIR_P) "$(ELN_DESTDIR){}" \; ; \ - find native-lisp -type f -exec ${INSTALL_DATA} "{}" "$(ELN_DESTDIR){}" \; + find native-lisp -type f -exec ${INSTALL_ELN} "{}" "$(ELN_DESTDIR){}" \; endif ### Build Emacs and install it, stripping binaries while installing them. commit f8ef415d4e2c428b1d3f066913a8a51d494d5536 Author: Michael Albinus Date: Mon Sep 27 20:36:12 2021 +0200 ; Still more instrumentation on autorevert-tests.el diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el index 162c8c8a86..7dce39810a 100644 --- a/test/lisp/autorevert-tests.el +++ b/test/lisp/autorevert-tests.el @@ -530,7 +530,6 @@ This expects `auto-revert--messages' to be bound by (lambda () (buffer-local-value 'auto-revert-notify-watch-descriptor buf-3)) (auto-revert--timeout)) - (message "Hallo0") (should (buffer-local-value 'auto-revert-notify-watch-descriptor buf-3)) (auto-revert-test--write-file "3-a" file-3) @@ -538,22 +537,28 @@ This expects `auto-revert--messages' to be bound by (should (equal (auto-revert-test--buffer-string buf-3) "3-a")) ;; Delete a visited file, and re-create it with new contents. + (when auto-revert-debug (message "Hallo0")) (delete-file file-1) + (when auto-revert-debug (message "Hallo1")) (should (equal (auto-revert-test--buffer-string buf-1) "1-a")) + (when auto-revert-debug (message "Hallo2")) (auto-revert-test--write-file "1-b" file-1) + (when auto-revert-debug (message "Hallo3")) (auto-revert-test--wait-for-buffer-text buf-1 "1-b" (auto-revert--timeout)) ;; On emba, `buf-1' is a killed buffer. (when auto-revert-debug (message - "Hallo1 %s %s %s %s %s %s %s" + "Hallo4 %s %s %s %s %s %s %s" buf-1 (buffer-name buf-1) (buffer-live-p buf-1) file-1 (get-file-buffer file-1) (buffer-name (get-file-buffer file-1)) - (buffer-live-p (get-file-buffer file-1)))) - (should - (buffer-local-value - 'auto-revert-notify-watch-descriptor (get-file-buffer file-1))) + (buffer-live-p (get-file-buffer file-1))) + (with-current-buffer buf-1 + (message "Hallo5\n%s" (buffer-local-variables)))) + (should (buffer-local-value + 'auto-revert-notify-watch-descriptor buf-1)) + (when auto-revert-debug (message "Hallo6")) ;; Write a buffer to a new file, then modify the new file on disk. (with-current-buffer buf-2 @@ -562,7 +567,6 @@ This expects `auto-revert--messages' to be bound by (auto-revert-test--write-file "2-b" file-2b) (auto-revert-test--wait-for-buffer-text buf-2 "2-b" (auto-revert--timeout)) - (message "Hallo2") (should (buffer-local-value 'auto-revert-notify-watch-descriptor buf-2))) @@ -573,8 +577,7 @@ This expects `auto-revert--messages' to be bound by (with-current-buffer buf (setq-local kill-buffer-hook nil)) (ignore-errors (kill-buffer buf))) (dolist (file (list file-1 file-2 file-2b file-3)) - (ignore-errors (delete-file file))) - )))) + (ignore-errors (delete-file file))))))) (auto-revert--deftest-remote auto-revert-test05-global-notify "Test `global-auto-revert-mode' without polling for remote buffers.") commit 07a276da6f2721e34c4edc9bbfeb22ba83d008cd Author: Michael Albinus Date: Mon Sep 27 20:35:31 2021 +0200 Simplify `file-notify--rm-descriptor' * lisp/filenotify.el (file-notify--rm-descriptor): Use `file-notify-handle-event'. diff --git a/lisp/filenotify.el b/lisp/filenotify.el index a0c3758238..e0dceb704d 100644 --- a/lisp/filenotify.el +++ b/lisp/filenotify.el @@ -76,16 +76,17 @@ struct.") "Remove DESCRIPTOR from `file-notify-descriptors'. DESCRIPTOR should be an object returned by `file-notify-add-watch'. If it is registered in `file-notify-descriptors', a `stopped' event is sent." - (when-let* ((watch (gethash descriptor file-notify-descriptors))) - (let ((callback (file-notify--watch-callback watch))) - ;; Make sure this is the last time the callback is invoked. + (when-let ((watch (gethash descriptor file-notify-descriptors))) + (unwind-protect + ;; Send `stopped' event. + (file-notify-handle-event + (make-file-notify + :-event `(,descriptor stopped + ,(file-notify--watch-absolute-filename watch)) + :-callback (file-notify--watch-callback watch))) + ;; Make sure this is the last time the callback was invoked. (setf (file-notify--watch-callback watch) nil) - ;; Send `stopped' event. - (unwind-protect - (funcall - callback - `(,descriptor stopped ,(file-notify--watch-absolute-filename watch))) - (remhash descriptor file-notify-descriptors))))) + (remhash descriptor file-notify-descriptors)))) (cl-defstruct (file-notify (:type list) :named) "A file system monitoring event, coming from the backends." commit dbe0fc234d38511041f16f9d546c439e3e70d0cf Author: Robert Pluim Date: Mon Sep 27 18:28:11 2021 +0200 ; * etc/NEWS: fix errors in previous changes diff --git a/etc/NEWS b/etc/NEWS index 99f5897eeb..4fd5036c3b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1497,7 +1497,7 @@ skipped. This is because the default value of 'grep-find-template' now includes the 'find' option '-H'. Commands that use that variable, including indirectly via a call to 'xref-matches-in-directory', might be -OAaffected. In particular, there should be no need anymore to ensure +affected. In particular, there should be no need anymore to ensure any directory names on the 'find' command lines end in a slash. This change is for better compatibility with old versions of non-GNU 'find', such as the one used on macOS. @@ -2151,7 +2151,7 @@ This function is meant to be used in 'compilation-filter-hook'. This controls what 'ansi-color-compilation-filter' does. *** Regexp matching of messages is now case-sensitive by default. -The user option 'compilation-error-case-fold-search' can be set for +The variable 'compilation-error-case-fold-search' can be set for case-insensitive matching of messages when the old behavior is required, but the recommended solution is to use a correctly matching regexp instead. commit 28f8ffa58ee6c3af5e486dd5cb28e7dbf680232f Author: Juri Linkov Date: Mon Sep 27 18:41:34 2021 +0300 * lisp/mouse.el (context-menu-region): Check for nil for char-after at eobp. diff --git a/lisp/mouse.el b/lisp/mouse.el index 9f1417f420..d80b241af5 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -486,8 +486,9 @@ Some context functions add menu items below the separator." `(menu-item "List" ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'list)) :help "Mark the list at click for a subsequent cut/copy")) - (when (let ((pos (posn-point (event-end click)))) - (or (eq (char-syntax (char-after pos)) ?\") + (when (let* ((pos (posn-point (event-end click))) + (char (when pos (char-after pos)))) + (or (and char (eq (char-syntax char) ?\")) (nth 3 (save-excursion (syntax-ppss pos))))) (define-key-after submenu [mark-string] `(menu-item "String" commit 79b5d66bd66458f6e669adee2698e9fd18c4bc3a Author: Mattias Engdegård Date: Mon Sep 27 16:00:32 2021 +0200 * lisp/progmodes/flymake.el (flymake-menu): Don't use obsolete name. diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 5a1455aa7b..bcb43c1faf 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1334,7 +1334,7 @@ default) no filter is applied." [ "Go to next problem" flymake-goto-next-error t ] [ "Go to previous problem" flymake-goto-prev-error t ] [ "Check now" flymake-start t ] - [ "List all problems" flymake-show-diagnostics-buffer t ] + [ "List all problems" flymake-show-buffer-diagnostics t ] "--" [ "Go to log buffer" flymake-switch-to-log-buffer t ] [ "Turn off Flymake" flymake-mode t ])) @@ -1599,7 +1599,7 @@ buffer." ;; been set to a valid buffer. This could happen when this function ;; is called too early. For example 'global-display-line-numbers-mode' ;; calls us from its mode hook, when the diagnostic buffer has just - ;; been created by 'flymake-show-diagnostics-buffer', but is not yet + ;; been created by 'flymake-show-buffer-diagnostics', but is not yet ;; set up properly (Bug#40529). (when (bufferp flymake--diagnostics-buffer-source) (with-current-buffer flymake--diagnostics-buffer-source commit 75f2739e1ae8b193e495f0ec611b408de7204719 Author: Alan Third Date: Mon Sep 27 14:23:02 2021 +0100 Fix GNUstep build failure * src/nsfns.m (Fns_hide_emacs): NSRunningApplication is only available in GNUstep 0.27 and above. diff --git a/src/nsfns.m b/src/nsfns.m index 07bcab1816..906c5c934f 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -1966,12 +1966,14 @@ Frames are listed from topmost (first) to bottommost (last). */) [NSApp unhide: NSApp]; [NSApp activateIgnoringOtherApps: YES]; } +#if GNUSTEP_GUI_MAJOR_VERSION > 0 || GNUSTEP_GUI_MINOR_VERSION >= 27 else if (EQ (on, intern ("activate-front"))) { [NSApp unhide: NSApp]; [[NSRunningApplication currentApplication] activateWithOptions: NSApplicationActivateIgnoringOtherApps]; } +#endif else if (NILP (on)) [NSApp unhide: NSApp]; else commit 0f4b55dc8d551f266ae8cc36d94bcd216a80754b Author: Robert Pluim Date: Mon Sep 27 14:42:18 2021 +0200 Document 'glyphless-char-display-control' changes * etc/NEWS: Document 'glyphless-char-display-control' changes for Variation Selectors. diff --git a/etc/NEWS b/etc/NEWS index b7da790cf7..99f5897eeb 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -168,6 +168,11 @@ allows e.g. to be displayed using the emoji font even if 'Emoji codepoint' does not have emoji presentation by default. ++++ +** 'glyphless-char-display-control' now applies to Variation Selectors. +VS-1 through VS-16 are now displayed as 'thin-space' by default when +not composed. + +++ ** New command 'execute-extended-command-for-buffer'. This new command, bound to 'M-S-x', works like commit 35f97b9e477951c257476253ebd70d8628938447 Author: Robert Pluim Date: Mon Sep 27 14:37:28 2021 +0200 Try to be consistent about user options in NEWS * etc/NEWS: Try to be consistent about calling 'user options' that instead of 'variables'. diff --git a/etc/NEWS b/etc/NEWS index 015b120e04..b7da790cf7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -497,7 +497,7 @@ the tab bar displays tab groups. --- *** New optional key binding for 'tab-last'. -If you customize the variable 'tab-bar-select-tab-modifiers' for +If you customize the user option 'tab-bar-select-tab-modifiers' for selecting tabs using its index numbers, the '-9' key is bound to 'tab-last', and switches to the last tab. Here is any of the modifiers in the list that is the value of @@ -634,7 +634,7 @@ functions. New command 'help-view-source' ('s') will view the source file (if any) of the current help topic. New command 'help-goto-info' ('i') will look up the current symbol (if any) in Info. New command -'help-customize' ('c') will customize the variable or the face +'help-customize' ('c') will customize the user option or the face (if any) whose doc string is being shown in the Help buffer. --- @@ -808,7 +808,7 @@ user-visible changes for normal usage. *** 'global-display-fill-column-indicator-mode' skips some buffers. By default, turning on 'global-display-fill-column-indicator-mode' doesn't turn on 'display-fill-column-indicator-mode' in special-mode -buffers. This can be controlled by customizing the variable +buffers. This can be controlled by customizing the user option 'global-display-fill-column-indicator-modes'. +++ @@ -995,7 +995,7 @@ Revert a buffer trying to be as non-destructive as possible, preserving markers, properties and overlays. The new variable 'revert-buffer-with-fine-grain-max-seconds' specifies the maximum number of seconds that 'revert-buffer-with-fine-grain' should spend -trying to be non-destructive. +trying to be non-destructive, with a default value of 2 seconds. +++ ** New command 'revert-buffer-quick'. @@ -1453,7 +1453,7 @@ default predicate (replacing 'so-long-detected-long-line-p'). --- *** Default values 'so-long-threshold' and 'so-long-max-lines' increased. -The values of these variables have been raised to 10000 bytes and 500 +The values of these user options have been raised to 10000 bytes and 500 lines respectively, to reduce the likelihood of false-positives when 'global-so-long-mode' is enabled. The latter value is now only used by the old predicate, as the new predicate knows the longest line in @@ -1492,7 +1492,7 @@ skipped. This is because the default value of 'grep-find-template' now includes the 'find' option '-H'. Commands that use that variable, including indirectly via a call to 'xref-matches-in-directory', might be -affected. In particular, there should be no need anymore to ensure +OAaffected. In particular, there should be no need anymore to ensure any directory names on the 'find' command lines end in a slash. This change is for better compatibility with old versions of non-GNU 'find', such as the one used on macOS. @@ -1951,7 +1951,8 @@ This is used when forwarding messages as MIME, but not using MML. *** Message now supports the OpenPGP header. To generate these headers, add the new function 'message-add-openpgp-header' to 'message-send-hook'. The header will -be generated according to the new 'message-openpgp-header' variable. +be generated according to the new 'message-openpgp-header' user +option. --- *** A change to how "Mail-Copies-To: never" is handled. @@ -2145,7 +2146,7 @@ This function is meant to be used in 'compilation-filter-hook'. This controls what 'ansi-color-compilation-filter' does. *** Regexp matching of messages is now case-sensitive by default. -The variable 'compilation-error-case-fold-search' can be set for +The user option 'compilation-error-case-fold-search' can be set for case-insensitive matching of messages when the old behavior is required, but the recommended solution is to use a correctly matching regexp instead. @@ -2153,7 +2154,7 @@ regexp instead. --- *** New user option 'compilation-search-all-directories'. When doing parallel builds, directories and compilation errors may -arrive in the "*compilation*" buffer out-of-order. If this variable is +arrive in the "*compilation*" buffer out-of-order. If this option is non-nil (the default), Emacs will now search backwards in the buffer for any directory the file with errors may be in. If nil, this won't be done (and this restores how this previously worked). @@ -2394,9 +2395,9 @@ If this user option is non-nil, and 'shr-width' is nil, then SHR will use the value of 'shr-max-width' to limit the width of the rendered HTML. The default is 120 characters, so even if you have very wide frames, HTML text will be rendered more narrowly, which usually leads -to a more readable text. Set this user option to nil to get the -previous behavior of rendering as wide as the 'window-width' allows. -If 'shr-width' is non-nil, it overrides this variable. +to a more readable text. Customize it to nil to get the previous +behavior of rendering as wide as the 'window-width' allows. If +'shr-width' is non-nil, it overrides this option. --- *** New faces for heading elements. @@ -2566,9 +2567,9 @@ truncation, amongst other things. --- *** Bug reference mode uses auto-setup. If 'bug-reference-mode' or 'bug-reference-prog-mode' have been -activated, their respective hook has been run and still -'bug-reference-bug-regexp' and 'bug-reference-url-format' aren't both -set, it tries to guess appropriate values for those two variables. +activated, their respective hook has been run, and both +'bug-reference-bug-regexp' and 'bug-reference-url-format' are still +not set, it tries to guess appropriate values for those two variables. There are three guessing mechanisms so far: based on version control information of the current buffer's file, based on newsgroup/mail-folder name and several news and mail message headers @@ -2804,8 +2805,9 @@ which is no longer needed. *** erc-match.el now supports 'message' highlight type (not including the nick). The 'erc-current-nick-highlight-type', 'erc-pal-highlight-type', 'erc-fool-highlight-type', 'erc-keyword-highlight-type', and -'erc-dangerous-host-highlight-type' variables now support a 'message' -type for highlighting the entire message but not the sender's nick. +'erc-dangerous-host-highlight-type' user options now support a +'message' type for highlighting the entire message but not the +sender's nick. --- *** erc-status-sidebar.el is now part of ERC. @@ -2929,8 +2931,8 @@ The old binding is supported but warns that it is obsolete. 'mh-blacklist-msg-hook' is renamed 'mh-blocklist-msg-hook'. +++ -*** New names for some variables. -Variable 'mh-whitelist-preserves-sequences-flag' is renamed +*** New names for some user options. +User option 'mh-whitelist-preserves-sequences-flag' is renamed 'mh-allowlist-preserves-sequences-flag'. +++ @@ -3096,7 +3098,7 @@ in Ruby). +++ *** New user option 'imenu-max-index-time'. If creating the imenu index takes longer than specified by this -variable (default 5 seconds), imenu indexing is stopped. +option (default 5 seconds), imenu indexing is stopped. * New Modes and Packages in Emacs 28.1 @@ -4487,7 +4489,7 @@ instances of xwidget webkit is not supported. --- *** Downloading files from xwidget-webkit is now supported. -The new variable 'xwidget-webkit-download-dir' says where to download to. +The new user option 'xwidget-webkit-download-dir' says where to download to. --- *** New command 'xwidget-webkit-clone-and-split-below'. @@ -4498,7 +4500,7 @@ Open a new window below displaying the current URL. Open a new window to the right displaying the current URL. --- -*** New variable 'xwidget-webkit-enable-plugins'. +*** New user option 'xwidget-webkit-enable-plugins'. If non-nil, enable plugins in xwidget. (This is only available on macOS.) commit 51c79967c3af3f912074a0112cbe7e00cf5073f9 Author: Alan Third Date: Mon Sep 27 13:33:49 2021 +0100 Fix resizing glitches in NS port (bug#50413) * src/nsterm.m ([EmacsView resizeWithOldSuperviewSize:]): Use the superview's size instead of trusting the view's size. diff --git a/src/nsterm.m b/src/nsterm.m index 1970a7a1c1..a6c2e7505b 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -6974,13 +6974,18 @@ - (void)resizeWithOldSuperviewSize: (NSSize)oldSize if (! FRAME_LIVE_P (emacsframe)) return; - frame = [self frame]; + frame = [[self superview] bounds]; width = (int)NSWidth (frame); height = (int)NSHeight (frame); NSTRACE_SIZE ("New size", NSMakeSize (width, height)); NSTRACE_SIZE ("Original size", size); + /* Reset the frame size to match the bounds of the superview (the + NSWindow's contentView). We need to do this as sometimes the + view's frame isn't resized correctly, or can end up with the + wrong origin. */ + [self setFrame:frame]; change_frame_size (emacsframe, width, height, false, YES, false); SET_FRAME_GARBAGED (emacsframe); commit 2c2688ffbfce99dee56d6d89740dfbcfe6103219 Merge: 3ad1bcaf04 dc12ad8978 Author: Michael Albinus Date: Mon Sep 27 14:28:50 2021 +0200 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit 3ad1bcaf04c5d3a83bd68aa6bfa43f18b4080b6f Author: Michael Albinus Date: Mon Sep 27 14:28:32 2021 +0200 ; More instrumentation in autorevert-tests.el * test/lisp/autorevert-tests.el (auto-revert-test--instrument-kill-buffer-hook): New defun. (auto-revert-test05-global-notify): More instrumentation. diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el index d0c52f6103..162c8c8a86 100644 --- a/test/lisp/autorevert-tests.el +++ b/test/lisp/autorevert-tests.el @@ -469,6 +469,17 @@ This expects `auto-revert--messages' to be bound by (lambda () (string-equal (auto-revert-test--buffer-string buffer) string)) max-wait)) +(defun auto-revert-test--instrument-kill-buffer-hook (buffer) + "Instrument local `kill-buffer-hook' with messages." + (when auto-revert-debug + (with-current-buffer buffer + (add-hook + 'kill-buffer-hook + (lambda () + (message + "%s killed\n%s" (current-buffer) (with-output-to-string (backtrace)))) + nil 'local)))) + (ert-deftest auto-revert-test05-global-notify () "Test `global-auto-revert-mode' without polling." (skip-unless (or file-notify--library @@ -476,6 +487,8 @@ This expects `auto-revert--messages' to be bound by (with-auto-revert-test (let* ((auto-revert-use-notify t) (auto-revert-avoid-polling t) + (auto-revert-debug (getenv "EMACS_EMBA_CI")) + (file-notify-debug (getenv "EMACS_EMBA_CI")) (was-in-global-auto-revert-mode global-auto-revert-mode) (file-1 (make-temp-file "global-auto-revert-test-1")) (file-2 (make-temp-file "global-auto-revert-test-2")) @@ -485,7 +498,9 @@ This expects `auto-revert--messages' to be bound by (unwind-protect (progn (setq buf-1 (find-file-noselect file-1)) + (auto-revert-test--instrument-kill-buffer-hook buf-1) (setq buf-2 (find-file-noselect file-2)) + (auto-revert-test--instrument-kill-buffer-hook buf-2) (auto-revert-test--write-file "1-a" file-1) (should (equal (auto-revert-test--buffer-string buf-1) "")) @@ -508,11 +523,12 @@ This expects `auto-revert--messages' to be bound by ;; Visit a file, and modify it on disk. (setq buf-3 (find-file-noselect file-3)) + (auto-revert-test--instrument-kill-buffer-hook buf-3) ;; Newly opened buffers won't be use notification until the ;; first poll cycle; wait for it. (auto-revert-test--wait-for (lambda () (buffer-local-value - 'auto-revert-notify-watch-descriptor buf-3)) + 'auto-revert-notify-watch-descriptor buf-3)) (auto-revert--timeout)) (message "Hallo0") (should (buffer-local-value @@ -528,7 +544,13 @@ This expects `auto-revert--messages' to be bound by (auto-revert-test--wait-for-buffer-text buf-1 "1-b" (auto-revert--timeout)) ;; On emba, `buf-1' is a killed buffer. - (message "Hallo1 %s %s %s %s %s %s %s" buf-1 (buffer-name buf-1) (buffer-live-p buf-1) file-1 (get-file-buffer file-1) (buffer-name (get-file-buffer file-1)) (buffer-live-p (get-file-buffer file-1))) + (when auto-revert-debug + (message + "Hallo1 %s %s %s %s %s %s %s" + buf-1 (buffer-name buf-1) (buffer-live-p buf-1) + file-1 (get-file-buffer file-1) + (buffer-name (get-file-buffer file-1)) + (buffer-live-p (get-file-buffer file-1)))) (should (buffer-local-value 'auto-revert-notify-watch-descriptor (get-file-buffer file-1))) @@ -548,6 +570,7 @@ This expects `auto-revert--messages' to be bound by (unless was-in-global-auto-revert-mode (global-auto-revert-mode 0)) ; Turn it off. (dolist (buf (list buf-1 buf-2 buf-3)) + (with-current-buffer buf (setq-local kill-buffer-hook nil)) (ignore-errors (kill-buffer buf))) (dolist (file (list file-1 file-2 file-2b file-3)) (ignore-errors (delete-file file))) commit dc12ad8978853991c16d27778152526bd91a9f89 Author: Stefan Kangas Date: Mon Sep 27 12:40:04 2021 +0200 ; Update some links to HTTPS and note some broken links diff --git a/admin/charsets/mapfiles/CP720.map b/admin/charsets/mapfiles/CP720.map index e27deac7ee..0e95b5d66e 100644 --- a/admin/charsets/mapfiles/CP720.map +++ b/admin/charsets/mapfiles/CP720.map @@ -1,4 +1,4 @@ -# Created manually from . +# Created manually from . # The text in that page is available under the terms of the GNU Free # Documentation License. 0x00-0x7F 0x0000 diff --git a/admin/charsets/mapfiles/CP858.map b/admin/charsets/mapfiles/CP858.map index 753dc50946..d5a59b2c52 100644 --- a/admin/charsets/mapfiles/CP858.map +++ b/admin/charsets/mapfiles/CP858.map @@ -1,4 +1,4 @@ -# Created manually from . +# Created manually from . # The text in that page is available under the terms of the GNU Free # Documentation License. 0x00-0x7F 0x0000 diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index 46f78220fe..f80ccc080a 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -816,7 +816,7 @@ Emacs news, a history of recent user-visible changes More GNU and FSF information is available at -@uref{https://www.gnu.org} and @uref{http://www.fsf.org} +@uref{https://www.gnu.org} and @uref{https://www.fsf.org} @node Help installing Emacs @section Where can I get help in installing Emacs? diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 42d714bf1e..72696e36fc 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -2247,7 +2247,7 @@ implementation is only available in UNICOWS.DLL, which implements the Microsoft Layer for Unicode on Windows 9X, or "MSLU". This article on MSDN: - http://msdn.microsoft.com/en-us/goglobal/bb688166.aspx + https://web.archive.org/web/20151224032644/https://msdn.microsoft.com/en-us/goglobal/bb688166.aspx includes a short description of MSLU and a link where it can be downloaded. @@ -2314,7 +2314,7 @@ dialogs introduced in Windows 7. It is explicitly described in the MSDN documentation of the GetOpenFileName API used by Emacs to pop up the file selection dialog. For the details, see - http://msdn.microsoft.com/en-us/library/windows/desktop/ms646839%28v=vs.85%29.aspx + https://msdn.microsoft.com/en-us/library/windows/desktop/ms646839%28v=vs.85%29.aspx The dialog shows the last directory in which the user selected a file in a previous invocation of the dialog with the same initial diff --git a/lisp/ChangeLog.15 b/lisp/ChangeLog.15 index bd1fbe61ad..29fbe47489 100644 --- a/lisp/ChangeLog.15 +++ b/lisp/ChangeLog.15 @@ -17307,7 +17307,7 @@ * simple.el (normal-erase-is-backspace-mode): Use input-decode-map rather than fiddling with global-map bindings, since it should only affect per-terminal settings. - See http://bugs.gentoo.org/show_bug.cgi?id=289709. + See https://bugs.gentoo.org/show_bug.cgi?id=289709. * minibuffer.el (completion-table-with-terminator): Allow to specify the terminator-regexp. diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el index ccb4c8390b..dfd4e5b829 100644 --- a/lisp/international/titdic-cnv.el +++ b/lisp/international/titdic-cnv.el @@ -627,8 +627,8 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." py-converter "\ ;; \"pinyin.map\" is included in a free package called CCE. It is -;; available at: -;; http://ftp.debian.org/debian/dists/potato/main +;; available at: [link needs updating -- SK 2021-09-27] +;; https://ftp.debian.org/debian/dists/potato/main ;; /source/utils/cce_0.36.orig.tar.gz ;; This package contains the following copyright notice. ;; @@ -655,8 +655,8 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." ziranma-converter "\ ;; \"ziranma.cin\" is included in a free package called CCE. It is -;; available at: -;; http://ftp.debian.org/debian/dists/potato/main +;; available at: [link needs updating -- SK 2021-09-27] +;; https://ftp.debian.org/debian/dists/potato/main ;; /source/utils/cce_0.36.orig.tar.gz ;; This package contains the following copyright notice. ;; diff --git a/msdos/autogen/config.in b/msdos/autogen/config.in index 263cba15a2..560f5f346f 100644 --- a/msdos/autogen/config.in +++ b/msdos/autogen/config.in @@ -1712,7 +1712,7 @@ along with GNU Emacs. If not, see . */ /* Suppress GCC's bogus "no previous prototype for 'FOO'" and "no previous declaration for 'FOO'" diagnostics, when FOO is an inline function in the header; see - . */ + . */ # define _GL_INLINE_HEADER_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ diff --git a/nt/ChangeLog.1 b/nt/ChangeLog.1 index 247f10a733..d0aed936d1 100644 --- a/nt/ChangeLog.1 +++ b/nt/ChangeLog.1 @@ -222,7 +222,7 @@ as earlier versions. This is so GetVersion and GetVersionEx APIs used for bug reporting and other purposes return accurate version number on Windows 8.1. See the discussion on MSDN - http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074.aspx + https://msdn.microsoft.com/en-us/library/windows/desktop/dn302074.aspx for more details. 2013-12-12 Eli Zaretskii diff --git a/src/w16select.c b/src/w16select.c index 37239137cf..bbd2ed4bb9 100644 --- a/src/w16select.c +++ b/src/w16select.c @@ -87,7 +87,7 @@ static size_t clipboard_storage_size; /* C functions to access the Windows 3.1x clipboard from DOS apps. The information was obtained from the Microsoft Knowledge Base, - article Q67675 and can be found at: + article Q67675 and can be found at: [broken link -- SK 2021-09-27] http://www.microsoft.com/kb/developr/win_dk/q67675.htm */ /* See also Ralf Brown's Interrupt List. commit d22d7d6be8c6348eead9412d6f05b18de3f481b6 Author: Alan Third Date: Mon Sep 27 10:50:02 2021 +0100 Attempt to debug a graphical glitch on macOS * src/nsterm.m (ns_scroll_run): (ns_shift_glyphs_for_insert): Switch to using NSPoint for destination. ([EmacsView copyRect:to:]): Use NSPoint for the destination, always use the view's layer, and log any questionable copy requests. diff --git a/src/nsterm.h b/src/nsterm.h index 1bedf78bcb..8cbc663651 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -489,7 +489,7 @@ typedef id instancetype; - (void)lockFocus; - (void)unlockFocus; #endif -- (void)copyRect:(NSRect)srcRect to:(NSRect)dstRect; +- (void)copyRect:(NSRect)srcRect to:(NSPoint)dest; /* Non-notification versions of NSView methods. Used for direct calls. */ - (void)windowWillEnterFullScreen; diff --git a/src/nsterm.m b/src/nsterm.m index 3363fac475..1970a7a1c1 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2701,10 +2701,10 @@ Hide the window (X11 semantics) { NSRect srcRect = NSMakeRect (x, from_y, width, height); - NSRect dstRect = NSMakeRect (x, to_y, width, height); + NSPoint dest = NSMakePoint (x, to_y); EmacsView *view = FRAME_NS_VIEW (f); - [view copyRect:srcRect to:dstRect]; + [view copyRect:srcRect to:dest]; #ifdef NS_IMPL_COCOA [view setNeedsDisplayInRect:srcRect]; #endif @@ -2826,11 +2826,11 @@ Hide the window (X11 semantics) -------------------------------------------------------------------------- */ { NSRect srcRect = NSMakeRect (x, y, width, height); - NSRect dstRect = NSMakeRect (x+shift_by, y, width, height); + NSPoint dest = NSMakePoint (x+shift_by, y); NSTRACE ("ns_shift_glyphs_for_insert"); - [FRAME_NS_VIEW (f) copyRect:srcRect to:dstRect]; + [FRAME_NS_VIEW (f) copyRect:srcRect to:dest]; } @@ -7854,17 +7854,39 @@ - (void)windowDidChangeBackingProperties:(NSNotification *)notification #endif /* NS_IMPL_COCOA */ -- (void)copyRect:(NSRect)srcRect to:(NSRect)dstRect +- (void)copyRect:(NSRect)srcRect to:(NSPoint)dest { NSTRACE ("[EmacsView copyRect:To:]"); NSTRACE_RECT ("Source", srcRect); - NSTRACE_RECT ("Destination", dstRect); + NSTRACE_POINT ("Destination", dest); + + NSRect dstRect = NSMakeRect (dest.x, dest.y, NSWidth (srcRect), + NSHeight (srcRect)); + NSRect frame = [self frame]; + + /* TODO: This check is an attempt to debug a rare graphical glitch + on macOS and should be removed before the Emacs 28 release. */ + if (!NSContainsRect (frame, srcRect) + || !NSContainsRect (frame, dstRect)) + { + NSLog (@"[EmacsView copyRect:to:] Attempting to copy to or " + "from an area outside the graphics buffer."); + NSLog (@" Frame: (%f, %f) %f×%f", + NSMinX (frame), NSMinY (frame), + NSWidth (frame), NSHeight (frame)); + NSLog (@" Source: (%f, %f) %f×%f", + NSMinX (srcRect), NSMinY (srcRect), + NSWidth (srcRect), NSHeight (srcRect)); + NSLog (@" Destination: (%f, %f) %f×%f", + NSMinX (dstRect), NSMinY (dstRect), + NSWidth (dstRect), NSHeight (dstRect)); + } #ifdef NS_IMPL_COCOA if ([self wantsLayer]) { double scale = [[self window] backingScaleFactor]; - CGContextRef context = [[NSGraphicsContext currentContext] CGContext]; + CGContextRef context = [(EmacsLayer *)[self layer] getContext]; int bpp = CGBitmapContextGetBitsPerPixel (context) / 8; void *pixels = CGBitmapContextGetData (context); int rowSize = CGBitmapContextGetBytesPerRow (context); @@ -7873,8 +7895,8 @@ - (void)copyRect:(NSRect)srcRect to:(NSRect)dstRect + (int) (NSMinY (srcRect) * scale * rowSize + NSMinX (srcRect) * scale * bpp); void *dstPixels = (char *) pixels - + (int) (NSMinY (dstRect) * scale * rowSize - + NSMinX (dstRect) * scale * bpp); + + (int) (dest.y * scale * rowSize + + dest.x * scale * bpp); if (NSIntersectsRect (srcRect, dstRect) && NSMinY (srcRect) < NSMinY (dstRect)) commit 86bf8afa45f8d8fe19c82a9351ca445bc6f0e12e Author: Alan Third Date: Sun Sep 26 11:12:48 2021 +0100 Fix NS toolbar again (bug#50534) * src/nsmenu.m (free_frame_tool_bar): Remove toolbar. (update_frame_tool_bar_1): New function. (update_frame_tool_bar): Move most of the functionality to update_frame_tool_bar_1. * src/nsterm.h: Definitions of functions and methods. * src/nsterm.m (ns_update_begin): ([EmacsView windowDidEnterFullScreen]): ([EmacsView windowDidExitFullScreen]): We no longer need to reset the toolbar visibility as that's done when we create the new fullscreen window. ([EmacsWindow initWithEmacsFrame:fullscreen:screen:]): Move the check for undecorated frames into createToolbar:. ([EmacsWindow createToolbar:]): Check whether a toolbar should be created, and run the toolbar update immediately. diff --git a/src/nsmenu.m b/src/nsmenu.m index f0c5bb24e6..9b78643d56 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -995,25 +995,24 @@ - (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item /* Note: This triggers an animation, which calls windowDidResize repeatedly. */ f->output_data.ns->in_animation = 1; - [[[view window] toolbar] setVisible: NO]; + [[[view window] toolbar] setVisible:NO]; f->output_data.ns->in_animation = 0; + [[view window] setToolbar:nil]; + unblock_input (); } void -update_frame_tool_bar (struct frame *f) +update_frame_tool_bar_1 (struct frame *f, EmacsToolbar *toolbar) /* -------------------------------------------------------------------------- Update toolbar contents. -------------------------------------------------------------------------- */ { int i, k = 0; - NSWindow *window = [FRAME_NS_VIEW (f) window]; - EmacsToolbar *toolbar = (EmacsToolbar *)[window toolbar]; NSTRACE ("update_frame_tool_bar"); - if (window == nil || toolbar == nil) return; block_input (); #ifdef NS_IMPL_COCOA @@ -1094,13 +1093,6 @@ - (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item #undef TOOLPROP } - if (![toolbar isVisible] != !FRAME_EXTERNAL_TOOL_BAR (f)) - { - f->output_data.ns->in_animation = 1; - [toolbar setVisible: FRAME_EXTERNAL_TOOL_BAR (f)]; - f->output_data.ns->in_animation = 0; - } - #ifdef NS_IMPL_COCOA if ([toolbar changed]) { @@ -1124,9 +1116,28 @@ - (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item [newDict release]; } #endif + + [toolbar setVisible:YES]; unblock_input (); } +void +update_frame_tool_bar (struct frame *f) +{ + EmacsWindow *window = (EmacsWindow *)[FRAME_NS_VIEW (f) window]; + EmacsToolbar *toolbar = (EmacsToolbar *)[window toolbar]; + + if (!toolbar) + { + [window createToolbar:f]; + return; + } + + if (window == nil || toolbar == nil) return; + + update_frame_tool_bar_1 (f, toolbar); +} + /* ========================================================================== diff --git a/src/nsterm.h b/src/nsterm.h index 6d4ea77121..1bedf78bcb 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -418,6 +418,7 @@ typedef id instancetype; - (instancetype)initWithEmacsFrame:(struct frame *)f; - (instancetype)initWithEmacsFrame:(struct frame *)f fullscreen:(BOOL)fullscreen screen:(NSScreen *)screen; +- (void)createToolbar:(struct frame *)f; - (void)setParentChildRelationships; - (NSInteger)borderWidth; - (BOOL)restackWindow:(NSWindow *)win above:(BOOL)above; @@ -1148,6 +1149,10 @@ extern void ns_init_locale (void); /* in nsmenu */ extern void update_frame_tool_bar (struct frame *f); +#ifdef __OBJC__ +extern void update_frame_tool_bar_1 (struct frame *f, EmacsToolbar *toolbar); +#endif + extern void free_frame_tool_bar (struct frame *f); extern Lisp_Object find_and_return_menu_selection (struct frame *f, bool keymaps, diff --git a/src/nsterm.m b/src/nsterm.m index 4ef20e4c2b..3363fac475 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1021,15 +1021,6 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen) ns_update_auto_hide_menu_bar (); - NSToolbar *toolbar = [[FRAME_NS_VIEW (f) window] toolbar]; - if (toolbar) - { - /* Ensure the toolbars visibility is set correctly. */ - BOOL tbar_visible = FRAME_EXTERNAL_TOOL_BAR (f) ? YES : NO; - if (! tbar_visible != ! [toolbar isVisible]) - [toolbar setVisible: tbar_visible]; - } - ns_updating_frame = f; [view lockFocus]; } @@ -7401,7 +7392,6 @@ - (void)windowDidEnterFullScreen /* provided for direct calls */ } else { - BOOL tbar_visible = FRAME_EXTERNAL_TOOL_BAR (emacsframe) ? YES : NO; #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 \ && MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 unsigned val = (unsigned)[NSApp presentationOptions]; @@ -7419,7 +7409,6 @@ - (void)windowDidEnterFullScreen /* provided for direct calls */ [NSApp setPresentationOptions: options]; } #endif - [[[self window]toolbar] setVisible:tbar_visible]; } } @@ -7460,14 +7449,6 @@ - (void)windowDidExitFullScreen /* provided for direct calls */ #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 [self updateCollectionBehavior]; #endif - if (FRAME_EXTERNAL_TOOL_BAR (emacsframe)) - { - [[[self window] toolbar] setVisible:YES]; - update_frame_tool_bar (emacsframe); - [[self window] display]; - } - else - [[[self window] toolbar] setVisible:NO]; if (next_maximized != -1) [[self window] performZoom:self]; @@ -8298,8 +8279,7 @@ - (instancetype) initWithEmacsFrame:(struct frame *)f [self setOpaque:NO]; /* toolbar support */ - if (! FRAME_UNDECORATED (f)) - [self createToolbar:f]; + [self createToolbar:f]; /* macOS Sierra automatically enables tabbed windows. We can't allow this to be enabled until it's available on a Free system. @@ -8316,13 +8296,17 @@ - (instancetype) initWithEmacsFrame:(struct frame *)f - (void)createToolbar: (struct frame *)f { + if (FRAME_UNDECORATED (f) || !FRAME_EXTERNAL_TOOL_BAR (f)) + return; + EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); EmacsToolbar *toolbar = [[EmacsToolbar alloc] initForView:view withIdentifier:[NSString stringWithLispString:f->name]]; - [toolbar setVisible:NO]; + [self setToolbar:toolbar]; + update_frame_tool_bar_1 (f, toolbar); #ifdef NS_IMPL_COCOA { commit 3d2d7e8ea235a13543ed475836f8f7ea4c88520e Author: Stefan Kangas Date: Mon Sep 27 11:26:31 2021 +0200 Fix automatic filling of docstring in cl-defstruct * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Fix bug where a paragraph was filled as if it were a single line, which led to garbled output in the docstring. (Bug#50839) * test/lisp/subr-tests.el (subr-test-internal--format-docstring-line): New test. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 833c1d1973..4e0e323cfa 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -3080,12 +3080,12 @@ Supported keywords for slots are: `(nth ,pos cl-x)))))) (push slot slots) (push default-value defaults) - ;; The arg "cl-x" is referenced by name in eg pred-form + ;; The arg "cl-x" is referenced by name in e.g. pred-form ;; and pred-check, so changing it is not straightforward. (push `(,defsym ,accessor (cl-x) - ,(internal--format-docstring-line - "Access slot \"%s\" of `%s' struct CL-X.%s" - slot name + ,(concat + (internal--format-docstring-line + "Access slot \"%s\" of `%s' struct CL-X." slot name) (if doc (concat "\n" doc) "")) (declare (side-effect-free t)) ,access-body) diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 695da10408..ed9a3d0149 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -767,6 +767,18 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350." (should-not (equal dir default-directory)) (should (file-exists-p default-directory))))) +(ert-deftest subr-test-internal--format-docstring-line () + (should + (string= (let ((fill-column 60)) + (internal--format-docstring-line + "Emacs is the advanced, extensible, customizable, \ +self-documenting editor. This manual describes how to edit with Emacs and \ +some of the ways to customize it; it corresponds to GNU Emacs version 28.1.")) + "Emacs is the advanced, extensible, customizable, +self-documenting editor. This manual describes how to edit +with Emacs and some of the ways to customize it; it +corresponds to GNU Emacs version 28.1."))) + (ert-deftest test-ensure-list () (should (equal (ensure-list nil) nil)) (should (equal (ensure-list :foo) '(:foo))) commit 2403deca2bcffc62ff80e4c90a61fea1ea30a768 Author: Eli Zaretskii Date: Mon Sep 27 12:28:54 2021 +0300 Minor fix in 'w32-find-non-USB-fonts' * lisp/term/w32-win.el (w32--filter-USB-scripts): Handle representative characters given as a vector, not a list. diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index 80afcb3604..5d1dc60667 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el @@ -532,7 +532,7 @@ characters from these blocks.") (let (val) (dolist (elt script-representative-chars) (let ((subranges w32-no-usb-subranges) - (chars (cdr elt)) + (chars (append (cdr elt) nil)) ; handle vectors as well ch found subrange) (while (and (consp chars) (not found)) (setq ch (car chars) @@ -595,7 +595,11 @@ default font on FRAME, or its best approximation." 0 nchars script-chars) '[nil])) ;; Does this font support ALL of the script's - ;; representative characters? + ;; representative characters? Note that, when the + ;; representative characters are specified as a + ;; vector, this is a more stringent test than font + ;; selection does, because supporting _any_ + ;; character from the vector is enough. (setq idx 0) (while (and (< idx nchars) (not (null (aref glyphs idx)))) (setq idx (1+ idx))) commit 129efd9c0b05610794cbfbb4d88facda435a8fe6 Author: Basil L. Contovounesios Date: Mon Sep 27 10:20:54 2021 +0100 ; Fix compilation of doc/lispref/symbols.texi. diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi index 3a767892ff..8ae2d1fc88 100644 --- a/doc/lispref/symbols.texi +++ b/doc/lispref/symbols.texi @@ -694,7 +694,7 @@ As can be seen, it's quite tedious to read or develop this code since the symbol names to type are so long. We can use shorthands to alleviate that. -@lisp1 +@lisp (defun snu-split (separator s &optional omit-nulls) "A match-data saving variation on `split-string'." (save-match-data (split-string s separator omit-nulls))) commit 93d200b23c9f2c89c39166e7e3ef3c6ef0806348 Author: João Távora Date: Mon Sep 27 10:19:35 2021 +0100 * etc/NEWS (Shorthands for Lisp symbols): Reword. diff --git a/etc/NEWS b/etc/NEWS index 381712f05d..015b120e04 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3921,13 +3921,13 @@ It can be used to create Lisp strings with arbitrary byte sequences +++ ** Shorthands for Lisp symbols. Shorthands are a general purpose namespacing system to make Emacs -Lisp's symbol-naming etiquette easier to use. Also known as a -"renamed symbol", a shorthand is any symbolic form found in Lisp -source that "abbreviates" a symbol's print name with. Usually, the -abbreviated name will be shorter, but that is not necessarily so; this -feature could also be used for providing namespace prefixes to -symbols, in order to avoid name clashes and namespace pollution. For -details, see the manual section "(elisp) Shorthands". +Lisp's symbol-naming etiquette easier to use. A shorthand is any +symbolic form found in Lisp source that "abbreviates" a symbol's print +name. Among other applications, this feature can be used to avoid +name clashes and namespace pollution by renaming an entire file's +worth of symbols with proper and longer prefixes, without actually +touching the Lisp source. For details, see the manual section +"(elisp) Shorthands". +++ ** New function 'string-search'. commit a2a62f71051f1295492780f320e9b7bc02b6e6f4 Author: Robert Pluim Date: Sun Sep 26 17:26:22 2021 +0200 Enhance font_range to check for emoji composition triggers If the codepoint that triggered composition is from the emoji script, use the emoji font to check the string being composed, rather than the font of the first character of the string. This makes e.g. "emoji codepoint with Emoji_Presentation = No followed by VS-16 (FE0F)" display the emoji version of the glyph for that codepoint. * admin/unidata/blocks.awk: Add VS-1 through VS-16 to the emoji script. * src/composite.c (autocmp_chars): Accept additional argument CH for the codepoint that triggered composition, pass it to font_range. (composition_reseat_it, find_automatic_composition): Pass codepoint that triggered composition to autocmp_chars. * src/font.c (font_range): Accept additional argument CH for the triggering codepoint. If the codepoint is from the 'emoji' script, use Vscript_representative_chars to find the font to use for the composition attempt. (syms_of_font): Add Qemoji symbol. * src/font.h: Update font_range prototype for argument CH. * etc/NEWS: Announce change. diff --git a/admin/unidata/blocks.awk b/admin/unidata/blocks.awk index b0303d7e66..96b0413875 100755 --- a/admin/unidata/blocks.awk +++ b/admin/unidata/blocks.awk @@ -243,6 +243,12 @@ END { override_start[idx] = "1F590" override_end[idx] = "1F590" + ## These are here so that font_range can choose Emoji presentation + ## for the preceding codepoint when it encounters a VS + idx++ + override_start[idx] = "FE00" + override_end[idx] = "FE0F" + for (k in override_start) { i++ diff --git a/etc/NEWS b/etc/NEWS index 72a4b100b3..381712f05d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -156,6 +156,18 @@ sequences (if a suitable font is installed) so that they are displayed as single glyphs instead of multiple ones. 'Noto Color Emoji' is one such suitable font. ++++ +** Composition of emoji has been improved. +If autocomposition is triggered by an emoji character, then the emoji +font is now used to check if composition can be performed, rather than +the font of the first character of the string being composed. This +allows e.g. + +'Emoji codepoint' + VS-16 + +to be displayed using the emoji font even if 'Emoji codepoint' does +not have emoji presentation by default. + +++ ** New command 'execute-extended-command-for-buffer'. This new command, bound to 'M-S-x', works like diff --git a/src/composite.c b/src/composite.c index c37b1fd4b9..f456e7a835 100644 --- a/src/composite.c +++ b/src/composite.c @@ -882,14 +882,15 @@ fill_gstring_body (Lisp_Object gstring) /* Try to compose the characters at CHARPOS according to composition rule RULE ([PATTERN PREV-CHARS FUNC]). LIMIT limits the characters to compose. STRING, if not nil, is a target string. WIN is a - window where the characters are being displayed. If characters are + window where the characters are being displayed. CH is the + character that triggered the composition check. If characters are successfully composed, return the composition as a glyph-string object. Otherwise return nil. */ static Lisp_Object autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t limit, struct window *win, struct face *face, - Lisp_Object string, Lisp_Object direction) + Lisp_Object string, Lisp_Object direction, int ch) { ptrdiff_t count = SPECPDL_INDEX (); Lisp_Object pos = make_fixnum (charpos); @@ -920,7 +921,7 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, struct frame *f = XFRAME (font_object); if (FRAME_WINDOW_P (f)) { - font_object = font_range (charpos, bytepos, &to, win, face, string); + font_object = font_range (charpos, bytepos, &to, win, face, string, ch); if (! FONT_OBJECT_P (font_object) || (! NILP (re) && to < limit @@ -1272,7 +1273,7 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, if (XFIXNAT (AREF (elt, 1)) != cmp_it->lookback) goto no_composition; lgstring = autocmp_chars (elt, charpos, bytepos, endpos, - w, face, string, direction); + w, face, string, direction, cmp_it->ch); if (composition_gstring_p (lgstring)) break; lgstring = Qnil; @@ -1310,7 +1311,7 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, else direction = QR2L; lgstring = autocmp_chars (elt, cpos, bpos, charpos + 1, w, face, - string, direction); + string, direction, cmp_it->ch); if (! composition_gstring_p (lgstring) || cpos + LGSTRING_CHAR_LEN (lgstring) - 1 != charpos) /* Composition failed or didn't cover the current @@ -1679,7 +1680,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit, ptrdiff_t backlim, for (check = cur; check_pos < check.pos; ) BACKWARD_CHAR (check, stop); *gstring = autocmp_chars (elt, check.pos, check.pos_byte, - tail, w, NULL, string, Qnil); + tail, w, NULL, string, Qnil, c); need_adjustment = 1; if (NILP (*gstring)) { diff --git a/src/font.c b/src/font.c index e043ef8d01..82a1dffc01 100644 --- a/src/font.c +++ b/src/font.c @@ -3866,6 +3866,9 @@ font_at (int c, ptrdiff_t pos, struct face *face, struct window *w, If STRING is not nil, it is the string to check instead of the current buffer. In that case, FACE must be not NULL. + CH is the character that actually caused the composition + process to start, it may be different from the character at POS. + The return value is the font-object for the character at POS. *LIMIT is set to the position where that font can't be used. @@ -3873,15 +3876,16 @@ font_at (int c, ptrdiff_t pos, struct face *face, struct window *w, Lisp_Object font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit, - struct window *w, struct face *face, Lisp_Object string) + struct window *w, struct face *face, Lisp_Object string, + int ch) { ptrdiff_t ignore; int c; Lisp_Object font_object = Qnil; + struct frame *f = XFRAME (w->frame); if (!face) { - struct frame *f = XFRAME (w->frame); int face_id; if (NILP (string)) @@ -3900,6 +3904,24 @@ font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit, face = FACE_FROM_ID (f, face_id); } + /* If the composition was triggered by an emoji, use a character + from 'script-representative-chars', rather than the first + character in the string, to determine the font to use. */ + if (EQ (CHAR_TABLE_REF (Vchar_script_table, ch), + Qemoji)) + { + Lisp_Object val = assq_no_quit (Qemoji, Vscript_representative_chars); + if (CONSP (val)) + { + val = XCDR (val); + if (CONSP (val)) + val = XCAR (val); + else if (VECTORP (val)) + val = AREF (val, 0); + font_object = font_for_char (face, XFIXNAT (val), pos - 1, string); + } + } + while (pos < *limit) { c = (NILP (string) @@ -5423,6 +5445,7 @@ syms_of_font (void) DEFSYM (Qiso8859_1, "iso8859-1"); DEFSYM (Qiso10646_1, "iso10646-1"); DEFSYM (Qunicode_bmp, "unicode-bmp"); + DEFSYM (Qemoji, "emoji"); /* Symbols representing keys of font extra info. */ DEFSYM (QCotf, ":otf"); diff --git a/src/font.h b/src/font.h index d3e1530642..1da72cca07 100644 --- a/src/font.h +++ b/src/font.h @@ -885,7 +885,7 @@ valid_font_driver (struct font_driver const *d) extern Lisp_Object font_update_drivers (struct frame *f, Lisp_Object list); extern Lisp_Object font_range (ptrdiff_t, ptrdiff_t, ptrdiff_t *, struct window *, struct face *, - Lisp_Object); + Lisp_Object, int); extern void font_fill_lglyph_metrics (Lisp_Object, struct font *, unsigned int); extern Lisp_Object font_put_extra (Lisp_Object font, Lisp_Object prop, commit da4e58458f6659d075143083a9f04be3a42853da Author: Lars Ingebrigtsen Date: Mon Sep 27 09:33:56 2021 +0200 Fix checkdoc-related test failure diff --git a/test/src/comp-resources/comp-test-funcs.el b/test/src/comp-resources/comp-test-funcs.el index eb2521e5d3..6352a7c7e9 100644 --- a/test/src/comp-resources/comp-test-funcs.el +++ b/test/src/comp-resources/comp-test-funcs.el @@ -478,8 +478,9 @@ (eq family 'unspecified)) family))) +;; This function doesn't have a doc string on purpose. (defun comp-test-46670-1-f (_) - "Foo.") + "foo") (defun comp-test-46670-2-f (s) (and (equal (comp-test-46670-1-f (length s)) s) commit 5f6e88ec9b43fef259f0303d167107fc56f70a5c Author: Lars Ingebrigtsen Date: Mon Sep 27 09:28:34 2021 +0200 Fix two doc-related test failures diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index f1778b3856..ecf62a4c12 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -285,7 +285,7 @@ Check that the resulting binaries do not differ." (should (string= (comp-tests-condition-case-0-f) "arith-error Arithmetic error catched")) (should (string= (comp-tests-condition-case-1-f) - "error foo catched")) + "error Foo catched")) (should (= (comp-tests-catch-f (lambda () (throw 'foo 3))) 3)) @@ -333,7 +333,7 @@ Check that the resulting binaries do not differ." (comp-deftest doc () (should (string= (documentation #'comp-tests-doc-f) - "A nice docstring")) + "A nice docstring.")) ;; Check a preloaded function, we can't use `comp-tests-doc-f' now ;; as this is loaded manually with no .elc. (should (string-match "\\.*.elc\\'" (symbol-file #'error)))) commit b023f252682544154311124d7350fe111e34f1ca Merge: 2cef8c216a 00609b1a70 Author: Michael Albinus Date: Mon Sep 27 09:22:10 2021 +0200 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit 2cef8c216ab58ae00cc3a97c3cb254fa50d29748 Author: Michael Albinus Date: Mon Sep 27 09:21:53 2021 +0200 Optimize emba builds * test/infra/Dockerfile.emba (emacs-base): Install also libdbus-1-dev and libacl1-dev. * test/infra/gitlab-ci.yml (prep-image-base): Comment out. This stage is activated by default in Dockerfile.emba. diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba index e79f370f17..0b69a71992 100644 --- a/test/infra/Dockerfile.emba +++ b/test/infra/Dockerfile.emba @@ -28,13 +28,15 @@ FROM debian:stretch as emacs-base RUN apt-get update && \ apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \ - libc-dev gcc g++ make autoconf automake libncurses-dev gnutls-dev git texinfo \ + libc-dev gcc g++ make autoconf automake libncurses-dev gnutls-dev \ + libdbus-1-dev libacl1-dev git texinfo \ && rm -rf /var/lib/apt/lists/* FROM emacs-base as emacs-inotify RUN apt-get update && \ - apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 inotify-tools \ + apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \ + inotify-tools \ && rm -rf /var/lib/apt/lists/* COPY . /checkout @@ -62,7 +64,8 @@ RUN make -j4 FROM emacs-base as emacs-gnustep RUN apt-get update && \ - apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 gnustep-devel \ + apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \ + gnustep-devel \ && rm -rf /var/lib/apt/lists/* COPY . /checkout @@ -75,7 +78,8 @@ RUN make -j4 FROM emacs-base as emacs-native-comp-speed0 RUN apt-get update && \ - apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 libgccjit-6-dev \ + apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \ + libgccjit-6-dev \ && rm -rf /var/lib/apt/lists/* ARG make_bootstrap_params="" @@ -84,5 +88,6 @@ COPY . /checkout WORKDIR /checkout RUN ./autogen.sh autoconf RUN ./configure --with-native-compilation -RUN make bootstrap -j2 NATIVE_FULL_AOT=1 BYTE_COMPILE_EXTRA_FLAGS='--eval "(setq comp-speed 0)"' +RUN make bootstrap -j2 \ + NATIVE_FULL_AOT=1 BYTE_COMPILE_EXTRA_FLAGS='--eval "(setq comp-speed 0)"' RUN make -j4 diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index 898fb341b2..b6243e1063 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -199,7 +199,7 @@ default: timeout: 8 hours stages: - - prep-images +# - prep-images - build-images # - fast - normal @@ -209,16 +209,16 @@ stages: - native-comp - slow -prep-image-base: - stage: prep-images - extends: [.job-template, .build-template] - variables: - target: emacs-base +# prep-image-base: +# stage: prep-images +# extends: [.job-template, .build-template] +# variables: +# target: emacs-base build-image-inotify: stage: build-images extends: [.job-template, .build-template] - needs: [prep-image-base] +# needs: [prep-image-base] variables: target: emacs-inotify @@ -246,14 +246,14 @@ test-lisp-net-inotify: build-image-filenotify-gio: stage: platform-images extends: [.job-template, .build-template, .filenotify-gio-template] - needs: [prep-image-base] +# needs: [prep-image-base] variables: target: emacs-filenotify-gio build-image-gnustep: stage: platform-images extends: [.job-template, .build-template, .gnustep-template] - needs: [prep-image-base] +# needs: [prep-image-base] variables: target: emacs-gnustep @@ -278,7 +278,7 @@ test-gnustep: build-native-bootstrap-speed0: stage: native-comp-images extends: [.job-template, .build-template, .native-comp-template] - needs: [prep-image-base] +# needs: [prep-image-base] variables: target: emacs-native-comp-speed0 commit 00609b1a708f594326080501e13354986358b8d6 Author: Eli Zaretskii Date: Mon Sep 27 10:20:54 2021 +0300 Minor stylistic fixes of shorthand code in C * src/lread.c (oblookup_considering_shorthand): Now static. Move prototype to where it belongs. (read1, Fintern, Fintern_soft, Funintern) (oblookup_considering_shorthand, syms_of_lread): Fix style of braces and indentation, comments, and doc strings. diff --git a/src/lread.c b/src/lread.c index db8c847a87..af0a799459 100644 --- a/src/lread.c +++ b/src/lread.c @@ -165,6 +165,12 @@ static void readevalloop (Lisp_Object, struct infile *, Lisp_Object, bool, Lisp_Object, Lisp_Object); static void build_load_history (Lisp_Object, bool); + +static Lisp_Object oblookup_considering_shorthand (Lisp_Object, const char *, + ptrdiff_t, ptrdiff_t, + char **, ptrdiff_t *, + ptrdiff_t *); + /* Functions that read one byte from the current source READCHARFUN or unreads one byte. If the integer argument C is -1, it returns @@ -2956,11 +2962,6 @@ read_integer (Lisp_Object readcharfun, int radix, return unbind_to (count, string_to_number (read_buffer, radix, NULL)); } -Lisp_Object oblookup_considering_shorthand -(Lisp_Object obarray, - const char *in, ptrdiff_t size, ptrdiff_t size_byte, - char **out, ptrdiff_t *size_out, ptrdiff_t *size_byte_out); - /* If the next token is ')' or ']' or '.', we store that character in *PCH and the return value is not interesting. Else, we store zero in *PCH and we read and return one lisp object. @@ -3806,27 +3807,29 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) Lisp_Object tem; if (skip_shorthand) tem = oblookup (obarray, read_buffer, nchars, nbytes); - else { - tem = oblookup_considering_shorthand - (obarray, read_buffer, nchars, nbytes, - &longhand, &longhand_chars, &longhand_bytes); - } + else + tem = oblookup_considering_shorthand (obarray, read_buffer, + nchars, nbytes, &longhand, + &longhand_chars, + &longhand_bytes); if (SYMBOLP (tem)) result = tem; - else if (longhand) { - Lisp_Object name - = make_specified_string (longhand, longhand_chars, - longhand_bytes, - multibyte); - xfree (longhand); - result = intern_driver (name, obarray, tem); - } else { - Lisp_Object name - = make_specified_string (read_buffer, nchars, nbytes, - multibyte); - result = intern_driver (name, obarray, tem); - } + else if (longhand) + { + Lisp_Object name + = make_specified_string (longhand, longhand_chars, + longhand_bytes, multibyte); + xfree (longhand); + result = intern_driver (name, obarray, tem); + } + else + { + Lisp_Object name + = make_specified_string (read_buffer, nchars, nbytes, + multibyte); + result = intern_driver (name, obarray, tem); + } } if (EQ (Vread_with_symbol_positions, Qt) @@ -4441,9 +4444,10 @@ it defaults to the value of `obarray'. */) char* longhand = NULL; ptrdiff_t longhand_chars = 0; ptrdiff_t longhand_bytes = 0; - tem = oblookup_considering_shorthand - (obarray, SSDATA (string), SCHARS (string), SBYTES (string), - &longhand, &longhand_chars, &longhand_bytes); + tem = oblookup_considering_shorthand (obarray, SSDATA (string), + SCHARS (string), SBYTES (string), + &longhand, &longhand_chars, + &longhand_bytes); if (!SYMBOLP (tem)) { @@ -4455,10 +4459,8 @@ it defaults to the value of `obarray'. */) xfree (longhand); } else - { - tem = intern_driver (NILP (Vpurify_flag) ? string : Fpurecopy (string), - obarray, tem); - } + tem = intern_driver (NILP (Vpurify_flag) ? string : Fpurecopy (string), + obarray, tem); } return tem; } @@ -4478,25 +4480,28 @@ it defaults to the value of `obarray'. */) if (!SYMBOLP (name)) { - CHECK_STRING (name); - string = name; - char* longhand = NULL; + char *longhand = NULL; ptrdiff_t longhand_chars = 0; ptrdiff_t longhand_bytes = 0; - tem = oblookup_considering_shorthand - (obarray, SSDATA (string), SCHARS (string), SBYTES (string), - &longhand, &longhand_chars, &longhand_bytes); - if (longhand) xfree (longhand); - if (FIXNUMP (tem)) return Qnil; else return tem; + + CHECK_STRING (name); + string = name; + tem = oblookup_considering_shorthand (obarray, SSDATA (string), + SCHARS (string), SBYTES (string), + &longhand, &longhand_chars, + &longhand_bytes); + if (longhand) + xfree (longhand); + return FIXNUMP (tem) ? Qnil : tem; } else { - // If already a symbol, we do no shorthand-longhand translation, - // as promised in docstring. + /* If already a symbol, we don't do shorthand-longhand translation, + as promised in the docstring. */ string = SYMBOL_NAME (name); tem = oblookup (obarray, SSDATA (string), SCHARS (string), SBYTES (string)); - if (EQ (name, tem)) return tem; else return Qnil; + return EQ (name, tem) ? name : Qnil; } } @@ -4524,13 +4529,15 @@ usage: (unintern NAME OBARRAY) */) string = name; } - char* longhand = NULL; + char *longhand = NULL; ptrdiff_t longhand_chars = 0; ptrdiff_t longhand_bytes = 0; - tem = oblookup_considering_shorthand - (obarray, SSDATA (string), SCHARS (string), SBYTES (string), - &longhand, &longhand_chars, &longhand_bytes); - if (longhand) free(longhand); + tem = oblookup_considering_shorthand (obarray, SSDATA (string), + SCHARS (string), SBYTES (string), + &longhand, &longhand_chars, + &longhand_bytes); + if (longhand) + xfree(longhand); if (FIXNUMP (tem)) return Qnil; @@ -4624,41 +4631,43 @@ oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff which is then then placed in OUT. In that case, memory is malloc'ed for OUT (which the caller must free) while SIZE_OUT and SIZE_BYTE_OUT respectively hold the character and byte sizes of the - transformed symbol name. If IN is not recognized shorthand for any + transformed symbol name. If IN is not recognized shorthand for any other symbol, OUT is set to point to NULL and 'oblookup' is called. */ Lisp_Object -oblookup_considering_shorthand -(Lisp_Object obarray, - const char *in, ptrdiff_t size, ptrdiff_t size_byte, - char **out, ptrdiff_t *size_out, ptrdiff_t *size_byte_out) +oblookup_considering_shorthand (Lisp_Object obarray, const char *in, + ptrdiff_t size, ptrdiff_t size_byte, char **out, + ptrdiff_t *size_out, ptrdiff_t *size_byte_out) { - // First, assume no transformation will take place. - *out = NULL; Lisp_Object tail = Velisp_shorthands; - // Then, iterate each pair in Velisp_shorthands. + + /* First, assume no transformation will take place. */ + *out = NULL; + /* Then, iterate each pair in Velisp_shorthands. */ FOR_EACH_TAIL_SAFE (tail) { Lisp_Object pair = XCAR (tail); - // Be lenient to Velisp_shorthands: if some element isn't a cons - // or some member of that cons isn't a string, just skip to the - // next element. - if (!CONSP (pair)) continue; + /* Be lenient to 'elisp-shorthands': if some element isn't a + cons, or some member of that cons isn't a string, just skip + to the next element. */ + if (!CONSP (pair)) + continue; Lisp_Object sh_prefix = XCAR (pair); Lisp_Object lh_prefix = XCDR (pair); - if (!STRINGP (sh_prefix) || !STRINGP (lh_prefix)) continue; + if (!STRINGP (sh_prefix) || !STRINGP (lh_prefix)) + continue; ptrdiff_t sh_prefix_size = SBYTES (sh_prefix); - // Compare the prefix of the transformation pair to the symbol - // name. If a match occurs, do the renaming and exit the loop. - // In other words, only one such transformation may take place. - // Calculate the amount of memory to allocate for the longhand - // version of the symbol name with realloc(). This isn't - // strictly needed, but it could later be used as a way for - // multiple transformations on a single symbol name. - if (sh_prefix_size <= size_byte && - memcmp(SSDATA(sh_prefix), in, sh_prefix_size) == 0) + /* Compare the prefix of the transformation pair to the symbol + name. If a match occurs, do the renaming and exit the loop. + In other words, only one such transformation may take place. + Calculate the amount of memory to allocate for the longhand + version of the symbol name with xrealloc. This isn't + strictly needed, but it could later be used as a way for + multiple transformations on a single symbol name. */ + if (sh_prefix_size <= size_byte + && memcmp (SSDATA (sh_prefix), in, sh_prefix_size) == 0) { ptrdiff_t lh_prefix_size = SBYTES (lh_prefix); ptrdiff_t suffix_size = size_byte - sh_prefix_size; @@ -4670,10 +4679,10 @@ oblookup_considering_shorthand break; } } - // Now, as promised, call oblookup() with the "final" symbol name to - // lookup. That function remains oblivious to whether a - // transformation happened here or not, but the caller of this - // function can tell by inspecting the OUT parameter. + /* Now, as promised, call oblookup with the "final" symbol name to + lookup. That function remains oblivious to whether a + transformation happened here or not, but the caller of this + function can tell by inspecting the OUT parameter. */ if (*out) return oblookup (obarray, *out, *size_out, *size_byte_out); else @@ -5438,7 +5447,9 @@ that are loaded before your customizations are read! */); DEFSYM (Qchar_from_name, "char-from-name"); DEFVAR_LISP ("elisp-shorthands", Velisp_shorthands, - doc: /* Alist of known symbol name shorthands*/); + doc: /* Alist of known symbol-name shorthands. +This variable's value can only be set via file-local variables. +See Info node `(elisp)Shorthands' for more details. */); Velisp_shorthands = Qnil; DEFSYM (Qobarray_cache, "obarray-cache"); } commit d45b3e03c96813e10f8de3c375a5310c01623dab Author: Eli Zaretskii Date: Mon Sep 27 09:49:28 2021 +0300 Minor fixes of Lisp doc strings for shorthands feature * lisp/progmodes/elisp-mode.el (obarray-cache) (elisp--completion-local-symbols): * lisp/international/mule.el (hack-elisp-shorthands) (load-with-shorthands-and-code-conversion): Doc string fixes. diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 6c73600e20..2298af42b2 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -296,11 +296,10 @@ attribute." (defun hack-elisp-shorthands (fullname) "Return value of the `elisp-shorthands' file-local variable in FULLNAME. -FULLNAME is the absolute file name of an Elisp file which +FULLNAME is the absolute file name of an Elisp .el file which potentially specifies a file-local value for `elisp-shorthands'. -The Elisp code isn't read or evaluated in any way, we merely -extract what the buffer-local value of `elisp-shorthands' would -be if the file had been found by `find-file'." +The Elisp code in FULLNAME isn't read or evaluated in any way, except +for extraction of the buffer-local value of `elisp-shorthands'." (let ((size (nth 7 (file-attributes fullname)))) (with-temp-buffer (insert-file-contents fullname nil (max 0 (- size 3000)) size) @@ -380,7 +379,9 @@ Return t if file exists." t))) (defun load-with-shorthands-and-code-conversion (fullname file noerror nomessage) - "As `load-with-code-conversion', also considering Elisp shorthands." + "Like `load-with-code-conversion', but also consider Elisp shorthands. +This function uses shorthands defined in the file FULLNAME's local +value of `elisp-shorthands', when it processes that file's Elisp code." (let ((elisp-shorthands (hack-elisp-shorthands fullname))) (load-with-code-conversion fullname file noerror nomessage))) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index d2ea25d67b..acf7123225 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -533,14 +533,13 @@ It can be quoted, or be inside a quoted form." ((facep sym) (find-definition-noselect sym 'defface))))) (defvar obarray-cache nil - "Hash table of obarray-related cache, or nil. -If non-nil this variable is a hash-table holding information -specific to the current state of the Elisp obarray. If the -obarray changes by any means (interning or uninterning a symbol), -the variable is immediately set to nil.") + "If non-nil, a hash table of cached obarray-related information. +The cache holds information specific to the current state of the +Elisp obarray. If the obarray is modified by any means (such as +interning or uninterning a symbol), this variable is set to nil.") (defun elisp--completion-local-symbols () - "Compute collections all Elisp symbols for completion purposes. + "Compute collections of all Elisp symbols for completion purposes. The return value is compatible with the COLLECTION form described in `completion-at-point-functions' (which see)." (cl-flet ((obarray-plus-shorthands () commit 106a95c8ab42ca17ea75d7a1e2eadc16c04e281e Author: Eli Zaretskii Date: Mon Sep 27 09:37:33 2021 +0300 Minor fixes in documentation of shorthands * etc/NEWS: * doc/lispref/symbols.texi (Symbol Components, Creating Symbols) (Shorthands): Improve wording, fix indexing and typos. diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi index 775f5e5dbc..3a767892ff 100644 --- a/doc/lispref/symbols.texi +++ b/doc/lispref/symbols.texi @@ -70,9 +70,10 @@ important not to have two symbols with the same name. The Lisp reader ensures this: every time it reads a symbol, it looks for an existing symbol with the specified name before it creates a new one. To get a symbol's name, use the function @code{symbol-name} (@pxref{Creating -Symbols}). Nonwithstanding each symbol having only one unique _print -name_, it is nevertheless possible to refer to that same symbol via -different terms called ``shorthands'' (@pxref{Shorthands}). +Symbols}). However, although each symbol has only one unique +@emph{print name}, it is nevertheless possible to refer to that same +symbol via different alias names called ``shorthands'' +(@pxref{Shorthands}). The value cell holds a symbol's value as a variable, which is what you get if the symbol itself is evaluated as a Lisp expression. @@ -176,36 +177,34 @@ know how Lisp reads them. Lisp must ensure that it finds the same symbol every time it reads the same sequence of characters in the same context. Failure to do so would cause complete confusion. - When the Lisp reader encounters a reference to symbol in the source -code, it reads all the characters of that name. Then it looks up that -name in a table called an @dfn{obarray} to find the symbol that the -programmer meant. - @cindex symbol name hashing @cindex hashing @cindex obarray @cindex bucket (in obarray) -One the techniques used in this lookup is called hashing, an efficient -method of looking something up. For example, instead of searching a -telephone book cover to cover when looking up Jan Jones, you start -with the J's and go from there. That is a simple version of hashing. -Each element of the obarray is a @dfn{bucket} which holds all the -symbols with a given hash code; to look for a given name, it is -sufficient to look through all the symbols in the bucket for that -name's hash code. (The same idea is used for general Emacs hash -tables, but they are a different data type; see @ref{Hash Tables}.) - -@cindex shorthands -@cindex namespacing -@cindex namespaces -When looking up names, the reader also considers ``shorthands''. If -the programmer supplied them, this allows the reader to find a symbol -even if its name isn't typed out fully in the source code. Of course, -the reader needs to be aware of some pre-established context about -such shorthands, much as one needs context to be to able to refer -uniquely to Jan Jones by just the name ``Jan'': it's probably fine -when amongst the Joneses, or when Jan has been mentioned recently, but -very ambiguous in any other situation. @xref{Shorthands}. + When the Lisp reader encounters a name that references a symbol in +the source code, it reads all the characters of that name. Then it +looks up that name in a table called an @dfn{obarray} to find the +symbol that the programmer meant. The technique used in this lookup +is called ``hashing'', an efficient method of looking something up by +converting a sequence of characters to a number, known as a ``hash +code''. For example, instead of searching a telephone book cover to +cover when looking up Jan Jones, you start with the J's and go from +there. That is a simple version of hashing. Each element of the +obarray is a @dfn{bucket} which holds all the symbols with a given +hash code; to look for a given name, it is sufficient to look through +all the symbols in the bucket for that name's hash code. (The same +idea is used for general Emacs hash tables, but they are a different +data type; see @ref{Hash Tables}.) + +When looking up names, the Lisp reader also considers ``shorthands''. +If the programmer supplied them, this allows the reader to find a +symbol even if its name isn't present in its full form in the source +code. Of course, the reader needs to be aware of some pre-established +context about such shorthands, much as one needs context to be to able +to refer uniquely to Jan Jones by just the name ``Jan'': it's probably +fine when amongst the Joneses, or when Jan has been mentioned +recently, but very ambiguous in any other situation. +@xref{Shorthands}. @cindex interning If a symbol with the desired name is found, the reader uses that @@ -220,11 +219,13 @@ same obarray. Thus, the reader gets the same symbols for the same names, as long as you keep reading with the same obarray. Interning usually happens automatically in the reader, but sometimes -other programs may want to do it. For example, a hypothetical -telephone book program could intern the name of each looked up -person's name as a symbol, even if the obarray did not contain it, so -that it could attach information to that new symbol such as the last -time someone looked it up. +other programs may want to do it. For example, after the @kbd{M-x} +command obtains the command name as a string using the minibuffer, it +then interns the string, to get the interned symbol with that name. +As another example, a hypothetical telephone book program could intern +the name of each looked up person's name as a symbol, even if the +obarray did not contain it, so that it could attach information to +that new symbol, such as the last time someone looked it up. @cindex symbol equality @cindex uninterned symbol @@ -232,7 +233,8 @@ time someone looked it up. obarray. They are called @dfn{uninterned symbols}. An uninterned symbol has the same four cells as other symbols; however, the only way to gain access to it is by finding it in some other object or as the -value of a variable. +value of a variable. Uninterned symbols are sometimes useful in +generating Lisp code, see below. In Emacs Lisp, an obarray is actually a vector. Each element of the vector is a bucket; its value is either an interned symbol whose name @@ -256,8 +258,8 @@ not work---only @code{intern} can enter a symbol in an obarray properly. @b{Common Lisp note:} Unlike Common Lisp, Emacs Lisp does not provide for interning the same name in several different ``packages'', thus creating multiple symbols with the same name but different packages. -Emacs Lisp provides a different namespacing system called shorthands -() +Emacs Lisp provides a different namespacing system called +``shorthands'' (@pxref{Shorthands}). @end quotation Most of the functions below take a name and sometimes an obarray as @@ -279,7 +281,7 @@ change the name of the symbol, but fails to update the obarray, so don't do it! @end defun -@cindex uninterned symbol (generated code) +@cindex uninterned symbol, and generating Lisp code Creating an uninterned symbol is useful in generating Lisp code, because an uninterned symbol used as a variable in the code you generate cannot clash with any variables used in other Lisp programs. @@ -301,15 +303,14 @@ distinct uninterned symbol whose name is also @samp{foo}. @defun gensym &optional prefix This function returns a symbol using @code{make-symbol}, whose name is -made by appending @code{gensym-counter} to @var{prefix} and increnting -that counter, guaranteeing that no two calls to this function -generates a symbol with the same name. The prefix defaults to +made by appending @code{gensym-counter} to @var{prefix} and incrementing +that counter, guaranteeing that no two calls to this function will +generate a symbol with the same name. The prefix defaults to @code{"g"}. @end defun -@cindex uninterned symbol (recommendation for generated code) To avoid problems when accidentally interning printed representation -of generated code, (@pxref{Printed Representation}), it is recommended +of generated code (@pxref{Printed Representation}), it is recommended to use @code{gensym} instead of @code{make-symbol}. @defun intern name &optional obarray @@ -638,60 +639,62 @@ functions. @xref{Defining Faces}. @section Shorthands @cindex shorthands @cindex symbolic shorthands +@cindex namespacing +@cindex namespaces -@dfn{Shorthands}, sometimes known as "renamed symbols", are symbolic -forms found in Lisp source. They're just like regular symbolic forms, -except that when the Lisp reader encounters them, it produces symbols -which have a different and usually longer @dfn{print name} -(@pxref{Symbol Components}). + The symbol @dfn{shorthands}, sometimes known as ``renamed symbols'', are +symbolic forms found in Lisp source. They're just like regular +symbolic forms, except that when the Lisp reader encounters them, it +produces symbols which have a different and usually longer @dfn{print +name} (@pxref{Symbol Components}). It is useful to think of shorthands as @emph{abbreviating} the full -names of intended symbols. Despite this, do not confuse with the +names of intended symbols. Despite this, do not confuse shorthands with the Abbrev system @pxref{Abbrevs}. @cindex namespace etiquette -Shorthands make Emacs Lisp's namespacing etiquette easier to work +Shorthands make Emacs Lisp's @dfn{namespacing etiquette} easier to work with. Since all symbols are stored in a single obarray (@pxref{Creating Symbols}), programmers commonly prefix each symbol name with the name of the library where it originates. For example, the functions @code{text-property-search-forward} and @code{text-property-search-backward} both belong to the -@code{text-property-search.el} library (@pxref{Loading}). By properly +@file{text-property-search.el} library (@pxref{Loading}). By properly prefixing symbol names, one effectively prevents clashes between -similarly named symbols which belong to different libraries and do +similarly named symbols which belong to different libraries and thus do different things. However, this practice commonly originates very -long symbols names, which are bothersome to type and read after a -while. +long symbols names, which are inconvenient to type and read after a +while. Shorthands solve these issues in a clean way. @defvar elisp-shorthands -This variable is an alist whose elements have the form +This variable's value is an alist whose elements have the form @code{(@var{shorthand-prefix} . @var{longhand-prefix})}. Each element instructs the Lisp reader to read every symbol form which starts with @var{shorthand-prefix} as if it started with @var{longhand-prefix} instead. -This variable may only be set file-locally (@pxref{File Variables, , +This variable may only be set in file-local variables (@pxref{File Variables, , Local Variables in Files, emacs, The GNU Emacs Manual}). @end defvar -Take this excerpt from following example of a hypothetical string +Here's an example of shorthands usage in a hypothetical string manipulating library @file{some-nice-string-utils.el}. -@example +@smalllisp (defun some-nice-string-utils-split (separator s &optional omit-nulls) - "A match-data saving variation on `split-string'." + "A match-data saving variant of `split-string'." (save-match-data (split-string s separator omit-nulls))) (defun some-nice-string-utils-lines (s) - "Split string S into a list of strings on newline characters." + "Split string S at newline characters into a list of strings." (some-nice-string-utils-split "\\(\r\n\\|[\n\r]\\)" s)) -@end example +@end smalllisp As can be seen, it's quite tedious to read or develop this code since -the symbol names to type are so long. We can use shorthands to good -effect here. +the symbol names to type are so long. We can use shorthands to +alleviate that. -@example +@lisp1 (defun snu-split (separator s &optional omit-nulls) "A match-data saving variation on `split-string'." (save-match-data (split-string s separator omit-nulls))) @@ -703,10 +706,10 @@ effect here. ;; Local Variables: ;; elisp-shorthands: (("snu-" . "some-nice-string-utils-")) ;; End: -@end example +@end lisp Even though the two excerpts look different, they are quite identical -after Lisp reader is done with them. Both will lead to the very same +after the Lisp reader processes them. Both will lead to the very same symbols being interned (@pxref{Creating Symbols}). Thus loading or byte-compiling any of the two files has equivalent results. The shorthands @code{snu-split} and @code{snu-lines} used in the second @@ -720,9 +723,9 @@ Since @code{elisp-shorthands} is a file-local variable, it is possible that multiple libraries depending on @file{some-nice-string-utils-lines.el} refer to the same symbols under @emph{different} shorthands, or not using shorthands at all. In the -next example, the @file{my-tricks.el} library refers to symbol -aforementioned symbol @code{some-nice-string-utils-lines} using the -@code{sns-} prefix. +next example, the @file{my-tricks.el} library refers to the +symbol @code{some-nice-string-utils-lines} using the +@code{sns-} prefix instead of @code{snu-}. @example (defun t-reverse-lines (s) (string-join (reverse (sns-lines s)) "\n") diff --git a/etc/NEWS b/etc/NEWS index d003d0d092..72a4b100b3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3907,15 +3907,15 @@ It can be used to create Lisp strings with arbitrary byte sequences (a.k.a. "raw bytes"). +++ -** Shorthands +** Shorthands for Lisp symbols. Shorthands are a general purpose namespacing system to make Emacs -Lisp's symbol-naming etiquette easier to manage. Also known as a +Lisp's symbol-naming etiquette easier to use. Also known as a "renamed symbol", a shorthand is any symbolic form found in Lisp -source that abbreviates a symbol with a different and longer print -name. Among other applications, it facilitates the importation of -popular libraries such as 's.el' without the polution associated of -very short prefixes. For details, see the manual section "(elisp) -Shorthands". +source that "abbreviates" a symbol's print name with. Usually, the +abbreviated name will be shorter, but that is not necessarily so; this +feature could also be used for providing namespace prefixes to +symbols, in order to avoid name clashes and namespace pollution. For +details, see the manual section "(elisp) Shorthands". +++ ** New function 'string-search'. commit 00011c0ad28cdf1516c854e5fe088a2681aa641c Author: Lars Ingebrigtsen Date: Mon Sep 27 08:15:24 2021 +0200 Make comint understand the ccrypt password phrases * lisp/comint.el (comint-password-prompt-regexp): Add the ccrypt confirmation phrase (bug#50837). * lisp/international/mule-conf.el (password-word-equivalents): Add the ccrypt phrases. diff --git a/lisp/comint.el b/lisp/comint.el index 26aa5547a3..1e5b990c77 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -382,7 +382,10 @@ This variable is buffer-local." "\\(?:" (regexp-opt password-word-equivalents) "\\|Response\\)" "\\(?:\\(?:, try\\)? *again\\| (empty for no passphrase)\\| (again)\\)?" ;; "[[:alpha:]]" used to be "for", which fails to match non-English. - "\\(?: [[:alpha:]]+ .+\\)?[[:blank:]]*[::៖][[:space:]]*\\'") + "\\(?: [[:alpha:]]+ .+\\)?[[:blank:]]*[::៖][[:space:]]*\\'" + ;; The ccrypt encryption dialogue doesn't end with a colon, so + ;; treat it specially. + "\\|^Enter encryption key: (repeat) *\\'") "Regexp matching prompts for passwords in the inferior process. This is used by `comint-watch-for-password-prompt'." :version "28.1" diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el index 2d36dab632..9a68fce2e8 100644 --- a/lisp/international/mule-conf.el +++ b/lisp/international/mule-conf.el @@ -1679,6 +1679,7 @@ for decoding and encoding files, process I/O, etc." (defcustom password-word-equivalents '("password" "passcode" "passphrase" "pass phrase" "pin" + "decryption key" "encryption key" ; From ccrypt. ; These are sorted according to the GNU en_US locale. "암호" ; ko "パスワード" ; ja diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el index 4cba1e4cf2..e1bac81a18 100644 --- a/test/lisp/comint-tests.el +++ b/test/lisp/comint-tests.el @@ -44,6 +44,9 @@ "Password (again):" "Enter password:" "Current password:" ; "passwd" (to change password) in Debian. + "Enter encryption key: " ; ccrypt + "Enter decryption key: " ; ccrypt + "Enter encryption key: (repeat) " ; ccrypt "Enter Auth Password:" ; OpenVPN (Bug#35724) "Verify password: " ; zip -e zipfile.zip ... (Bug#47209) "Mot de Passe :" ; localized (Bug#29729) commit bec88ecc82fd6154351a22b67315d9e0b358c046 Author: Lars Ingebrigtsen Date: Mon Sep 27 07:55:37 2021 +0200 Add "passwd" (change password) prompt to comint * lisp/comint.el (comint-password-prompt-regexp): Add "passwd" (to change the password) first promp in Debian bullseye. diff --git a/lisp/comint.el b/lisp/comint.el index 8bf23897f9..26aa5547a3 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -372,6 +372,7 @@ This variable is buffer-local." "\\(^ *\\|" (regexp-opt '("Enter" "enter" "Enter same" "enter same" "Enter the" "enter the" + "Current" "Enter Auth" "enter auth" "Old" "old" "New" "new" "'s" "login" "Kerberos" "CVS" "UNIX" " SMB" "LDAP" "PEM" "SUDO" "[sudo]" "doas" "Repeat" "Bad" "Retype" "Verify") diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el index 19d0cca88c..4cba1e4cf2 100644 --- a/test/lisp/comint-tests.el +++ b/test/lisp/comint-tests.el @@ -43,6 +43,7 @@ "PIN for user:" ; Bug#35523 "Password (again):" "Enter password:" + "Current password:" ; "passwd" (to change password) in Debian. "Enter Auth Password:" ; OpenVPN (Bug#35724) "Verify password: " ; zip -e zipfile.zip ... (Bug#47209) "Mot de Passe :" ; localized (Bug#29729) commit 44dbc11ff7bdccc8af2cdd311e6ebacfef2c43a7 Author: Lars Ingebrigtsen Date: Mon Sep 27 06:12:53 2021 +0200 Note that the Packaging sub-nodes are mostly for maintainers * doc/lispref/package.texi (Packaging): Note that the information is mostly for ELPA maintainers (bug#50825). diff --git a/doc/lispref/package.texi b/doc/lispref/package.texi index 9c033fe3df..aeb455bb25 100644 --- a/doc/lispref/package.texi +++ b/doc/lispref/package.texi @@ -17,6 +17,11 @@ put it in a @dfn{package archive} for others to download. @xref{Packages,,, emacs, The GNU Emacs Manual}, for a description of user-level features of the packaging system. + These sections are mostly directed towards package archive +maintainers---much of this information is not relevant for package +authors (i.e., people who write code that will be distributed via +these archives). + @menu * Packaging Basics:: The basic concepts of Emacs Lisp packages. * Simple Packages:: How to package a single .el file. commit cc3b11480ca3dc0fe5e604095487abecdce40741 Author: dickmao Date: Sun Sep 26 15:48:04 2021 -0400 Get a `package-test-signed` to work again The test signing key succumbed to either expiration or bitrot. I hope I didn't just publish my secret key to the world. * test/lisp/emacs-lisp/package-resources/key.pub: Refresh. * test/lisp/emacs-lisp/package-resources/key.sec: Refresh. diff --git a/test/lisp/emacs-lisp/package-resources/key.pub b/test/lisp/emacs-lisp/package-resources/key.pub index 5e2ebc55d3..99965723ba 100644 --- a/test/lisp/emacs-lisp/package-resources/key.pub +++ b/test/lisp/emacs-lisp/package-resources/key.pub @@ -1,20 +1,17 @@ -----BEGIN PGP PUBLIC KEY BLOCK----- -mI0EX48EbAEEANrsWXyZ4MRZRjVbLAh5jX/+1+31oB/aJ/q/5DkH1qUHJf0La9LC -sykUSM3H2u5VWLytX/ozrxIRYX13GR2xBxyJlUkDWB209AAVLFrjSp1yUX/Sb5SU -Kb7p421ZAeHiOxfnLRuErFZkTfzY19mUCyw4cdamw430V3mUC9uns/d9ABEBAAG0 -LUouIFJhbmRvbSBIYWNrZXIgKFRFU1QgS0VZKSA8anJoQGV4YW1wbGUub3JnPojO -BBMBCgA4FiEEHP310DrP36xrZ1kSMKdkJgeTYhoFAl+PBGwCGwMFCwkIBwIGFQoJ -CAsCBBYCAwECHgECF4AACgkQMKdkJgeTYhq9MQP7BYkCk8r5G777Ilp8kWjsEIo3 -aDX9jORiNfMAGys/aLjjEajHFAlTQKfSLm/VXLDYtK28c8ACjThQagaDF46MRWqQ -rFFiH4IAZRgj2ELj+/j1ljQZjGjKR2Yx4BCDhbumz8zeMSPL6yFT5+8LOMUAtdv4 -lEPWXW0AycylbdbE7024jQRfjwRsAQQApjTw9kONmSVouCi8ZIQwwYiA9tLzbSZv -CYxbJ6KH0icRhBLfdb1hL/Kn8x3k+xll9A0c/ABVkMxRcbQkY98xsFck7E2GcvnC -sY+w/NdcUUZJYMB3l2MH5ojCbOk5jSAZzxzeFcJhNAhmLqomMHg2LI6KDVey6iYU -FxyIpIQ3SlkAEQEAAYi2BBgBCgAgFiEEHP310DrP36xrZ1kSMKdkJgeTYhoFAl+P -BGwCGwwACgkQMKdkJgeTYhrtywQAhoCR/skBSQWWBI10N0qhtdlNxbpvK8ErSPKw -wS74Pq407Zv0VD9ual/HC3Uet2z8LeG9ZwU4Jd23g96fmJt7AM9CQWrOhC242JYr -YSqWxANyek8otsvppJNHtt2Stmknv7XbJFFB1JDC8WKo8lVo9/MkmzROxuEFEvOU -Yn923VI= -=NRtx +mQGiBGFQyDcRBACmAI6cfY3fM02vb9JtC1BS19boKXbBsDoVrD9qRf8tDFROOpO3 +ZMlbuz+O9Vnljo6Y4WZGnyeWWAMqCditMOfr1cLbux77wSrmAVgZ9exwtGzkmUhM +xcptzKuyod8NuhghXbJgVbfJZ6HlBkk4kiWv98iJQwUBZJfjBUfIv+acjwCg4M2i +Ifu2A3UYl9VqF7qfcDOZudEEAI7V35yfsBDnr9ndKqdGYNw0alX9BEG3KwnAe0fF +O1jDVW12Y/bwnyyrRTrz6o1G8dj7M4XVZQb5PpT9mpNzOSZ6yxqhg+foeJwn2JkD +vyP+kMYU7SZ/tWuMOCdzN95Ki1rf+ti7pLnSMqKx+t3vOWwQbtnsbI6RCLLwETPA +esghA/0X3Dw7cdiE5Xq4TRaPSGViCWP4ekL2KYKqmKv6M/4f2pgFNJY7C+2SIiiP +T62zFlIjs5tF2Df34/M5mh4Vx6E8341r55+XO++kfFWJ5QjLiydRAY6ochG9IFgB +xyBCkCNpiby9PpKyPodedBScdMxIAe4eJR7rG/j9gFC1MypBurQnSm9obm55IFJv +Y2tldHMgPGpvaG5ueS5yb2NrZXRzQGdmeS5vcmc+iHgEExECADgWIQRIVz1DPzm4 +REDIXNtltQG5ACv6lwUCYVDINwIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAK +CRBltQG5ACv6l4iZAKCqldroRYH7vUzVV0Uv1NcDVcpLngCgmEoLVxGLKSwDEXNq +qjRDzDRpReg= +=/l51 -----END PGP PUBLIC KEY BLOCK----- diff --git a/test/lisp/emacs-lisp/package-resources/key.sec b/test/lisp/emacs-lisp/package-resources/key.sec index dbc80f43cb..5bbac1226a 100644 --- a/test/lisp/emacs-lisp/package-resources/key.sec +++ b/test/lisp/emacs-lisp/package-resources/key.sec @@ -1,35 +1,17 @@ -----BEGIN PGP PRIVATE KEY BLOCK----- -lQIGBF+PBGwBBADa7Fl8meDEWUY1WywIeY1//tft9aAf2if6v+Q5B9alByX9C2vS -wrMpFEjNx9ruVVi8rV/6M68SEWF9dxkdsQcciZVJA1gdtPQAFSxa40qdclF/0m+U -lCm+6eNtWQHh4jsX5y0bhKxWZE382NfZlAssOHHWpsON9Fd5lAvbp7P3fQARAQAB -/gcDAngNw4ppSPBe/w734cz++xNEv0TDgwxGBWp2wGSwWao04Nl1U4LkjiIy+dkc -uUPwEZMvxXwMcq10PPH26ifP8Xfi/zANXUoLJ0DsG6rtE3BcSC9MPFe3EJENtcIP -a0jFLsbi72aBzolNEDCZCv93znXFPekaXw/RAeeFLJz8GR2Sx6bHbTJKklXgWPHw -C5Dw6xr/kEZktgjlhjkx280STpLGaFO4jiiGZ4Obp5ePp7kyOzDUzaimdZgJwClT -VbZDNQMTzgQrBOP8doXlo9euW4Wo1IYBIOwgeYieM3ZA9YjJAmp4lFnk/KFYt0Ak -0H9IWzDU8VERcU4B04PSXahzvB1Ii7C7bbHxPyuu6sAfMK8DRkrGjwgAlrhuWNLX -M07acT/E9Pm+mBlDcdkyKB2LfwgaVb9F3C25sfcFSvc5p+sqgZp1Zx7Qg9pOhQjw -U7Ln+96c0bUl+iQKdm3TGjOXAFUHYXbRkx2cJ4gxnMVNj0D68xBtBSm0LUouIFJh -bmRvbSBIYWNrZXIgKFRFU1QgS0VZKSA8anJoQGV4YW1wbGUub3JnPojOBBMBCgA4 -FiEEHP310DrP36xrZ1kSMKdkJgeTYhoFAl+PBGwCGwMFCwkIBwIGFQoJCAsCBBYC -AwECHgECF4AACgkQMKdkJgeTYhq9MQP7BYkCk8r5G777Ilp8kWjsEIo3aDX9jORi -NfMAGys/aLjjEajHFAlTQKfSLm/VXLDYtK28c8ACjThQagaDF46MRWqQrFFiH4IA -ZRgj2ELj+/j1ljQZjGjKR2Yx4BCDhbumz8zeMSPL6yFT5+8LOMUAtdv4lEPWXW0A -ycylbdbE702dAgYEX48EbAEEAKY08PZDjZklaLgovGSEMMGIgPbS820mbwmMWyei -h9InEYQS33W9YS/yp/Md5PsZZfQNHPwAVZDMUXG0JGPfMbBXJOxNhnL5wrGPsPzX -XFFGSWDAd5djB+aIwmzpOY0gGc8c3hXCYTQIZi6qJjB4NiyOig1XsuomFBcciKSE -N0pZABEBAAH+BwMCXeUOBwcOsxb/AY6rnHmgACNTGwIa5vgelw0qfET0ms/YzVrN -ufikyV9dEWVxJyuTKav978wanPu7VcCh0pTjL2nTm2nZWyRJN4gb3UIC0MA1xfB2 -yPLTCmsGeJhVOqi4Af/r06mk+NOQ96ivOA2CJuw1LSpcUtuYxB5t/grGyEojYjRP -s0Htvf2bfN9KbFJ26DGsfYzC8bCxm9szPFHBQjw4NboCigUSAHmkoTW01aWZU9Vq -brY4cWhdmCqHgfmsQgzP3LfaAQ6kJ/bkuKef7z57lz5XmlyjMQGWcZWp5xf2n81p -BV6unaIPyavzkKVAXizVfNiHNJgK9PoVoEOJkPLjRfMxVmFSGN/oF7lVTRWfOIwo -68rtNPhr6UzE4ArGHYv/pK3kijUp5daWmfrySWPcwoVAaR3mIIVs/1rhd9aZrwn6 -Q07Yo5u11rH9b8anZQF3BdTcrnU9pUzLYlFPnfhtyGqhikQILtPTf0iwr8hpG9b2 -Zoi2BBgBCgAgFiEEHP310DrP36xrZ1kSMKdkJgeTYhoFAl+PBGwCGwwACgkQMKdk -JgeTYhrtywQAhoCR/skBSQWWBI10N0qhtdlNxbpvK8ErSPKwwS74Pq407Zv0VD9u -al/HC3Uet2z8LeG9ZwU4Jd23g96fmJt7AM9CQWrOhC242JYrYSqWxANyek8otsvp -pJNHtt2Stmknv7XbJFFB1JDC8WKo8lVo9/MkmzROxuEFEvOUYn923VI= -=2DW8 +lQG7BGFQyDcRBACmAI6cfY3fM02vb9JtC1BS19boKXbBsDoVrD9qRf8tDFROOpO3 +ZMlbuz+O9Vnljo6Y4WZGnyeWWAMqCditMOfr1cLbux77wSrmAVgZ9exwtGzkmUhM +xcptzKuyod8NuhghXbJgVbfJZ6HlBkk4kiWv98iJQwUBZJfjBUfIv+acjwCg4M2i +Ifu2A3UYl9VqF7qfcDOZudEEAI7V35yfsBDnr9ndKqdGYNw0alX9BEG3KwnAe0fF +O1jDVW12Y/bwnyyrRTrz6o1G8dj7M4XVZQb5PpT9mpNzOSZ6yxqhg+foeJwn2JkD +vyP+kMYU7SZ/tWuMOCdzN95Ki1rf+ti7pLnSMqKx+t3vOWwQbtnsbI6RCLLwETPA +esghA/0X3Dw7cdiE5Xq4TRaPSGViCWP4ekL2KYKqmKv6M/4f2pgFNJY7C+2SIiiP +T62zFlIjs5tF2Df34/M5mh4Vx6E8341r55+XO++kfFWJ5QjLiydRAY6ochG9IFgB +xyBCkCNpiby9PpKyPodedBScdMxIAe4eJR7rG/j9gFC1MypBugAAn0mvGeJi+oSo +5jXAeXBhRiTyI5WPCuK0J0pvaG5ueSBSb2NrZXRzIDxqb2hubnkucm9ja2V0c0Bn +Znkub3JnPoh4BBMRAgA4FiEESFc9Qz85uERAyFzbZbUBuQAr+pcFAmFQyDcCGwMF +CwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQZbUBuQAr+peImQCgqpXa6EWB+71M +1VdFL9TXA1XKS54AoJhKC1cRiyksAxFzaqo0Q8w0aUXo +=cyQm -----END PGP PRIVATE KEY BLOCK----- diff --git a/test/lisp/emacs-lisp/package-resources/signed/archive-contents.sig b/test/lisp/emacs-lisp/package-resources/signed/archive-contents.sig index dac168b0e4..b40620a0e8 100644 Binary files a/test/lisp/emacs-lisp/package-resources/signed/archive-contents.sig and b/test/lisp/emacs-lisp/package-resources/signed/archive-contents.sig differ diff --git a/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el.sig b/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el.sig index 5b1c721e32..1109241160 100644 Binary files a/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el.sig and b/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el.sig differ commit d31e56046b1d9d1fae597e299eb223d80ab7488e Author: Lars Ingebrigtsen Date: Mon Sep 27 05:57:04 2021 +0200 Move test-cl-flet-indentation to the right file diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el index 5e533b370e..e2cecdf6b0 100644 --- a/test/lisp/emacs-lisp/lisp-mode-tests.el +++ b/test/lisp/emacs-lisp/lisp-mode-tests.el @@ -330,16 +330,5 @@ Expected initialization file: `%s'\" (faceup-clean-buffer) (should (faceup-test-font-lock-buffer 'emacs-lisp-mode faceup))))) -(ert-deftest test-cl-flet-indentation () - (should (equal - (with-temp-buffer - (lisp-mode) - (insert "(cl-flet ((bla (x)\n(* x x)))\n(bla 42))") - (indent-region (point-min) (point-max)) - (buffer-string)) - "(cl-flet ((bla (x) - (* x x))) - (bla 42))"))) - (provide 'lisp-mode-tests) ;;; lisp-mode-tests.el ends here diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index fbf264a715..e0e2cb112e 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -1105,6 +1105,16 @@ evaluation of BODY." (should (= 84 (funcall (intern-soft "f-test4---")))) (should (unintern "f-test4---")))) +(ert-deftest test-cl-flet-indentation () + (should (equal + (with-temp-buffer + (emacs-lisp-mode) + (insert "(cl-flet ((bla (x)\n(* x x)))\n(bla 42))") + (indent-region (point-min) (point-max)) + (buffer-string)) + "(cl-flet ((bla (x) + (* x x))) + (bla 42))"))) (provide 'elisp-mode-tests) ;;; elisp-mode-tests.el ends here commit 07ecd81dddc17143f5fd1cb8e3ffe04d1f154f62 Author: Lars Ingebrigtsen Date: Sun Sep 26 09:05:38 2021 +0200 Improve describe-char buffer extremely slightly * lisp/descr-text.el (describe-char): Add a colon to further signify that we're talking about the following line (bug#50795). diff --git a/lisp/descr-text.el b/lisp/descr-text.el index 7ab90d08ac..98871164f2 100644 --- a/lisp/descr-text.el +++ b/lisp/descr-text.el @@ -677,7 +677,7 @@ The character information includes: (let ((display (describe-char-display pos char))) (if (display-graphic-p (selected-frame)) (if display - (concat "by this font (glyph code)\n " display) + (concat "by this font (glyph code):\n " display) "no font available") (if display (format "terminal code %s" display) commit 58055b5fc330689234cafb51398844f6e5791077 Author: João Távora Date: Thu Sep 23 17:45:24 2021 +0100 Document shorthands in the Elisp manual section on Symbols * doc/lispref/symbols.texi (Symbol Components): Mentione "Shorthands". (Creating Symbols): Mention shorthands. Correct references to Common Lisp. (Shorthands): New section. * etc/NEWS (Shorthands): New entry. diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi index ed36f5139a..775f5e5dbc 100644 --- a/doc/lispref/symbols.texi +++ b/doc/lispref/symbols.texi @@ -29,6 +29,9 @@ otherwise. * Creating Symbols:: How symbols are kept unique. * Symbol Properties:: Each symbol has a property list for recording miscellaneous information. +* Shorthands:: Properly organize your symbol names but + type less of them. + @end menu @node Symbol Components @@ -67,7 +70,9 @@ important not to have two symbols with the same name. The Lisp reader ensures this: every time it reads a symbol, it looks for an existing symbol with the specified name before it creates a new one. To get a symbol's name, use the function @code{symbol-name} (@pxref{Creating -Symbols}). +Symbols}). Nonwithstanding each symbol having only one unique _print +name_, it is nevertheless possible to refer to that same symbol via +different terms called ``shorthands'' (@pxref{Shorthands}). The value cell holds a symbol's value as a variable, which is what you get if the symbol itself is evaluated as a Lisp expression. @@ -166,26 +171,41 @@ definitions. @xref{Name Help,,, emacs, The GNU Emacs Manual}. @section Creating and Interning Symbols @cindex reading symbols - To understand how symbols are created in GNU Emacs Lisp, you must know -how Lisp reads them. Lisp must ensure that it finds the same symbol -every time it reads the same set of characters. Failure to do so would -cause complete confusion. + To understand how symbols are created in GNU Emacs Lisp, you must +know how Lisp reads them. Lisp must ensure that it finds the same +symbol every time it reads the same sequence of characters in the same +context. Failure to do so would cause complete confusion. + + When the Lisp reader encounters a reference to symbol in the source +code, it reads all the characters of that name. Then it looks up that +name in a table called an @dfn{obarray} to find the symbol that the +programmer meant. @cindex symbol name hashing @cindex hashing @cindex obarray @cindex bucket (in obarray) - When the Lisp reader encounters a symbol, it reads all the characters -of the name. Then it hashes those characters to find an index in a -table called an @dfn{obarray}. Hashing is an efficient method of -looking something up. For example, instead of searching a telephone -book cover to cover when looking up Jan Jones, you start with the J's -and go from there. That is a simple version of hashing. Each element -of the obarray is a @dfn{bucket} which holds all the symbols with a -given hash code; to look for a given name, it is sufficient to look -through all the symbols in the bucket for that name's hash code. (The -same idea is used for general Emacs hash tables, but they are a -different data type; see @ref{Hash Tables}.) +One the techniques used in this lookup is called hashing, an efficient +method of looking something up. For example, instead of searching a +telephone book cover to cover when looking up Jan Jones, you start +with the J's and go from there. That is a simple version of hashing. +Each element of the obarray is a @dfn{bucket} which holds all the +symbols with a given hash code; to look for a given name, it is +sufficient to look through all the symbols in the bucket for that +name's hash code. (The same idea is used for general Emacs hash +tables, but they are a different data type; see @ref{Hash Tables}.) + +@cindex shorthands +@cindex namespacing +@cindex namespaces +When looking up names, the reader also considers ``shorthands''. If +the programmer supplied them, this allows the reader to find a symbol +even if its name isn't typed out fully in the source code. Of course, +the reader needs to be aware of some pre-established context about +such shorthands, much as one needs context to be to able to refer +uniquely to Jan Jones by just the name ``Jan'': it's probably fine +when amongst the Joneses, or when Jan has been mentioned recently, but +very ambiguous in any other situation. @xref{Shorthands}. @cindex interning If a symbol with the desired name is found, the reader uses that @@ -200,9 +220,11 @@ same obarray. Thus, the reader gets the same symbols for the same names, as long as you keep reading with the same obarray. Interning usually happens automatically in the reader, but sometimes -other programs need to do it. For example, after the @kbd{M-x} command -obtains the command name as a string using the minibuffer, it then -interns the string, to get the interned symbol with that name. +other programs may want to do it. For example, a hypothetical +telephone book program could intern the name of each looked up +person's name as a symbol, even if the obarray did not contain it, so +that it could attach information to that new symbol such as the last +time someone looked it up. @cindex symbol equality @cindex uninterned symbol @@ -212,10 +234,6 @@ symbol has the same four cells as other symbols; however, the only way to gain access to it is by finding it in some other object or as the value of a variable. - Creating an uninterned symbol is useful in generating Lisp code, -because an uninterned symbol used as a variable in the code you generate -cannot clash with any variables used in other Lisp programs. - In Emacs Lisp, an obarray is actually a vector. Each element of the vector is a bucket; its value is either an interned symbol whose name hashes to that bucket, or 0 if the bucket is empty. Each interned @@ -236,7 +254,10 @@ not work---only @code{intern} can enter a symbol in an obarray properly. @cindex CL note---symbol in obarrays @quotation @b{Common Lisp note:} Unlike Common Lisp, Emacs Lisp does not provide -for interning a single symbol in several obarrays. +for interning the same name in several different ``packages'', thus +creating multiple symbols with the same name but different packages. +Emacs Lisp provides a different namespacing system called shorthands +() @end quotation Most of the functions below take a name and sometimes an obarray as @@ -258,6 +279,11 @@ change the name of the symbol, but fails to update the obarray, so don't do it! @end defun +@cindex uninterned symbol (generated code) +Creating an uninterned symbol is useful in generating Lisp code, +because an uninterned symbol used as a variable in the code you +generate cannot clash with any variables used in other Lisp programs. + @defun make-symbol name This function returns a newly-allocated, uninterned symbol whose name is @var{name} (which must be a string). Its value and function definition @@ -275,10 +301,17 @@ distinct uninterned symbol whose name is also @samp{foo}. @defun gensym &optional prefix This function returns a symbol using @code{make-symbol}, whose name is -made by appending @code{gensym-counter} to @var{prefix}. The prefix -defaults to @code{"g"}. +made by appending @code{gensym-counter} to @var{prefix} and increnting +that counter, guaranteeing that no two calls to this function +generates a symbol with the same name. The prefix defaults to +@code{"g"}. @end defun +@cindex uninterned symbol (recommendation for generated code) +To avoid problems when accidentally interning printed representation +of generated code, (@pxref{Printed Representation}), it is recommended +to use @code{gensym} instead of @code{make-symbol}. + @defun intern name &optional obarray This function returns the interned symbol whose name is @var{name}. If there is no such symbol in the obarray @var{obarray}, @code{intern} @@ -600,3 +633,102 @@ If non-@code{nil}, this specifies the named variable's documentation string. This is set automatically by @code{defvar} and related functions. @xref{Defining Faces}. @end table + +@node Shorthands +@section Shorthands +@cindex shorthands +@cindex symbolic shorthands + +@dfn{Shorthands}, sometimes known as "renamed symbols", are symbolic +forms found in Lisp source. They're just like regular symbolic forms, +except that when the Lisp reader encounters them, it produces symbols +which have a different and usually longer @dfn{print name} +(@pxref{Symbol Components}). + +It is useful to think of shorthands as @emph{abbreviating} the full +names of intended symbols. Despite this, do not confuse with the +Abbrev system @pxref{Abbrevs}. + +@cindex namespace etiquette +Shorthands make Emacs Lisp's namespacing etiquette easier to work +with. Since all symbols are stored in a single obarray +(@pxref{Creating Symbols}), programmers commonly prefix each symbol +name with the name of the library where it originates. For example, +the functions @code{text-property-search-forward} and +@code{text-property-search-backward} both belong to the +@code{text-property-search.el} library (@pxref{Loading}). By properly +prefixing symbol names, one effectively prevents clashes between +similarly named symbols which belong to different libraries and do +different things. However, this practice commonly originates very +long symbols names, which are bothersome to type and read after a +while. + +@defvar elisp-shorthands +This variable is an alist whose elements have the form +@code{(@var{shorthand-prefix} . @var{longhand-prefix})}. Each element +instructs the Lisp reader to read every symbol form which starts with +@var{shorthand-prefix} as if it started with @var{longhand-prefix} +instead. + +This variable may only be set file-locally (@pxref{File Variables, , +Local Variables in Files, emacs, The GNU Emacs Manual}). +@end defvar + +Take this excerpt from following example of a hypothetical string +manipulating library @file{some-nice-string-utils.el}. + +@example +(defun some-nice-string-utils-split (separator s &optional omit-nulls) + "A match-data saving variation on `split-string'." + (save-match-data (split-string s separator omit-nulls))) + +(defun some-nice-string-utils-lines (s) + "Split string S into a list of strings on newline characters." + (some-nice-string-utils-split "\\(\r\n\\|[\n\r]\\)" s)) +@end example + +As can be seen, it's quite tedious to read or develop this code since +the symbol names to type are so long. We can use shorthands to good +effect here. + +@example +(defun snu-split (separator s &optional omit-nulls) + "A match-data saving variation on `split-string'." + (save-match-data (split-string s separator omit-nulls))) + +(defun snu-lines (s) + "Split string S into a list of strings on newline characters." + (snu-split "\\(\r\n\\|[\n\r]\\)" s)) + +;; Local Variables: +;; elisp-shorthands: (("snu-" . "some-nice-string-utils-")) +;; End: +@end example + +Even though the two excerpts look different, they are quite identical +after Lisp reader is done with them. Both will lead to the very same +symbols being interned (@pxref{Creating Symbols}). Thus loading or +byte-compiling any of the two files has equivalent results. The +shorthands @code{snu-split} and @code{snu-lines} used in the second +version are @emph{not} interned in the obarray. This is easily seen +by moving point to the location where the shorthands are used and +waiting for ElDoc (@pxref{Lisp Doc, , Local Variables in Files, emacs, +The GNU Emacs Manual}) to hint at the true full name of the symbol +under point in the echo area. + +Since @code{elisp-shorthands} is a file-local variable, it is possible +that multiple libraries depending on +@file{some-nice-string-utils-lines.el} refer to the same symbols under +@emph{different} shorthands, or not using shorthands at all. In the +next example, the @file{my-tricks.el} library refers to symbol +aforementioned symbol @code{some-nice-string-utils-lines} using the +@code{sns-} prefix. + +@example +(defun t-reverse-lines (s) (string-join (reverse (sns-lines s)) "\n") + +;; Local Variables: +;; elisp-shorthands: (("t-" . "my-tricks-") +;; ("sns-" . "some-nice-string-utils-")) +;; End: +@end example diff --git a/etc/NEWS b/etc/NEWS index bc468c6df4..d003d0d092 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3906,6 +3906,17 @@ asynchronously send data back to Emacs. It can be used to create Lisp strings with arbitrary byte sequences (a.k.a. "raw bytes"). ++++ +** Shorthands +Shorthands are a general purpose namespacing system to make Emacs +Lisp's symbol-naming etiquette easier to manage. Also known as a +"renamed symbol", a shorthand is any symbolic form found in Lisp +source that abbreviates a symbol with a different and longer print +name. Among other applications, it facilitates the importation of +popular libraries such as 's.el' without the polution associated of +very short prefixes. For details, see the manual section "(elisp) +Shorthands". + +++ ** New function 'string-search'. This function takes two string parameters and returns the position of commit 66f30875304e373c40e9b81aa37041d49bf7abfe Author: João Távora Date: Wed Sep 22 23:53:15 2021 +0100 Add #_ reader macro to escape shorthand renaming * src/lread.c (read1): Add skip_shorthand variable. Add a '#_' case. If skip_shorthand call oblookup instead of oblookup_considering_shorthand. * test/lisp/progmodes/elisp-mode-tests.el (elisp-shorthand-escape): New test. * test/lisp/progmodes/elisp-resources/simple-shorthand-test.el (#_f-test4---): New fixture function. diff --git a/src/lread.c b/src/lread.c index 51a7084821..db8c847a87 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2972,6 +2972,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) { int c; bool uninterned_symbol = false; + bool skip_shorthand = false; bool multibyte; char stackbuf[stackbufsize]; current_thread->stack_top = stackbuf; @@ -3367,6 +3368,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) if (c == ':') { uninterned_symbol = true; + read_hash_prefixed_symbol: c = READCHAR; if (!(c > 040 && c != NO_BREAK_SPACE @@ -3380,6 +3382,12 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) } goto read_symbol; } + /* #_foo is really the symbol foo, regardless of shorthands */ + if (c == '_') + { + skip_shorthand = true; + goto read_hash_prefixed_symbol; + } /* ## is the empty symbol. */ if (c == '#') return Fintern (empty_unibyte_string, Qnil); @@ -3760,7 +3768,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) ptrdiff_t nbytes = p - read_buffer; UNREAD (c); - if (!quoted && !uninterned_symbol) + if (!quoted && !uninterned_symbol && !skip_shorthand) { ptrdiff_t len; Lisp_Object result = string_to_number (read_buffer, 10, &len); @@ -3795,10 +3803,14 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) ptrdiff_t longhand_chars = 0; ptrdiff_t longhand_bytes = 0; - Lisp_Object tem - = oblookup_considering_shorthand + Lisp_Object tem; + if (skip_shorthand) + tem = oblookup (obarray, read_buffer, nchars, nbytes); + else { + tem = oblookup_considering_shorthand (obarray, read_buffer, nchars, nbytes, &longhand, &longhand_chars, &longhand_bytes); + } if (SYMBOLP (tem)) result = tem; diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 9fe583d8cc..fbf264a715 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -1096,5 +1096,15 @@ evaluation of BODY." "elisp--foo-test-complete-me")) (revert-buffer t t)))) +(ert-deftest elisp-shorthand-escape () + (let ((test-file (expand-file-name "simple-shorthand-test.el" + elisp--test-resources-dir))) + (load test-file) + (should (intern-soft "f-test4---")) + (should-not (intern-soft "elisp--foo-test4---")) + (should (= 84 (funcall (intern-soft "f-test4---")))) + (should (unintern "f-test4---")))) + + (provide 'elisp-mode-tests) ;;; elisp-mode-tests.el ends here diff --git a/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el b/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el index cadcb4de89..ec568093af 100644 --- a/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el +++ b/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el @@ -16,10 +16,13 @@ (defvar f-test-complete-me 42) +(defun #_f-test4--- () 84) + (when nil (f-test3) (f-test2) - (f-test)) + (f-test) + (#_f-test4---)) ;; Local Variables: commit 90cbf0cb8d9959b94ba09f1faa0dcb50c8dbddbd Author: João Távora Date: Tue Sep 21 22:20:17 2021 +0100 Consider shorthands in Elisp's elisp-completion-at-point Instead of referencing obarray directly, that function has to consider a collection of completions which includes the shorthand versions of some of the symbols. That collection changes from buffer to buffer, depending on the choice of elisp-shorthands. To make this process efficient, and avoid needless recalculation of the above collection, a new obarray-specific cache was invented. The Elisp variable obarray-cache is immediately nullified if something touches the obarray. * lisp/progmodes/elisp-mode.el : New helper. (elisp-completion-at-point): Use new helpers. (elisp--completion-local-symbols) (elisp--fboundp-considering-shorthands) (elisp--bboundp-considering-shorthands): New helpers * src/lread.c (intern_driver): Nullify Qobarray_cache. (syms_of_lread): Add Qobarray_cache. * test/lisp/progmodes/elisp-mode-tests.el (elisp-shorthand-completion-at-point): New test. * test/lisp/progmodes/elisp-resources/simple-shorthand-test.el (f-test-complete-me): New fixture. diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 4a0abb74b3..d2ea25d67b 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -532,6 +532,54 @@ It can be quoted, or be inside a quoted form." 0)) ((facep sym) (find-definition-noselect sym 'defface))))) +(defvar obarray-cache nil + "Hash table of obarray-related cache, or nil. +If non-nil this variable is a hash-table holding information +specific to the current state of the Elisp obarray. If the +obarray changes by any means (interning or uninterning a symbol), +the variable is immediately set to nil.") + +(defun elisp--completion-local-symbols () + "Compute collections all Elisp symbols for completion purposes. +The return value is compatible with the COLLECTION form described +in `completion-at-point-functions' (which see)." + (cl-flet ((obarray-plus-shorthands () + (let (retval) + (mapatoms + (lambda (s) + (push s retval) + (cl-loop + for (shorthand . longhand) in elisp-shorthands + for full-name = (symbol-name s) + when (string-prefix-p longhand full-name) + do (let ((sym (make-symbol + (concat shorthand + (substring full-name + (length longhand)))))) + (put sym 'shorthand t) + (push sym retval) + retval)))) + retval))) + (cond ((null elisp-shorthands) obarray) + ((and obarray-cache + (gethash (cons (current-buffer) elisp-shorthands) + obarray-cache))) + (obarray-cache + (puthash (cons (current-buffer) elisp-shorthands) + (obarray-plus-shorthands) + obarray-cache)) + (t + (setq obarray-cache (make-hash-table :test #'equal)) + (puthash (cons (current-buffer) elisp-shorthands) + (obarray-plus-shorthands) + obarray-cache))))) + +(defun elisp--shorthand-aware-fboundp (sym) + (fboundp (intern-soft (symbol-name sym)))) + +(defun elisp--shorthand-aware-boundp (sym) + (boundp (intern-soft (symbol-name sym)))) + (defun elisp-completion-at-point () "Function used for `completion-at-point-functions' in `emacs-lisp-mode'. If the context at point allows only a certain category of @@ -579,24 +627,27 @@ functions are annotated with \"\" via the ;; the current form and use it to provide a more ;; specific completion table in more cases. ((eq fun-sym 'ignore-error) - (list t obarray + (list t (elisp--completion-local-symbols) :predicate (lambda (sym) (get sym 'error-conditions)))) ((elisp--expect-function-p beg) - (list nil obarray - :predicate #'fboundp + (list nil (elisp--completion-local-symbols) + :predicate + #'elisp--shorthand-aware-fboundp :company-kind #'elisp--company-kind :company-doc-buffer #'elisp--company-doc-buffer :company-docsig #'elisp--company-doc-string :company-location #'elisp--company-location)) (quoted - (list nil obarray + (list nil (elisp--completion-local-symbols) ;; Don't include all symbols (bug#16646). :predicate (lambda (sym) - (or (boundp sym) - (fboundp sym) - (featurep sym) - (symbol-plist sym))) + ;; shorthand-aware + (let ((sym (intern-soft (symbol-name sym)))) + (or (boundp sym) + (fboundp sym) + (featurep sym) + (symbol-plist sym)))) :annotation-function (lambda (str) (if (fboundp (intern-soft str)) " ")) :company-kind #'elisp--company-kind @@ -607,8 +658,8 @@ functions are annotated with \"\" via the (list nil (completion-table-merge elisp--local-variables-completion-table (apply-partially #'completion-table-with-predicate - obarray - #'boundp + (elisp--completion-local-symbols) + #'elisp--shorthand-aware-boundp 'strict)) :company-kind (lambda (s) @@ -645,11 +696,11 @@ functions are annotated with \"\" via the (ignore-errors (forward-sexp 2) (< (point) beg))))) - (list t obarray + (list t (elisp--completion-local-symbols) :predicate (lambda (sym) (get sym 'error-conditions)))) ;; `ignore-error' with a list CONDITION parameter. ('ignore-error - (list t obarray + (list t (elisp--completion-local-symbols) :predicate (lambda (sym) (get sym 'error-conditions)))) ((and (or ?\( 'let 'let*) @@ -659,14 +710,14 @@ functions are annotated with \"\" via the (up-list -1)) (forward-symbol -1) (looking-at "\\_")))) - (list t obarray - :predicate #'boundp + (list t (elisp--completion-local-symbols) + :predicate #'elisp--shorthand-aware-boundp :company-kind (lambda (_) 'variable) :company-doc-buffer #'elisp--company-doc-buffer :company-docsig #'elisp--company-doc-string :company-location #'elisp--company-location)) - (_ (list nil obarray - :predicate #'fboundp + (_ (list nil (elisp--completion-local-symbols) + :predicate #'elisp--shorthand-aware-fboundp :company-kind #'elisp--company-kind :company-doc-buffer #'elisp--company-doc-buffer :company-docsig #'elisp--company-doc-string diff --git a/src/lread.c b/src/lread.c index 4b7fcc2875..51a7084821 100644 --- a/src/lread.c +++ b/src/lread.c @@ -4356,6 +4356,7 @@ intern_sym (Lisp_Object sym, Lisp_Object obarray, Lisp_Object index) Lisp_Object intern_driver (Lisp_Object string, Lisp_Object obarray, Lisp_Object index) { + SET_SYMBOL_VAL (XSYMBOL (Qobarray_cache), Qnil); return intern_sym (Fmake_symbol (string), obarray, index); } @@ -5427,4 +5428,5 @@ that are loaded before your customizations are read! */); DEFVAR_LISP ("elisp-shorthands", Velisp_shorthands, doc: /* Alist of known symbol name shorthands*/); Velisp_shorthands = Qnil; + DEFSYM (Qobarray_cache, "obarray-cache"); } diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index d5d3f336fa..9fe583d8cc 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -1080,5 +1080,21 @@ evaluation of BODY." (should (intern-soft "elisp--foo-test")) (should-not (intern-soft "f-test")))) +(ert-deftest elisp-shorthand-completion-at-point () + (let ((test-file (expand-file-name "simple-shorthand-test.el" + elisp--test-resources-dir))) + (load test-file) + (with-current-buffer (find-file-noselect test-file) + (revert-buffer t t) + (goto-char (point-min)) + (insert "f-test-compl") + (completion-at-point) + (goto-char (point-min)) + (should (search-forward "f-test-complete-me" (line-end-position) t)) + (goto-char (point-min)) + (should (string= (symbol-name (read (current-buffer))) + "elisp--foo-test-complete-me")) + (revert-buffer t t)))) + (provide 'elisp-mode-tests) ;;; elisp-mode-tests.el ends here diff --git a/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el b/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el index 5634926c6d..cadcb4de89 100644 --- a/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el +++ b/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el @@ -14,6 +14,8 @@ (let ((elisp-shorthands '(("foo-" . "bar-")))) (intern "foo-bar"))) +(defvar f-test-complete-me 42) + (when nil (f-test3) (f-test2) commit 68d73eb154c745cbba7b3fd6a0a0a087d7c157da Author: João Távora Date: Wed Dec 23 19:57:27 2020 +0000 Rework Elisp shorthands to only allow only prefix substitution This simplification in requirements makes for more complex C code but that code is much less wasteful in Lisp strings than the previous implementation. * src/lread.c (read1): Rework. (Fintern): Rework. (Fintern_soft): Rework. (Funintern): Rework. (oblookup_considering_shorthand): Rewrite. * test/lisp/progmodes/elisp-mode-tests.el (elisp-shorthand-read-buffer) (elisp-shorthand-read-from-string): Use new format of elisp-shorthands. * test/lisp/progmodes/elisp-resources/simple-shorthand-test.el (f-test) (f-test2, f-test3): Use new form of elisp-shorthands. diff --git a/lisp/international/mule.el b/lisp/international/mule.el index deb801ff1a..6c73600e20 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -296,11 +296,11 @@ attribute." (defun hack-elisp-shorthands (fullname) "Return value of the `elisp-shorthands' file-local variable in FULLNAME. -FULLNAME is the full name of an Elisp file which potentially -specifies a file-local value for `elisp-shorthands'. The Elisp -code isn't read or evaluated in any way, we merely extract what -the buffer-local value of `elisp-shorthands' would be if the file -had been found by `find-file'." +FULLNAME is the absolute file name of an Elisp file which +potentially specifies a file-local value for `elisp-shorthands'. +The Elisp code isn't read or evaluated in any way, we merely +extract what the buffer-local value of `elisp-shorthands' would +be if the file had been found by `find-file'." (let ((size (nth 7 (file-attributes fullname)))) (with-temp-buffer (insert-file-contents fullname nil (max 0 (- size 3000)) size) diff --git a/src/lread.c b/src/lread.c index 0c0c4f34ba..4b7fcc2875 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2956,7 +2956,10 @@ read_integer (Lisp_Object readcharfun, int radix, return unbind_to (count, string_to_number (read_buffer, radix, NULL)); } -Lisp_Object oblookup_considering_shorthand (Lisp_Object, Lisp_Object*); +Lisp_Object oblookup_considering_shorthand +(Lisp_Object obarray, + const char *in, ptrdiff_t size, ptrdiff_t size_byte, + char **out, ptrdiff_t *size_out, ptrdiff_t *size_byte_out); /* If the next token is ')' or ']' or '.', we store that character in *PCH and the return value is not interesting. Else, we store @@ -3782,17 +3785,36 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) } else { - /* Like intern_1 but supports multibyte names. */ + /* Don't create the string object for the name unless + we're going to retain it in a new symbol. + + Like intern_1 but supports multibyte names. */ Lisp_Object obarray = check_obarray (Vobarray); - Lisp_Object name - = make_specified_string (read_buffer, nchars, nbytes, - multibyte); - Lisp_Object tem = oblookup_considering_shorthand (obarray, &name); + + char* longhand = NULL; + ptrdiff_t longhand_chars = 0; + ptrdiff_t longhand_bytes = 0; + + Lisp_Object tem + = oblookup_considering_shorthand + (obarray, read_buffer, nchars, nbytes, + &longhand, &longhand_chars, &longhand_bytes); if (SYMBOLP (tem)) result = tem; - else - result = intern_driver (name, obarray, tem); + else if (longhand) { + Lisp_Object name + = make_specified_string (longhand, longhand_chars, + longhand_bytes, + multibyte); + xfree (longhand); + result = intern_driver (name, obarray, tem); + } else { + Lisp_Object name + = make_specified_string (read_buffer, nchars, nbytes, + multibyte); + result = intern_driver (name, obarray, tem); + } } if (EQ (Vread_with_symbol_positions, Qt) @@ -4402,10 +4424,29 @@ it defaults to the value of `obarray'. */) obarray = check_obarray (NILP (obarray) ? Vobarray : obarray); CHECK_STRING (string); - tem = oblookup_considering_shorthand (obarray, &string); + + char* longhand = NULL; + ptrdiff_t longhand_chars = 0; + ptrdiff_t longhand_bytes = 0; + tem = oblookup_considering_shorthand + (obarray, SSDATA (string), SCHARS (string), SBYTES (string), + &longhand, &longhand_chars, &longhand_bytes); + if (!SYMBOLP (tem)) - tem = intern_driver (NILP (Vpurify_flag) ? string : Fpurecopy (string), - obarray, tem); + { + if (longhand) + { + tem = intern_driver (make_specified_string (longhand, longhand_chars, + longhand_bytes, true), + obarray, tem); + xfree (longhand); + } + else + { + tem = intern_driver (NILP (Vpurify_flag) ? string : Fpurecopy (string), + obarray, tem); + } + } return tem; } @@ -4426,15 +4467,24 @@ it defaults to the value of `obarray'. */) { CHECK_STRING (name); string = name; + char* longhand = NULL; + ptrdiff_t longhand_chars = 0; + ptrdiff_t longhand_bytes = 0; + tem = oblookup_considering_shorthand + (obarray, SSDATA (string), SCHARS (string), SBYTES (string), + &longhand, &longhand_chars, &longhand_bytes); + if (longhand) xfree (longhand); + if (FIXNUMP (tem)) return Qnil; else return tem; } else - string = SYMBOL_NAME (name); - - tem = oblookup_considering_shorthand (obarray, &string); - if (FIXNUMP (tem) || (SYMBOLP (name) && !EQ (name, tem))) - return Qnil; - else - return tem; + { + // If already a symbol, we do no shorthand-longhand translation, + // as promised in docstring. + string = SYMBOL_NAME (name); + tem + = oblookup (obarray, SSDATA (string), SCHARS (string), SBYTES (string)); + if (EQ (name, tem)) return tem; else return Qnil; + } } DEFUN ("unintern", Funintern, Sunintern, 1, 2, 0, @@ -4461,7 +4511,14 @@ usage: (unintern NAME OBARRAY) */) string = name; } - tem = oblookup_considering_shorthand (obarray, &string); + char* longhand = NULL; + ptrdiff_t longhand_chars = 0; + ptrdiff_t longhand_bytes = 0; + tem = oblookup_considering_shorthand + (obarray, SSDATA (string), SCHARS (string), SBYTES (string), + &longhand, &longhand_chars, &longhand_bytes); + if (longhand) free(longhand); + if (FIXNUMP (tem)) return Qnil; /* If arg was a symbol, don't delete anything but that symbol itself. */ @@ -4549,34 +4606,65 @@ oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff return tem; } +/* Like 'oblookup', but considers 'Velisp_shorthands', potentially + recognizing that IN is shorthand for some other longhand name, + which is then then placed in OUT. In that case, memory is + malloc'ed for OUT (which the caller must free) while SIZE_OUT and + SIZE_BYTE_OUT respectively hold the character and byte sizes of the + transformed symbol name. If IN is not recognized shorthand for any + other symbol, OUT is set to point to NULL and 'oblookup' is + called. */ + Lisp_Object -oblookup_considering_shorthand (Lisp_Object obarray, Lisp_Object* string) +oblookup_considering_shorthand +(Lisp_Object obarray, + const char *in, ptrdiff_t size, ptrdiff_t size_byte, + char **out, ptrdiff_t *size_out, ptrdiff_t *size_byte_out) { - Lisp_Object original = *string; /* Save pointer to original string... */ + // First, assume no transformation will take place. + *out = NULL; Lisp_Object tail = Velisp_shorthands; - FOR_EACH_TAIL_SAFE(tail) + // Then, iterate each pair in Velisp_shorthands. + FOR_EACH_TAIL_SAFE (tail) { Lisp_Object pair = XCAR (tail); - if (!CONSP (pair)) goto undo; - Lisp_Object shorthand = XCAR (pair); - Lisp_Object longhand = XCDR (pair); - if (!STRINGP (shorthand) || !STRINGP (longhand)) goto undo; - Lisp_Object match = Fstring_match (shorthand, *string, Qnil); - if (!NILP(match)){ - *string = Freplace_match(longhand, Qnil, Qnil, *string, Qnil); - } + // Be lenient to Velisp_shorthands: if some element isn't a cons + // or some member of that cons isn't a string, just skip to the + // next element. + if (!CONSP (pair)) continue; + Lisp_Object sh_prefix = XCAR (pair); + Lisp_Object lh_prefix = XCDR (pair); + if (!STRINGP (sh_prefix) || !STRINGP (lh_prefix)) continue; + ptrdiff_t sh_prefix_size = SBYTES (sh_prefix); + + // Compare the prefix of the transformation pair to the symbol + // name. If a match occurs, do the renaming and exit the loop. + // In other words, only one such transformation may take place. + // Calculate the amount of memory to allocate for the longhand + // version of the symbol name with realloc(). This isn't + // strictly needed, but it could later be used as a way for + // multiple transformations on a single symbol name. + if (sh_prefix_size <= size_byte && + memcmp(SSDATA(sh_prefix), in, sh_prefix_size) == 0) + { + ptrdiff_t lh_prefix_size = SBYTES (lh_prefix); + ptrdiff_t suffix_size = size_byte - sh_prefix_size; + *out = xrealloc (*out, lh_prefix_size + suffix_size); + memcpy (*out, SSDATA(lh_prefix), lh_prefix_size); + memcpy (*out + lh_prefix_size, in + sh_prefix_size, suffix_size); + *size_out = SCHARS (lh_prefix) - SCHARS (sh_prefix) + size; + *size_byte_out = lh_prefix_size + suffix_size; + break; + } } - goto fine; - undo: - { - static const char* warn = - "Fishy value of `elisp-shorthands'. " - "Consider reviewing before evaluating code."; - message_dolog (warn, sizeof(warn), 0, 0); - *string = original; /* ...so we can any failed trickery here. */ - } - fine: - return oblookup(obarray, SSDATA (*string), SCHARS (*string), SBYTES (*string)); + // Now, as promised, call oblookup() with the "final" symbol name to + // lookup. That function remains oblivious to whether a + // transformation happened here or not, but the caller of this + // function can tell by inspecting the OUT parameter. + if (*out) + return oblookup (obarray, *out, *size_out, *size_byte_out); + else + return oblookup (obarray, in, size, size_byte); } diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index fadf858b71..d5d3f336fa 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -1028,7 +1028,7 @@ evaluation of BODY." (expected (intern (format "shorthand-longhand-%s" gsym)))) (cl-assert (not (intern-soft shorthand-sname))) (should (equal (let ((elisp-shorthands - '(("^s-" . "shorthand-longhand-")))) + '(("s-" . "shorthand-longhand-")))) (with-temp-buffer (insert shorthand-sname) (goto-char (point-min)) @@ -1042,7 +1042,7 @@ evaluation of BODY." (expected (intern (format "shorthand-longhand-%s" gsym)))) (cl-assert (not (intern-soft shorthand-sname))) (should (equal (let ((elisp-shorthands - '(("^s-" . "shorthand-longhand-")))) + '(("s-" . "shorthand-longhand-")))) (car (read-from-string shorthand-sname))) expected)) (should (not (intern-soft shorthand-sname))))) diff --git a/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el b/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el index 7e1ed95229..5634926c6d 100644 --- a/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el +++ b/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el @@ -1,17 +1,17 @@ (defun f-test () - (let ((elisp-shorthands '(("^foo-" . "bar-")))) + (let ((elisp-shorthands '(("foo-" . "bar-")))) (with-temp-buffer (insert "(foo-bar)") (goto-char (point-min)) (read (current-buffer))))) (defun f-test2 () - (let ((elisp-shorthands '(("^foo-" . "bar-")))) + (let ((elisp-shorthands '(("foo-" . "bar-")))) (read-from-string "(foo-bar)"))) (defun f-test3 () - (let ((elisp-shorthands '(("^foo-" . "bar-")))) + (let ((elisp-shorthands '(("foo-" . "bar-")))) (intern "foo-bar"))) (when nil @@ -21,5 +21,5 @@ ;; Local Variables: -;; elisp-shorthands: (("^f-" . "elisp--foo-")) +;; elisp-shorthands: (("f-" . "elisp--foo-")) ;; End: commit 71857d410635743d437ce1ee73dff69de50030d6 Author: João Távora Date: Sat Sep 19 22:16:38 2020 +0100 Move most of the shorthand implementation to C code It passes the tests designed for the previous Elisp implementation. Likely, this isn't the final form of the implementation. For one, the reader is much slower and allocates a Lisp string for every atom read, regardless if its already interned or not. This has the potential to be catastrophic in terms of GC. Also rename the main variable to elisp-shorthands, from the repetitive shorthand-shorthands. For some reason, I had to put 'hack-elisp-shorthands' and 'load-with-shorthands-and-code-conversion', the new source-file loading functions, in lisp/international/mule.el. Otherwise, lisp/loadup.el wouldn't see them, for some reason that I didn't investigate. This should probably be fixed. * lisp/shorthand.el: Remove. * test/lisp/shorthand-tests.el: Remove. * src/lread.c: (read1, Fintern, Fintern_soft, Funintern): Use oblookup_considering_shorthand. (oblookup_considering_shorthand): New helper. (syms_of_lread): Declare elisp-shorthands. * lisp/progmodes/elisp-mode.el (elisp-shorthands): Put a safe-local-variable spec. * test/lisp/progmodes/elisp-mode-tests.el (elisp-shorthand-read-buffer) (elisp-shorthand-read-from-string) (elisp-shorthand-byte-compile-a-file) (elisp-shorthand-load-a-file): New tests. * test/lisp/progmodes/elisp-resources/simple-shorthand-test.el: New file * lisp/loadup.el (load-source-file-function): Set to load-with-shorthands-and-code-conversion. * lisp/international/mule.el (hack-elisp-shorthands): Move here. (load-with-shorthands-and-code-conversion): And here. diff --git a/lisp/international/mule.el b/lisp/international/mule.el index ee116976ea..deb801ff1a 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -294,6 +294,31 @@ attribute." (apply 'define-charset-internal name (mapcar 'cdr attrs)))) +(defun hack-elisp-shorthands (fullname) + "Return value of the `elisp-shorthands' file-local variable in FULLNAME. +FULLNAME is the full name of an Elisp file which potentially +specifies a file-local value for `elisp-shorthands'. The Elisp +code isn't read or evaluated in any way, we merely extract what +the buffer-local value of `elisp-shorthands' would be if the file +had been found by `find-file'." + (let ((size (nth 7 (file-attributes fullname)))) + (with-temp-buffer + (insert-file-contents fullname nil (max 0 (- size 3000)) size) + (goto-char (point-max)) + (let* ((found (search-backward-regexp "elisp-shorthands:[ \t]*" 0 t)) + (val (and found + (goto-char (match-end 0)) + (ignore-errors (read (current-buffer))))) + (probe val) + aux) + (catch 'done + (when (consp probe) + (while (setq aux (pop probe)) + (unless (and (consp aux) + (stringp (car aux)) + (stringp (cdr aux))) + (throw 'done nil))) + val)))))) (defun load-with-code-conversion (fullname file &optional noerror nomessage) "Execute a file of Lisp code named FILE whose absolute name is FULLNAME. @@ -354,6 +379,11 @@ Return t if file exists." (message "Loading %s...done" file))) t))) +(defun load-with-shorthands-and-code-conversion (fullname file noerror nomessage) + "As `load-with-code-conversion', also considering Elisp shorthands." + (let ((elisp-shorthands (hack-elisp-shorthands fullname))) + (load-with-code-conversion fullname file noerror nomessage))) + (defun charset-info (charset) "Return a vector of information of CHARSET. This function is provided for backward compatibility. diff --git a/lisp/loadup.el b/lisp/loadup.el index fce17bf113..942057c838 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -151,7 +151,7 @@ ;; variable its advertised default value (it starts as nil, see ;; xdisp.c). (setq resize-mini-windows 'grow-only) -(setq load-source-file-function #'load-with-code-conversion) +(setq load-source-file-function #'load-with-shorthands-and-code-conversion) (load "files") ;; Load-time macro-expansion can only take effect after setting diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 0b2395d976..4a0abb74b3 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -2075,5 +2075,8 @@ Runs in a batch-mode Emacs. Interactively use variable (terpri) (pp collected))) + +(put 'elisp-shorthands 'safe-local-variable #'consp) + (provide 'elisp-mode) ;;; elisp-mode.el ends here diff --git a/lisp/shorthand.el b/lisp/shorthand.el deleted file mode 100644 index 54c3412039..0000000000 --- a/lisp/shorthand.el +++ /dev/null @@ -1,114 +0,0 @@ -;;; shorthand.el --- namespacing system -*- lexical-binding: t; -*- - -;; Copyright (C) 2020 Free Software Foundation - -;; Author: João Távora -;; Keywords: languages, lisp - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Simple-minded namespacing in Emacs: - -;; 1. Do this on an Emacs you don't care about, since this advises basic -;; functions; -;; 2. Load `shorthand.el` (or byte-compile and load it); -;; 3. Construct an example user of this library. -;; -;; magnar-string.el is constructed by taking s.el, renaming it to -;; magnar-string.el, and then appending this to the end of the file: -;; -;; ;;; magnar-string.el ends here, -;; Local Variables: -;; shorthand-shorthands: (("^s-" . "magnar-string-")) -;; End: -;; -;; 4. Load `magnar-string.el` or byte-compile it and load `magnar-string.elc`; -;; 5. Try C-h f and check there's no "s-" pollution; Not even the `s-` -;; symbols are interned. All the relevant functions are namespaced -;; under "magnar-string-"; -;; 6. Open test.el, and play around there. Open test2.el and play around -;; with magnar-string.el under a different "mstring-" prefix; -;; 7. Evaluating code should work. Eldoc should also work. Xref (`M-.`) -;; is broken. Anything else might breaks spectacularly; - -;; Read `shorthand.el`: it's less than 50 loc. The idea is to keep only -;; one obarray, but instruments `read` to not pollute it with symbols -;; that with the shorthands for other longer named symbols. - -;;; Code: - -(require 'cl-lib) - -(defvar shorthand-shorthands nil) -(put 'shorthand-shorthands 'safe-local-variable #'consp) - -(defun shorthand--expand-shorthand (form) - (cl-typecase form - (cons (setcar form (shorthand--expand-shorthand (car form))) - (setcdr form (shorthand--expand-shorthand (cdr form)))) - (vector (cl-loop for i from 0 for e across form - do (aset form i (shorthand--expand-shorthand e)))) - (symbol (let* ((name (symbol-name form))) - (cl-loop for (short-pat . long-pat) in shorthand-shorthands - when (string-match short-pat name) - do (setq name (replace-match long-pat t nil name))) - (setq form (intern name)))) - (string) (number) - (t (message "[shorthand] unexpected %s" (type-of form)))) - form) - -(defun shorthand-read-wrapper (wrappee stream &rest stuff) - "Read a form from STREAM. -Do this in two steps, read the form while shadowing the global -`obarray' so that symbols aren't just automatically interned into -`obarray' as usual. Then walk the form using -`shorthand--expand-shorthand' and every time a symbol is found, -apply the transformations of `shorthand-shorthands' to it before -interning it the \"real\" global `obarray'. This ensures that -longhand, _not_ shorthand, versions of each symbol is interned." - (if (and load-file-name (string-match "\\.elc$" load-file-name)) - (apply wrappee stream stuff) - (shorthand--expand-shorthand - (let ((obarray (obarray-make))) (apply wrappee stream stuff))))) - -(defun shorthand-intern-soft-wrapper (wrappee name &rest stuff) - "Tell if string NAME names an interned symbol. -Even if NAME directly doesn't, its longhand expansion might." - (let ((res (apply wrappee name stuff))) - (or res (cl-loop - for (short-pat . long-pat) in shorthand-shorthands - thereis (apply wrappee - (replace-regexp-in-string short-pat - long-pat name) - stuff))))) - -(defun shorthand-load-wrapper (wrappee file &rest stuff) - "Load Elisp FILE, aware of file-local `shortand-shorthands'." - (let (file-local-shorthands) - (when (file-readable-p file) - (with-temp-buffer - (insert-file-contents file) - (hack-local-variables) - (setq file-local-shorthands shorthand-shorthands))) - (let ((shorthand-shorthands file-local-shorthands)) - (apply wrappee file stuff)))) - -(advice-add 'read :around #'shorthand-read-wrapper) -(advice-add 'intern-soft :around #'shorthand-intern-soft-wrapper) -(advice-add 'load :around #'shorthand-load-wrapper) - -(provide 'shorthand) -;;; shorthand.el ends here diff --git a/src/lread.c b/src/lread.c index 2abe2fd91a..0c0c4f34ba 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2956,6 +2956,7 @@ read_integer (Lisp_Object readcharfun, int radix, return unbind_to (count, string_to_number (read_buffer, radix, NULL)); } +Lisp_Object oblookup_considering_shorthand (Lisp_Object, Lisp_Object*); /* If the next token is ')' or ']' or '.', we store that character in *PCH and the return value is not interesting. Else, we store @@ -3781,23 +3782,17 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) } else { - /* Don't create the string object for the name unless - we're going to retain it in a new symbol. - - Like intern_1 but supports multibyte names. */ + /* Like intern_1 but supports multibyte names. */ Lisp_Object obarray = check_obarray (Vobarray); - Lisp_Object tem = oblookup (obarray, read_buffer, - nchars, nbytes); + Lisp_Object name + = make_specified_string (read_buffer, nchars, nbytes, + multibyte); + Lisp_Object tem = oblookup_considering_shorthand (obarray, &name); if (SYMBOLP (tem)) result = tem; else - { - Lisp_Object name - = make_specified_string (read_buffer, nchars, nbytes, - multibyte); - result = intern_driver (name, obarray, tem); - } + result = intern_driver (name, obarray, tem); } if (EQ (Vread_with_symbol_positions, Qt) @@ -4407,7 +4402,7 @@ it defaults to the value of `obarray'. */) obarray = check_obarray (NILP (obarray) ? Vobarray : obarray); CHECK_STRING (string); - tem = oblookup (obarray, SSDATA (string), SCHARS (string), SBYTES (string)); + tem = oblookup_considering_shorthand (obarray, &string); if (!SYMBOLP (tem)) tem = intern_driver (NILP (Vpurify_flag) ? string : Fpurecopy (string), obarray, tem); @@ -4435,7 +4430,7 @@ it defaults to the value of `obarray'. */) else string = SYMBOL_NAME (name); - tem = oblookup (obarray, SSDATA (string), SCHARS (string), SBYTES (string)); + tem = oblookup_considering_shorthand (obarray, &string); if (FIXNUMP (tem) || (SYMBOLP (name) && !EQ (name, tem))) return Qnil; else @@ -4451,7 +4446,8 @@ OBARRAY, if nil, defaults to the value of the variable `obarray'. usage: (unintern NAME OBARRAY) */) (Lisp_Object name, Lisp_Object obarray) { - register Lisp_Object string, tem; + register Lisp_Object tem; + Lisp_Object string; size_t hash; if (NILP (obarray)) obarray = Vobarray; @@ -4465,9 +4461,7 @@ usage: (unintern NAME OBARRAY) */) string = name; } - tem = oblookup (obarray, SSDATA (string), - SCHARS (string), - SBYTES (string)); + tem = oblookup_considering_shorthand (obarray, &string); if (FIXNUMP (tem)) return Qnil; /* If arg was a symbol, don't delete anything but that symbol itself. */ @@ -4554,6 +4548,37 @@ oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff XSETINT (tem, hash); return tem; } + +Lisp_Object +oblookup_considering_shorthand (Lisp_Object obarray, Lisp_Object* string) +{ + Lisp_Object original = *string; /* Save pointer to original string... */ + Lisp_Object tail = Velisp_shorthands; + FOR_EACH_TAIL_SAFE(tail) + { + Lisp_Object pair = XCAR (tail); + if (!CONSP (pair)) goto undo; + Lisp_Object shorthand = XCAR (pair); + Lisp_Object longhand = XCDR (pair); + if (!STRINGP (shorthand) || !STRINGP (longhand)) goto undo; + Lisp_Object match = Fstring_match (shorthand, *string, Qnil); + if (!NILP(match)){ + *string = Freplace_match(longhand, Qnil, Qnil, *string, Qnil); + } + } + goto fine; + undo: + { + static const char* warn = + "Fishy value of `elisp-shorthands'. " + "Consider reviewing before evaluating code."; + message_dolog (warn, sizeof(warn), 0, 0); + *string = original; /* ...so we can any failed trickery here. */ + } + fine: + return oblookup(obarray, SSDATA (*string), SCHARS (*string), SBYTES (*string)); +} + void map_obarray (Lisp_Object obarray, void (*fn) (Lisp_Object, Lisp_Object), Lisp_Object arg) @@ -5310,4 +5335,8 @@ that are loaded before your customizations are read! */); DEFSYM (Qrehash_threshold, "rehash-threshold"); DEFSYM (Qchar_from_name, "char-from-name"); + + DEFVAR_LISP ("elisp-shorthands", Velisp_shorthands, + doc: /* Alist of known symbol name shorthands*/); + Velisp_shorthands = Qnil; } diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index ba349237cb..fadf858b71 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -1021,5 +1021,64 @@ evaluation of BODY." (should (equal (elisp--xref-infer-namespace p3) 'any)) (should (equal (elisp--xref-infer-namespace p4) 'any)))) + +(ert-deftest elisp-shorthand-read-buffer () + (let* ((gsym (downcase (symbol-name (cl-gensym "sh-")))) + (shorthand-sname (format "s-%s" gsym)) + (expected (intern (format "shorthand-longhand-%s" gsym)))) + (cl-assert (not (intern-soft shorthand-sname))) + (should (equal (let ((elisp-shorthands + '(("^s-" . "shorthand-longhand-")))) + (with-temp-buffer + (insert shorthand-sname) + (goto-char (point-min)) + (read (current-buffer)))) + expected)) + (should (not (intern-soft shorthand-sname))))) + +(ert-deftest elisp-shorthand-read-from-string () + (let* ((gsym (downcase (symbol-name (cl-gensym "sh-")))) + (shorthand-sname (format "s-%s" gsym)) + (expected (intern (format "shorthand-longhand-%s" gsym)))) + (cl-assert (not (intern-soft shorthand-sname))) + (should (equal (let ((elisp-shorthands + '(("^s-" . "shorthand-longhand-")))) + (car (read-from-string shorthand-sname))) + expected)) + (should (not (intern-soft shorthand-sname))))) + +(defvar elisp--test-resources-dir + (expand-file-name "elisp-resources/" + (file-name-directory + (or load-file-name + (error "this file needs to be loaded"))))) + +(ert-deftest elisp-shorthand-load-a-file () + (let ((test-file (expand-file-name "simple-shorthand-test.el" + elisp--test-resources-dir))) + (mapatoms (lambda (s) + (when (string-match "^elisp--foo-" (symbol-name s)) + (unintern s obarray)))) + (load test-file) + (should (intern-soft "elisp--foo-test")) + (should-not (intern-soft "f-test")))) + +(ert-deftest elisp-shorthand-byte-compile-a-file () + + (let ((test-file (expand-file-name "simple-shorthand-test.el" + elisp--test-resources-dir)) + (byte-compiled (expand-file-name "simple-shorthand-test.elc" + elisp--test-resources-dir))) + (mapatoms (lambda (s) + (when (string-match "^elisp--foo-" (symbol-name s)) + (unintern s obarray)))) + (byte-compile-file test-file) + (should-not (intern-soft "f-test")) + (should (intern-soft "elisp--foo-test")) + (should-not (fboundp (intern-soft "elisp--foo-test"))) + (load byte-compiled) + (should (intern-soft "elisp--foo-test")) + (should-not (intern-soft "f-test")))) + (provide 'elisp-mode-tests) ;;; elisp-mode-tests.el ends here diff --git a/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el b/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el new file mode 100644 index 0000000000..7e1ed95229 --- /dev/null +++ b/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el @@ -0,0 +1,25 @@ +(defun f-test () + (let ((elisp-shorthands '(("^foo-" . "bar-")))) + (with-temp-buffer + (insert "(foo-bar)") + (goto-char (point-min)) + (read (current-buffer))))) + +(defun f-test2 () + (let ((elisp-shorthands '(("^foo-" . "bar-")))) + (read-from-string "(foo-bar)"))) + + +(defun f-test3 () + (let ((elisp-shorthands '(("^foo-" . "bar-")))) + (intern "foo-bar"))) + +(when nil + (f-test3) + (f-test2) + (f-test)) + + +;; Local Variables: +;; elisp-shorthands: (("^f-" . "elisp--foo-")) +;; End: diff --git a/test/lisp/shorthand-tests.el b/test/lisp/shorthand-tests.el deleted file mode 100644 index e3d5615ec7..0000000000 --- a/test/lisp/shorthand-tests.el +++ /dev/null @@ -1,60 +0,0 @@ -;;; shorthand-tests.el --- Tests for shorthand.el -*- lexical-binding: t; -*- - -;; Copyright (C) 2020 Free Software Foundation, Inc. - -;; Author: João Távora -;; Keywords: - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - -;;; Commentary: - -;; - -;;; Code: - -(require 'shorthand) -(require 'cl-lib) -(require 'ert) - -(ert-deftest shorthand-read-buffer () - (let* ((gsym (downcase (symbol-name (cl-gensym "sh-")))) - (shorthand-sname (format "s-%s" gsym)) - (expected (intern (format "shorthand-longhand-%s" gsym)))) - (cl-assert (not (intern-soft shorthand-sname))) - (should (equal (let ((shorthand-shorthands - '(("^s-" . "shorthand-longhand-")))) - (with-temp-buffer - (insert shorthand-sname) - (goto-char (point-min)) - (read (current-buffer)))) - expected)) - (should (not (intern-soft shorthand-sname))))) - -(ert-deftest shorthand-read-from-string () - (let* ((gsym (downcase (symbol-name (cl-gensym "sh-")))) - (shorthand-sname (format "s-%s" gsym)) - (expected (intern (format "shorthand-longhand-%s" gsym)))) - (cl-assert (not (intern-soft shorthand-sname))) - (should (equal (let ((shorthand-shorthands - '(("^s-" . "shorthand-longhand-")))) - (car (read-from-string shorthand-sname))) - expected)) - (should (not (intern-soft shorthand-sname))))) - - -(provide 'shorthand-tests) -;;; shorthand-tests.el ends here commit 6237bad419a23fcbefb2c33728522b1bb52cb557 Author: João Távora Date: Wed Aug 26 21:29:15 2020 +0100 First Elisp version of lisp/shorthand.el, failing some tests * lisp/shorthand.el: New file * test/lisp/shorthand-tests.el: New file diff --git a/lisp/shorthand.el b/lisp/shorthand.el new file mode 100644 index 0000000000..54c3412039 --- /dev/null +++ b/lisp/shorthand.el @@ -0,0 +1,114 @@ +;;; shorthand.el --- namespacing system -*- lexical-binding: t; -*- + +;; Copyright (C) 2020 Free Software Foundation + +;; Author: João Távora +;; Keywords: languages, lisp + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Simple-minded namespacing in Emacs: + +;; 1. Do this on an Emacs you don't care about, since this advises basic +;; functions; +;; 2. Load `shorthand.el` (or byte-compile and load it); +;; 3. Construct an example user of this library. +;; +;; magnar-string.el is constructed by taking s.el, renaming it to +;; magnar-string.el, and then appending this to the end of the file: +;; +;; ;;; magnar-string.el ends here, +;; Local Variables: +;; shorthand-shorthands: (("^s-" . "magnar-string-")) +;; End: +;; +;; 4. Load `magnar-string.el` or byte-compile it and load `magnar-string.elc`; +;; 5. Try C-h f and check there's no "s-" pollution; Not even the `s-` +;; symbols are interned. All the relevant functions are namespaced +;; under "magnar-string-"; +;; 6. Open test.el, and play around there. Open test2.el and play around +;; with magnar-string.el under a different "mstring-" prefix; +;; 7. Evaluating code should work. Eldoc should also work. Xref (`M-.`) +;; is broken. Anything else might breaks spectacularly; + +;; Read `shorthand.el`: it's less than 50 loc. The idea is to keep only +;; one obarray, but instruments `read` to not pollute it with symbols +;; that with the shorthands for other longer named symbols. + +;;; Code: + +(require 'cl-lib) + +(defvar shorthand-shorthands nil) +(put 'shorthand-shorthands 'safe-local-variable #'consp) + +(defun shorthand--expand-shorthand (form) + (cl-typecase form + (cons (setcar form (shorthand--expand-shorthand (car form))) + (setcdr form (shorthand--expand-shorthand (cdr form)))) + (vector (cl-loop for i from 0 for e across form + do (aset form i (shorthand--expand-shorthand e)))) + (symbol (let* ((name (symbol-name form))) + (cl-loop for (short-pat . long-pat) in shorthand-shorthands + when (string-match short-pat name) + do (setq name (replace-match long-pat t nil name))) + (setq form (intern name)))) + (string) (number) + (t (message "[shorthand] unexpected %s" (type-of form)))) + form) + +(defun shorthand-read-wrapper (wrappee stream &rest stuff) + "Read a form from STREAM. +Do this in two steps, read the form while shadowing the global +`obarray' so that symbols aren't just automatically interned into +`obarray' as usual. Then walk the form using +`shorthand--expand-shorthand' and every time a symbol is found, +apply the transformations of `shorthand-shorthands' to it before +interning it the \"real\" global `obarray'. This ensures that +longhand, _not_ shorthand, versions of each symbol is interned." + (if (and load-file-name (string-match "\\.elc$" load-file-name)) + (apply wrappee stream stuff) + (shorthand--expand-shorthand + (let ((obarray (obarray-make))) (apply wrappee stream stuff))))) + +(defun shorthand-intern-soft-wrapper (wrappee name &rest stuff) + "Tell if string NAME names an interned symbol. +Even if NAME directly doesn't, its longhand expansion might." + (let ((res (apply wrappee name stuff))) + (or res (cl-loop + for (short-pat . long-pat) in shorthand-shorthands + thereis (apply wrappee + (replace-regexp-in-string short-pat + long-pat name) + stuff))))) + +(defun shorthand-load-wrapper (wrappee file &rest stuff) + "Load Elisp FILE, aware of file-local `shortand-shorthands'." + (let (file-local-shorthands) + (when (file-readable-p file) + (with-temp-buffer + (insert-file-contents file) + (hack-local-variables) + (setq file-local-shorthands shorthand-shorthands))) + (let ((shorthand-shorthands file-local-shorthands)) + (apply wrappee file stuff)))) + +(advice-add 'read :around #'shorthand-read-wrapper) +(advice-add 'intern-soft :around #'shorthand-intern-soft-wrapper) +(advice-add 'load :around #'shorthand-load-wrapper) + +(provide 'shorthand) +;;; shorthand.el ends here diff --git a/test/lisp/shorthand-tests.el b/test/lisp/shorthand-tests.el new file mode 100644 index 0000000000..e3d5615ec7 --- /dev/null +++ b/test/lisp/shorthand-tests.el @@ -0,0 +1,60 @@ +;;; shorthand-tests.el --- Tests for shorthand.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2020 Free Software Foundation, Inc. + +;; Author: João Távora +;; Keywords: + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; + +;;; Code: + +(require 'shorthand) +(require 'cl-lib) +(require 'ert) + +(ert-deftest shorthand-read-buffer () + (let* ((gsym (downcase (symbol-name (cl-gensym "sh-")))) + (shorthand-sname (format "s-%s" gsym)) + (expected (intern (format "shorthand-longhand-%s" gsym)))) + (cl-assert (not (intern-soft shorthand-sname))) + (should (equal (let ((shorthand-shorthands + '(("^s-" . "shorthand-longhand-")))) + (with-temp-buffer + (insert shorthand-sname) + (goto-char (point-min)) + (read (current-buffer)))) + expected)) + (should (not (intern-soft shorthand-sname))))) + +(ert-deftest shorthand-read-from-string () + (let* ((gsym (downcase (symbol-name (cl-gensym "sh-")))) + (shorthand-sname (format "s-%s" gsym)) + (expected (intern (format "shorthand-longhand-%s" gsym)))) + (cl-assert (not (intern-soft shorthand-sname))) + (should (equal (let ((shorthand-shorthands + '(("^s-" . "shorthand-longhand-")))) + (car (read-from-string shorthand-sname))) + expected)) + (should (not (intern-soft shorthand-sname))))) + + +(provide 'shorthand-tests) +;;; shorthand-tests.el ends here commit 4a43b49885b8ad8725d6efec5229ab80f8dfd5d4 Author: Stefan Kangas Date: Sun Sep 26 20:56:36 2021 +0200 Add 'doc-string' declaration to defcalcmodevar * lisp/calc/calc.el (defcalcmodevar): Add 'doc-string' declaration. diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index b9bdc0fd8d..553bdc9c6e 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -494,6 +494,7 @@ This setting only applies to floats in normal display mode.") (defmacro defcalcmodevar (var defval &optional doc) "Declare VAR as a Calc variable, with default value DEFVAL and doc-string DOC. The variable VAR will be added to `calc-mode-var-list'." + (declare (doc-string 3)) `(progn (defvar ,var ,defval ,doc) (add-to-list 'calc-mode-var-list (list (quote ,var) ,defval)))) commit c00785cbabe34619c50415ddf2c8dcbfc8b02d5e Author: Stefan Kangas Date: Sun Sep 26 20:34:34 2021 +0200 Move two incorrectly named test files * test/lisp/emacs-lisp/tabulated-list-test.el: Move from here... * test/lisp/emacs-lisp/tabulated-list-tests.el: ...to here. * test/lisp/url/url-handlers-test.el: Move from here... * test/lisp/url/url-handlers-tests.el: ...to here. diff --git a/test/lisp/emacs-lisp/tabulated-list-test.el b/test/lisp/emacs-lisp/tabulated-list-tests.el similarity index 97% rename from test/lisp/emacs-lisp/tabulated-list-test.el rename to test/lisp/emacs-lisp/tabulated-list-tests.el index 7cac254ac4..e376d2f328 100644 --- a/test/lisp/emacs-lisp/tabulated-list-test.el +++ b/test/lisp/emacs-lisp/tabulated-list-tests.el @@ -1,4 +1,4 @@ -;;; tabulated-list-test.el --- Tests for emacs-lisp/tabulated-list.el -*- lexical-binding: t; -*- +;;; tabulated-list-tests.el --- Tests for emacs-lisp/tabulated-list.el -*- lexical-binding: t; -*- ;; Copyright (C) 2015-2021 Free Software Foundation, Inc. @@ -115,5 +115,4 @@ (should-error (tabulated-list-sort) :type 'user-error) (should-error (tabulated-list-sort 4) :type 'user-error))) -(provide 'tabulated-list-test) -;;; tabulated-list-test.el ends here +;;; tabulated-list-tests.el ends here diff --git a/test/lisp/url/url-handlers-test.el b/test/lisp/url/url-handlers-tests.el similarity index 94% rename from test/lisp/url/url-handlers-test.el rename to test/lisp/url/url-handlers-tests.el index 7e5a60363d..71e054b128 100644 --- a/test/lisp/url/url-handlers-test.el +++ b/test/lisp/url/url-handlers-tests.el @@ -1,4 +1,4 @@ -;;; url-handlers-test.el --- Test suite for url-handlers.el -*- lexical-binding: t; -*- +;;; url-handlers-tests.el --- Test suite for url-handlers.el -*- lexical-binding: t; -*- ;; Copyright (C) 2018-2021 Free Software Foundation, Inc. @@ -73,5 +73,4 @@ (should (equal (file-name-directory "https://foo.org/") "https://foo.org/")))) -(provide 'url-handlers-test) -;;; url-handlers-test.el ends here +;;; url-handlers-tests.el ends here commit 77494628e2bf6edb8cdb3f78784aab880a6b87a2 Author: Stefan Kangas Date: Sun Sep 26 20:20:20 2021 +0200 checkdoc: Don't add "Commentary" header to test files * lisp/emacs-lisp/checkdoc.el (checkdoc-file-comments-engine): Don't add "Commentary:" header if it looks like a test file. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 24e1ae3f09..b3707bb786 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -2385,8 +2385,13 @@ Code:, and others referenced in the style guide." err (or ;; * Commentary Section - (if (not (lm-commentary-mark)) - (progn + (if (and (not (lm-commentary-mark)) + ;; No need for a commentary section in test files. + (not (string-match + (rx (or (seq (or "-test.el" "-tests.el") string-end) + "/test/" "/tests/")) + (buffer-file-name)))) + (progn (goto-char (point-min)) (cond ((re-search-forward commit 950831c369636d8a681edc736a6c6151c1b1edee Author: Robert Pluim Date: Fri Sep 24 14:13:24 2021 +0200 Add glyphless-char-display-control for Variation Selectors * lisp/international/characters.el (update-glyphless-char-display): (glyphless-char-display-control): Add control knob for U+FE00 through U+FE0F, defaulting to 'thin-space'. * doc/lispref/display.texi (Glyphless Chars): Document it. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 510efaf271..2ae04a8521 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -7952,6 +7952,11 @@ Characters of Unicode General Category [Cf], such as U+200E @sc{left-to-right mark}, but excluding characters that have graphic images, such as U+00AD @sc{soft hyphen}. +@item variation-selectors +Unicode VS-1 through VS-16 (U+FE00 through U+FE0F), which are used to +select between different glyphs for the same codepoints (typically +emojis). + @item no-font Characters for which there is no suitable font, or which cannot be encoded by the terminal's coding system. diff --git a/lisp/international/characters.el b/lisp/international/characters.el index e08dc27549..475a669dc4 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el @@ -1540,6 +1540,9 @@ option `glyphless-char-display'." ((eq target 'c1-control) (glyphless-set-char-table-range glyphless-char-display #x80 #x9F method)) + ((eq target 'variation-selectors) + (glyphless-set-char-table-range glyphless-char-display + #xFE00 #xFE0F method)) ((eq target 'format-control) (when unicode-category-table (map-char-table @@ -1575,6 +1578,7 @@ option `glyphless-char-display'." ;;; Control of displaying glyphless characters. (defcustom glyphless-char-display-control '((format-control . thin-space) + (variation-selectors . thin-space) (no-font . hex-code)) "List of directives to control display of glyphless characters. @@ -1590,6 +1594,9 @@ GROUP must be one of these symbols: such as U+200C (ZWNJ), U+200E (LRM), but excluding characters that have graphic images, such as U+00AD (SHY). + `variation-selectors': U+FE00..U+FE0F, used for choosing between + glyph variations (e.g. Emoji vs Text + presentation). `no-font': characters for which no suitable font is found. For character terminals, characters that cannot be encoded by `terminal-coding-system'. @@ -1607,7 +1614,7 @@ Do not set its value directly from Lisp; the value takes effect only via a custom `:set' function (`update-glyphless-char-display'), which updates `glyphless-char-display'." - :version "24.1" + :version "28.1" :type '(alist :key-type (symbol :tag "Character Group") :value-type (symbol :tag "Display Method")) :options '((c0-control @@ -1628,6 +1635,12 @@ function (`update-glyphless-char-display'), which updates (const :tag "Display as empty box" empty-box) (const :tag "Display acronym" acronym) (const :tag "Display hex code in a box" hex-code))) + (variation-selectors + (choice (const :tag "Don't display" zero-width) + (const :tag "Display as thin space" thin-space) + (const :tag "Display as empty box" empty-box) + (const :tag "Display acronym" acronym) + (const :tag "Display hex code in a box" hex-code))) (no-font (choice (const :tag "Don't display" zero-width) (const :tag "Display as thin space" thin-space) commit dd60f94747d2ad2115fa6aefd3c556da7243e1a9 Author: Stefan Kangas Date: Sun Sep 26 18:14:27 2021 +0200 Explicitly make the rest of erc-compat.el obsolete * lisp/obsolete/erc-compat.el (erc-decode-coding-string) (erc-encode-coding-string, erc-set-write-file-functions) (erc-emacs-build-time, erc-replace-match-subexpression-in-string) (erc-member-if, erc-delete-if, erc-remove-if-not, erc-subseq): Explicitly declare obsolete. (erc-define-minor-mode): Make into obsolete function alias for 'define-minor-mode'. (erc-user-emacs-directory): Make into obsolete variable alias for 'user-emacs-directory'. diff --git a/lisp/obsolete/erc-compat.el b/lisp/obsolete/erc-compat.el index 9972e927e6..ef47ab793a 100644 --- a/lisp/obsolete/erc-compat.el +++ b/lisp/obsolete/erc-compat.el @@ -31,16 +31,19 @@ (require 'format-spec) ;;;###autoload(autoload 'erc-define-minor-mode "erc-compat") -(defalias 'erc-define-minor-mode #'define-minor-mode) +(define-obsolete-function-alias 'erc-define-minor-mode + #'define-minor-mode "28.1") (defun erc-decode-coding-string (s coding-system) "Decode S using CODING-SYSTEM." + (declare (obsolete decode-coding-string "28.1")) (decode-coding-string s coding-system t)) (defun erc-encode-coding-string (s coding-system) "Encode S using CODING-SYSTEM. Return the same string, if the encoding operation is trivial. See `erc-encoding-coding-alist'." + (declare (obsolete encode-coding-string "28.1")) (encode-coding-string s coding-system t)) (define-obsolete-function-alias 'erc-propertize #'propertize "28.1") @@ -51,6 +54,7 @@ See `erc-encoding-coding-alist'." (define-obsolete-function-alias 'erc-replace-regexp-in-string #'replace-regexp-in-string "28.1") (defun erc-set-write-file-functions (new-val) + (declare (obsolete nil "28.1")) (set (make-local-variable 'write-file-functions) new-val)) (defvar erc-emacs-build-time @@ -58,18 +62,8 @@ See `erc-encoding-coding-alist'." emacs-build-time (format-time-string "%Y-%m-%d" emacs-build-time)) "Time at which Emacs was dumped out, or nil if not available.") - -;; Emacs 21 and XEmacs do not have user-emacs-directory, but XEmacs -;; has user-init-directory. -(defvar erc-user-emacs-directory - (cond ((boundp 'user-emacs-directory) - user-emacs-directory) - ((boundp 'user-init-directory) - user-init-directory) - (t "~/.emacs.d/")) - "Directory beneath which additional per-user Emacs-specific files -are placed. -Note that this should end with a directory separator.") +(make-obsolete-variable 'erc-emacs-build-time 'emacs-build-time "28.1") +(define-obsolete-variable-alias 'erc-user-emacs-directory 'user-emacs-directory "28.1") (defun erc-replace-match-subexpression-in-string (newtext string _match subexp _start &optional fixedcase literal) @@ -77,6 +71,7 @@ Note that this should end with a directory separator.") MATCH is the text which matched the subexpression (see `match-string'). START is the beginning position of the last match (see `match-beginning'). See `replace-match' for explanations of FIXEDCASE and LITERAL." + (declare (obsolete replace-match "28.1")) (replace-match newtext fixedcase literal string subexp)) (define-obsolete-function-alias 'erc-with-selected-window @@ -86,10 +81,11 @@ See `replace-match' for explanations of FIXEDCASE and LITERAL." (define-obsolete-function-alias 'erc-make-obsolete-variable #'make-obsolete-variable "28.1") -;; Provide a simpler replacement for `member-if' +;; Provide a simpler replacement for `cl-member-if' (defun erc-member-if (predicate list) "Find the first item satisfying PREDICATE in LIST. Return the sublist of LIST whose car matches." + (declare (obsolete cl-member-if "28.1")) (let ((ptr list)) (catch 'found (while ptr @@ -97,11 +93,12 @@ Return the sublist of LIST whose car matches." (throw 'found ptr)) (setq ptr (cdr ptr)))))) -;; Provide a simpler replacement for `delete-if' +;; Provide a simpler replacement for `cl-delete-if' (defun erc-delete-if (predicate seq) "Remove all items satisfying PREDICATE in SEQ. This is a destructive function: it reuses the storage of SEQ whenever possible." + (declare (obsolete cl-delete-if "28.1")) ;; remove from car (while (when (funcall predicate (car seq)) (setq seq (cdr seq)))) @@ -117,11 +114,12 @@ whenever possible." (setq next (cdr ptr)))) seq) -;; Provide a simpler replacement for `remove-if-not' +;; Provide a simpler replacement for `cl-remove-if-not' (defun erc-remove-if-not (predicate seq) "Remove all items not satisfying PREDICATE in SEQ. This is a non-destructive function; it makes a copy of SEQ to avoid corrupting the original SEQ." + (declare (obsolete cl-remove-if-not "28.1")) (let (newseq) (dolist (el seq) (when (funcall predicate el) @@ -133,6 +131,7 @@ avoid corrupting the original SEQ." "Return the subsequence of SEQ from START to END. If END is omitted, it defaults to the length of the sequence. If START or END is negative, it counts from the end." + (declare (obsolete cl-subseq "28.1")) (if (stringp seq) (substring seq start end) (let (len) (and end (< end 0) (setq end (+ end (setq len (length seq))))) commit 8bb28e740dd2cc8058d7833dd60b0ef9a8765c1b Author: Stefan Kangas Date: Sun Sep 26 01:53:56 2021 +0200 ; Minor stylistic checkdoc fixes in test/**/*.el diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el index a04610089c..d0c52f6103 100644 --- a/test/lisp/autorevert-tests.el +++ b/test/lisp/autorevert-tests.el @@ -688,4 +688,4 @@ This expects `auto-revert--messages' to be bound by (ert-run-tests-batch "^auto-revert-"))) (provide 'auto-revert-tests) -;;; auto-revert-tests.el ends here +;;; autorevert-tests.el ends here diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el index 13dd228d3b..8a78a06824 100644 --- a/test/lisp/calc/calc-tests.el +++ b/test/lisp/calc/calc-tests.el @@ -53,7 +53,7 @@ A and B should be calc expressions." (defun calc-tests-simple (fun string &rest args) "Push STRING on the calc stack, then call FUN and return the new top. -The result is a calc (i.e., lisp) expression, not its string representation. +The result is a calc (i.e., Lisp) expression, not its string representation. Also pop the entire stack afterwards. An existing calc stack is reused, otherwise a new one is created." (calc-eval string 'push) @@ -448,7 +448,7 @@ An existing calc stack is reused, otherwise a new one is created." ;; Generalisation for any n, integral k≥0: use falling product (/ (apply '* (number-sequence n (- n (1- k)) -1)) (calc-tests--fac k))) - (t (error "case not covered")))) + (t (error "Case not covered")))) (defun calc-tests--calc-to-number (x) "Convert a Calc object to a Lisp number." diff --git a/test/lisp/calculator-tests.el b/test/lisp/calculator-tests.el index 9551b1a4c6..f24ca97310 100644 --- a/test/lisp/calculator-tests.el +++ b/test/lisp/calculator-tests.el @@ -48,4 +48,4 @@ (should (equal (calculator-string-to-number str) expected))))))) (provide 'calculator-tests) -;; calculator-tests.el ends here +;;; calculator-tests.el ends here diff --git a/test/lisp/calendar/cal-french-tests.el b/test/lisp/calendar/cal-french-tests.el index ab62c1e6fc..1de5dea088 100644 --- a/test/lisp/calendar/cal-french-tests.el +++ b/test/lisp/calendar/cal-french-tests.el @@ -111,3 +111,4 @@ (should (equal (calendar-french-date-string (list m d y)) str)))) (provide 'cal-french-tests) +;;; cal-french-tests.el ends here diff --git a/test/lisp/calendar/icalendar-tests.el b/test/lisp/calendar/icalendar-tests.el index de2a891758..a1853ff3d4 100644 --- a/test/lisp/calendar/icalendar-tests.el +++ b/test/lisp/calendar/icalendar-tests.el @@ -1636,7 +1636,7 @@ SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30 (format-time-string "%FT%T%z" (encode-time time) 0))) (defun icalendar-tests--decode-isodatetime (_ical-string) - "Test icalendar--decode-isodatetime." + "Test `icalendar--decode-isodatetime'." (should (equal (icalendar-test--format "20040917T050910-0200") "2004-09-17T03:09:10+0000")) (should (equal (icalendar-test--format "20040917T050910") diff --git a/test/lisp/calendar/solar-tests.el b/test/lisp/calendar/solar-tests.el index 337deb8ce9..921be1d2d4 100644 --- a/test/lisp/calendar/solar-tests.el +++ b/test/lisp/calendar/solar-tests.el @@ -17,6 +17,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Code: + (require 'ert) (require 'solar) @@ -42,3 +44,5 @@ (should (< (abs (- sunset 17.72)) epsilon))))) (provide 'solar-tests) + +;;; solar-tests.el ends here diff --git a/test/lisp/calendar/todo-mode-tests.el b/test/lisp/calendar/todo-mode-tests.el index 6fa2b9d7c3..0538368fc8 100644 --- a/test/lisp/calendar/todo-mode-tests.el +++ b/test/lisp/calendar/todo-mode-tests.el @@ -35,7 +35,7 @@ "Todo Archive mode test file.") (defmacro with-todo-test (&rest body) - "Set up an isolated todo-mode test environment." + "Set up an isolated `todo-mode' test environment." (declare (debug (body))) `(let* ((todo-test-home (make-temp-file "todo-test-home-" t)) ;; Since we change HOME, clear this to avoid a conflict diff --git a/test/lisp/cedet/semantic-utest-c.el b/test/lisp/cedet/semantic-utest-c.el index d08c79cad3..c5eb5b0ec0 100644 --- a/test/lisp/cedet/semantic-utest-c.el +++ b/test/lisp/cedet/semantic-utest-c.el @@ -60,7 +60,7 @@ (semantic-fetch-tags)))) (when (or (not tags-expected) (not tags-actual)) (message "Tried to find test files in: %s" semantic-utest-c-test-directory) - (error "Failed: Discovered no tags in test files or test file not found.")) + (error "Failed: Discovered no tags in test files or test file not found")) ;; Now that we have the tags, compare them for SPP accuracy. (dolist (tag tags-actual) diff --git a/test/lisp/cedet/semantic-utest-ia.el b/test/lisp/cedet/semantic-utest-ia.el index 122c431d47..6ea4ca1a16 100644 --- a/test/lisp/cedet/semantic-utest-ia.el +++ b/test/lisp/cedet/semantic-utest-ia.el @@ -489,4 +489,4 @@ tag that contains point, and return that." (provide 'semantic-ia-utest) -;;; semantic-ia-utest.el ends here +;;; semantic-utest-ia.el ends here diff --git a/test/lisp/cedet/semantic-utest.el b/test/lisp/cedet/semantic-utest.el index 172ab62f89..3e4cfb0f0c 100644 --- a/test/lisp/cedet/semantic-utest.el +++ b/test/lisp/cedet/semantic-utest.el @@ -29,6 +29,8 @@ (require 'cedet) (require 'semantic) +;;; Code: + (defvar cedet-utest-directory (let* ((C (file-name-directory (locate-library "cedet"))) (D (expand-file-name "../../test/manual/cedet/" C))) @@ -103,7 +105,7 @@ int calc_sv(int); (defvar semantic-utest-C-filename-h (concat (file-name-sans-extension semantic-utest-C-filename) ".h") - "Header file filename for C") + "Header file filename for C.") (defvar semantic-utest-C-name-contents @@ -424,8 +426,7 @@ class aClass { nil (overlay 135 262 "phptest.php")) ) - "Expected results from the PHP Unit test" - ) + "Expected results from the PHP Unit test.") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/test/lisp/cedet/semantic/fw-tests.el b/test/lisp/cedet/semantic/fw-tests.el index 7b1cd21bd1..6a5f3c85fc 100644 --- a/test/lisp/cedet/semantic/fw-tests.el +++ b/test/lisp/cedet/semantic/fw-tests.el @@ -42,4 +42,4 @@ ;; retrieve cached data (should (equal (semantic-get-cache-data 'moose) data))))) -;;; gw-tests.el ends here +;;; fw-tests.el ends here diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el index 8a9a41f452..19d0cca88c 100644 --- a/test/lisp/comint-tests.el +++ b/test/lisp/comint-tests.el @@ -1,4 +1,4 @@ -;;; comint-tests.el -*- lexical-binding:t -*- +;;; comint-tests.el --- Tests for comint.el -*- lexical-binding:t -*- ;; Copyright (C) 2010-2021 Free Software Foundation, Inc. @@ -94,4 +94,4 @@ password flow if it returns a nil value." ;; no-byte-compile: t ;; End: -;;; comint-testsuite.el ends here +;;; comint-tests.el ends here diff --git a/test/lisp/cus-edit-tests.el b/test/lisp/cus-edit-tests.el index 97b3349000..f7d5283437 100644 --- a/test/lisp/cus-edit-tests.el +++ b/test/lisp/cus-edit-tests.el @@ -37,7 +37,7 @@ ;;;; showing/hiding obsolete options -(defgroup cus-edit-tests nil "test" +(defgroup cus-edit-tests nil "Test." :group 'test-group) (defcustom cus-edit-tests--obsolete-option-tag nil diff --git a/test/lisp/dabbrev-tests.el b/test/lisp/dabbrev-tests.el index 0b20dcf921..e4b7837391 100644 --- a/test/lisp/dabbrev-tests.el +++ b/test/lisp/dabbrev-tests.el @@ -70,3 +70,5 @@ multiple expansions." ;; C-u C-u C-M-/ (execute-kbd-macro [21 21 201326639])) (should (string= (buffer-string) "abc\na"))))) + +;;; dabbrev-tests.el ends here diff --git a/test/lisp/descr-text-tests.el b/test/lisp/descr-text-tests.el index 2052dc0e38..715fafa44c 100644 --- a/test/lisp/descr-text-tests.el +++ b/test/lisp/descr-text-tests.el @@ -91,4 +91,4 @@ (provide 'descr-text-test) -;;; descr-text-test.el ends here +;;; descr-text-tests.el ends here diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el index 7f1743f88d..d5940ed8ca 100644 --- a/test/lisp/dired-aux-tests.el +++ b/test/lisp/dired-aux-tests.el @@ -159,4 +159,4 @@ (dired-test--check-highlighting (nth 0 lines) '(8)))) (provide 'dired-aux-tests) -;; dired-aux-tests.el ends here +;;; dired-aux-tests.el ends here diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index aac78c64c6..83f7dc3cac 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -518,4 +518,4 @@ (delete-directory testdir t))))) (provide 'dired-tests) -;; dired-tests.el ends here +;;; dired-tests.el ends here diff --git a/test/lisp/dired-x-tests.el b/test/lisp/dired-x-tests.el index 003923d60f..d00815e543 100644 --- a/test/lisp/dired-x-tests.el +++ b/test/lisp/dired-x-tests.el @@ -63,4 +63,4 @@ nil)))) (provide 'dired-x-tests) -;; dired-x-tests.el ends here +;;; dired-x-tests.el ends here diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index 46bcbfce30..4e7cbf5419 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el @@ -871,7 +871,7 @@ baz\"\"" (local-set-key (vector key) 'self-insert-command))) (defun electric-layout-for-c-style-du-jour (inserted) - "A function to use in `electric-layout-rules'" + "A function to use in `electric-layout-rules'." (when (memq inserted '(?\{ ?\})) (save-excursion (backward-char 2) (c-point-syntax) (forward-char) ; silly, but needed diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 14df39bfd7..448c7be621 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -1,4 +1,4 @@ -;;; bytecomp-tests.el -*- lexical-binding:t -*- +;;; bytecomp-tests.el --- Tests for bytecomp.el -*- lexical-binding:t -*- ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. @@ -1498,4 +1498,4 @@ EXPECTED-POINT BINDINGS (MODES \\='\\='(ruby-mode js-mode python-mode)) \ ;; End: (provide 'bytecomp-tests) -;; bytecomp-tests.el ends here. +;;; bytecomp-tests.el ends here diff --git a/test/lisp/emacs-lisp/cconv-tests.el b/test/lisp/emacs-lisp/cconv-tests.el index 5aeed0cc15..4290571735 100644 --- a/test/lisp/emacs-lisp/cconv-tests.el +++ b/test/lisp/emacs-lisp/cconv-tests.el @@ -1,4 +1,4 @@ -;;; cconv-tests.el -*- lexical-binding: t -*- +;;; cconv-tests.el --- Tests for cconv.el -*- lexical-binding: t -*- ;; Copyright (C) 2018-2021 Free Software Foundation, Inc. @@ -19,6 +19,8 @@ ;;; Commentary: +;;; Code: + (require 'ert) (require 'cl-lib) @@ -204,4 +206,4 @@ 42))) (provide 'cconv-tests) -;; cconv-tests.el ends here. +;;; cconv-tests.el ends here diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el b/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el index 9f9bb73133..d1da066dc4 100644 --- a/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el +++ b/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el @@ -22,22 +22,22 @@ ;;; Commentary: ;; -;; Test method invocation order. From the common lisp reference -;; manual: +;; Test method invocation order. From the Common Lisp Reference +;; Manual: ;; ;; QUOTE: ;; - All the :before methods are called, in most-specific-first ;; order. Their values are ignored. An error is signaled if ;; call-next-method is used in a :before method. ;; -;; - The most specific primary method is called. Inside the body of a +;; - The most specific primary method is called. Inside the body of a ;; primary method, call-next-method may be used to call the next -;; most specific primary method. When that method returns, the +;; most specific primary method. When that method returns, the ;; previous primary method can execute more code, perhaps based on -;; the returned value or values. The generic function no-next-method +;; the returned value or values. The generic function no-next-method ;; is invoked if call-next-method is used and there are no more -;; applicable primary methods. The function next-method-p may be -;; used to determine whether a next method exists. If +;; applicable primary methods. The function next-method-p may be +;; used to determine whether a next method exists. If ;; call-next-method is not used, only the most specific primary ;; method is called. ;; @@ -46,12 +46,14 @@ ;; call-next-method is used in a :after method. ;; ;; -;; Also test behavior of `call-next-method'. From clos.org: +;; Also test behavior of `call-next-method'. From clos.org: ;; ;; QUOTE: ;; When call-next-method is called with no arguments, it passes the ;; current method's original arguments to the next method. +;;; Code: + (require 'eieio) (require 'ert) @@ -403,3 +405,5 @@ (should (equal (eieio-test--1 (make-instance 'CNM-2) 5) '("CNM-1-1" "CNM-1-2" "CNM-0" 7 5))) (should (equal (eieio-test--1 'CNM-2 6) '("subclass CNM-1-2" CNM-2 6)))) + +;;; eieio-test-methodinvoke.el ends here diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el b/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el index ddbef02c35..fd044ff373 100644 --- a/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el +++ b/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el @@ -165,9 +165,9 @@ Assume SLOTVALUE is a symbol of some sort." ((slot1 :initarg :slot1 :initform 1) (slot2 :initform 2)) - "Class for testing persistent saving of an object that isn't -persistent. This class is instead used as a slot value in a -persistent class.") + "Class for testing persistent saving of an object that isn't persistent. +This class is instead used as a slot value in a persistent +class.") (defclass persistent-with-objs-slot (eieio-persistent) ((pnp :initarg :pnp diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el index 3ec4234344..9eb7fb0223 100644 --- a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el +++ b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el @@ -48,13 +48,13 @@ :type (or null class-a) :documentation "Test self referencing types.") ) - "Class A") + "Class A.") (defclass class-b () ((land :initform "Sc" :type string :documentation "Detail about land.")) - "Class B") + "Class B.") (defclass class-ab (class-a class-b) ((amphibian :initform "frog" @@ -160,7 +160,7 @@ ;; error (should-error (abstract-class))) -(defgeneric generic1 () "First generic function") +(defgeneric generic1 () "First generic function.") (ert-deftest eieio-test-03-generics () (defun anormalfunction () "A plain function for error testing." nil) @@ -901,12 +901,12 @@ Subclasses to override slot attributes.") (defclass opt-test1 () () - "Abstract base class" + "Abstract base class." :abstract t) (defclass opt-test2 (opt-test1) () - "Instantiable child") + "Instantiable child.") (ert-deftest eieio-test-36-build-class-alist () (should (= (length (eieio-build-class-alist 'opt-test1 nil)) 2)) diff --git a/test/lisp/emacs-lisp/faceup-resources/faceup-test-this-file-directory.el b/test/lisp/emacs-lisp/faceup-resources/faceup-test-this-file-directory.el index 3303e7b178..9fe5fe9218 100644 --- a/test/lisp/emacs-lisp/faceup-resources/faceup-test-this-file-directory.el +++ b/test/lisp/emacs-lisp/faceup-resources/faceup-test-this-file-directory.el @@ -22,7 +22,7 @@ ;;; Commentary: -;; Support file for `faceup-test-basics.el'. This file is used to test +;; Support file for `faceup-test-basics.el'. This file is used to test ;; `faceup-this-file-directory' in various contexts. ;;; Code: diff --git a/test/lisp/emacs-lisp/generator-tests.el b/test/lisp/emacs-lisp/generator-tests.el index a1b9f64fdb..c81d3d09e7 100644 --- a/test/lisp/emacs-lisp/generator-tests.el +++ b/test/lisp/emacs-lisp/generator-tests.el @@ -271,7 +271,7 @@ identical output." (unwind-protect (progn (iter-yield 1) - (error "test") + (error "Test") (iter-yield 2)) (cl-incf nr-unwound)))))) (should (equal (iter-next iter) 1)) diff --git a/test/lisp/emacs-lisp/let-alist-tests.el b/test/lisp/emacs-lisp/let-alist-tests.el index d856696da2..88e689c80b 100644 --- a/test/lisp/emacs-lisp/let-alist-tests.el +++ b/test/lisp/emacs-lisp/let-alist-tests.el @@ -100,4 +100,4 @@ See Bug#24641." `[,(+ .a) ,(+ .a .b .b)]) [1 5]))) -;;; let-alist.el ends here +;;; let-alist-tests.el ends here diff --git a/test/lisp/emacs-lisp/memory-report-tests.el b/test/lisp/emacs-lisp/memory-report-tests.el index e352dd165f..d37f09b34f 100644 --- a/test/lisp/emacs-lisp/memory-report-tests.el +++ b/test/lisp/emacs-lisp/memory-report-tests.el @@ -17,6 +17,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Code: + (require 'ert) (require 'memory-report) diff --git a/test/lisp/emacs-lisp/nadvice-tests.el b/test/lisp/emacs-lisp/nadvice-tests.el index 358d9025ad..ee33bb0fa4 100644 --- a/test/lisp/emacs-lisp/nadvice-tests.el +++ b/test/lisp/emacs-lisp/nadvice-tests.el @@ -208,4 +208,4 @@ function being an around advice." ;; no-byte-compile: t ;; End: -;;; advice-tests.el ends here. +;;; nadvice-tests.el ends here diff --git a/test/lisp/emacs-lisp/package-resources/macro-problem-package-1.0/macro-aux.el b/test/lisp/emacs-lisp/package-resources/macro-problem-package-1.0/macro-aux.el index f43232224a..ad20a3507a 100644 --- a/test/lisp/emacs-lisp/package-resources/macro-problem-package-1.0/macro-aux.el +++ b/test/lisp/emacs-lisp/package-resources/macro-problem-package-1.0/macro-aux.el @@ -5,7 +5,7 @@ ;;; Code: (defun macro-aux-1 ( &rest forms) - "Description" + "Description." `(progn ,@forms)) (provide 'macro-aux) diff --git a/test/lisp/emacs-lisp/package-resources/macro-problem-package-1.0/macro-problem.el b/test/lisp/emacs-lisp/package-resources/macro-problem-package-1.0/macro-problem.el index 0533b1bd9c..6e5e54e54f 100644 --- a/test/lisp/emacs-lisp/package-resources/macro-problem-package-1.0/macro-problem.el +++ b/test/lisp/emacs-lisp/package-resources/macro-problem-package-1.0/macro-problem.el @@ -9,11 +9,11 @@ (require 'macro-aux) (defmacro macro-problem-1 ( &rest forms) - "Description" + "Description." `(progn ,@forms)) (defun macro-problem-func () - "" + "Description." (macro-problem-1 'a 'b) (macro-aux-1 'a 'b)) diff --git a/test/lisp/emacs-lisp/package-resources/macro-problem-package-2.0/macro-aux.el b/test/lisp/emacs-lisp/package-resources/macro-problem-package-2.0/macro-aux.el index 6a55a40e3b..814d77183a 100644 --- a/test/lisp/emacs-lisp/package-resources/macro-problem-package-2.0/macro-aux.el +++ b/test/lisp/emacs-lisp/package-resources/macro-problem-package-2.0/macro-aux.el @@ -5,11 +5,11 @@ ;;; Code: (defmacro macro-aux-1 ( &rest forms) - "Description" + "Description." `(progn ,@forms)) (defmacro macro-aux-3 ( &rest _) - "Description" + "Description." 90) (provide 'macro-aux) diff --git a/test/lisp/emacs-lisp/package-resources/macro-problem-package-2.0/macro-problem.el b/test/lisp/emacs-lisp/package-resources/macro-problem-package-2.0/macro-problem.el index cad4ed93f1..aef5eda7c6 100644 --- a/test/lisp/emacs-lisp/package-resources/macro-problem-package-2.0/macro-problem.el +++ b/test/lisp/emacs-lisp/package-resources/macro-problem-package-2.0/macro-problem.el @@ -9,21 +9,21 @@ (require 'macro-aux) (defmacro macro-problem-1 ( &rest forms) - "Description" + "Description." `(progn ,(cadr (car forms)))) (defun macro-problem-func () - "" + "Description." (list (macro-problem-1 '1 'b) (macro-aux-1 'a 'b))) (defmacro macro-problem-3 (&rest _) - "Description" + "Description." 10) (defun macro-problem-10-and-90 () - "" + "Description." (list (macro-problem-3 haha) (macro-aux-3 hehe))) (provide 'macro-problem) diff --git a/test/lisp/emacs-lisp/package-resources/newer-versions/simple-single-1.4.el b/test/lisp/emacs-lisp/package-resources/newer-versions/simple-single-1.4.el index 301993deb3..be6bedf8a1 100644 --- a/test/lisp/emacs-lisp/package-resources/newer-versions/simple-single-1.4.el +++ b/test/lisp/emacs-lisp/package-resources/newer-versions/simple-single-1.4.el @@ -7,14 +7,14 @@ ;;; Commentary: ;; This package provides a minor mode to frobnicate and/or bifurcate -;; any flanges you desire. To activate it, type "C-M-r M-3 butterfly" +;; any flanges you desire. To activate it, type "C-M-r M-3 butterfly" ;; and all your dreams will come true. ;; ;; This is a new, updated version. ;;; Code: -(defgroup simple-single nil "Simply a file" +(defgroup simple-single nil "Simply a file." :group 'lisp) (defcustom simple-single-super-sunday nil @@ -29,7 +29,7 @@ Default changed to nil." ;;;###autoload (define-minor-mode simple-single-mode - "It does good things to stuff") + "It does good things to stuff.") (provide 'simple-single) diff --git a/test/lisp/emacs-lisp/package-resources/signed/signed-bad-1.0.el b/test/lisp/emacs-lisp/package-resources/signed/signed-bad-1.0.el index ff070c6526..781077251e 100644 --- a/test/lisp/emacs-lisp/package-resources/signed/signed-bad-1.0.el +++ b/test/lisp/emacs-lisp/package-resources/signed/signed-bad-1.0.el @@ -8,12 +8,12 @@ ;;; Commentary: ;; This package provides a minor mode to frobnicate and/or bifurcate -;; any flanges you desire. To activate it, type "C-M-r M-3 butterfly" +;; any flanges you desire. To activate it, type "C-M-r M-3 butterfly" ;; and all your dreams will come true. ;;; Code: -(defgroup signed-bad nil "Simply a file" +(defgroup signed-bad nil "Simply a file." :group 'lisp) (defcustom signed-bad-super-sunday t @@ -26,7 +26,7 @@ ;;;###autoload (define-minor-mode signed-bad-mode - "It does good things to stuff") + "It does good things to stuff.") (provide 'signed-bad) diff --git a/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el b/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el index 60b1b8663d..8a408c1f30 100644 --- a/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el +++ b/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el @@ -8,12 +8,12 @@ ;;; Commentary: ;; This package provides a minor mode to frobnicate and/or bifurcate -;; any flanges you desire. To activate it, type "C-M-r M-3 butterfly" +;; any flanges you desire. To activate it, type "C-M-r M-3 butterfly" ;; and all your dreams will come true. ;;; Code: -(defgroup signed-good nil "Simply a file" +(defgroup signed-good nil "Simply a file." :group 'lisp) (defcustom signed-good-super-sunday t @@ -26,7 +26,7 @@ ;;;###autoload (define-minor-mode signed-good-mode - "It does good things to stuff") + "It does good things to stuff.") (provide 'signed-good) diff --git a/test/lisp/emacs-lisp/package-resources/simple-depend-1.0.el b/test/lisp/emacs-lisp/package-resources/simple-depend-1.0.el index cb003905bb..f1ee862761 100644 --- a/test/lisp/emacs-lisp/package-resources/simple-depend-1.0.el +++ b/test/lisp/emacs-lisp/package-resources/simple-depend-1.0.el @@ -12,6 +12,6 @@ ;;; Code: (defvar simple-depend "Value" - "Some trivial code") + "Some trivial code.") ;;; simple-depend.el ends here diff --git a/test/lisp/emacs-lisp/package-resources/simple-single-1.3.el b/test/lisp/emacs-lisp/package-resources/simple-single-1.3.el index 9c3f427ff4..459801d78c 100644 --- a/test/lisp/emacs-lisp/package-resources/simple-single-1.3.el +++ b/test/lisp/emacs-lisp/package-resources/simple-single-1.3.el @@ -8,12 +8,12 @@ ;;; Commentary: ;; This package provides a minor mode to frobnicate and/or bifurcate -;; any flanges you desire. To activate it, type "C-M-r M-3 butterfly" +;; any flanges you desire. To activate it, type "C-M-r M-3 butterfly" ;; and all your dreams will come true. ;;; Code: -(defgroup simple-single nil "Simply a file" +(defgroup simple-single nil "Simply a file." :group 'lisp) (defcustom simple-single-super-sunday t @@ -26,7 +26,7 @@ ;;;###autoload (define-minor-mode simple-single-mode - "It does good things to stuff") + "It does good things to stuff.") (provide 'simple-single) diff --git a/test/lisp/emacs-lisp/package-resources/simple-two-depend-1.1.el b/test/lisp/emacs-lisp/package-resources/simple-two-depend-1.1.el index a0a9607350..8de6141d67 100644 --- a/test/lisp/emacs-lisp/package-resources/simple-two-depend-1.1.el +++ b/test/lisp/emacs-lisp/package-resources/simple-two-depend-1.1.el @@ -12,6 +12,6 @@ ;;; Code: (defvar simple-two-depend "Value" - "Some trivial code") + "Some trivial code.") ;;; simple-two-depend.el ends here diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index 77bc8117cf..1fd93bc1be 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -180,7 +180,7 @@ (replace-regexp-in-string "-pkg\\.el\\'" "" (package--description-file dir))) (defun package-test-suffix-matches (base suffix-list) - "Return file names matching BASE concatenated with each item in SUFFIX-LIST" + "Return file names matching BASE concatenated with each item in SUFFIX-LIST." (mapcan (lambda (item) (file-expand-wildcards (concat base item))) suffix-list)) diff --git a/test/lisp/emacs-lisp/regexp-opt-tests.el b/test/lisp/emacs-lisp/regexp-opt-tests.el index 940feb5e82..65494e20df 100644 --- a/test/lisp/emacs-lisp/regexp-opt-tests.el +++ b/test/lisp/emacs-lisp/regexp-opt-tests.el @@ -66,4 +66,4 @@ (should (equal (regexp-opt-charset '()) regexp-unmatchable))) -;;; regexp-tests.el ends here. +;;; regexp-opt-tests.el ends here diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el index 4828df0de9..3bc35feb6d 100644 --- a/test/lisp/emacs-lisp/rx-tests.el +++ b/test/lisp/emacs-lisp/rx-tests.el @@ -17,6 +17,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Code: + (require 'ert) (require 'rx) @@ -583,3 +585,5 @@ "\\(?3:.+$\\)"))) (provide 'rx-tests) + +;;; rx-tests.el ends here diff --git a/test/lisp/emacs-lisp/shortdoc-tests.el b/test/lisp/emacs-lisp/shortdoc-tests.el index 3bb3185649..cfb0b4244b 100644 --- a/test/lisp/emacs-lisp/shortdoc-tests.el +++ b/test/lisp/emacs-lisp/shortdoc-tests.el @@ -17,6 +17,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Code: + (require 'ert) (require 'shortdoc) @@ -43,3 +45,5 @@ (setq props (cddr props)))))))) (provide 'shortdoc-tests) + +;;; shortdoc-tests.el ends here diff --git a/test/lisp/emacs-lisp/testcover-resources/testcases.el b/test/lisp/emacs-lisp/testcover-resources/testcases.el index 7ced257c6f..29094526d7 100644 --- a/test/lisp/emacs-lisp/testcover-resources/testcases.el +++ b/test/lisp/emacs-lisp/testcover-resources/testcases.el @@ -77,12 +77,12 @@ "Testcover doesn't prevent testing of defcustom values." ;; ==== (defgroup testcover-testcase nil - "Test case for testcover" + "Test case for testcover." :group 'lisp :prefix "testcover-testcase-" :version "26.0") (defcustom testcover-testcase-flag t - "Test value used by testcover-tests.el" + "Test value used by testcover-tests.el." :type 'boolean :group 'testcover-testcase) (defun testcover-testcase-get-flag () @@ -111,7 +111,7 @@ "Wrapping a form with noreturn prevents splotching." ;; ==== (defun testcover-testcase-cancel (spacecraft) - (error "no destination for %s" spacecraft)) + (error "No destination for %s" spacecraft)) (defun testcover-testcase-launch (spacecraft planet) (if (null planet) (noreturn (testcover-testcase-cancel spacecraft%%%)) @@ -220,7 +220,7 @@ (defun testcover-testcase-cc (arg) (condition-case nil (if (null arg%%%)%%% - (error "foo") + (error "Foo") "0")!!! (error nil))) (should-not (testcover-testcase-cc nil)) @@ -510,4 +510,4 @@ regarding the odd-looking coverage result for the quoted form." (testcover-testcase-cyc2 1 2) (testcover-testcase-cyc2 1 4) -;; testcases.el ends here. +;;; testcases.el ends here diff --git a/test/lisp/emacs-lisp/unsafep-tests.el b/test/lisp/emacs-lisp/unsafep-tests.el index b2a48d8067..f0d9b03243 100644 --- a/test/lisp/emacs-lisp/unsafep-tests.el +++ b/test/lisp/emacs-lisp/unsafep-tests.el @@ -105,7 +105,7 @@ . (variable (x))) ( (let (1) 2) . (variable 1)) - ( (error "asdf") + ( (error "Asdf") . #'error) ( (signal 'error "asdf") . #'signal) diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el index 22f62a35c7..6ed26f6828 100644 --- a/test/lisp/erc/erc-tests.el +++ b/test/lisp/erc/erc-tests.el @@ -227,3 +227,5 @@ (when noninteractive (kill-buffer "*erc-protocol*") (should-not erc-debug-irc-protocol))) + +;;; erc-tests.el ends here diff --git a/test/lisp/erc/erc-track-tests.el b/test/lisp/erc/erc-track-tests.el index 0ce93bd45c..b2687a96ab 100644 --- a/test/lisp/erc/erc-track-tests.el +++ b/test/lisp/erc/erc-track-tests.el @@ -119,3 +119,5 @@ '(bold erc-current-nick-face) str1) (should (erc-faces-in str0)) (should (erc-faces-in str1)) )) + +;;; erc-track-tests.el ends here diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el index 4f0cc9b678..a460f45bf1 100644 --- a/test/lisp/eshell/eshell-tests.el +++ b/test/lisp/eshell/eshell-tests.el @@ -262,4 +262,4 @@ chars" (provide 'eshell-tests) -;;; tests/eshell-tests.el ends here +;;; eshell-tests.el ends here diff --git a/test/lisp/faces-resources/faces-test-dark-theme.el b/test/lisp/faces-resources/faces-test-dark-theme.el index f3ef6b67fa..7e8871ec10 100644 --- a/test/lisp/faces-resources/faces-test-dark-theme.el +++ b/test/lisp/faces-resources/faces-test-dark-theme.el @@ -22,7 +22,7 @@ ;;; Code: (deftheme faces-test-dark - "") + "Dark test theme.") (custom-theme-set-faces 'faces-test-dark diff --git a/test/lisp/faces-resources/faces-test-light-theme.el b/test/lisp/faces-resources/faces-test-light-theme.el index 390b846164..70a7501761 100644 --- a/test/lisp/faces-resources/faces-test-light-theme.el +++ b/test/lisp/faces-resources/faces-test-light-theme.el @@ -22,7 +22,7 @@ ;;; Code: (deftheme faces-test-light - "") + "Light test theme.") (custom-theme-set-faces 'faces-test-light diff --git a/test/lisp/faces-tests.el b/test/lisp/faces-tests.el index c0db9c9de1..fe5f3ec95f 100644 --- a/test/lisp/faces-tests.el +++ b/test/lisp/faces-tests.el @@ -25,7 +25,7 @@ (require 'ert) (require 'ert-x) -(defgroup faces--test nil "" +(defgroup faces--test nil "Group to test faces." :group 'faces--test) (defface faces--test1 diff --git a/test/lisp/gnus/gnus-search-tests.el b/test/lisp/gnus/gnus-search-tests.el index 6148da6562..9f012d4e88 100644 --- a/test/lisp/gnus/gnus-search-tests.el +++ b/test/lisp/gnus/gnus-search-tests.el @@ -97,4 +97,4 @@ "more bits")))) (provide 'gnus-search-tests) -;;; search-tests.el ends here +;;; gnus-search-tests.el ends here diff --git a/test/lisp/gnus/gnus-util-tests.el b/test/lisp/gnus/gnus-util-tests.el index f8d30f6373..60a9cde0e7 100644 --- a/test/lisp/gnus/gnus-util-tests.el +++ b/test/lisp/gnus/gnus-util-tests.el @@ -132,4 +132,4 @@ (should (equal '("1") (gnus-setdiff '(2 "1" 2) '(2)))) (should (equal '("1" "1") (gnus-setdiff '(2 "1" 2 "1") '(2))))) -;;; gnustest-gnus-util.el ends here +;;; gnus-util-tests.el ends here diff --git a/test/lisp/gnus/message-tests.el b/test/lisp/gnus/message-tests.el index b4f2b7f675..0f42f62f38 100644 --- a/test/lisp/gnus/message-tests.el +++ b/test/lisp/gnus/message-tests.el @@ -185,4 +185,4 @@ Hello. (provide 'message-mode-tests) -;;; message-mode-tests.el ends here +;;; message-tests.el ends here diff --git a/test/lisp/htmlfontify-tests.el b/test/lisp/htmlfontify-tests.el index 879131cae3..15798319a1 100644 --- a/test/lisp/htmlfontify-tests.el +++ b/test/lisp/htmlfontify-tests.el @@ -43,4 +43,4 @@ available (Bug#25468)." 0))) (provide 'htmlfontify-tests) -;; htmlfontify-tests.el ends here +;;; htmlfontify-tests.el ends here diff --git a/test/lisp/ibuffer-tests.el b/test/lisp/ibuffer-tests.el index a51079180a..9b0327b0ef 100644 --- a/test/lisp/ibuffer-tests.el +++ b/test/lisp/ibuffer-tests.el @@ -826,4 +826,4 @@ (should (equal (ibuffer-unary-operand '(not . a)) 'a))) (provide 'ibuffer-tests) -;; ibuffer-tests.el ends here +;;; ibuffer-tests.el ends here diff --git a/test/lisp/info-xref-tests.el b/test/lisp/info-xref-tests.el index ecba86146f..0b8091f17a 100644 --- a/test/lisp/info-xref-tests.el +++ b/test/lisp/info-xref-tests.el @@ -161,4 +161,4 @@ text. (line-end-position))))))) -;;; info-xref.el ends here +;;; info-xref-tests.el ends here diff --git a/test/lisp/international/ccl-tests.el b/test/lisp/international/ccl-tests.el index 0f765e4ff8..f3da2d8873 100644 --- a/test/lisp/international/ccl-tests.el +++ b/test/lisp/international/ccl-tests.el @@ -246,3 +246,5 @@ At EOF: (registers [17 0 0 0 0 0 0 0])) (ccl-execute compiled registers) (should (equal registers [2 16 0 0 0 0 0 1]))))) + +;;; ccl-tests.el ends here diff --git a/test/lisp/jit-lock-tests.el b/test/lisp/jit-lock-tests.el index 121966b2b7..a54aad8165 100644 --- a/test/lisp/jit-lock-tests.el +++ b/test/lisp/jit-lock-tests.el @@ -58,3 +58,5 @@ (with-silent-modifications (put-text-property (point-min) (point-max) 'fontified t)) (jit-lock-fontify-now (point-min) (point-max)))) + +;;; jit-lock-tests.el ends here diff --git a/test/lisp/kmacro-tests.el b/test/lisp/kmacro-tests.el index 8736f7fd2d..ecd3d5fc22 100644 --- a/test/lisp/kmacro-tests.el +++ b/test/lisp/kmacro-tests.el @@ -834,7 +834,7 @@ and `read-event' and `read-key-sequence' set up to return items from EVENTS and SEQUENCES respectively. SEQUENCES may be nil, but EVENTS should not be. EVENTS should be a list of symbols bound in `kmacro-step-edit-map' or `query-replace' map, and this function -will do the keymap lookup for you. SEQUENCES should contain +will do the keymap lookup for you. SEQUENCES should contain return values for `read-key-sequence'. Before running the macro, the current buffer will be erased. diff --git a/test/lisp/mail/rmail-tests.el b/test/lisp/mail/rmail-tests.el index f533401496..826a90455f 100644 --- a/test/lisp/mail/rmail-tests.el +++ b/test/lisp/mail/rmail-tests.el @@ -32,4 +32,4 @@ 'rmail-edit-current-message)))) (provide 'rmail-tests) -;; rmail-tests.el ends here +;;; rmail-tests.el ends here diff --git a/test/lisp/mail/rmailmm-tests.el b/test/lisp/mail/rmailmm-tests.el index a022008b53..d7b3775d6d 100644 --- a/test/lisp/mail/rmailmm-tests.el +++ b/test/lisp/mail/rmailmm-tests.el @@ -114,4 +114,4 @@ This is the epilogue. It is also to be ignored.")) (provide 'rmailmm-tests) -;; rmailmm-tests.el ends here +;;; rmailmm-tests.el ends here diff --git a/test/lisp/mail/uudecode-tests.el b/test/lisp/mail/uudecode-tests.el index 6ff767562e..981ce1c4ae 100644 --- a/test/lisp/mail/uudecode-tests.el +++ b/test/lisp/mail/uudecode-tests.el @@ -35,11 +35,11 @@ (defvar uudecode-tests-encoded-str (uudecode-tests-read-file (ert-resource-file "uuencoded.txt")) - "Uuencoded data for bookmark-tests.el + "Uuencoded data for bookmark-tests.el. Same as `uudecode-tests-decoded-str' but uuencoded.") (defvar uudecode-tests-decoded-str (uudecode-tests-read-file (ert-resource-file "uudecoded.txt")) - "Plain text data for bookmark-tests.el + "Plain text data for bookmark-tests.el. Same as `uudecode-tests-encoded-str' but plain text.") (ert-deftest uudecode-tests-decode-region-internal () diff --git a/test/lisp/net/shr-tests.el b/test/lisp/net/shr-tests.el index ed532af657..bfb83f2518 100644 --- a/test/lisp/net/shr-tests.el +++ b/test/lisp/net/shr-tests.el @@ -67,4 +67,4 @@ (require 'shr) -;;; shr-stream-tests.el ends here +;;; shr-tests.el ends here diff --git a/test/lisp/net/socks-tests.el b/test/lisp/net/socks-tests.el index c0f90bc2d4..9079c1bef2 100644 --- a/test/lisp/net/socks-tests.el +++ b/test/lisp/net/socks-tests.el @@ -128,7 +128,7 @@ (defvar socks-tests-canned-server-patterns nil "Alist containing request/response cons pairs to be tried in order. -Vectors must match verbatim. Strings are considered regex patterns.") +Vectors must match verbatim. Strings are considered regex patterns.") (defun socks-tests-canned-server-create () "Create and return a fake SOCKS server." diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 26a3ac7e96..55396c5079 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -6071,7 +6071,7 @@ This requires restrictions of file name syntax." 'tramp-ftp-file-name-handler)) (defun tramp--test-crypt-p () - "Check, whether the remote directory is crypted" + "Check, whether the remote directory is crypted." (tramp-crypt-file-name-p tramp-test-temporary-file-directory)) (defun tramp--test-docker-p () diff --git a/test/lisp/newcomment-tests.el b/test/lisp/newcomment-tests.el index 5485673b72..65690e593d 100644 --- a/test/lisp/newcomment-tests.el +++ b/test/lisp/newcomment-tests.el @@ -1,4 +1,4 @@ -;;; newcomment-tests.el -*- lexical-binding:t -*- +;;; newcomment-tests.el --- Tests for newcomment.el -*- lexical-binding:t -*- ;; Copyright (C) 2021 Free Software Foundation, Inc. @@ -36,4 +36,4 @@ (uncomment-region (point-min) (point-max)) (buffer-string)))))) -;;; newcomment-testsuite.el ends here +;;; newcomment-tests.el ends here diff --git a/test/lisp/org/org-tests.el b/test/lisp/org/org-tests.el index c1985a46a4..e53b038408 100644 --- a/test/lisp/org/org-tests.el +++ b/test/lisp/org/org-tests.el @@ -29,3 +29,5 @@ Ref ." (should (require 'org-version nil t)) (should (equal (version-to-list (org-release)) (cdr (assq 'org package--builtin-versions))))) + +;;; org-tests.el ends here diff --git a/test/lisp/play/cookie1-tests.el b/test/lisp/play/cookie1-tests.el index 75dea4e5ef..2dd73d1802 100644 --- a/test/lisp/play/cookie1-tests.el +++ b/test/lisp/play/cookie1-tests.el @@ -37,4 +37,4 @@ (should (= (length (cookie-apropos "false" fortune-file)) 1)))) (provide 'fortune-tests) -;;; fortune-tests.el ends here +;;; cookie1-tests.el ends here diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 60946c2f44..ba349237cb 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -429,7 +429,7 @@ to (xref-elisp-test-descr-to-target xref)." slot-1) (cl-defgeneric xref-elisp-generic-no-methods (arg1 arg2) - "doc string generic no-methods" + "Doc string generic no-methods." ;; No default implementation, no methods, but fboundp is true for ;; this symbol; it calls cl-no-applicable-method ) @@ -440,44 +440,44 @@ to (xref-elisp-test-descr-to-target xref)." ;; ‘this’. It passes in interactive tests, so I haven't been able to ;; track down the problem. (cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type) arg2) - "doc string generic no-default xref-elisp-root-type" + "Doc string generic no-default xref-elisp-root-type." "non-default for no-default") ;; defgeneric after defmethod in file to ensure the fallback search ;; method of just looking for the function name will fail. (cl-defgeneric xref-elisp-generic-no-default (arg1 arg2) - "doc string generic no-default generic" + "Doc string generic no-default generic." ;; No default implementation; this function calls the cl-generic ;; dispatching code. ) (cl-defgeneric xref-elisp-generic-co-located-default (arg1 arg2) - "doc string generic co-located-default" + "Doc string generic co-located-default." "co-located default") (cl-defmethod xref-elisp-generic-co-located-default ((this xref-elisp-root-type) arg2) - "doc string generic co-located-default xref-elisp-root-type" + "Doc string generic co-located-default xref-elisp-root-type." "non-default for co-located-default") (cl-defgeneric xref-elisp-generic-separate-default (arg1 arg2) - "doc string generic separate-default" + "Doc string generic separate-default." ;; default implementation provided separately ) (cl-defmethod xref-elisp-generic-separate-default (arg1 arg2) - "doc string generic separate-default default" + "Doc string generic separate-default default." "separate default") (cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type) arg2) - "doc string generic separate-default xref-elisp-root-type" + "Doc string generic separate-default xref-elisp-root-type." "non-default for separate-default") (cl-defmethod xref-elisp-generic-implicit-generic (arg1 arg2) - "doc string generic implicit-generic default" + "Doc string generic implicit-generic default." "default for implicit generic") (cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type) arg2) - "doc string generic implicit-generic xref-elisp-root-type" + "Doc string generic implicit-generic xref-elisp-root-type." "non-default for implicit generic") @@ -623,35 +623,35 @@ to (xref-elisp-test-descr-to-target xref)." (declare-function xref-elisp-overloadable-no-default-default "elisp-mode-tests") (define-overloadable-function xref-elisp-overloadable-no-methods () - "doc string overloadable no-methods") + "Doc string overloadable no-methods.") (define-overloadable-function xref-elisp-overloadable-no-default () - "doc string overloadable no-default") + "Doc string overloadable no-default.") (define-mode-local-override xref-elisp-overloadable-no-default c-mode (_start _end &optional _nonterminal _depth _returnonerror) - "doc string overloadable no-default c-mode." + "Doc string overloadable no-default c-mode." "result overloadable no-default c-mode.") (define-overloadable-function xref-elisp-overloadable-co-located-default () - "doc string overloadable co-located-default" + "Doc string overloadable co-located-default." "result overloadable co-located-default.") (define-mode-local-override xref-elisp-overloadable-co-located-default c-mode (_start _end &optional _nonterminal _depth _returnonerror) - "doc string overloadable co-located-default c-mode." + "Doc string overloadable co-located-default c-mode." "result overloadable co-located-default c-mode.") (define-overloadable-function xref-elisp-overloadable-separate-default () - "doc string overloadable separate-default.") + "Doc string overloadable separate-default.") (defun xref-elisp-overloadable-separate-default-default () - "doc string overloadable separate-default default" + "Doc string overloadable separate-default default." "result overloadable separate-default.") (define-mode-local-override xref-elisp-overloadable-separate-default c-mode (_start _end &optional _nonterminal _depth _returnonerror) - "doc string overloadable separate-default c-mode." + "Doc string overloadable separate-default c-mode." "result overloadable separate-default c-mode.") (xref-elisp-deftest find-defs-define-overload-no-methods diff --git a/test/lisp/progmodes/etags-tests.el b/test/lisp/progmodes/etags-tests.el index 35a2592e76..9b14a3ae86 100644 --- a/test/lisp/progmodes/etags-tests.el +++ b/test/lisp/progmodes/etags-tests.el @@ -111,3 +111,5 @@ (should (visit-tags-table-buffer)) (should (equal tags-file-name (car tag-tables))))) (delete-file file)))) + +;;; etags-tests.el ends here diff --git a/test/lisp/progmodes/flymake-tests.el b/test/lisp/progmodes/flymake-tests.el index 10111ca06c..4c0d15d1e1 100644 --- a/test/lisp/progmodes/flymake-tests.el +++ b/test/lisp/progmodes/flymake-tests.el @@ -193,7 +193,7 @@ SEVERITY-PREDICATE is used to setup (defun flymake-tests--diagnose-words (report-fn type words) - "Helper. Call REPORT-FN with diagnostics for WORDS in buffer." + "Helper. Call REPORT-FN with diagnostics for WORDS in buffer." (funcall report-fn (cl-loop for word in words diff --git a/test/lisp/progmodes/gdb-mi-tests.el b/test/lisp/progmodes/gdb-mi-tests.el index ab482214af..d66df961b6 100644 --- a/test/lisp/progmodes/gdb-mi-tests.el +++ b/test/lisp/progmodes/gdb-mi-tests.el @@ -17,6 +17,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Code: + (require 'ert) (require 'gdb-mi) @@ -44,3 +46,5 @@ ) (provide 'gdb-mi-tests) + +;;; gdb-mi-tests.el ends here diff --git a/test/lisp/progmodes/opascal-tests.el b/test/lisp/progmodes/opascal-tests.el index 682f2c6cb6..ea91479362 100644 --- a/test/lisp/progmodes/opascal-tests.el +++ b/test/lisp/progmodes/opascal-tests.el @@ -17,6 +17,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Code: + (require 'ert) (require 'opascal) diff --git a/test/lisp/progmodes/pascal-tests.el b/test/lisp/progmodes/pascal-tests.el index e9c705806b..f5202143e2 100644 --- a/test/lisp/progmodes/pascal-tests.el +++ b/test/lisp/progmodes/pascal-tests.el @@ -17,6 +17,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Code: + (require 'ert) (require 'pascal) @@ -61,3 +63,5 @@ (should (equal (point) 15)))) (provide 'pascal-tests) + +;;; pascal-tests.el ends here diff --git a/test/lisp/progmodes/sql-tests.el b/test/lisp/progmodes/sql-tests.el index 21dd064952..99b79b61d6 100644 --- a/test/lisp/progmodes/sql-tests.el +++ b/test/lisp/progmodes/sql-tests.el @@ -50,7 +50,7 @@ (lambda (_command) t)) ((symbol-function 'process-lines) (lambda (_program &rest _args) - (error "some error")))) + (error "Some error")))) (should-not (sql-postgres-list-databases)))) ;;; Check Connection Password Handling/Wallet diff --git a/test/lisp/ps-print-tests.el b/test/lisp/ps-print-tests.el index b25e88622d..d468911dd3 100644 --- a/test/lisp/ps-print-tests.el +++ b/test/lisp/ps-print-tests.el @@ -34,3 +34,5 @@ (autoloadp (symbol-function 'ps-mule-initialize)))) + +;;; ps-print-tests.el ends here diff --git a/test/lisp/saveplace-tests.el b/test/lisp/saveplace-tests.el index 17199ed443..63577fdd16 100644 --- a/test/lisp/saveplace-tests.el +++ b/test/lisp/saveplace-tests.el @@ -21,6 +21,8 @@ ;;; Commentary: +;;; Code: + (require 'ert) (require 'ert-x) (require 'saveplace) diff --git a/test/lisp/ses-tests.el b/test/lisp/ses-tests.el index 04f255dcd4..9a7fb502d7 100644 --- a/test/lisp/ses-tests.el +++ b/test/lisp/ses-tests.el @@ -175,3 +175,5 @@ to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to (provide 'ses-tests) + +;;; ses-tests.el ends here diff --git a/test/lisp/shell-tests.el b/test/lisp/shell-tests.el index 223a18590b..342b421911 100644 --- a/test/lisp/shell-tests.el +++ b/test/lisp/shell-tests.el @@ -1,4 +1,4 @@ -;;; shell-tests.el -*- lexical-binding:t -*- +;;; shell-tests.el --- Tests for shell.el -*- lexical-binding:t -*- ;; Copyright (C) 2010-2021 Free Software Foundation, Inc. diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index 3ece61290b..742da0bde5 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el @@ -972,4 +972,4 @@ See Bug#21722." (should (= (length (delq nil (undo-make-selective-list 6 9))) 0)))) (provide 'simple-test) -;;; simple-test.el ends here +;;; simple-tests.el ends here diff --git a/test/lisp/so-long-tests/so-long-tests-helpers.el b/test/lisp/so-long-tests/so-long-tests-helpers.el index dd2331e6e4..f542806ac1 100644 --- a/test/lisp/so-long-tests/so-long-tests-helpers.el +++ b/test/lisp/so-long-tests/so-long-tests-helpers.el @@ -106,8 +106,8 @@ (defun so-long-tests-remember () "Remember the original states of modes and variables. -Call this after setting up a buffer in the normal (not so-long) -state for its major mode, so that after triggering a so-long +Call this after setting up a buffer in the normal (not `so-long') +state for its major mode, so that after triggering a `so-long' action we can call `so-long-revert' and compare the reverted state against this remembered state." (setq so-long-tests-memory nil) diff --git a/test/lisp/tar-mode-tests.el b/test/lisp/tar-mode-tests.el index 48a127157d..6964d42318 100644 --- a/test/lisp/tar-mode-tests.el +++ b/test/lisp/tar-mode-tests.el @@ -47,4 +47,4 @@ (provide 'tar-mode-tests) -;; tar-mode-tests.el ends here +;;; tar-mode-tests.el ends here diff --git a/test/lisp/term/tty-colors-tests.el b/test/lisp/term/tty-colors-tests.el index ba29a9c376..d0e739b5ec 100644 --- a/test/lisp/term/tty-colors-tests.el +++ b/test/lisp/term/tty-colors-tests.el @@ -35,4 +35,4 @@ (provide 'term-tests) -;;; term-tests.el ends here +;;; tty-colors-tests.el ends here diff --git a/test/lisp/textmodes/dns-mode-tests.el b/test/lisp/textmodes/dns-mode-tests.el index 8bc48732c6..1be5291509 100644 --- a/test/lisp/textmodes/dns-mode-tests.el +++ b/test/lisp/textmodes/dns-mode-tests.el @@ -77,3 +77,5 @@ (insert " ") (dns-mode-ipv6-to-nibbles nil) (should (equal (buffer-string) "8.b.d.0.1.0.0.2.ip6.arpa. "))))) + +;;; dns-mode-tests.el ends here diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el index 1849480347..2a32dc57b1 100644 --- a/test/lisp/thingatpt-tests.el +++ b/test/lisp/thingatpt-tests.el @@ -70,7 +70,7 @@ ;; UUID, only hex is allowed ("01234567-89ab-cdef-ABCD-EF0123456789" 1 uuid "01234567-89ab-cdef-ABCD-EF0123456789") ("01234567-89ab-cdef-ABCD-EF012345678G" 1 uuid nil)) - "List of thing-at-point tests. + "List of `thing-at-point' tests. Each list element should have the form (STRING POS THING RESULT) @@ -231,4 +231,4 @@ position to retrieve THING.") (goto-char 5) (should (eq (symbol-at-point) 'bar)))) -;;; thingatpt.el ends here +;;; thingatpt-tests.el ends here diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index dc628af19f..0449704b41 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -86,7 +86,7 @@ (should (equal (time-stamp-string "%H %Z" ref-time1) "15 GMT"))))) (iter-defun time-stamp-test-pattern-sequential () - "Iterate through each possibility for a part of time-stamp-pattern." + "Iterate through each possibility for a part of `time-stamp-pattern'." (let ((pattern-value-parts '(("4/" "10/" "-4/" "0/" "") ;0: line limit ("stamp<" "") ;1: start @@ -115,7 +115,7 @@ (extract-part 5)))))))))) (iter-defun time-stamp-test-pattern-multiply () - "Iterate through every combination of parts of time-stamp-pattern." + "Iterate through every combination of parts of `time-stamp-pattern'." (let ((line-limit-values '("" "4/")) (start-values '("" "stamp<")) (format-values '("%%" "%m")) @@ -871,7 +871,7 @@ The functions in `pattern-mod' are composed left to right." (defmacro formatz-generate-tests (form-strings hour-mod mins-mod secs-mod big-mod secbig-mod) - "Defines ert-deftest tests for time formats FORM-STRINGS. + "Defines tests for time formats FORM-STRINGS. FORM-STRINGS is a list of formats, each \"%z\" or some variation thereof. Each of the remaining arguments is an unquoted list of the form diff --git a/test/lisp/time-tests.el b/test/lisp/time-tests.el index 88b7638d91..89e6985b84 100644 --- a/test/lisp/time-tests.el +++ b/test/lisp/time-tests.el @@ -21,6 +21,8 @@ ;;; Commentary: +;;; Code: + (require 'ert) (require 'ert-x) (require 'time) diff --git a/test/lisp/timezone-tests.el b/test/lisp/timezone-tests.el index 9f6961409e..9bbe36cfe8 100644 --- a/test/lisp/timezone-tests.el +++ b/test/lisp/timezone-tests.el @@ -21,6 +21,8 @@ ;;; Commentary: +;;; Code: + (require 'ert) (require 'timezone) diff --git a/test/lisp/url/url-parse-tests.el b/test/lisp/url/url-parse-tests.el index 2418af40ac..a7f81eba8f 100644 --- a/test/lisp/url/url-parse-tests.el +++ b/test/lisp/url/url-parse-tests.el @@ -23,7 +23,7 @@ ;;; Commentary: ;; Test cases covering generic URI syntax as described in RFC3986, -;; section 3. Syntax Components and 4. Usage. See also appendix +;; section 3. Syntax Components and 4. Usage. See also appendix ;; A. Collected ABNF for URI, as the example given here are all ;; productions of this grammar. diff --git a/test/lisp/vc/add-log-tests.el b/test/lisp/vc/add-log-tests.el index dc2b9961c6..70e49fe57f 100644 --- a/test/lisp/vc/add-log-tests.el +++ b/test/lisp/vc/add-log-tests.el @@ -29,8 +29,8 @@ content marker expected-defun) "Generate an ert test for mode-own `add-log-current-defun-function'. Run `add-log-current-defun' at the point where MARKER specifies -in a buffer which content is CONTENT under major mode MODE. Then -it compares the result with EXPECTED-DEFUN." +in a buffer which content is CONTENT under major mode MODE. +Then it compares the result with EXPECTED-DEFUN." (let ((xname (intern (concat "add-log-current-defun-test-" (symbol-name name) )))) diff --git a/test/lisp/vc/diff-mode-tests.el b/test/lisp/vc/diff-mode-tests.el index fefe50d517..ef19fe0e0e 100644 --- a/test/lisp/vc/diff-mode-tests.el +++ b/test/lisp/vc/diff-mode-tests.el @@ -481,3 +481,4 @@ baz")))) '("/tmp/ange-ftp1351895K.el" "/tmp/ange-ftp13518wvE.el"))))) (provide 'diff-mode-tests) +;;; diff-mode-tests.el ends here diff --git a/test/lisp/vc/smerge-mode-tests.el b/test/lisp/vc/smerge-mode-tests.el index 2c8f48618e..d7827c7a8c 100644 --- a/test/lisp/vc/smerge-mode-tests.el +++ b/test/lisp/vc/smerge-mode-tests.el @@ -34,3 +34,5 @@ (should (equal (buffer-substring (point-min) (point-max)) "")))) (provide 'smerge-mode-tests) + +;;; smerge-mode-tests.el ends here diff --git a/test/lisp/vc/vc-bzr-tests.el b/test/lisp/vc/vc-bzr-tests.el index b02dce8f70..43385de595 100644 --- a/test/lisp/vc/vc-bzr-tests.el +++ b/test/lisp/vc/vc-bzr-tests.el @@ -153,4 +153,4 @@ t))) (delete-directory homedir t)))) -;;; vc-bzr.el ends here +;;; vc-bzr-tests.el ends here diff --git a/test/lisp/whitespace-tests.el b/test/lisp/whitespace-tests.el index 9f54a4fd34..1001476a28 100644 --- a/test/lisp/whitespace-tests.el +++ b/test/lisp/whitespace-tests.el @@ -51,7 +51,7 @@ ;; We cannot call whitespace-mode because it will do nothing in batch ;; mode. So we call its innards instead. (defun whitespace-tests-whitespace-mode-on () - "Turn whitespace-mode on even in batch mode." + "Turn `whitespace-mode' on even in batch mode." (whitespace-turn-on) (whitespace-action-when-on) (setq whitespace-mode t)) diff --git a/test/lisp/xml-tests.el b/test/lisp/xml-tests.el index b00b58acfc..7c64ef39f8 100644 --- a/test/lisp/xml-tests.el +++ b/test/lisp/xml-tests.el @@ -78,7 +78,7 @@ ;; Bug#16344 "< /x>" "< b/>") - "List of XML strings that should signal an error in the parser") + "List of XML strings that should signal an error in the parser.") (defvar xml-parse-tests--qnames '( ;; Test data for name expansion @@ -199,4 +199,4 @@ Parser is called with and without 'symbol-qnames argument.") ;; no-byte-compile: t ;; End: -;;; xml-parse-tests.el ends here. +;;; xml-tests.el ends here diff --git a/test/manual/biditest.el b/test/manual/biditest.el index a77fc15880..c84e7ed731 100644 --- a/test/manual/biditest.el +++ b/test/manual/biditest.el @@ -121,3 +121,5 @@ BidiCharacterTest.txt file." (message "%s" (bidi-resolved-levels))) (define-key global-map [f8] #'bidi-levels) + +;;; biditest.el ends here diff --git a/test/manual/cedet/ede-tests.el b/test/manual/cedet/ede-tests.el index 2af50860c6..17618381ef 100644 --- a/test/manual/cedet/ede-tests.el +++ b/test/manual/cedet/ede-tests.el @@ -80,4 +80,4 @@ The search is done with the current EDE root." (ede-locate-file-in-project loc file) (data-debug-insert-object-slots loc "]"))) -;;; ede-test.el ends here +;;; ede-tests.el ends here diff --git a/test/manual/cedet/semantic-tests.el b/test/manual/cedet/semantic-tests.el index 044db29cda..3e416cc6b2 100644 --- a/test/manual/cedet/semantic-tests.el +++ b/test/manual/cedet/semantic-tests.el @@ -271,3 +271,5 @@ tag that contains point, and return that." Lcount (semantic-tag-name target) (semantic-elapsed-time start nil))) Lcount))) + +;;; semantic-tests.el ends here diff --git a/test/manual/cedet/tests/test.el b/test/manual/cedet/tests/test.el index d1d0d1602f..34c03619f8 100644 --- a/test/manual/cedet/tests/test.el +++ b/test/manual/cedet/tests/test.el @@ -19,31 +19,29 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . -;;; Require -;; +;;; Code: + (require 'semantic) (require 'eieio "../eieio") ;; tags encapsulated in eval-when-compile and eval-and-compile ;; should be expanded out into the outer environment. (eval-when-compile - (require 'semantic-imenu) - ) + (require 'semantic-imenu)) (eval-and-compile (defconst const-1 nil) (defun function-1 (arg) - nil) - ) + nil)) ;;; Functions ;; (defun a-defun (arg1 arg2 &optional arg3) - "doc a" + "Doc a." nil) (defun a-defun-interactive (arg1 arg2 &optional arg3) - "doc a that is a command" + "Doc a that is a command." (interactive "R") nil) @@ -52,15 +50,15 @@ nil) (defsubst a-defsubst (arg1 arg2 &optional arg3) - "doc a-subst" + "Doc a-subst." nil) (defmacro a-defmacro (arg1 arg2 &optional arg3) - "doc a-macro" + "Doc a-macro." nil) (define-overload a-overload (arg) - "doc a-overload" + "Doc a-overload." nil) ;;; Methods @@ -81,16 +79,16 @@ ;;; Variables ;; (defvar a-defvar (cons 1 2) - "Variable a") + "Variable a.") ;; FIXME: This practice is not recommended in recent Emacs. Remove? (defvar a-defvar-star (cons 1 2) - "*User visible var a") + "*User visible var a.") -(defconst a-defconst 'a "var doc const") +(defconst a-defconst 'a "Var doc const.") (defcustom a-defcustom nil - "doc custom" + "Doc custom." :group 'a-defgroup :type 'boolean) @@ -111,7 +109,7 @@ (defgroup a-defgroup nil - "Group for `emacs-lisp' regression-test") + "Group for `emacs-lisp' regression-test.") ;;; Classes ;; @@ -154,3 +152,5 @@ "some value") (provide 'test) + +;;; test.el ends here diff --git a/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el b/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el index 36f6624472..86cc882546 100644 --- a/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el +++ b/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el @@ -732,7 +732,7 @@ Returns t if it visits a tags table, or nil if there are no more in the list." "Return the file name of the file whose tags point is within. Assumes the tags table is the current buffer. If RELATIVE is non-nil, file name returned is relative to tags -table file's directory. If RELATIVE is nil, file name returned +table file's directory. If RELATIVE is nil, file name returned is complete." (funcall file-of-tag-function relative)) diff --git a/test/manual/image-size-tests.el b/test/manual/image-size-tests.el index 44846a7a67..067a0bfc8e 100644 --- a/test/manual/image-size-tests.el +++ b/test/manual/image-size-tests.el @@ -17,6 +17,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Commentary: + ;; To test: Load the file and eval (image-size-tests). ;; A non-erroring result is a success. diff --git a/test/manual/image-transforms-tests.el b/test/manual/image-transforms-tests.el index debb74f2ed..acbaed5c0b 100644 --- a/test/manual/image-transforms-tests.el +++ b/test/manual/image-transforms-tests.el @@ -174,3 +174,5 @@ (test-scaling) (test-scaling-rotation) (goto-char (point-min)))) + +;;; image-transforms-tests.el ends here diff --git a/test/manual/redisplay-testsuite.el b/test/manual/redisplay-testsuite.el index 8e90f2d7a5..8a4828417c 100644 --- a/test/manual/redisplay-testsuite.el +++ b/test/manual/redisplay-testsuite.el @@ -350,3 +350,5 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff (test-redisplay-4) (test-redisplay-5) (goto-char (point-min)))) + +;;; redisplay-testsuite.el ends here diff --git a/test/misc/test-custom-libs.el b/test/misc/test-custom-libs.el index cc2be99dea..d826dfbcab 100644 --- a/test/misc/test-custom-libs.el +++ b/test/misc/test-custom-libs.el @@ -19,7 +19,7 @@ ;;; Commentary: -;; This file runs for all libraries with autoloads separate emacs +;; This file runs for all libraries with autoloads separate Emacs ;; processes of the form "emacs -batch -l LIB". ;;; Code: @@ -45,4 +45,4 @@ (cus-test-libs t) (should-not cus-test-libs-errors)) -;;; test-custom-deps.el ends here +;;; test-custom-libs.el ends here diff --git a/test/src/alloc-tests.el b/test/src/alloc-tests.el index 1324c2d3b4..5383c43603 100644 --- a/test/src/alloc-tests.el +++ b/test/src/alloc-tests.el @@ -58,3 +58,5 @@ (dolist (c (list 10003 ?b 128 ?c ?d (max-char) ?e)) (aset s 0 c) (should (equal s (make-string 1 c)))))) + +;;; alloc-tests.el ends here diff --git a/test/src/character-tests.el b/test/src/character-tests.el index f630b32a5e..ba24d49039 100644 --- a/test/src/character-tests.el +++ b/test/src/character-tests.el @@ -43,3 +43,5 @@ (should (= (string-width "áëòç" nil 4) 2)) (should (= (string-width "הַרְבֵּה אַהֲבָה") 9)) (should (= (string-width "הַרְבֵּה אַהֲבָה" nil 8) 4))) + +;;; character-tests.el ends here diff --git a/test/src/charset-tests.el b/test/src/charset-tests.el index 5c46627c16..23e201ad45 100644 --- a/test/src/charset-tests.el +++ b/test/src/charset-tests.el @@ -22,7 +22,9 @@ (require 'ert) (ert-deftest charset-decode-char () - "Test decode-char." + "Test `decode-char'." (should-error (decode-char 'ascii 0.5))) (provide 'charset-tests) + +;;; charset-tests.el ends here diff --git a/test/src/coding-tests.el b/test/src/coding-tests.el index 134f567670..1c585ea537 100644 --- a/test/src/coding-tests.el +++ b/test/src/coding-tests.el @@ -434,4 +434,4 @@ ;; End: (provide 'coding-tests) -;; coding-tests.el ends here +;;; coding-tests.el ends here diff --git a/test/src/comp-resources/comp-test-funcs.el b/test/src/comp-resources/comp-test-funcs.el index f2a246320a..eb2521e5d3 100644 --- a/test/src/comp-resources/comp-test-funcs.el +++ b/test/src/comp-resources/comp-test-funcs.el @@ -202,7 +202,7 @@ (defun comp-tests-err-arith-f () (/ 1 0)) (defun comp-tests-err-foo-f () - (error "foo")) + (error "Foo")) (defun comp-tests-condition-case-0-f () ;; Bpushhandler Bpophandler @@ -264,7 +264,7 @@ (% a b))) (defun comp-tests-doc-f () - "A nice docstring" + "A nice docstring." t) (defun comp-test-interactive-form0-f (dir) @@ -479,7 +479,7 @@ family))) (defun comp-test-46670-1-f (_) - "foo") + "Foo.") (defun comp-test-46670-2-f (s) (and (equal (comp-test-46670-1-f (length s)) s) @@ -647,7 +647,7 @@ (?> 2)))) (defun comp-test-big-interactive (filename &optional force arg load) - ;; Check non trivial interactive form using `byte-recompile-file'. + "Check non trivial interactive form using `byte-recompile-file'." (interactive (let ((file buffer-file-name) (file-name nil) @@ -683,17 +683,17 @@ (defun comp-test-no-return-1 (x) (while x - (error "foo"))) + (error "Foo"))) (defun comp-test-no-return-2 (x) (cond ((eql x '2) t) - ((error "bar") nil))) + ((error "Bar") nil))) (defun comp-test-no-return-3 ()) (defun comp-test-no-return-4 (x) (when x - (error "foo") + (error "Foo") (while (comp-test-no-return-3) (comp-test-no-return-3)))) diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index fb9441eb66..f1778b3856 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -1167,7 +1167,7 @@ Return a list of results." ;; 49 ((defun comp-tests-ret-type-spec-f () - (error "foo")) + (error "Foo")) nil) ;; 50 @@ -1373,7 +1373,7 @@ Return a list of results." (defun comp-tests-pure-checker-1 (_) "Check that inside `comp-tests-pure-caller-f' `comp-tests-pure-callee-f' is - folded." +folded." (should (cl-notany #'identity diff --git a/test/src/data-tests.el b/test/src/data-tests.el index b1e5fa0767..03dfae8cc3 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el @@ -26,10 +26,10 @@ (defconst data-tests--float-greater-than-fixnums (+ 1.0 most-positive-fixnum) "A floating-point value that is greater than all fixnums. It is also as small as conveniently possible, to make the tests sharper. -Adding 1.0 to most-positive-fixnum should suffice on all +Adding 1.0 to `most-positive-fixnum' should suffice on all practical Emacs platforms, since the result is a power of 2 and this is exactly representable and is greater than -most-positive-fixnum, which is just less than a power of 2.") +`most-positive-fixnum', which is just less than a power of 2.") (ert-deftest data-tests-= () (should-error (=)) @@ -204,11 +204,11 @@ most-positive-fixnum, which is just less than a power of 2.") ""))) (defun test-bool-vector-count-consecutive-tc (desc) - "Run a test case for bool-vector-count-consecutive. + "Run a test case for `bool-vector-count-consecutive'. DESC is a string describing the test. It is a sequence of hexadecimal digits describing the bool vector. We exhaustively test all counts at all possible positions in the vector by -comparing the subr with a much slower lisp implementation." +comparing the subr with a much slower Lisp implementation." (let ((bv (test-bool-vector-bv-from-hex-string desc))) (cl-loop for lf in '(nil t) @@ -338,7 +338,7 @@ comparing the subr with a much slower lisp implementation." (should (eq binding-test-some-local 'local)))) (ert-deftest binding-test-setq-default () - "Test that a setq-default has no effect when there is a local binding." + "Test that a `setq-default' has no effect when there is a local binding." (with-current-buffer binding-test-buffer-B ;; This variable is not local in this buffer. (let ((binding-test-some-local 'something-else)) @@ -399,28 +399,28 @@ comparing the subr with a much slower lisp implementation." (eq binding-test-some-local 'outer)))))) (ert-deftest binding-test-defvar-bool () - "Test DEFVAR_BOOL" + "Test DEFVAR_BOOL." (let ((display-hourglass 5)) (should (eq display-hourglass t)))) (ert-deftest binding-test-defvar-int () - "Test DEFVAR_INT" + "Test DEFVAR_INT." (should-error (setq gc-cons-threshold 5.0) :type 'wrong-type-argument)) (ert-deftest binding-test-set-constant-t () - "Test setting the constant t" + "Test setting the constant t." (with-no-warnings (should-error (setq t 'bob) :type 'setting-constant))) (ert-deftest binding-test-set-constant-nil () - "Test setting the constant nil" + "Test setting the constant nil." (with-no-warnings (should-error (setq nil 'bob) :type 'setting-constant))) (ert-deftest binding-test-set-constant-keyword () - "Test setting a keyword constant" + "Test setting a keyword constant." (with-no-warnings (should-error (setq :keyword 'bob) :type 'setting-constant))) (ert-deftest binding-test-set-constant-nil () - "Test setting a keyword to itself" + "Test setting a keyword to itself." (with-no-warnings (should (setq :keyword :keyword)))) (ert-deftest data-tests--set-default-per-buffer () diff --git a/test/src/decompress-tests.el b/test/src/decompress-tests.el index 520445cca5..1d25cf2f66 100644 --- a/test/src/decompress-tests.el +++ b/test/src/decompress-tests.el @@ -42,4 +42,4 @@ (provide 'decompress-tests) -;;; decompress-tests.el ends here. +;;; decompress-tests.el ends here diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index 438ebebb76..4143503aa1 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el @@ -17,6 +17,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Code: + (require 'ert) (defun try-link (target link) @@ -97,7 +99,7 @@ Also check that an encoding error can appear in a symlink." (should (equal (file-name-as-directory "D:/abc//") "d:/abc//"))) (ert-deftest fileio-tests--relative-HOME () - "Test that expand-file-name works even when HOME is relative." + "Test that `expand-file-name' works even when HOME is relative." (let ((process-environment (copy-sequence process-environment))) (setenv "HOME" "a/b/c") (should (equal (expand-file-name "~/foo") @@ -128,7 +130,7 @@ Also check that an encoding error can appear in a symlink." (if f (delete-file f))))) (ert-deftest fileio-tests--relative-default-directory () - "Test expand-file-name when default-directory is relative." + "Test `expand-file-name' when `default-directory' is relative." (let ((default-directory "some/relative/name")) (should (file-name-absolute-p (expand-file-name "foo")))) (let* ((default-directory "~foo") @@ -137,7 +139,7 @@ Also check that an encoding error can appear in a symlink." (not (eq (aref name 0) ?~)))))) (ert-deftest fileio-test--expand-file-name-null-bytes () - "Test that expand-file-name checks for null bytes in filenames." + "Test that `expand-file-name' checks for null bytes in filenames." (should-error (expand-file-name (concat "file" (char-to-string ?\0) ".txt")) :type 'wrong-type-argument) (should-error (expand-file-name "file.txt" (concat "dir" (char-to-string ?\0))) @@ -146,7 +148,7 @@ Also check that an encoding error can appear in a symlink." (should-error (expand-file-name "file.txt") :type 'wrong-type-argument))) (ert-deftest fileio-tests--file-name-absolute-p () - "Test file-name-absolute-p." + "Test `file-name-absolute-p'." (dolist (suffix '("" "/" "//" "/foo" "/foo/" "/foo//" "/foo/bar")) (unless (string-equal suffix "") (should (file-name-absolute-p suffix))) @@ -157,7 +159,7 @@ Also check that an encoding error can appear in a symlink." (should (not (file-name-absolute-p (concat "~nosuchuser" suffix))))))) (ert-deftest fileio-tests--circular-after-insert-file-functions () - "Test after-insert-file-functions as a circular list." + "Test `after-insert-file-functions' as a circular list." (let ((f (make-temp-file "fileio")) (after-insert-file-functions (list 'identity))) (setcdr after-insert-file-functions after-insert-file-functions) diff --git a/test/src/floatfns-tests.el b/test/src/floatfns-tests.el index 4a3c03d833..47fa194162 100644 --- a/test/src/floatfns-tests.el +++ b/test/src/floatfns-tests.el @@ -17,6 +17,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Code: + (require 'ert) (ert-deftest divide-extreme-sign () @@ -125,3 +127,5 @@ (ash (1- (ash 1 53)) 2045)))) (provide 'floatfns-tests) + +;;; floatfns-tests.el ends here diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index bd5a4358e6..5759457209 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -1114,3 +1114,5 @@ (should (= (line-number-at-pos nil) 11)) (should-error (line-number-at-pos -1)) (should-error (line-number-at-pos 100)))) + +;;; fns-tests.el ends here diff --git a/test/src/indent-tests.el b/test/src/indent-tests.el index 6a3f1a5c95..6cfe64c07e 100644 --- a/test/src/indent-tests.el +++ b/test/src/indent-tests.el @@ -57,3 +57,5 @@ (move-to-column 12 t) (buffer-substring-no-properties 1 14)) "\txxx \tLine"))) + +;;; indent-tests.el ends here diff --git a/test/src/inotify-tests.el b/test/src/inotify-tests.el index 5572c7d7a0..8aab7eeb30 100644 --- a/test/src/inotify-tests.el +++ b/test/src/inotify-tests.el @@ -70,4 +70,4 @@ (provide 'inotify-tests) -;;; inotify-tests.el ends here. +;;; inotify-tests.el ends here diff --git a/test/src/lcms-tests.el b/test/src/lcms-tests.el index 40a48f1e9b..d2d137e9bd 100644 --- a/test/src/lcms-tests.el +++ b/test/src/lcms-tests.el @@ -95,7 +95,7 @@ B is considered the exact value." '(0.29902 0.31485 1.0)))) (ert-deftest lcms-roundtrip () - "Test accuracy of converting to and from different color spaces" + "Test accuracy of converting to and from different color spaces." (skip-unless (featurep 'lcms2)) (should (let ((color '(.5 .3 .7))) @@ -109,7 +109,7 @@ B is considered the exact value." 0.0001)))) (ert-deftest lcms-ciecam02-gold () - "Test CIE CAM02 JCh gold values" + "Test CIE CAM02 JCh gold values." (skip-unless (featurep 'lcms2)) (should (lcms-triple-approx-p diff --git a/test/src/marker-tests.el b/test/src/marker-tests.el index 234a0b35ea..cf8e82cd56 100644 --- a/test/src/marker-tests.el +++ b/test/src/marker-tests.el @@ -57,4 +57,4 @@ (set-marker marker-2 marker-1) (should (goto-char marker-2)))) -;;; marker-tests.el ends here. +;;; marker-tests.el ends here diff --git a/test/src/minibuf-tests.el b/test/src/minibuf-tests.el index feea1c112b..51d9c67453 100644 --- a/test/src/minibuf-tests.el +++ b/test/src/minibuf-tests.el @@ -414,8 +414,8 @@ (let ((inhibit-interaction t)) (should-error (read-from-minibuffer "foo: ") :type 'inhibited-interaction) - (should-error (y-or-n-p "foo: ") :type 'inhibited-interaction) - (should-error (yes-or-no-p "foo: ") :type 'inhibited-interaction) + (should-error (y-or-n-p "Foo?") :type 'inhibited-interaction) + (should-error (yes-or-no-p "Foo?") :type 'inhibited-interaction) (should-error (read-no-blanks-input "foo: ") :type 'inhibited-interaction) ;; See that we get the expected error. diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 9bab523708..e39f57d23b 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -745,7 +745,7 @@ Return nil if that can't be determined." process-tests--EMFILE-message) (ert-deftest process-tests/sentinel-called () - "Check that sentinels are called after processes finish" + "Check that sentinels are called after processes finish." (let ((command (process-tests--emacs-command))) (skip-unless command) (dolist (conn-type '(pipe pty)) diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el index 0607eacf39..71e3189443 100644 --- a/test/src/regex-emacs-tests.el +++ b/test/src/regex-emacs-tests.el @@ -279,11 +279,11 @@ on success" (defconst regex-tests-re-even-escapes "\\(?:^\\|[^\\]\\)\\(?:\\\\\\\\\\)*" - "Regex that matches an even number of \\ characters") + "Regex that matches an even number of \\ characters.") (defconst regex-tests-re-odd-escapes (concat regex-tests-re-even-escapes "\\\\") - "Regex that matches an odd number of \\ characters") + "Regex that matches an odd number of \\ characters.") (defun regex-tests-unextend (pattern) @@ -396,9 +396,9 @@ pattern)" ;; emacs matches non-greedy regex ab.*? non-greedily 639 677 712 ] - "Line numbers in the boost test that should be skipped. These -are false-positive test failures that represent known/benign -differences in behavior.") + "Line numbers in the boost test that should be skipped. +These are false-positive test failures that represent +known/benign differences in behavior.") ;; - Format ;; - Comments are lines starting with ; @@ -480,9 +480,9 @@ differences in behavior.") ;; ambiguous groupings are ambiguous 610 611 1154 1157 1160 1168 1171 1176 1179 1182 1185 1188 1193 1196 1203 ] - "Line numbers in the PCRE test that should be skipped. These -are false-positive test failures that represent known/benign -differences in behavior.") + "Line numbers in the PCRE test that should be skipped. +These are false-positive test failures that represent +known/benign differences in behavior.") ;; - Format ;; @@ -562,9 +562,9 @@ differences in behavior.") ;; fails to match 168 ] - "Line numbers in the PTESTS test that should be skipped. These -are false-positive test failures that represent known/benign -differences in behavior.") + "Line numbers in the PTESTS test that should be skipped. +These are false-positive test failures that represent +known/benign differences in behavior.") ;; - Format ;; - fields separated by ¦ (note: this is not a |) @@ -621,9 +621,9 @@ differences in behavior.") ;; emacs is more stringent with regexes involving unbalanced ) 67 ] - "Line numbers in the TESTS test that should be skipped. These -are false-positive test failures that represent known/benign -differences in behavior.") + "Line numbers in the TESTS test that should be skipped. +These are false-positive test failures that represent +known/benign differences in behavior.") ;; - Format ;; - fields separated by :. Watch for [\[:xxx:]] diff --git a/test/src/textprop-tests.el b/test/src/textprop-tests.el index b083588e64..c001579c47 100644 --- a/test/src/textprop-tests.el +++ b/test/src/textprop-tests.el @@ -69,4 +69,4 @@ (null stack))))) (provide 'textprop-tests) -;; textprop-tests.el ends here. +;;; textprop-tests.el ends here diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el index fc7bc7441b..52eace7e9d 100644 --- a/test/src/thread-tests.el +++ b/test/src/thread-tests.el @@ -70,12 +70,12 @@ (thread-live-p (make-thread #'ignore)))) (ert-deftest threads-all-threads () - "Simple test for all-threads." + "Simple test for `all-threads'." (skip-unless (featurep 'threads)) (should (listp (all-threads)))) (ert-deftest threads-main-thread () - "Simple test for all-threads." + "Simple test for `all-threads'." (skip-unless (featurep 'threads)) (should (eq main-thread (car (all-threads))))) @@ -155,7 +155,7 @@ (should (eq (type-of (make-mutex)) 'mutex))) (ert-deftest threads-mutex-lock-unlock () - "Test mutex-lock and unlock." + "Test `mutex-lock' and unlock." (skip-unless (featurep 'threads)) (should (let ((mx (make-mutex))) @@ -392,4 +392,4 @@ (let ((th (make-thread 'ignore))) (should-not (equal th main-thread)))) -;;; threads.el ends here +;;; thread-tests.el ends here diff --git a/test/src/timefns-tests.el b/test/src/timefns-tests.el index 0a450a7573..bba9b3fcd8 100644 --- a/test/src/timefns-tests.el +++ b/test/src/timefns-tests.el @@ -241,3 +241,5 @@ a fixed place on the right and are padded on the left." (let ((xdiv (/ x divisor))) (should (= xdiv (float-time (time-convert xdiv t)))))) (setq x (* x 2))))) + +;;; timefns-tests.el ends here diff --git a/test/src/xfaces-tests.el b/test/src/xfaces-tests.el index 0a7ef55b2b..cba706f453 100644 --- a/test/src/xfaces-tests.el +++ b/test/src/xfaces-tests.el @@ -17,6 +17,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Code: + (require 'ert) (ert-deftest xfaces-color-distance () @@ -48,3 +50,5 @@ (should (equal (color-values-from-color-spec "rgbi:0/0.5/10") nil))) (provide 'xfaces-tests) + +;;; xfaces-tests.el ends here diff --git a/test/src/xml-tests.el b/test/src/xml-tests.el index a35b4d2ccc..7c4ca396f7 100644 --- a/test/src/xml-tests.el +++ b/test/src/xml-tests.el @@ -52,4 +52,4 @@ (should (equal (cdr test) (libxml-parse-xml-region (point-min) (point-max))))))) -;;; libxml-tests.el ends here +;;; xml-tests.el ends here commit 4cc43449432427817400bad12e7ef722e6591a21 Author: Stephen Gildea Date: Sun Sep 26 08:23:29 2021 -0700 ; Clarify and simplify time-stamp comments * lisp/time-stamp.el (time-stamp-end, time-stamp-string-preprocess, time-stamp-formatz-from-parsed-options): Simplify doc. * test/lisp/time-stamp-tests.el (time-stamp-custom-pattern): Refactor to set limit-number only once. diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index 5258742845..663773281b 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -41,6 +41,7 @@ :group 'data :group 'extensions) + (defcustom time-stamp-format "%Y-%02m-%02d %02H:%02M:%02S %l" "Format of the string inserted by \\[time-stamp]. This is a string, used verbatim except for character sequences beginning @@ -92,6 +93,7 @@ edited by older versions of Emacs also, do not use this format yet." :version "27.1") ;;;###autoload(put 'time-stamp-format 'safe-local-variable 'stringp) + (defcustom time-stamp-active t "Non-nil to enable time-stamping of buffers by \\[time-stamp]. Can be toggled by \\[time-stamp-toggle-active]. @@ -109,6 +111,7 @@ line to a local variables list near the end of the file: See also the variable `time-stamp-warn-inactive'." :type 'boolean) + (defcustom time-stamp-warn-inactive t "Have \\[time-stamp] warn if a buffer did not get time-stamped. If non-nil, a warning is displayed if `time-stamp-active' has @@ -117,6 +120,7 @@ otherwise would have been updated." :type 'boolean :version "19.29") + (defcustom time-stamp-time-zone nil "The time zone to be used by \\[time-stamp]. Its format is that of the ZONE argument of the `format-time-string' function." @@ -131,6 +135,7 @@ Its format is that of the ZONE argument of the `format-time-string' function." :version "20.1") ;;;###autoload(put 'time-stamp-time-zone 'safe-local-variable 'time-stamp-zone-type-p) + ;;;###autoload (defun time-stamp-zone-type-p (zone) "Return whether or not ZONE is of the correct type for a timezone rule. @@ -143,6 +148,7 @@ Valid ZONE values are described in the documentation of `format-time-string'." (stringp (cadr zone))) (integerp zone))) + ;;; Do not change time-stamp-line-limit, time-stamp-start, ;;; time-stamp-end, time-stamp-pattern, time-stamp-inserts-lines, ;;; or time-stamp-count in your .emacs or you will be incompatible @@ -167,6 +173,7 @@ If you were to change `time-stamp-line-limit', `time-stamp-start', would be incompatible with other people's files.") ;;;###autoload(put 'time-stamp-line-limit 'safe-local-variable 'integerp) + (defvar time-stamp-start "Time-stamp:[ \t]+\\\\?[\"<]+" ;Do not change! "Regexp after which the time stamp is written by \\[time-stamp]. @@ -180,6 +187,7 @@ If you were to change `time-stamp-line-limit', `time-stamp-start', would be incompatible with other people's files.") ;;;###autoload(put 'time-stamp-start 'safe-local-variable 'stringp) + (defvar time-stamp-end "\\\\?[\">]" ;Do not change! "Regexp marking the text after the time stamp. \\[time-stamp] deletes the text between the first match of `time-stamp-start' @@ -192,8 +200,8 @@ or `time-stamp-format'. The end text normally starts on the same line as the start text ends, but if there are any newlines in `time-stamp-format', the same number -of newlines must separate the start and end. \\[time-stamp] tries -to not change the number of lines in the buffer. `time-stamp-inserts-lines' +of newlines must separate the start and end. Thus \\[time-stamp] tries +to not change the number of lines in the buffer; `time-stamp-inserts-lines' controls this behavior. These variables are best changed with file-local variables. @@ -469,9 +477,8 @@ normally the current time is used." (defconst time-stamp-no-file "(no file)" "String to use when the buffer is not associated with a file.") -;;; time-stamp is transitioning to be compatible with format-time-string. -;;; During the process, this function implements -;;; intermediate, compatible formats. +;;; time-stamp is transitioning to be more compatible with format-time-string. +;;; This function implements the differences. ;;; At all times, all the formats recommended in the doc string ;;; of time-stamp-format will work not only in the current version of ;;; Emacs, but in all versions that have been released within the past @@ -713,6 +720,7 @@ This is an internal helper for `time-stamp-string-preprocess'." "" ;discourage "%:2d" and the like (string-to-number (time-stamp--format format-string time))))) + (defvar time-stamp-conversion-warn t "Enable warnings about soon-to-be-unsupported forms in `time-stamp-format'. If nil, these warnings are disabled, which would be a bad idea! @@ -740,6 +748,7 @@ Suggests replacing OLD-FORM with NEW-FORM." (insert "\"" old-form "\" -- use " new-form "\n")) (display-buffer "*Time-stamp-compatibility*")))) + ;;; A principled, expressive implementation of time zone offset ;;; formatting ("%z" and variants). @@ -816,15 +825,13 @@ Suggests replacing OLD-FORM with NEW-FORM." ;;; * ABNF syntax of the offset string produced by %z -;; offset = sign hours [minutes [seconds]] padding / -;; sign hours [colonminutes [colonseconds]] padding / -;; sign bighours colonminutes [colonseconds] padding +;; offset = sign ( hours [minutes [seconds]] / +;; hours [":" minutes [":" seconds]] / +;; bighours ":" minutes [":" seconds] ) padding ;; sign = "+" / "-" ;; hours = digitpair ;; minutes = digitpair ;; seconds = digitpair -;; colonminutes = ":" minutes -;; colonseconds = ":" seconds ;; digitpair = digit digit ;; digit = "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" ;; bighours = 1*digit digitpair @@ -837,8 +844,6 @@ Suggests replacing OLD-FORM with NEW-FORM." field-width offset-secs) "Formats a time offset according to a %z variation. -The caller of this function must have already parsed the %z format -string; this function accepts just the parts of the format. With no flags, the output includes hours and minutes: +-HHMM unless there is a non-zero seconds part, in which case the seconds @@ -865,7 +870,14 @@ added on the right if necessary. The added characters will be spaces unless FLAG-PAD-ZEROS-FIRST is non-nil. OFFSET-SECS is the time zone offset (in seconds east of UTC) to be -formatted according to the preceding parameters." +formatted according to the preceding parameters. + +This is an internal function used by `time-stamp'." + ;; The caller of this function must have already parsed the %z + ;; format string; this function accepts just the parts of the format. + ;; `time-stamp-string-preprocess' is the full-fledged parser normally + ;; used. The unit test (in time-stamp-tests.el) defines the simpler + ;; parser `format-time-offset'. (let ((hrs (/ (abs offset-secs) 3600)) (mins (/ (% (abs offset-secs) 3600) 60)) (secs (% (abs offset-secs) 60)) diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index 4e6fbbba92..dc628af19f 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -141,9 +141,9 @@ ts-format _format-lines _end-lines) ;; Verify that time-stamp parsed time-stamp-pattern and ;; called us with the correct pieces. - (let ((limit-number (string-to-number line-limit1))) - (if (equal line-limit1 "") - (setq limit-number time-stamp-line-limit)) + (let ((limit-number (if (equal line-limit1 "") + time-stamp-line-limit + (string-to-number line-limit1)))) (goto-char (point-min)) (if (> limit-number 0) (should (= search-limit (line-beginning-position commit 5b44e0511a881593eb62ff1648be37ac1c728ecc Author: Eli Zaretskii Date: Sun Sep 26 16:50:11 2021 +0300 ; Fix some recent fixes to doc strings * lisp/whitespace.el (whitespace-empty-at-bob-regexp): * lisp/vc/vc-dir.el (vc-dir-child-files-and-states): * lisp/vc/vc-annotate.el (vc-annotate-show-changeset-diff-revision-at-line): * lisp/vc/ediff.el (ediff-merge-with-ancestor-command): * lisp/gnus/nnvirtual.el (nnvirtual-update-xref-header) (nnvirtual-map-article): * lisp/emulation/viper-init.el (viper-ESC-keyseq-timeout): * lisp/emulation/viper-cmd.el (viper-set-parsing-style-toggling-macro): * lisp/cedet/data-debug.el (data-debug-insert-hash-table-button): "The first line of a doc string must be a complete sentence." Also, fix some awkward wording in doc strings while at that. diff --git a/lisp/cedet/data-debug.el b/lisp/cedet/data-debug.el index 8f40a4db79..d8d1364491 100644 --- a/lisp/cedet/data-debug.el +++ b/lisp/cedet/data-debug.el @@ -413,8 +413,9 @@ PREBUTTONTEXT is some text between prefix and the stuff list button." ) (defun data-debug-insert-hash-table-button (hash-table prefix prebuttontext) - "Insert HASH-TABLE as expandable button with recursive prefix PREFIX and -PREBUTTONTEXT in front of the button text." + "Insert HASH-TABLE as expandable button, using PREFIX and PREBUTTONTEXT. +PREFIX is a recursive prefix and PREBUTTONTEXT is text to be inserted +in front of the button text." (let ((string (propertize (format "%s" hash-table) 'face 'font-lock-keyword-face))) (insert (propertize diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index b132d786eb..3fcc14c99d 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -3546,11 +3546,11 @@ If MODE is set, set the macros only in that major mode." (defun viper-set-parsing-style-toggling-macro (unset) - "Set `%%%' to be a macro that toggles whether comment fields should be parsed -for matching parentheses. + "Set or unset `%%%' as a macro that toggles comment parsing for parentheses. This is used in conjunction with the `%' command. - -With a prefix argument, unsets the macro." +By default, sets the macro which will toggle whether comment fields should +be parsed for matching parentheses. With a prefix argument, unsets the +macro instead." (interactive "P") (or noninteractive (if (not unset) diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index ffcb4602e7..fe3704841a 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el @@ -932,8 +932,9 @@ Should be set in `viper-custom-file-name'." (setq cursor-type '(bar . 2))) (defun viper-ESC-keyseq-timeout () - "Key sequence beginning with ESC and separated by no more than this many -milliseconds is considered to be generated by a keyboard function key. + "Return the timeout for considering an ESC sequence to be a function key. +Sequences of keys beginning with ESC and separated by no more than this many +milliseconds are considered to be generated by a keyboard function key. Setting this too high may slow down switching from insert to vi state. Setting this value too low will make it impossible to use function keys in insert mode on a dumb terminal." diff --git a/lisp/gnus/nnvirtual.el b/lisp/gnus/nnvirtual.el index 4136392c82..41a2da958a 100644 --- a/lisp/gnus/nnvirtual.el +++ b/lisp/gnus/nnvirtual.el @@ -382,8 +382,10 @@ It is computed from the marks of individual component groups.") (defun nnvirtual-update-xref-header (group article prefix sysname) - "Edit current NOV header in current buffer to have an xref to the component -group, and also server prefix any existing xref lines." + "Edit current NOV header to have xref to component group and correct prefix. +This function edits the current NOV header in current buffer so that it +has an xref to the component group, and also ensures any existing xref +lines have the correct component server prefix." ;; Move to beginning of Xref field, creating a slot if needed. (beginning-of-line) (looking-at @@ -570,7 +572,8 @@ If UPDATE-P is not nil, call gnus-group-update-group on the components." ;; unique reverse mapping. (defun nnvirtual-map-article (article) - "Return a cons of the component group and article corresponding to the given + "Return the component group and article corresponding to virtual ARTICLE. +Value is a cons of the component group and article corresponding to the given virtual ARTICLE." (let ((table nnvirtual-mapping-table) entry group-pos) diff --git a/lisp/vc/ediff.el b/lisp/vc/ediff.el index e406275cd1..49fc60431f 100644 --- a/lisp/vc/ediff.el +++ b/lisp/vc/ediff.el @@ -1600,8 +1600,7 @@ With optional NODE, goes to that node." ;;;###autoload (defun ediff-merge-with-ancestor-command () - "Call `ediff-merge-files-with-ancestor' with the next three command line -arguments." + "Call `ediff-merge-files-with-ancestor' with next three command line arguments." (let ((file-a (nth 0 command-line-args-left)) (file-b (nth 1 command-line-args-left)) (ancestor (nth 2 command-line-args-left))) diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el index 5a4ac1aca8..def87db871 100644 --- a/lisp/vc/vc-annotate.el +++ b/lisp/vc/vc-annotate.el @@ -610,7 +610,7 @@ the file in question, search for the log entry required and move point." (vc-annotate-show-diff-revision-at-line-internal t)) (defun vc-annotate-show-changeset-diff-revision-at-line () - "Visit diff of revision at line from previous revision. + "Show the diffs of revision at current line relative to previous revision. This is done for all files in changeset." (interactive) (when (eq 'file (vc-call-backend vc-annotate-backend 'revision-granularity)) diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index d079b891e4..8165d5e09f 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -1015,9 +1015,11 @@ child files." (nreverse result))) (defun vc-dir-child-files-and-states () - "Return list of conses for child files of the current entry if it's a directory. -The conses have the format (FILE . STATE). -If it is a file, return the corresponding cons for the file itself." + "Return the state of one or more files for the current entry. +If the entry is a directory, return the list of states of its child +files, where each file is described by a cons of the form (FILE . STATE). +If the entry is a file, return a single cons cell (FILE . STATE) for +that file." (let* ((crt (ewoc-locate vc-ewoc)) (crt-data (ewoc-data crt)) result) diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 6e132de536..017409d6a4 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -2193,8 +2193,7 @@ resultant list will be returned." limit t)) (defun whitespace-empty-at-bob-regexp (limit) - "Match spaces at beginning of buffer which do not contain -the point at beginning of buffer." + "Match spaces at beginning of buffer (BOB) which do not contain point at BOB." (let ((b (point)) r) (cond commit b8b1d8dee7e30415b057b7a45f288fda3601274f Author: Stefan Kangas Date: Sun Sep 26 15:29:20 2021 +0200 Add fast-path to ert--explain-string-equal * lisp/emacs-lisp/ert.el (ert--explain-string-equal): Add fast-path to avoid doing extra work. Problem reported by Mattias Engdegård . diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index e72321f90f..72fe19461f 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -543,9 +543,11 @@ Returns nil if they are." (defun ert--explain-string-equal (a b) "Explainer function for `string-equal'." ;; Convert if they are symbols. - (let ((as (if (symbolp a) (symbol-name a) a)) - (bs (if (symbolp b) (symbol-name b) b))) - (ert--explain-equal-rec as bs))) + (if (string-equal a b) + nil + (let ((as (if (symbolp a) (symbol-name a) a)) + (bs (if (symbolp b) (symbol-name b) b))) + (ert--explain-equal-rec as bs)))) (put 'string-equal 'ert-explainer 'ert--explain-string-equal) (defun ert--significant-plist-keys (plist) commit 94af99b298381d7d8e08b6d76de00906c74d9421 Author: Michael Albinus Date: Sun Sep 26 15:28:17 2021 +0200 * test/infra/gitlab-ci.yml (variables): Set DOCKER_BUILDKIT. diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index 0b12f96f4c..898fb341b2 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -50,6 +50,7 @@ variables: # DOCKER_TLS_CERTDIR: "/certs" # Put the configuration for each run in a separate directory to avoid conflicts DOCKER_CONFIG: "/.docker-config-${CI_COMMIT_SHA}" + DOCKER_BUILDKIT: 1 # We don't use ${CI_COMMIT_SHA} to be able to do one bootstrap across multiple builds BUILD_TAG: ${CI_COMMIT_REF_SLUG} commit 3bab1476f63075671b6c40c4ad13d758a0064caa Author: Stefan Kangas Date: Sun Sep 26 14:32:58 2021 +0200 Rename "Homepage" field to "Website" in package description * lisp/emacs-lisp/package.el (describe-package-1): Rename "Homepage" field to "Website". * test/lisp/emacs-lisp/package-tests.el (package-test-describe-package) (package-test-describe-installed-multi-file-package) (package-test-describe-non-installed-package) (package-test-describe-non-installed-multi-file-package): Update tests. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 94087d172c..62f5fc7341 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1118,7 +1118,7 @@ is wrapped around any parts requiring it." (declare-function lm-header "lisp-mnt" (header)) (declare-function lm-header-multiline "lisp-mnt" (header)) -(declare-function lm-homepage "lisp-mnt" (&optional file)) +(declare-function lm-website "lisp-mnt" (&optional file)) (declare-function lm-keywords-list "lisp-mnt" (&optional file)) (declare-function lm-maintainers "lisp-mnt" (&optional file)) (declare-function lm-authors "lisp-mnt" (&optional file)) @@ -1153,7 +1153,7 @@ boundaries." (or (lm-header "package-version") (lm-header "version"))) (pkg-version (package-strip-rcs-id version-info)) (keywords (lm-keywords-list)) - (homepage (lm-homepage))) + (website (lm-website))) (unless pkg-version (if version-info (error "Unrecognized package version: %s" version-info) @@ -1164,7 +1164,7 @@ boundaries." (package--prepare-dependencies (package-read-from-string (mapconcat #'identity require-lines " ")))) :kind 'single - :url homepage + :url website :keywords keywords :maintainer ;; For backward compatibility, use a single string if there's only @@ -2170,7 +2170,7 @@ Otherwise return nil." ;; to make sure we use a "canonical name"! (if l (package-version-join l))))) -(declare-function lm-homepage "lisp-mnt" (&optional file)) +(declare-function lm-website "lisp-mnt" (&optional file)) ;;;###autoload (defun package-install-from-buffer () @@ -2506,7 +2506,7 @@ Helper function for `describe-package'." (version (if desc (package-desc-version desc))) (archive (if desc (package-desc-archive desc))) (extras (and desc (package-desc-extras desc))) - (homepage (cdr (assoc :url extras))) + (website (cdr (assoc :url extras))) (commit (cdr (assoc :commit extras))) (keywords (if desc (package-desc--keywords desc))) (built-in (eq pkg-dir 'builtin)) @@ -2619,20 +2619,20 @@ Helper function for `describe-package'." (help-insert-xref-button text 'help-package (package-desc-name pkg)))) (insert "\n"))) - (when homepage - ;; Prefer https for the homepage of packages on common domains. + (when website + ;; Prefer https for the website of packages on common domains. (when (string-match-p (rx bol "http://" (or "elpa." "www." "git." "") (or "nongnu.org" "gnu.org" "sr.ht" "emacswiki.org" "gitlab.com" "github.com") "/") - homepage) + website) ;; But only if the user has "https" in `package-archives'. (let ((gnu (cdr (assoc "gnu" package-archives)))) (and gnu (string-match-p "^https" gnu) - (setq homepage - (replace-regexp-in-string "^http" "https" homepage))))) - (package--print-help-section "Homepage") - (help-insert-xref-button homepage 'help-url homepage) + (setq website + (replace-regexp-in-string "^http" "https" website))))) + (package--print-help-section "Website") + (help-insert-xref-button website 'help-url website) (insert "\n")) (when keywords (package--print-help-section "Keywords") diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index 2943579955..77bc8117cf 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -636,7 +636,7 @@ but with a different end of line convention (bug#48137)." (save-excursion (should (re-search-forward "Status: Installed in ['`‘]simple-single-1.3/['’] (unsigned)." nil t))) (save-excursion (should (search-forward "Version: 1.3" nil t))) (save-excursion (should (search-forward "Summary: A single-file package with no dependencies" nil t))) - (save-excursion (should (search-forward "Homepage: http://doodles.au" nil t))) + (save-excursion (should (search-forward "Website: http://doodles.au" nil t))) (save-excursion (should (re-search-forward "Keywords: \\[?frobnicate\\]?" nil t))) (save-excursion (should (search-forward "This package provides a minor mode to frobnicate" nil t))) @@ -652,7 +652,7 @@ but with a different end of line convention (bug#48137)." (with-fake-help-buffer (describe-package 'multi-file) (goto-char (point-min)) - (should (search-forward "Homepage: http://puddles.li" nil t)) + (should (search-forward "Website: http://puddles.li" nil t)) (should (search-forward "This is a bare-bones readme file for the multi-file" nil t))))) @@ -665,7 +665,7 @@ but with a different end of line convention (bug#48137)." (with-fake-help-buffer (describe-package 'simple-single) (goto-char (point-min)) - (should (search-forward "Homepage: http://doodles.au" nil t)) + (should (search-forward "Website: http://doodles.au" nil t)) (should (search-forward "This package provides a minor mode to frobnicate" nil t))))) @@ -678,7 +678,7 @@ but with a different end of line convention (bug#48137)." (with-fake-help-buffer (describe-package 'multi-file) (goto-char (point-min)) - (should (search-forward "Homepage: http://puddles.li" nil t)) + (should (search-forward "Website: http://puddles.li" nil t)) (should (search-forward "This is a bare-bones readme file for the multi-file" nil t))))) commit 8ea1765fea35e68189ba5edca74d61660950ee8b Author: Stefan Kangas Date: Sun Sep 26 14:29:41 2021 +0200 Prefer https for other domains than gnu.org in package URL * lisp/emacs-lisp/package.el (describe-package-1): Prefer https for some other common domains in the package URL. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index a0bfcbb24f..94087d172c 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2620,12 +2620,17 @@ Helper function for `describe-package'." (package-desc-name pkg)))) (insert "\n"))) (when homepage - ;; Prefer https for the homepage of packages on gnu.org. - (if (string-match-p "^http://\\(elpa\\|www\\)\\.gnu\\.org/" homepage) - (let ((gnu (cdr (assoc "gnu" package-archives)))) - (and gnu (string-match-p "^https" gnu) - (setq homepage - (replace-regexp-in-string "^http" "https" homepage))))) + ;; Prefer https for the homepage of packages on common domains. + (when (string-match-p (rx bol "http://" (or "elpa." "www." "git." "") + (or "nongnu.org" "gnu.org" "sr.ht" + "emacswiki.org" "gitlab.com" "github.com") + "/") + homepage) + ;; But only if the user has "https" in `package-archives'. + (let ((gnu (cdr (assoc "gnu" package-archives)))) + (and gnu (string-match-p "^https" gnu) + (setq homepage + (replace-regexp-in-string "^http" "https" homepage))))) (package--print-help-section "Homepage") (help-insert-xref-button homepage 'help-url homepage) (insert "\n")) commit a0d5de4fb9de82dfda741c5cf39d87cee955cc46 Author: Stefan Kangas Date: Sun Sep 26 14:13:03 2021 +0200 Add test for lm-website * lisp/emacs-lisp/lisp-mnt.el (lm-website): Use rx. * test/lisp/emacs-lisp/lisp-mnt-tests.el (lm--tests-lm-website): New test. diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el index b27c7e78a8..96ac054a7d 100644 --- a/lisp/emacs-lisp/lisp-mnt.el +++ b/lisp/emacs-lisp/lisp-mnt.el @@ -501,9 +501,9 @@ absent, return nil." (defun lm-website (&optional file) "Return the website in file FILE, or current buffer if FILE is nil." (let ((page (lm-with-file file - (lm-header "\\(?:x-\\)?\\(?:url\\|homepage\\)")))) - (if (and page (string-match "^<.+>$" page)) - (substring page 1 -1) + (lm-header (rx (? "x-") (or "url" "homepage")))))) + (if (and page (string-match (rx bol "<" (+ nonl) ">" eol) page)) + (substring page 1 -1) page))) (defalias 'lm-homepage 'lm-website) ; for backwards-compatibility diff --git a/test/lisp/emacs-lisp/lisp-mnt-tests.el b/test/lisp/emacs-lisp/lisp-mnt-tests.el index 84cdc7205f..d77804fbe6 100644 --- a/test/lisp/emacs-lisp/lisp-mnt-tests.el +++ b/test/lisp/emacs-lisp/lisp-mnt-tests.el @@ -32,5 +32,13 @@ '(("Bob Weiner" . "rsw@gnu.org") ("Mats Lidell" . "matsl@gnu.org"))))) +(ert-deftest lm--tests-lm-website () + (with-temp-buffer + (insert ";; URL: https://example.org/foo") + (should (string= (lm-website) "https://example.org/foo"))) + (with-temp-buffer + (insert ";; X-URL: ") + (should (string= (lm-website) "https://example.org/foo")))) + (provide 'lisp-mnt-tests) ;;; lisp-mnt-tests.el ends here commit 6e1de14e51f692684ccaffb7113ca0e6c135ba41 Author: Mattias Engdegård Date: Sun Sep 26 14:36:02 2021 +0200 Rx documentation touch-ups (bug#46910) * doc/lispref/searching.texi (Rx Constructs, Rx Functions): Add clarifications and improve naming of arguments. Add examples illustrating the differences between `rx` and `rx-to-string`. diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 9451d83def..d27cfb8c0c 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -1060,7 +1060,8 @@ customization. The various forms in @code{rx} regexps are described below. The shorthand @var{rx} represents any @code{rx} form, and @var{rx}@dots{} -means zero or more @code{rx} forms. Where the corresponding string +means zero or more @code{rx} forms. These are all valid arguments to +the @code{rx} macro. Where the corresponding string regexp syntax is given, @var{A}, @var{B}, @dots{} are string regexp subexpressions. @@ -1356,7 +1357,8 @@ names: For details, @pxref{Syntax Class Table}. Please note that @code{(syntax punctuation)} is @emph{not} equivalent to the character class @code{punctuation}.@* -Corresponding string regexp: @samp{\s@var{code}} +Corresponding string regexp: @samp{\s@var{char}} where @var{char} is the +syntax character. @item @code{(category @var{category})} @cindex @code{category} in rx @@ -1413,7 +1415,8 @@ the names below or its category character. For more information about currently defined categories, run the command @kbd{M-x describe-categories @key{RET}}. For how to define new categories, @pxref{Categories}.@* -Corresponding string regexp: @samp{\c@var{code}} +Corresponding string regexp: @samp{\c@var{char}} where @var{char} is the +category character. @end table @subsubheading Zero-width assertions @@ -1543,11 +1546,18 @@ in the current global environment. @node Rx Functions @subsubsection Functions and macros using @code{rx} regexps -@defmac rx rx-expr@dots{} -Translate the @var{rx-expr}s to a string regexp, as if they were the +@defmac rx rx-form@dots{} +Translate the @var{rx-form}s to a string regexp, as if they were the body of a @code{(seq @dots{})} form. The @code{rx} macro expands to a string constant, or, if @code{literal} or @code{regexp} forms are -used, a Lisp expression that evaluates to a string. +used, a Lisp expression that evaluates to a string. Example: + +@example +@group +(rx (+ alpha) "=" (+ digit)) + @result{} "[[:alpha:]]+=[[:digit:]]+" +@end group +@end example @end defmac @defun rx-to-string rx-expr &optional no-group @@ -1555,6 +1565,14 @@ Translate @var{rx-expr} to a string regexp which is returned. If @var{no-group} is absent or nil, bracket the result in a non-capturing group, @samp{\(?:@dots{}\)}, if necessary to ensure that a postfix operator appended to it will apply to the whole expression. +Example: + +@example +@group +(rx-to-string '(seq (+ alpha) "=" (+ digit)) t) + @result{} "[[:alpha:]]+=[[:digit:]]+" +@end group +@end example Arguments to @code{literal} and @code{regexp} forms in @var{rx-expr} must be string literals. commit c51b1c02db636ac66402432ed9416f80a4a9b2b5 Author: Stefan Kangas Date: Fri Sep 24 19:10:46 2021 +0200 Warn about overly long docstring in lambda * lisp/emacs-lisp/bytecomp.el (byte-compile-docstring-length-warn): Warn about overly long docstring in lambda. (Bug#44858) (byte-compile--wide-docstring-p): Improve comment. * test/lisp/emacs-lisp/bytecomp-tests.el ("warn-wide-docstring-defun.el"): Update to test for the above new warning. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index fc5b092f7d..0856626b7b 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1666,7 +1666,10 @@ URLs." (seq "(" (* (not ")")) ")"))) ")"))) "" - ;; Heuristic: assume these substitutions are of some length N. + ;; Heuristic: We can't reliably do `subsititute-command-keys' + ;; substitutions, since the value of a keymap in general can't be + ;; known at compile time. So instead, we assume that these + ;; substitutions are of some length N. (replace-regexp-in-string (rx "\\" (or (seq "[" (* (not "]")) "]"))) (make-string byte-compile--wide-docstring-substitution-len ?x) @@ -1686,13 +1689,6 @@ value, it will override this variable." "Warn if documentation string of FORM is too wide. It is too wide if it has any lines longer than the largest of `fill-column' and `byte-compile-docstring-max-column'." - ;; This has some limitations that it would be nice to fix: - ;; 1. We don't try to handle defuns. It is somewhat tricky to get - ;; it right since `defun' is a macro. Also, some macros - ;; themselves produce defuns (e.g. `define-derived-mode'). - ;; 2. We assume that any `subsititute-command-keys' command replacement has a - ;; given length. We can't reliably do these replacements, since the value - ;; of the keymaps in general can't be known at compile time. (when (byte-compile-warning-enabled-p 'docstrings) (let ((col (max byte-compile-docstring-max-column fill-column)) kind name docs) @@ -1703,12 +1699,10 @@ It is too wide if it has any lines longer than the largest of (setq kind (nth 0 form)) (setq name (nth 1 form)) (setq docs (nth 3 form))) - ;; Here is how one could add lambda's here: - ;; ('lambda - ;; (setq kind "") ; can't be "function", unfortunately - ;; (setq docs (and (stringp (nth 2 form)) - ;; (nth 2 form)))) - ) + ('lambda + (setq kind "") ; can't be "function", unfortunately + (setq docs (and (stringp (nth 2 form)) + (nth 2 form))))) (when (and (consp name) (eq (car name) 'quote)) (setq name (cadr name))) (setq name (if name (format " `%s'" name) "")) diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 707f597fd4..14df39bfd7 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -937,10 +937,9 @@ byte-compiled. Run with dynamic binding." "warn-wide-docstring-define-obsolete-variable-alias.el" "defvaralias .foo. docstring wider than .* characters") -;; TODO: We don't yet issue warnings for defuns. (bytecomp--define-warning-file-test "warn-wide-docstring-defun.el" - "wider than .* characters" 'reverse) + "wider than .* characters") (bytecomp--define-warning-file-test "warn-wide-docstring-defvar.el" commit 89bac05aaaf5d8cf0c54382d4150cfad35e04f3c Author: Stefan Kangas Date: Fri Sep 24 17:44:40 2021 +0200 Avoid warning about long docstring lines in defcustom * lisp/custom.el (defcustom): Avoid warning about long docstring lines. This was caused by the value of the defcustom being treated as docstring due to it being wrapped in a lambda. diff --git a/lisp/custom.el b/lisp/custom.el index f392bd8d36..858b158051 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -378,7 +378,7 @@ for more information." ;; expression is checked by the byte-compiler, and that ;; lexical-binding is obeyed, so quote the expression with ;; `lambda' rather than with `quote'. - ``(funcall #',(lambda () ,standard)) + ``(funcall #',(lambda () "" ,standard)) `',standard) ,doc ,@args)) commit 8c3ec4e3ccf8b675195d173c207ff3accfca5301 Author: Stefan Kangas Date: Fri Sep 24 17:47:35 2021 +0200 Fill some auto-generated docstring lines * lisp/cedet/mode-local.el (define-mode-local-override): * lisp/cedet/semantic/decorate/mode.el (define-semantic-decoration-style): * lisp/cedet/semantic/idle.el (define-semantic-idle-service): * lisp/emacs-lisp/derived.el (derived-mode-make-docstring): * lisp/emacs-lisp/eieio.el (defclass): Fill auto-generated docstring lines. diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el index 02d69a1686..18fb05e7eb 100644 --- a/lisp/cedet/mode-local.el +++ b/lisp/cedet/mode-local.el @@ -600,16 +600,17 @@ BODY is the implementation of this function." `(progn (eval-and-compile (defun ,newname ,args - ,(format "%s\n\nOverride %s in `%s' buffers." - docstring name mode) + ,(concat docstring "\n" + (internal--format-docstring-line + "Override `%s' in `%s' buffers." + name mode)) ;; The body for this implementation ,@body) ;; For find-func to locate the definition of NEWNAME. (put ',newname 'definition-name ',name)) (mode-local-bind '((,name . ,newname)) '(override-flag t) - ',mode)) - )) + ',mode)))) ;;; Read/Query Support (defun mode-local-read-function (prompt &optional initial hist default) diff --git a/lisp/cedet/semantic/decorate/mode.el b/lisp/cedet/semantic/decorate/mode.el index c6bf15205f..27634102df 100644 --- a/lisp/cedet/semantic/decorate/mode.el +++ b/lisp/cedet/semantic/decorate/mode.el @@ -409,8 +409,9 @@ decoration API found in this library." ;; Create an override method to specify if a given tag belongs ;; to this type of decoration (define-overloadable-function ,predicate (tag) - ,(format "Return non-nil to decorate TAG with `%s' style.\n%s" - name doc)) + ,(internal--format-docstring-line + "Return non-nil to decorate TAG with `%s' style.\n%s" + name doc)) ;; Create an override method that will perform the highlight ;; operation if the -p method returns non-nil. (define-overloadable-function ,highlighter (tag) diff --git a/lisp/cedet/semantic/idle.el b/lisp/cedet/semantic/idle.el index b1805f720d..a14994424d 100644 --- a/lisp/cedet/semantic/idle.el +++ b/lisp/cedet/semantic/idle.el @@ -577,10 +577,11 @@ This routine creates the following functions and variables:" `(progn (define-minor-mode ,global ,(concat "Toggle " (symbol-name global) ". -With ARG, turn the minor mode on if ARG is positive, off otherwise. - -When this minor mode is enabled, `" (symbol-name mode) "' is -turned on in every Semantic-supported buffer.") +With ARG, turn the minor mode on if ARG is positive, off otherwise.\n\n" + (internal--format-docstring-line + "When this minor mode is enabled, `%s' is \ +turned on in every Semantic-supported buffer." + (symbol-name mode))) :global t :group 'semantic :group 'semantic-modes @@ -618,8 +619,9 @@ turned on in every Semantic-supported buffer.") "") ; idle schedulers are quiet? (defun ,func () - ,(concat "Perform idle activity for the minor mode `" - (symbol-name mode) "'.") + ,(internal--format-docstring-line + "Perform idle activity for the minor mode `%s'." + (symbol-name mode)) ,@forms)))) ;;; SUMMARY MODE diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 6d6482c349..833c1d1973 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -3083,9 +3083,10 @@ Supported keywords for slots are: ;; The arg "cl-x" is referenced by name in eg pred-form ;; and pred-check, so changing it is not straightforward. (push `(,defsym ,accessor (cl-x) - ,(format "Access slot \"%s\" of `%s' struct CL-X.%s" - slot name - (if doc (concat "\n" doc) "")) + ,(internal--format-docstring-line + "Access slot \"%s\" of `%s' struct CL-X.%s" + slot name + (if doc (concat "\n" doc) "")) (declare (side-effect-free t)) ,access-body) forms) diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el index 5aa745262a..dd30846546 100644 --- a/lisp/emacs-lisp/derived.el +++ b/lisp/emacs-lisp/derived.el @@ -321,7 +321,7 @@ No problems result if this variable is not bound. (format "Major mode derived from `%s' by `define-derived-mode'. It inherits all of the parent's attributes, but has its own keymap%s: - `%s'%s +%s which more-or-less shadow%s %s's corresponding table%s." parent @@ -330,12 +330,14 @@ which more-or-less shadow%s %s's corresponding table%s." (abbrev "\nand abbrev table") (syntax "\nand syntax table") (t "")) - map - (cond ((and abbrev syntax) - (format ", `%s' and `%s'" abbrev syntax)) - ((or abbrev syntax) - (format " and `%s'" (or abbrev syntax))) - (t "")) + (internal--format-docstring-line + " `%s'%s" + map + (cond ((and abbrev syntax) + (format ", `%s' and `%s'" abbrev syntax)) + ((or abbrev syntax) + (format " and `%s'" (or abbrev syntax))) + (t ""))) (if (or abbrev syntax) "" "s") parent (if (or abbrev syntax) "s" ""))))) diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index c16d8e110e..2dc3e0aeff 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -205,7 +205,7 @@ and reference them using the function `class-option'." (eieio-oset this ',sname value)) accessors) (push `(cl-defmethod ,acces ((this ,name)) - ,(format + ,(internal--format-docstring-line "Retrieve the slot `%S' from an object of class `%S'." sname name) ;; FIXME: Why is this different from the :reader case? @@ -285,7 +285,8 @@ This method is obsolete." ;; Non-abstract classes need a constructor. `(defun ,name (&rest slots) - ,(format "Create a new object of class type `%S'." name) + ,(internal--format-docstring-line + "Create a new object of class type `%S'." name) (declare (compiler-macro (lambda (whole) (if (not (stringp (car slots))) commit f3a6fe2c7d5943dcf241700aaf5c10c485217f60 Author: Stefan Kangas Date: Fri Sep 24 17:45:37 2021 +0200 Avoid false positives in bytecomp docstring width warning * lisp/emacs-lisp/bytecomp.el (byte-compile--wide-docstring-p): Ignore more function argument lists. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests-byte-compile--wide-docstring-p): New test. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index d7da7a2149..fc5b092f7d 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1649,14 +1649,22 @@ URLs." (replace-regexp-in-string (rx (or ;; Ignore some URLs. - (seq "http" (? "s") "://" (* anychar)) + (seq "http" (? "s") "://" (* nonl)) ;; Ignore these `substitute-command-keys' substitutions. (seq "\\" (or "=" (seq "<" (* (not ">")) ">") (seq "{" (* (not "}")) "}"))) ;; Ignore the function signature that's stashed at the end of ;; the doc string (in some circumstances). - (seq bol "(fn (" (* nonl)))) + (seq bol "(" (+ (any word "-/:[]&")) + ;; One or more arguments. + (+ " " (or + ;; Arguments. + (+ (or (syntax symbol) + (any word "-/:[]&=().?^\\#'"))) + ;; Argument that is a list. + (seq "(" (* (not ")")) ")"))) + ")"))) "" ;; Heuristic: assume these substitutions are of some length N. (replace-regexp-in-string diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index d56c60b1f1..707f597fd4 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -1470,6 +1470,30 @@ compiled correctly." (load-file (concat file "c")) (should (equal (bc-test-alpha-f 'a) '(nil a))))) +(ert-deftest bytecomp-tests-byte-compile--wide-docstring-p/func-arg-list () + (should-not (byte-compile--wide-docstring-p "\ +\(dbus-register-property BUS SERVICE PATH INTERFACE PROPERTY ACCESS \ +[TYPE] VALUE &optional EMITS-SIGNAL DONT-REGISTER-SERVICE)" fill-column)) + (should-not (byte-compile--wide-docstring-p "\ +(fn CMD FLAGS FIS &key (BUF (cvs-temp-buffer)) DONT-CHANGE-DISC CVSARGS \ +POSTPROC)" fill-column)) + ;; Bug#49007 + (should-not (byte-compile--wide-docstring-p "\ +(fn (THIS rudel-protocol-backend) TRANSPORT \ +INFO INFO-CALLBACK &optional PROGRESS-CALLBACK)" fill-column)) + (should-not (byte-compile--wide-docstring-p "\ +\(fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] \ +[:tags \\='(TAG...)] BODY...)" fill-column)) + (should-not (byte-compile--wide-docstring-p "\ +(make-soap-xs-element &key NAME NAMESPACE-TAG ID TYPE^ OPTIONAL\? MULTIPLE\? \ +REFERENCE SUBSTITUTION-GROUP ALTERNATIVES IS-GROUP)" fill-column)) + (should-not (byte-compile--wide-docstring-p "\ +(fn NAME FIXTURE INPUT &key SKIP-PAIR-STRING EXPECTED-STRING \ +EXPECTED-POINT BINDINGS (MODES \\='\\='(ruby-mode js-mode python-mode)) \ +(TEST-IN-COMMENTS t) (TEST-IN-STRINGS t) (TEST-IN-CODE t) \ +(FIXTURE-FN \\='#\\='electric-pair-mode))" fill-column))) + + ;; Local Variables: ;; no-byte-compile: t ;; End: commit 44da8dd3e4a1e961eb7bbfdf9b1d2abad429ac3c Author: Stefan Kangas Date: Fri Sep 24 17:47:43 2021 +0200 Improve filling of generated docstring lines * lisp/subr.el (internal--fill-string-single-line): Improve filling to use full width. Fix bug where line was not wrapped correctly. diff --git a/lisp/subr.el b/lisp/subr.el index fd1ceb95f5..8cb79b290b 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6419,12 +6419,19 @@ seconds." This is intended for very simple filling while bootstrapping Emacs itself, and does not support all the customization options of fill.el (for example `fill-region')." - (if (< (string-width str) fill-column) + (if (< (length str) fill-column) str - (let ((fst (substring str 0 fill-column)) - (lst (substring str fill-column))) - (if (string-match ".*\\( \\(.+\\)\\)$" fst) - (setq fst (replace-match "\n\\2" nil nil fst 1))) + (let* ((limit (min fill-column (length str))) + (fst (substring str 0 limit)) + (lst (substring str limit))) + (cond ((string-match "\\( \\)$" fst) + (setq fst (replace-match "\n" nil nil fst 1))) + ((string-match "^ \\(.*\\)" lst) + (setq fst (concat fst "\n")) + (setq lst (match-string 1 lst))) + ((string-match ".*\\( \\(.+\\)\\)$" fst) + (setq lst (concat (match-string 2 fst) lst)) + (setq fst (replace-match "\n" nil nil fst 1)))) (concat fst (internal--fill-string-single-line lst))))) (defun internal--format-docstring-line (string &rest objects) commit c78e16962e63895d340f80cf245fad568a7da770 Author: Stefan Kangas Date: Fri Sep 24 14:46:56 2021 +0200 ; Adjust overly long docstrings to fit 80 characters diff --git a/lisp/array.el b/lisp/array.el index 6632da55dd..2c9a6815d2 100644 --- a/lisp/array.el +++ b/lisp/array.el @@ -805,8 +805,9 @@ NOT recognized as integers or real numbers. The array MUST reside at the top of the buffer. TABs are not respected, and may be converted into spaces at any time. -Setting the variable `array-respect-tabs' to non-nil will prevent TAB conversion, -but will cause many functions to give errors if they encounter one. +Setting the variable `array-respect-tabs' to non-nil will prevent +TAB conversion, but will cause many functions to give errors if +they encounter one. Upon entering array mode, you will be prompted for the values of several variables. Others will be calculated based on the values you diff --git a/lisp/cedet/data-debug.el b/lisp/cedet/data-debug.el index 428848be04..8f40a4db79 100644 --- a/lisp/cedet/data-debug.el +++ b/lisp/cedet/data-debug.el @@ -413,7 +413,8 @@ PREBUTTONTEXT is some text between prefix and the stuff list button." ) (defun data-debug-insert-hash-table-button (hash-table prefix prebuttontext) - "Insert HASH-TABLE as expandable button with recursive prefix PREFIX and PREBUTTONTEXT in front of the button text." + "Insert HASH-TABLE as expandable button with recursive prefix PREFIX and +PREBUTTONTEXT in front of the button text." (let ((string (propertize (format "%s" hash-table) 'face 'font-lock-keyword-face))) (insert (propertize diff --git a/lisp/cedet/semantic/analyze/complete.el b/lisp/cedet/semantic/analyze/complete.el index 1e8cd9af08..5c3228ae16 100644 --- a/lisp/cedet/semantic/analyze/complete.el +++ b/lisp/cedet/semantic/analyze/complete.el @@ -70,7 +70,8 @@ context. Passing in a context is useful if the caller also needs to access parts of the analysis. The remaining FLAGS arguments are passed to the mode specific completion engine. Bad flags should be ignored by modes that don't use them. -See `semantic-analyze-possible-completions-default' for details on the default FLAGS. +See `semantic-analyze-possible-completions-default' for details +on the default FLAGS. Completions run through the following filters: * Elements currently in scope diff --git a/lisp/cedet/semantic/db-find.el b/lisp/cedet/semantic/db-find.el index 61baaa020f..e6a7879775 100644 --- a/lisp/cedet/semantic/db-find.el +++ b/lisp/cedet/semantic/db-find.el @@ -914,7 +914,7 @@ but should be good enough for debugging assertions." (null (car (cdr (car resultp))))))) (defun semanticdb-find-result-prin1-to-string (result) - "Presuming RESULT satisfies `semanticdb-find-results-p', provide a short PRIN1 output." + "If RESULT satisfies `semanticdb-find-results-p', provide a short PRIN1 output." (if (< (length result) 2) (concat "# (gnus-thread-highest-number h1) (gnus-thread-highest-number h2))) (defun gnus-thread-highest-number (thread) @@ -5187,7 +5188,7 @@ Unscored articles will be counted as having a score of zero." (gnus-article-sort-by-date h1 h2)) (defun gnus-thread-sort-by-most-recent-date (h1 h2) - "Sort threads such that the thread with the most recently dated article comes first." + "Sort threads such that the thread with most recently dated article is first." (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2))) (defsubst gnus-article-sort-by-newsgroups (h1 h2) @@ -5651,7 +5652,7 @@ or a straight list of headers." gnus-list-identifiers))) (defun gnus-summary-remove-list-identifiers () - "Remove list identifiers in `gnus-list-identifiers' from articles in the current group." + "Remove identifiers in `gnus-list-identifiers' from articles in current group." (let ((regexp (gnus-group-get-list-identifiers gnus-newsgroup-name)) changed subject) (when regexp diff --git a/lisp/gnus/nnvirtual.el b/lisp/gnus/nnvirtual.el index 03a0ff296f..4136392c82 100644 --- a/lisp/gnus/nnvirtual.el +++ b/lisp/gnus/nnvirtual.el @@ -382,7 +382,8 @@ It is computed from the marks of individual component groups.") (defun nnvirtual-update-xref-header (group article prefix sysname) - "Edit current NOV header in current buffer to have an xref to the component group, and also server prefix any existing xref lines." + "Edit current NOV header in current buffer to have an xref to the component +group, and also server prefix any existing xref lines." ;; Move to beginning of Xref field, creating a slot if needed. (beginning-of-line) (looking-at @@ -569,7 +570,8 @@ If UPDATE-P is not nil, call gnus-group-update-group on the components." ;; unique reverse mapping. (defun nnvirtual-map-article (article) - "Return a cons of the component group and article corresponding to the given virtual ARTICLE." + "Return a cons of the component group and article corresponding to the given +virtual ARTICLE." (let ((table nnvirtual-mapping-table) entry group-pos) (while (and table @@ -590,7 +592,7 @@ If UPDATE-P is not nil, call gnus-group-update-group on the components." (defun nnvirtual-reverse-map-article (group article) - "Return the virtual article number corresponding to the given component GROUP and ARTICLE." + "Return virtual article number corresponding to component GROUP and ARTICLE." (when (numberp article) (let ((table nnvirtual-mapping-table) (group-pos 0) diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index 4116d293e1..560ece6751 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -2073,7 +2073,8 @@ either a method name, a signal name, or an error name." (goto-char point))) (defun dbus-monitor-handler (&rest _args) - "Default handler for the \"org.freedesktop.DBus.Monitoring.BecomeMonitor\" interface. + "Default handler for the \"Monitoring.BecomeMonitor\" interface. +Its full name is \"org.freedesktop.DBus.Monitoring.BecomeMonitor\". It will be applied for all objects created by `dbus-register-monitor' which don't declare an own handler. The printed timestamps do not reflect the time the D-Bus message has passed the D-Bus diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 85467cd782..09d250fd7b 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -1049,7 +1049,7 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." 'dictionary-display-match-result))) (defun dictionary-do-matching (word dictionary strategy function) - "Find matches for WORD with STRATEGY in DICTIONARY and display them with FUNCTION." + "Search for WORD with STRATEGY in DICTIONARY and display them with FUNCTION." (message "Lookup matching words for %s in %s using %s" word dictionary strategy) (dictionary-send-command diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el index 5c451c6556..14e5c28b2d 100644 --- a/lisp/net/eudc.el +++ b/lisp/net/eudc.el @@ -798,8 +798,9 @@ see `eudc-inline-expansion-servers'." "Query the directory server, and return the matching responses. The variable `eudc-inline-query-format' controls how to associate the individual QUERY-WORDS with directory attribute names. -After querying the server for the given string, the expansion specified by -`eudc-inline-expansion-format' is applied to the matches before returning them.inserted in the buffer at point. +After querying the server for the given string, the expansion +specified by `eudc-inline-expansion-format' is applied to the +matches before returning them.inserted in the buffer at point. Multiple servers can be tried with the same query until one finds a match, see `eudc-inline-expansion-servers'." (cond diff --git a/lisp/net/ntlm.el b/lisp/net/ntlm.el index 747a69fb5d..0e0146df96 100644 --- a/lisp/net/ntlm.el +++ b/lisp/net/ntlm.el @@ -436,7 +436,7 @@ PASSWD is truncated to 14 bytes if longer." (make-string (- 15 len) 0))))) (defun ntlm-smb-owf-encrypt (passwd c8) - "Return response string of 24 bytes long for password string PASSWD based on DES encryption. + "Return response string of 24 bytes long for PASSWD based on DES encryption. PASSWD is of at most 14 bytes long and the challenge string C8 of 8 bytes long." (let* ((len (min (length passwd) 16)) @@ -459,7 +459,7 @@ PASSWD is of at most 14 bytes long and the challenge string C8 of (substring p15 7) t))) (defun ntlm-smb-hash (in key forw) - "Return hash string of length 8 for a string IN of length 8 and a string KEY of length 8. + "Return hash string of length 8 for IN of length 8 and KEY of length 8. FORW is t or nil." (let ((out (make-string 8 0)) (inb (make-string 64 0)) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 5f0e7bcd98..115d005c0c 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -1833,8 +1833,9 @@ a downcased host name only." result)))) (defun tramp-gvfs-handler-mounted-unmounted (mount-info) - "Signal handler for the \"org.gtk.vfs.MountTracker.mounted\" and \ -\"org.gtk.vfs.MountTracker.unmounted\" signals." + "Signal handler for the gvfs \"mounted\" and \"unmounted\" signals. +Their full names are \"org.gtk.vfs.MountTracker.mounted\" and +\"org.gtk.vfs.MountTracker.unmounted\"." (ignore-errors (let ((signal-name (dbus-event-member-name last-input-event)) (elt mount-info)) @@ -2090,8 +2091,10 @@ It was \"a(say)\", but has changed to \"a{sv})\"." `(:struct ,(tramp-gvfs-dbus-string-to-byte-array mount-pref) ,mount-spec))) (defun tramp-gvfs-handler-volumeadded-volumeremoved (_dbus-name _id volume) - "Signal handler for the \"org.gtk.Private.RemoteVolumeMonitor.VolumeAdded\" \ -and \"org.gtk.Private.RemoteVolumeMonitor.VolumeRemoved\" signals." + "Signal handler for the gvfs \"VolumeAdded\" and \"VolumeRemoved\" signals. +Their full names are +\"org.gtk.Private.RemoteVolumeMonitor.VolumeAdded\" and +\"org.gtk.Private.RemoteVolumeMonitor.VolumeRemoved\"." (ignore-errors (let* ((signal-name (dbus-event-member-name last-input-event)) (uri (url-generic-parse-url (nth 5 volume))) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 0fe106684c..dd92f22689 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1699,7 +1699,7 @@ ID-FORMAT valid values are `string' and `integer'." ;; FIXME: Fix function to work with count parameter. (defun tramp-do-directory-files-and-attributes-with-stat (vec localname &optional id-format) - "Implement `directory-files-and-attributes' for Tramp files using stat(1) command." + "Implement `directory-files-and-attributes' for Tramp files with stat(1) command." (tramp-message vec 5 "directory-files-and-attributes with stat: %s" localname) (tramp-send-command-and-read vec diff --git a/lisp/org/ob-table.el b/lisp/org/ob-table.el index 39a14a25d6..e081708701 100644 --- a/lisp/org/ob-table.el +++ b/lisp/org/ob-table.el @@ -78,7 +78,8 @@ So this `org-sbe' construct is the equivalent of the following source code block: - #+begin_src emacs-lisp :var results=source-block(n=val_at_col_2, m=3) :results silent + #+begin_src emacs-lisp :var results=source-block(n=val_at_col_2, m=3) \\ + :results silent results #+end_src diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 23c62809a2..271eac1c30 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -1230,7 +1230,8 @@ For example, 9:30am would become 09:30 rather than 9:30." ":" minute ampm))) (defun org-agenda-time-of-day-to-ampm-maybe (time) - "Conditionally convert TIME to AM/PM format based on `org-agenda-timegrid-use-ampm'." + "Conditionally convert TIME to AM/PM format. +This is based on `org-agenda-timegrid-use-ampm'." (if org-agenda-timegrid-use-ampm (org-agenda-time-of-day-to-ampm time) time)) diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el index 726c1ca2ba..ff8c08d5c5 100644 --- a/lisp/org/org-protocol.el +++ b/lisp/org/org-protocol.el @@ -178,11 +178,11 @@ Possible properties are: :working-suffix - the replacement for online-suffix :base-url - the base URL, e.g. http://www.example.com/project/ Last slash required. - :working-directory - the local working directory. This is, what base-url will - be replaced with. - :redirects - A list of cons cells, each of which maps a regular - expression to match to a path relative to - :working-directory. + :working-directory - the local working directory. This is what + base-url will be replaced with. + :redirects - A list of cons cells, each of which maps a + regular expression to match to a path relative + to `:working-directory'. Example: @@ -216,8 +216,9 @@ Example: does not include any suffix properties, allowing local source file to be opened as found by OpenGrok. -Consider using the interactive functions `org-protocol-create' and -`org-protocol-create-for-org' to help you filling this variable with valid contents." +Consider using the interactive functions `org-protocol-create' +and `org-protocol-create-for-org' to help you filling this +variable with valid contents." :group 'org-protocol :type 'alist) diff --git a/lisp/play/doctor.el b/lisp/play/doctor.el index b855f7e35a..33fecaa188 100644 --- a/lisp/play/doctor.el +++ b/lisp/play/doctor.el @@ -1011,8 +1011,8 @@ Put dialogue in buffer." (defun doctor-subjsearch (sent key type) "Search for the subject of a sentence SENT, looking for the noun closest -to and preceding KEY by at least TYPE words. Set global variable `doctor-subj' to -the subject noun, and return the portion of the sentence following it." +to and preceding KEY by at least TYPE words. Set global variable `doctor-subj' +to the subject noun, and return the portion of the sentence following it." (let ((i (- (length sent) (length (memq key sent)) type))) (while (and (> i -1) (not (doctor-nounp (nth i sent)))) (setq i (1- i))) diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 6c3da667bf..d40433a9b0 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -480,7 +480,7 @@ function to control that." ;; This function is only used in XEmacs. (defun c-hungry-delete () - "Delete a non-whitespace char, or all whitespace up to the next non-whitespace char. + "Delete non-whitespace char, or all whitespace up to next non-whitespace char. The direction of deletion depends on the configuration: If the function `delete-forward-p' is defined and returns non-nil, it deletes forward using `c-hungry-delete-forward'. Otherwise it deletes diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el index 27b46a45c5..7f2aa0f469 100644 --- a/lisp/progmodes/flymake-proc.el +++ b/lisp/progmodes/flymake-proc.el @@ -902,7 +902,7 @@ can also be executed interactively independently of temp-dir)))) (defun flymake-proc--delete-temp-directory (dir-name) - "Attempt to delete temp dir created by `flymake-proc-create-temp-with-folder-structure', do not fail on error." + "Attempt to delete temp dir DIR-NAME, do not fail on error." (let* ((temp-dir temporary-file-directory) (suffix (substring dir-name (1+ (length (directory-file-name temp-dir)))))) @@ -919,7 +919,8 @@ can also be executed interactively independently of (defvar-local flymake-proc--base-dir nil) (defun flymake-proc-init-create-temp-buffer-copy (create-temp-f) - "Make a temporary copy of the current buffer, save its name in buffer data and return the name." + "Make a temporary copy of the current buffer, save its name in buffer data. +Return the name." (let* ((source-file-name buffer-file-name) (temp-source-file-name (funcall create-temp-f source-file-name "flymake"))) @@ -1007,7 +1008,7 @@ Return full-name. Names are real, not patched." buildfile-name source-file-name))))) (defun flymake-proc--init-create-temp-source-and-master-buffer-copy (get-incl-dirs-f create-temp-f master-file-masks include-regexp) - "Find master file (or buffer), create its copy along with a copy of the source file." + "Find master file (or buffer), create its copy and a copy of the source file." (let* ((source-file-name buffer-file-name) (temp-source-file-name (flymake-proc-init-create-temp-buffer-copy create-temp-f)) (master-and-temp-master (flymake-proc--create-master-file diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index d6828eeffb..4224e47d16 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -1522,7 +1522,8 @@ No spaces before and 1 after a comma A minimum of 1 space before and after `=' (see `idlwave-expand-equal'). (idlwave-action-and-binding \"=\" (lambda (_) (idlwave-expand-equal -1 -1))) Capitalize system variables - action only - (idlwave-action-and-binding idlwave-sysvar (lambda (_) (capitalize-word 1) t))" + (idlwave-action-and-binding idlwave-sysvar + (lambda (_) (capitalize-word 1) t))" (if (not (equal select 'noaction)) ;; Add action (let* ((table (if select 'idlwave-indent-action-table diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 33ca01cc75..74a023775f 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -2136,7 +2136,8 @@ A return value of N means N more left parentheses than right ones." (line-end-position))))) (defun prolog-electric--if-then-else () - "Insert spaces after the opening parenthesis, \"then\" (->) and \"else\" (;) branches. + "Insert spaces after the opening parenthesis. +\"then\" (->) and \"else\" (;) branches. Spaces are inserted if all preceding objects on the line are whitespace characters, parentheses, or then/else branches." (when prolog-electric-if-then-else-flag diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index ac6a8fbbcb..d98230d9a0 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -4038,9 +4038,12 @@ Some other functions are: \\[verilog-sk-repeat] Insert a repeat (..) begin .. end block. \\[verilog-sk-specify] Insert a specify .. endspecify block. \\[verilog-sk-task] Insert a task .. begin .. end endtask block. - \\[verilog-sk-while] Insert a while (...) begin .. end block, prompting for details. - \\[verilog-sk-casex] Insert a casex (...) item: begin.. end endcase block, prompting for details. - \\[verilog-sk-casez] Insert a casez (...) item: begin.. end endcase block, prompting for details. + \\[verilog-sk-while] Insert a while (...) begin .. end block, + prompting for details. + \\[verilog-sk-casex] Insert a casex (...) item: begin.. end endcase block, + prompting for details. + \\[verilog-sk-casez] Insert a casez (...) item: begin.. end endcase block, + prompting for details. \\[verilog-sk-if] Insert an if (..) begin .. end block. \\[verilog-sk-else-if] Insert an else if (..) begin .. end block. \\[verilog-sk-comment] Insert a comment block. @@ -6580,7 +6583,8 @@ Return >0 for nested struct." nil)))) (defun verilog-at-constraint-p () - "If at the { of a constraint or coverpoint definition, return true, moving point to constraint." + "If at the { of a constraint or coverpoint definition, return true. +Also move point to constraint." (if (save-excursion (let ((p (point))) (and @@ -14985,7 +14989,9 @@ but instead, [[Fill in here]] happens!. (provide 'verilog-mode) +;;TODO: Could `byte-compile-docstring-max-column' be decreased? ;; Local Variables: +;; byte-compile-docstring-max-column: 90 ;; checkdoc-permit-comma-termination-flag:t ;; checkdoc-force-docstrings-flag:nil ;; indent-tabs-mode:nil diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index ceacd85971..abf0e814c4 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1007,7 +1007,8 @@ on the tab bar instead." When this command is bound to a numeric key (with a prefix or modifier key using `tab-bar-select-tab-modifiers'), calling it without an argument will translate its bound numeric key to the numeric argument. -TAB-NUMBER counts from 1. Negative TAB-NUMBER counts tabs from the end of the tab bar." +TAB-NUMBER counts from 1. Negative TAB-NUMBER counts tabs from the end of +the tab bar." (interactive "P") (unless (integerp tab-number) (let ((key (event-basic-type last-command-event))) @@ -1908,7 +1909,7 @@ Letters do not insert themselves; instead, they are commands. (move-to-column tab-switcher-column)) (defun tab-switcher-unmark (&optional backup) - "Cancel all requested operations on window configuration on this line and move down. + "Cancel requested operations on window configuration on this line and move down. Optional prefix arg means move up." (interactive "P") (beginning-of-line) @@ -1920,7 +1921,7 @@ Optional prefix arg means move up." (move-to-column tab-switcher-column)) (defun tab-switcher-backup-unmark () - "Move up and cancel all requested operations on window configuration on line above." + "Move up one line and cancel requested operations on window configuration there." (interactive) (forward-line -1) (tab-switcher-unmark) diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index 135a404731..7876a87a28 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el @@ -806,7 +806,8 @@ temporary file before the region itself. The buffer's header is all lines between the strings defined by `tex-start-of-header' and `tex-end-of-header' inclusive. The header must start in the first 100 lines. -The value of `texinfo-tex-trailer' is appended to the temporary file after the region." +The value of `texinfo-tex-trailer' is appended to the temporary +file after the region." (interactive "r") (require 'tex-mode) (let ((tex-command texinfo-tex-command) diff --git a/lisp/vc/ediff-merg.el b/lisp/vc/ediff-merg.el index 2bdce9e33c..d0ce9d326d 100644 --- a/lisp/vc/ediff-merg.el +++ b/lisp/vc/ediff-merg.el @@ -257,7 +257,8 @@ Buffer B." (defun ediff-re-merge () - "Remerge unmodified diff regions using a new default. Start with the current region." + "Remerge unmodified diff regions using a new default. +Start with the current region." (interactive) (let* ((default-variant-alist (list '("default-A") '("default-B") '("combined"))) diff --git a/lisp/vc/ediff.el b/lisp/vc/ediff.el index 74ed1bd0ef..e406275cd1 100644 --- a/lisp/vc/ediff.el +++ b/lisp/vc/ediff.el @@ -680,7 +680,7 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files." (defun ediff-merge-directories-with-ancestor (dir1 dir2 ancestor-dir regexp &optional merge-autostore-dir) - "Merge files in directories DIR1 and DIR2 using files in ANCESTOR-DIR as ancestors. + "Merge files in DIR1 and DIR2 using files in ANCESTOR-DIR as ancestors. Ediff merges files that have identical names in DIR1, DIR2. If a pair of files in DIR1 and DIR2 doesn't have an ancestor in ANCESTOR-DIR, Ediff will merge without ancestor. The fourth argument, REGEXP, is nil or a regular expression; @@ -746,7 +746,7 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files." (defun ediff-merge-directory-revisions-with-ancestor (dir1 regexp &optional merge-autostore-dir) - "Run Ediff on a directory, DIR1, merging its files with their revisions and ancestors. + "Run Ediff on DIR1 and merge its files with their revisions and ancestors. The second argument, REGEXP, is a regular expression that filters the file names. Only the files that are under revision control are taken into account. MERGE-AUTOSTORE-DIR is the directory in which to store merged files." @@ -1600,7 +1600,8 @@ With optional NODE, goes to that node." ;;;###autoload (defun ediff-merge-with-ancestor-command () - "Call `ediff-merge-files-with-ancestor' with the next three command line arguments." + "Call `ediff-merge-files-with-ancestor' with the next three command line +arguments." (let ((file-a (nth 0 command-line-args-left)) (file-b (nth 1 command-line-args-left)) (ancestor (nth 2 command-line-args-left))) @@ -1637,7 +1638,8 @@ With optional NODE, goes to that node." ;;;###autoload (defun ediff-merge-directories-with-ancestor-command () - "Call `ediff-merge-directories-with-ancestor' with the next four command line arguments." + "Call `ediff-merge-directories-with-ancestor' with the next four command line +arguments." (let ((file-a (nth 0 command-line-args-left)) (file-b (nth 1 command-line-args-left)) (ancestor (nth 2 command-line-args-left)) diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el index 45bb17749b..5a4ac1aca8 100644 --- a/lisp/vc/vc-annotate.el +++ b/lisp/vc/vc-annotate.el @@ -610,7 +610,8 @@ the file in question, search for the log entry required and move point." (vc-annotate-show-diff-revision-at-line-internal t)) (defun vc-annotate-show-changeset-diff-revision-at-line () - "Visit the diff of the revision at line from its previous revision for all files in the changeset." + "Visit diff of revision at line from previous revision. +This is done for all files in changeset." (interactive) (when (eq 'file (vc-call-backend vc-annotate-backend 'revision-granularity)) (error "The %s backend does not support changeset diffs" vc-annotate-backend)) diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index f8b87170af..d079b891e4 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -1015,7 +1015,8 @@ child files." (nreverse result))) (defun vc-dir-child-files-and-states () - "Return the list of conses (FILE . STATE) for child files of the current entry if it's a directory. + "Return list of conses for child files of the current entry if it's a directory. +The conses have the format (FILE . STATE). If it is a file, return the corresponding cons for the file itself." (let* ((crt (ewoc-locate vc-ewoc)) (crt-data (ewoc-data crt)) diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index cd23bcce94..346974bdba 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el @@ -404,7 +404,7 @@ Display the buffer in some window, but don't select it." (defvar compilation-error-regexp-alist) (defun vc-compilation-mode (backend) - "Setup `compilation-mode' after with the appropriate `compilation-error-regexp-alist'." + "Setup `compilation-mode' with the appropriate `compilation-error-regexp-alist'." (require 'compile) (let* ((error-regexp-alist (vc-make-backend-sym backend 'error-regexp-alist)) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 7d3b0f56f6..5b259fcdb3 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2624,7 +2624,7 @@ with its diffs (if the underlying VCS supports that)." ;;;###autoload (defun vc-log-incoming (&optional remote-location) - "Show a log of changes that will be received with a pull operation from REMOTE-LOCATION. + "Show log of changes that will be received with pull from REMOTE-LOCATION. When called interactively with a prefix argument, prompt for REMOTE-LOCATION." (interactive (when current-prefix-arg @@ -2637,7 +2637,7 @@ When called interactively with a prefix argument, prompt for REMOTE-LOCATION." ;;;###autoload (defun vc-log-outgoing (&optional remote-location) - "Show a log of changes that will be sent with a push operation to REMOTE-LOCATION. + "Show log of changes that will be sent with a push operation to REMOTE-LOCATION. When called interactively with a prefix argument, prompt for REMOTE-LOCATION." (interactive (when current-prefix-arg diff --git a/lisp/whitespace.el b/lisp/whitespace.el index d4f2b2890a..6e132de536 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -2193,8 +2193,8 @@ resultant list will be returned." limit t)) (defun whitespace-empty-at-bob-regexp (limit) - "Match spaces at beginning of buffer which do not contain the point at \ -beginning of buffer." + "Match spaces at beginning of buffer which do not contain +the point at beginning of buffer." (let ((b (point)) r) (cond diff --git a/test/lisp/auth-source-pass-tests.el b/test/lisp/auth-source-pass-tests.el index a0a97eca5e..3da6f3e9b7 100644 --- a/test/lisp/auth-source-pass-tests.el +++ b/test/lisp/auth-source-pass-tests.el @@ -97,7 +97,8 @@ This function is intended to be set to `auth-source-debug'." (defun auth-source-pass--explain-match-entry-p (entry hostname &optional user port) "Explainer function for `auth-source-pass-match-entry-p'. -ENTRY, HOSTNAME, USER and PORT are the same as in `auth-source-pass-match-entry-p'." +ENTRY, HOSTNAME, USER and PORT are the same as in +`auth-source-pass-match-entry-p'." `(entry ,entry store @@ -122,7 +123,8 @@ HOSTNAME, USER and PORT are passed unchanged to (defun auth-source-pass--explain-includes-sorted-entries (entries hostname &optional user port) "Explainer function for `auth-source-pass--includes-sorted-entries'. -ENTRIES, HOSTNAME, USER and PORT are the same as in `auth-source-pass--includes-sorted-entries'." +ENTRIES, HOSTNAME, USER and PORT are the same as in +`auth-source-pass--includes-sorted-entries'." `(store ,(auth-source-pass-entries) matching-entries diff --git a/test/lisp/international/ucs-normalize-tests.el b/test/lisp/international/ucs-normalize-tests.el index 52c3d3704e..eb577b97dc 100644 --- a/test/lisp/international/ucs-normalize-tests.el +++ b/test/lisp/international/ucs-normalize-tests.el @@ -123,9 +123,9 @@ The following invariants must be true for all conformant implementations..." (defsubst ucs-normalize-tests--rule2-holds-p (X) "Check 2nd conformance rule. -For every code point X assigned in this version of Unicode that is not specifically -listed in Part 1, the following invariants must be true for all conformant -implementations: +For every code point X assigned in this version of Unicode that +is not specifically listed in Part 1, the following invariants +must be true for all conformant implementations: X == toNFC(X) == toNFD(X) == toNFKC(X) == toNFKD(X)" (and (ucs-normalize-tests--normalization-chareq-p NFC X X) commit f4ea15907aeb020b80d021a8d6bf212bcde08ab9 Author: Stefan Kangas Date: Sun Sep 26 13:18:29 2021 +0200 ert: Add basic explainer for string-equal * lisp/emacs-lisp/ert.el (ert--explain-string-equal): Add basic explainer for 'string-equal' based on 'ert--explain-equal'. diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 6d867abd7a..e72321f90f 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -540,6 +540,14 @@ Returns nil if they are." (ert--explain-equal-rec a b))) (put 'equal 'ert-explainer 'ert--explain-equal) +(defun ert--explain-string-equal (a b) + "Explainer function for `string-equal'." + ;; Convert if they are symbols. + (let ((as (if (symbolp a) (symbol-name a) a)) + (bs (if (symbolp b) (symbol-name b) b))) + (ert--explain-equal-rec as bs))) +(put 'string-equal 'ert-explainer 'ert--explain-string-equal) + (defun ert--significant-plist-keys (plist) "Return the keys of PLIST that have non-null values, in order." (cl-assert (zerop (mod (length plist) 2)) t) commit ce6cee4ca3db5da25989b630668c03fe5d4c614c Author: Stefan Kangas Date: Sun Sep 26 13:17:38 2021 +0200 Unbreak ert tests * test/lisp/emacs-lisp/tabulated-list-test.el (tabulated-list-print) (tabulated-list-sort): Update tests for recent change. diff --git a/test/lisp/emacs-lisp/tabulated-list-test.el b/test/lisp/emacs-lisp/tabulated-list-test.el index 679afda394..7cac254ac4 100644 --- a/test/lisp/emacs-lisp/tabulated-list-test.el +++ b/test/lisp/emacs-lisp/tabulated-list-test.el @@ -56,10 +56,10 @@ (tabulated-list--test-with-buffer ;; Basic printing. (should (string= (buffer-substring-no-properties (point-min) (point-max)) - " zzzz-game zzzz-game 2113 installed play zzzz in Emacs - 4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions - abc-mode abc-mode 944 available Major mode for editing abc music files - mode mode 1128 installed A simple mode for editing Actionscript 3 files\n")) + " zzzz-game zzzz-game 2113 installed play zzzz in Emacs + 4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions + abc-mode abc-mode 944 available Major mode for editing abc music files + mode mode 1128 installed A simple mode for editing Actionscript 3 files\n")) ;; Preserve position. (forward-line 3) (let ((pos (thing-at-point 'line))) @@ -67,16 +67,16 @@ (tabulated-list-print t) (should (equal (thing-at-point 'line) pos)) (should (string= (buffer-substring-no-properties (point-min) (point-max)) - " 4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions - abc-mode abc-mode 944 available Major mode for editing abc music files - mode mode 1128 installed A simple mode for editing Actionscript 3 files\n")) + " 4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions + abc-mode abc-mode 944 available Major mode for editing abc music files + mode mode 1128 installed A simple mode for editing Actionscript 3 files\n")) ;; Check the UPDATE argument (pop tabulated-list-entries) (setf (cdr (car tabulated-list-entries)) (list ["x" "x" "944" "available" " XX"])) (tabulated-list-print t t) (should (string= (buffer-substring-no-properties (point-min) (point-max)) - " x x 944 available XX - mode mode 1128 installed A simple mode for editing Actionscript 3 files\n")) + " x x 944 available XX + mode mode 1128 installed A simple mode for editing Actionscript 3 files\n")) (should (equal (thing-at-point 'line) pos))))) (ert-deftest tabulated-list-sort () @@ -86,10 +86,11 @@ (skip-chars-forward "[:blank:]") (tabulated-list-sort) (let ((text (buffer-substring-no-properties (point-min) (point-max)))) - (should (string= text " 4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions - abc-mode abc-mode 944 available Major mode for editing abc music files - mode mode 1128 installed A simple mode for editing Actionscript 3 files - zzzz-game zzzz-game 2113 installed play zzzz in Emacs\n")) + (should (string= text + " 4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions + abc-mode abc-mode 944 available Major mode for editing abc music files + mode mode 1128 installed A simple mode for editing Actionscript 3 files + zzzz-game zzzz-game 2113 installed play zzzz in Emacs\n")) (skip-chars-forward "^[:blank:]") (skip-chars-forward "[:blank:]") @@ -101,10 +102,10 @@ ;; Invert. (tabulated-list-sort 1) (should (string= (buffer-substring-no-properties (point-min) (point-max)) - " zzzz-game zzzz-game 2113 installed play zzzz in Emacs - mode mode 1128 installed A simple mode for editing Actionscript 3 files - abc-mode abc-mode 944 available Major mode for editing abc music files - 4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions\n")) + " zzzz-game zzzz-game 2113 installed play zzzz in Emacs + mode mode 1128 installed A simple mode for editing Actionscript 3 files + abc-mode abc-mode 944 available Major mode for editing abc music files + 4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions\n")) ;; Again (tabulated-list-sort 1) (should (string= text (buffer-substring-no-properties (point-min) (point-max))))) commit 2cd2fc74e474c158a1b0e6dfa29b49341262fcd9 Author: Michael Albinus Date: Sun Sep 26 12:40:55 2021 +0200 ; More instrumentation in autorevert-tests.el diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el index 284b352cd7..a04610089c 100644 --- a/test/lisp/autorevert-tests.el +++ b/test/lisp/autorevert-tests.el @@ -528,7 +528,7 @@ This expects `auto-revert--messages' to be bound by (auto-revert-test--wait-for-buffer-text buf-1 "1-b" (auto-revert--timeout)) ;; On emba, `buf-1' is a killed buffer. - (message "Hallo1 %s %s %s" file-1 buf-1 (get-file-buffer file-1)) + (message "Hallo1 %s %s %s %s %s %s %s" buf-1 (buffer-name buf-1) (buffer-live-p buf-1) file-1 (get-file-buffer file-1) (buffer-name (get-file-buffer file-1)) (buffer-live-p (get-file-buffer file-1))) (should (buffer-local-value 'auto-revert-notify-watch-descriptor (get-file-buffer file-1))) commit 68994995db26343a43aa8a526629127279f83278 Author: Stefan Kangas Date: Sun Sep 26 11:28:36 2021 +0200 Doc fix: mode name in local variables needs no suffix * doc/emacs/custom.texi (Specifying File Variables): Clarify that a mode name does not need the "-mode" suffix. (Bug#50801) diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index d12033f841..73dfe03898 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -1084,8 +1084,9 @@ first line: @noindent You can specify any number of variable/value pairs in this way, each pair with a colon and semicolon. The special variable/value pair -@code{mode: @var{modename};}, if present, specifies a major mode. The -@var{value}s are used literally, and not evaluated. +@code{mode: @var{modename};}, if present, specifies a major mode +(without the ``-mode'' suffix). The @var{value}s are used literally, +and not evaluated. @findex add-file-local-variable-prop-line @findex delete-file-local-variable-prop-line commit 90948eb9d7e2f0770533f71931f4427757c2ad82 Author: Stefan Kangas Date: Sun Sep 26 02:02:52 2021 +0200 checkdoc: Library footer must match package.el requirement * lisp/emacs-lisp/checkdoc.el (checkdoc-file-comments-engine): Don't accept footer format unless it matches the requirement in package.el. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 74c27343bc..24e1ae3f09 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -2474,10 +2474,9 @@ Code:, and others referenced in the style guide." (save-excursion (goto-char (point-max)) (if (not (re-search-backward - (concat "^;;;[ \t]+" (regexp-quote fn) "\\(" (regexp-quote fe) - "\\)?[ \t]+ends here[ \t]*$" - "\\|^;;;[ \t]+ End of file[ \t]+" - (regexp-quote fn) "\\(" (regexp-quote fe) "\\)?") + ;; This should match the requirement in + ;; `package-buffer-info'. + (concat "^;;; " (regexp-quote (concat fn fe)) " ends here") nil t)) (if (checkdoc-y-or-n-p "No identifiable footer! Add one?") (progn commit cd0817a0f7ea17ad7d1771224b5036b13b9f3815 Author: Eli Zaretskii Date: Sun Sep 26 12:11:56 2021 +0300 ; Improve documentation of 'with-environment-variables' * lisp/env.el (with-environment-variables): * doc/lispref/os.texi (System Environment): Improve the documentation of 'with-environment-variables'. diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index a34c01c81a..e3297b1be7 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -1043,9 +1043,12 @@ if it removed @var{variable} from the environment. @end deffn @defmac with-environment-variables variables body@dots{} -This macro sets the environment variables in @var{variables} +This macro sets the environment variables according to @var{variables} temporarily when executing @var{body}. The previous values are -restored when the form finishes. +restored when the form finishes. The argument @var{variables} should +be a list of pairs of strings of the form +@w{@code{(@var{var} @var{value})}}, where @var{var} is the name of the +environment variable and @var{value} is that variable's value. @lisp (with-environment-variables (("LANG" "C") diff --git a/lisp/env.el b/lisp/env.el index 31a728c0e5..2f7cd9d3db 100644 --- a/lisp/env.el +++ b/lisp/env.el @@ -221,9 +221,9 @@ in the environment list of the selected frame." ;;;###autoload (defmacro with-environment-variables (variables &rest body) "Set VARIABLES in the environent and execute BODY. -VARIABLES is a list of variable settings where first element -should be the name of the variable and the second element should -be the value. +VARIABLES is a list of variable settings of the form (VAR VALUE), +where VAR is the name of the variable (a string) and VALUE +is its value (also a string). The previous values will be be restored upon exit." (declare (indent 1) (debug (sexp body))) commit 27d8726ae29a1441dba776d7d3d0685ef85a3fdf Author: Michael Albinus Date: Sun Sep 26 10:32:15 2021 +0200 Adapt Tramp's make-process for macOS. * lisp/net/tramp-sh.el (tramp-check-remote-uname): New defun. (tramp-sh-handle-file-ownership-preserved-p) (tramp-sh-handle-make-process, tramp-find-executable) (tramp-find-shell, tramp-get-remote-stat): Use it. (Bug#50748) * test/lisp/net/tramp-tests.el (tramp-check-remote-uname): Declare. (tramp-test29-start-file-process, tramp-test30-make-process): Instrument for macOS. (tramp--test-hpux-p): Adapt function. (tramp--test-macos-p): New defun. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 7f1a52fa93..0fe106684c 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1628,9 +1628,7 @@ ID-FORMAT valid values are `string' and `integer'." ;; On BSD-derived systems files always inherit the ;; parent directory's group, so skip the group-gid ;; test. - (string-match-p - "BSD\\|DragonFly\\|Darwin" - (tramp-get-connection-property v "uname" "")) + (tramp-check-remote-uname v "BSD\\|DragonFly\\|Darwin") (= (tramp-compat-file-attribute-group-id attributes) (tramp-get-remote-gid v 'integer))))))))) @@ -2937,8 +2935,11 @@ implementation will be used." (setq p (tramp-get-connection-process v)) (process-put p 'remote-pid pid) (tramp-set-connection-property p "remote-pid" pid)) - ;; Disable carriage return to newline translation. - (when (memq connection-type '(nil pipe)) + ;; Disable carriage return to newline + ;; translation. This does not work on + ;; macOS, see Bug#50748. + (when (and (memq connection-type '(nil pipe)) + (not (tramp-check-remote-uname v "Darwin"))) (tramp-send-command v "stty -icrnl")) ;; `tramp-maybe-open-connection' and ;; `tramp-send-command-and-read' could have @@ -4008,10 +4009,7 @@ This function expects to be in the right *tramp* buffer." ;; number of words it returns. "SunOS 5.10" (and maybe "SunOS ;; 5.11") have problems with this command, we disable the call ;; therefore. - (unless (or ignore-path - (string-match-p - tramp-sunos-unames - (tramp-get-connection-property vec "uname" ""))) + (unless (or ignore-path (tramp-check-remote-uname vec tramp-sunos-unames)) (tramp-send-command vec (format "which \\%s | wc -w" progname)) (goto-char (point-min)) (if (looking-at-p "^\\s-*1$") @@ -4221,9 +4219,7 @@ file exists and nonzero exit status otherwise." ;; The default shell (ksh93) of OpenSolaris ;; and Solaris is buggy. We've got reports ;; for "SunOS 5.10" and "SunOS 5.11" so far. - (string-match-p - tramp-sunos-unames - (tramp-get-connection-property vec "uname" ""))) + (tramp-check-remote-uname vec tramp-sunos-unames)) (or (tramp-find-executable vec "bash" (tramp-get-remote-path vec) t t) @@ -5340,6 +5336,10 @@ Return ATTR." ;; Variables local to connection. +(defun tramp-check-remote-uname (vec regexp) + "Check whether REGEXP matches the connection property \"uname\"." + (string-match-p regexp (tramp-get-connection-property vec "uname" ""))) + (defun tramp-get-remote-path (vec) "Compile list of remote directories for PATH. Nonexistent directories are removed from spec." @@ -5564,8 +5564,7 @@ Nonexistent directories are removed from spec." (with-tramp-connection-property vec "stat" ;; stat on Solaris is buggy. We've got reports for "SunOS 5.10" ;; and "SunOS 5.11" so far. - (unless (string-match-p - tramp-sunos-unames (tramp-get-connection-property vec "uname" "")) + (unless (tramp-check-remote-uname vec tramp-sunos-unames) (tramp-message vec 5 "Finding a suitable `stat' command") (let ((result (tramp-find-executable vec "stat" (tramp-get-remote-path vec))) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 358f87d84c..26a3ac7e96 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -52,6 +52,7 @@ (require 'vc-git) (require 'vc-hg) +(declare-function tramp-check-remote-uname "tramp-sh") (declare-function tramp-find-executable "tramp-sh") (declare-function tramp-get-remote-chmod-h "tramp-sh") (declare-function tramp-get-remote-gid "tramp-sh") @@ -4585,6 +4586,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (while (< (- (point-max) (point-min)) (length "66\n6F\n6F\n0D\n0A\n")) (while (accept-process-output proc 0 nil t)))) + (if (tramp--test-macos-p) + (tramp--test-message + "process-connection-type %s\n%s" + process-connection-type (pp-to-string (buffer-string))) (should (string-match-p (if (memq process-connection-type '(nil pipe)) @@ -4592,7 +4597,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; flag is FALSE. See telnet(1) man page. "66\n6F\n6F\n0D\\(\n00\\)?\n0A\n" "66\n6F\n6F\n0A\\(\n00\\)?\n0A\n") - (buffer-string)))) + (buffer-string))))) ;; Cleanup. (ignore-errors (delete-process proc))))) @@ -4850,6 +4855,10 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." (while (< (- (point-max) (point-min)) (length "66\n6F\n6F\n0D\n0A\n")) (while (accept-process-output proc 0 nil t)))) + (if (tramp--test-macos-p) + (tramp--test-message + "process-connection-type %s\n%s" + process-connection-type (pp-to-string (buffer-string))) (should (string-match-p (if (memq (or connection-type process-connection-type) @@ -4858,7 +4867,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." ;; flag is FALSE. See telnet(1) man page. "66\n6F\n6F\n0D\\(\n00\\)?\n0A\n" "66\n6F\n6F\n0A\\(\n00\\)?\n0A\n") - (buffer-string)))) + (buffer-string))))) ;; Cleanup. (ignore-errors (delete-process proc))))))))) @@ -6099,8 +6108,7 @@ If optional METHOD is given, it is checked first." Several special characters do not work properly there." ;; We must refill the cache. `file-truename' does it. (file-truename tramp-test-temporary-file-directory) - (string-match-p - "^HP-UX" (tramp-get-connection-property tramp-test-vec "uname" ""))) + (tramp-check-remote-uname tramp-test-vec "^HP-UX")) (defun tramp--test-ksh-p () "Check, whether the remote shell is ksh. @@ -6111,6 +6119,12 @@ a $'' syntax." (string-match-p "ksh$" (tramp-get-connection-property tramp-test-vec "remote-shell" ""))) +(defun tramp--test-macos-p () + "Check, whether the remote host runs macOS." + ;; We must refill the cache. `file-truename' does it. + (file-truename tramp-test-temporary-file-directory) + (tramp-check-remote-uname tramp-test-vec "Darwin")) + (defun tramp--test-mock-p () "Check, whether the mock method is used. This does not support external Emacs calls." commit 50798267f262d50bbe6cf755d19c2f6e08299695 Author: Lars Ingebrigtsen Date: Sun Sep 26 08:47:08 2021 +0200 Expand the ` doc string slightly * lisp/emacs-lisp/backquote.el (backquote): Note that ` is used for other things in some macros (bug#25462). diff --git a/lisp/emacs-lisp/backquote.el b/lisp/emacs-lisp/backquote.el index 173c11644d..fe39e8d099 100644 --- a/lisp/emacs-lisp/backquote.el +++ b/lisp/emacs-lisp/backquote.el @@ -103,7 +103,10 @@ b => (ba bb bc) ; assume b has this value \\=`(a ,b c) => (a (ba bb bc) c) ; insert the value of b \\=`(a ,@b c) => (a ba bb bc c) ; splice in the value of b -Vectors work just like lists. Nested backquotes are permitted." +Vectors work just like lists. Nested backquotes are permitted. + +Note that some macros, such as `pcase', use this symbol for other +purposes." (cdr (backquote-process structure))) ;; GNU Emacs has no reader macros commit 2a2c75d349a3ab836e48ecf378412cb962977871 Author: Lars Ingebrigtsen Date: Sun Sep 26 08:29:38 2021 +0200 Fix rendering non-ASCII text with links * lisp/gnus/mm-view.el (mm-text-html-renderer-alist): Add a new form for links. (mm-links-remove-leading-blank): Make obsolete. (mm-inline-wash-with-file): (mm-inline-render-with-file): Make obsolete -- they were awkwardly defined and only used with links. (mm-inline-render-with-links): New function. diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el index 129295474f..56d05c8fa9 100644 --- a/lisp/gnus/mm-view.el +++ b/lisp/gnus/mm-view.el @@ -50,9 +50,7 @@ (w3m . mm-inline-text-html-render-with-w3m) (w3m-standalone . mm-inline-text-html-render-with-w3m-standalone) (gnus-w3m . gnus-article-html) - (links mm-inline-render-with-file - mm-links-remove-leading-blank - "links" "-dump" file) + (links . mm-inline-render-with-links) (lynx mm-inline-render-with-stdin nil "lynx" "-dump" "-force_html" "-stdin" "-nolist") (html2text mm-inline-render-with-function html2text)) @@ -264,6 +262,7 @@ This is only used if `mm-inline-large-images' is set to (mm-inline-render-with-stdin handle nil "w3m" "-dump" "-T" "text/html"))) (defun mm-links-remove-leading-blank () + (declare (obsolete nil "28.1")) ;; Delete the annoying three spaces preceding each line of links ;; output. (goto-char (point-min)) @@ -271,6 +270,7 @@ This is only used if `mm-inline-large-images' is set to (delete-region (match-beginning 0) (match-end 0)))) (defun mm-inline-wash-with-file (post-func cmd &rest args) + (declare (obsolete nil "28.1")) (with-suppressed-warnings ((lexical file)) (dlet ((file (make-temp-file (expand-file-name "mm" mm-tmp-directory)))) @@ -290,12 +290,41 @@ This is only used if `mm-inline-large-images' is set to (and post-func (funcall post-func))) (defun mm-inline-render-with-file (handle post-func cmd &rest args) + (declare (obsolete nil "28.1")) (let ((source (mm-get-part handle))) (mm-insert-inline handle (mm-with-unibyte-buffer (insert source) - (apply #'mm-inline-wash-with-file post-func cmd args) + (with-suppressed-warnings ((obsolete mm-inline-wash-with-file)) + (apply #'mm-inline-wash-with-file post-func cmd args)) + (buffer-string))))) + +(defun mm-inline-render-with-links (handle) + (let ((source (mm-get-part handle)) + file charset) + (mm-insert-inline + handle + (with-temp-buffer + (setq charset (mail-content-type-get (mm-handle-type handle) 'charset)) + (insert source) + (unwind-protect + (progn + (setq file (make-temp-file (expand-file-name + "mm" mm-tmp-directory))) + (let ((coding-system-for-write 'binary)) + (write-region (point-min) (point-max) file nil 'silent)) + (delete-region (point-min) (point-max)) + (if charset + (with-environment-variables (("LANG" (format "en-US.%s" + charset))) + (call-process "links" nil t nil "-dump" file)) + (call-process "links" nil t nil "-dump" file)) + (goto-char (point-min)) + (while (re-search-forward "^ " nil t) + (delete-region (match-beginning 0) (match-end 0)))) + (when (and file (file-exists-p file)) + (delete-file file))) (buffer-string))))) (defun mm-inline-render-with-stdin (handle post-func cmd &rest args) commit 7cb29440433bda1ad8defad70cbd43fb2f9f4d1f Author: Lars Ingebrigtsen Date: Sun Sep 26 08:27:51 2021 +0200 Add new macro with-environment-variables * doc/lispref/os.texi (System Environment): Document it. * lisp/env.el (with-environment-variables): New macro. diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 658f742c41..a34c01c81a 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -1042,6 +1042,18 @@ that variable with @code{let} is also reasonable practice. if it removed @var{variable} from the environment. @end deffn +@defmac with-environment-variables variables body@dots{} +This macro sets the environment variables in @var{variables} +temporarily when executing @var{body}. The previous values are +restored when the form finishes. + +@lisp +(with-environment-variables (("LANG" "C") + ("LANGUAGE" "en_US:en")) + (call-process "ls" nil t)) +@end lisp +@end defmac + @defvar process-environment This variable is a list of strings, each describing one environment variable. The functions @code{getenv} and @code{setenv} work by means diff --git a/etc/NEWS b/etc/NEWS index d77d34160b..bc468c6df4 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -4417,6 +4417,11 @@ obsoletes the old data layout specifications. It supports arbitrary-size integers, recursive types, and more. See the Info node "(elisp) Byte Packing" in the ELisp manual for more details. ++++ +** New macro 'with-environment-variables'. +This macro allows setting environment variables temporarily when +executing a form. + * Changes in Emacs 28.1 on Non-Free Operating Systems diff --git a/lisp/env.el b/lisp/env.el index 83f43d1006..31a728c0e5 100644 --- a/lisp/env.el +++ b/lisp/env.el @@ -218,6 +218,23 @@ in the environment list of the selected frame." (message "%s" (if value value "Not set"))) value)) +;;;###autoload +(defmacro with-environment-variables (variables &rest body) + "Set VARIABLES in the environent and execute BODY. +VARIABLES is a list of variable settings where first element +should be the name of the variable and the second element should +be the value. + +The previous values will be be restored upon exit." + (declare (indent 1) (debug (sexp body))) + (unless (consp variables) + (error "Invalid VARIABLES: %s" variables)) + `(let ((process-environment (copy-sequence process-environment))) + ,@(mapcar (lambda (elem) + `(setenv ,(car elem) ,(cadr elem))) + variables) + ,@body)) + (provide 'env) ;;; env.el ends here commit 43ae8c828d853382bbc2a27b9e14b9fff6ba18b6 Author: Stefan Kangas Date: Sat Sep 25 22:49:47 2021 +0200 Revert "; Fix capitalization of F1..F12 keys in docs" This reverts commit fe5b20410f68546821e6c87577d7f826167491dc. This change was not correct; these are Lisp symbols that should be in lower-case. Problem reported by Mattias Engdegård . diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 3f65972fc6..d12033f841 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -2009,7 +2009,7 @@ Other cursor repositioning keys. @itemx @code{insertline}, @code{deleteline}, @code{insertchar}, @code{deletechar} Miscellaneous function keys. -@item @code{F1}, @code{F2}, @dots{} @code{F35} +@item @code{f1}, @code{f2}, @dots{} @code{f35} Numbered function keys (across the top of the keyboard). @item @code{kp-add}, @code{kp-subtract}, @code{kp-multiply}, @code{kp-divide} diff --git a/doc/misc/edt.texi b/doc/misc/edt.texi index b3206d0115..b4dabdb938 100644 --- a/doc/misc/edt.texi +++ b/doc/misc/edt.texi @@ -524,7 +524,7 @@ So, after executing @samp{xmodmap .xmodmaprc}, a press of the physical @key{F12} key looks like a Num_Lock keypress to X@. Also, a press of the physical @key{NumLock} key looks like a press of the @key{F12} key to X. -Now, @file{edt-mapper.el} will see @samp{F12} when the physical +Now, @file{edt-mapper.el} will see @samp{f12} when the physical @key{NumLock} key is pressed, allowing the @key{NumLock} key to be used as the EDT @key{PF1} (@key{GOLD}) key. diff --git a/doc/misc/idlwave.texi b/doc/misc/idlwave.texi index 0d20ff9548..3cd53c71da 100644 --- a/doc/misc/idlwave.texi +++ b/doc/misc/idlwave.texi @@ -3259,10 +3259,10 @@ Both functions take a single string argument sharing the syntax of the "help,___,/STRUCTURE")))) @end lisp -@noindent Now pressing @key{F9}, or middle-mouse dragging with the +@noindent Now pressing @key{f9}, or middle-mouse dragging with the @key{SUPER} key depressed, will print the dimensions of the nearby or -highlighted expression. Pressing @key{F10} will give the type string, -and @key{F11} will show the contents of a nearby structure. As you can +highlighted expression. Pressing @key{f10} will give the type string, +and @key{f11} will show the contents of a nearby structure. As you can see, the possibilities are only marginally finite. @defopt idlwave-shell-examine-alist diff --git a/doc/misc/viper.texi b/doc/misc/viper.texi index 2a31d6f091..e127f62bb5 100644 --- a/doc/misc/viper.texi +++ b/doc/misc/viper.texi @@ -1142,7 +1142,7 @@ either by calling @end example @noindent -or by setting @code{viper-buffer-search-char} to, say, @kbd{F3}: +or by setting @code{viper-buffer-search-char} to, say, @kbd{f3}: @example (setq viper-buffer-search-char ?g) @end example @@ -2763,7 +2763,7 @@ Second, Viper macros are defined in a WYSIWYG style. This means that commands are executed as you type them, so you can see precisely what is being defined. Third, macros can be bound to arbitrary sequences of keys, not just to printable keys. For instance, one can define a macro that will -be invoked by hitting @kbd{F3} then @kbd{F2} function keys. (The keys +be invoked by hitting @kbd{f3} then @kbd{f2} function keys. (The keys @kbd{delete} and @kbd{backspace} are excluded; also, a macro invocation sequence can't start with @key{ESC}. Some other keys, such as @kbd{f1} and @kbd{help}, can't be bound to macros under Emacs, since they @@ -2816,7 +2816,7 @@ To do the same for Vi state and all buffers with the major mode Both macro names and macro definitions are vectors of symbols that denote keys on the keyboard. Some keys, like @kbd{\}, @kbd{ }, or digit-keys must be escaped with a backslash. Modified keys are represented as lists. For -instance, holding Meta and Control and pressing @kbd{F4} is represented as +instance, holding Meta and Control and pressing @kbd{f4} is represented as @kbd{(control meta f4)}. If all members of a vectors are printable characters (or sequences, such as @kbd{\e}, @kbd{\t}, for @key{ESC} and @key{TAB}), then they can also be represented as @@ -2915,7 +2915,7 @@ in that file: To illustrate the above point, Viper provides two canned macros, which, by default, are bound to @kbd{[f12 \1]} and @kbd{[f12 \2]} (invoked by typing -@kbd{F12} then @kbd{1} and @kbd{2}, respectively). These macros are useful +@kbd{f12} then @kbd{1} and @kbd{2}, respectively). These macros are useful shortcuts to Viper's command ring history. The first macro will execute the second-last destructive command (the last one is executed by @kbd{.}, as usual). The second macro executes the third-last command. @@ -2931,7 +2931,7 @@ say, @kbd{f12 \3} like this: @end example -Note that even though the macro uses the function key @kbd{F12}, the key is +Note that even though the macro uses the function key @kbd{f12}, the key is actually free and can still be bound to some Emacs function via @code{define-key} or @code{global-set-key}. @@ -2950,7 +2950,7 @@ twice and then the remaining keys, @kbd{t e x t}, will be processed. When defining macros using @kbd{:map} or @kbd{:map!}, the user enters the actually keys to be used to invoke the macro. For instance, you -should hit the actual key @kbd{F6} if it is to be part of a macro +should hit the actual key @kbd{f6} if it is to be part of a macro name; you do @emph{not} write @kbd{f 6}. When entering keys, Viper displays them as strings or vectors (e.g., @code{"abc"} or @code{[f6 f7 a]}). The same holds for unmapping. Hitting @key{TAB} while commit c92444b4ba3b134378fe3deb7c040bef6b9fab54 Author: Stefan Kangas Date: Sat Sep 25 21:44:44 2021 +0200 ; Bump seq version to 2.23 diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index baafc51693..e7258c2da4 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -4,7 +4,7 @@ ;; Author: Nicolas Petton ;; Keywords: sequences -;; Version: 2.22 +;; Version: 2.23 ;; Package: seq ;; Maintainer: emacs-devel@gnu.org commit 822625fde5ae951d1e6e192272223df2d1eaaa84 Author: Stefan Kangas Date: Sat Sep 25 21:25:58 2021 +0200 Revert part of previous doc fix * lisp/emacs-lisp/derived.el (define-derived-mode): Revert part of previous doc fix. This change made the text confusing. (Bug#17567) diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el index 9557f3a463..5aa745262a 100644 --- a/lisp/emacs-lisp/derived.el +++ b/lisp/emacs-lisp/derived.el @@ -132,12 +132,12 @@ KEYWORD-ARGS: to this mode. The command `customize-mode' uses this. :syntax-table TABLE Use TABLE instead of the default (CHILD-syntax-table). - TABLE should be an unquoted symbol. A nil value means - to simply use the same syntax-table as the parent. + A nil value means to simply use the same syntax-table + as the parent. :abbrev-table TABLE Use TABLE instead of the default (CHILD-abbrev-table). - TABLE should be an unquoted symbol. A nil value means - to simply use the same abbrev-table as the parent. + A nil value means to simply use the same abbrev-table + as the parent. :after-hook FORM A single Lisp form which is evaluated after the mode hooks have been run. It should not be quoted. commit a1a63bb794156af38ac0ed55fd453705a183ebcd Author: Juri Linkov Date: Sat Sep 25 22:24:48 2021 +0300 * lisp/tab-bar.el (tab-bar-new-tab-to): Use ignore-window-parameters. Suggested by Adam Porter in https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg01758.html diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index d0a1b3b70b..ceacd85971 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1244,7 +1244,8 @@ After the tab is created, the hooks in ;; Handle the case when it's called in the active minibuffer. (when (minibuffer-selected-window) (select-window (minibuffer-selected-window))) - (delete-other-windows) + (let ((ignore-window-parameters t)) + (delete-other-windows)) ;; Create a new window to get rid of old window parameters ;; (e.g. prev/next buffers) of old window. (split-window) (delete-window) commit fcca1db9fd1eb2930f29972e7def0936c3269f1b Author: Adam Porter Date: Fri Sep 24 04:47:56 2021 +0000 * lisp/tab-line.el: Add modified-buffer face (tab-line-tab-modified): New face. (tab-line-tab-face-modified): New function. (tab-line-tab-face-functions): Use new function. * etc/NEWS: Update. diff --git a/etc/NEWS b/etc/NEWS index ca167d6099..d77d34160b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -529,12 +529,14 @@ the mouse pointer is in the tab line by scrolling left or right. *** New tab-line faces and options. The face 'tab-line-tab-special' is used for tabs whose buffers are special, i.e. buffers that don't visit a file. The face -'tab-line-tab-inactive-alternate' is used to display inactive tabs -with an alternating background color, making them easier to -distinguish, especially if the face 'tab-line-tab' is configured to -not display with a box; this alternate face is only applied when the -option 'tab-line-tab-face-functions' is so configured. That option -may also be used to customize tab-line faces in other ways. +'tab-line-tab-modified' is used to display modified, file-backed +buffers. The face 'tab-line-tab-inactive-alternate' is used to +display inactive tabs with an alternating background color, making +them easier to distinguish, especially if the face 'tab-line-tab' is +configured to not display with a box; this alternate face is only +applied when the option 'tab-line-tab-face-functions' is so +configured. That option may also be used to customize tab-line faces +in other ways. ** Mouse wheel diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 1f7af9e9a9..4a751b384e 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -36,13 +36,15 @@ :group 'convenience :version "27.1") -(defcustom tab-line-tab-face-functions '(tab-line-tab-face-special) +(defcustom tab-line-tab-face-functions + '(tab-line-tab-face-modified tab-line-tab-face-special) "Functions called to modify tab faces. Each function is called with five arguments: the tab, a list of all tabs, the face returned by the previously called modifier, whether the tab is a buffer, and whether the tab is selected." :type '(repeat (choice (function-item tab-line-tab-face-special) + (function-item tab-line-tab-face-modified) (function-item tab-line-tab-face-inactive-alternating) (function-item tab-line-tab-face-group) (function :tag "Custom function"))) @@ -92,6 +94,14 @@ function `tab-line-tab-face-special'." :version "28.1" :group 'tab-line-faces) +(defface tab-line-tab-modified + '((t :inherit font-lock-doc-face)) + "Face for modified tabs. +Applied when option `tab-line-tab-face-functions' includes +function `tab-line-tab-face-modified'." + :version "28.1" + :group 'tab-line-faces) + (defface tab-line-tab-group '((t :inherit tab-line :box nil)) "Face for group tabs. @@ -537,6 +547,15 @@ When TAB is a non-file-backed buffer, make FACE inherit from (setf face `(:inherit (tab-line-tab-special ,face)))) face) +(defun tab-line-tab-face-modified (tab _tabs face buffer-p _selected-p) + "Return FACE for TAB according to whether it's modified. +When TAB is a modified, file-backed buffer, make FACE inherit +from `tab-line-tab-modified'. For use in +`tab-line-tab-face-functions'." + (when (and buffer-p (buffer-file-name tab) (buffer-modified-p tab)) + (setf face `(:inherit (tab-line-tab-modified ,face)))) + face) + (defun tab-line-tab-face-group (tab _tabs face _buffer-p _selected-p) "Return FACE for TAB according to whether it's a group tab. For use in `tab-line-tab-face-functions'." commit fe5b20410f68546821e6c87577d7f826167491dc Author: Stefan Kangas Date: Sat Sep 25 20:51:13 2021 +0200 ; Fix capitalization of F1..F12 keys in docs * doc/emacs/custom.texi (Function Keys): * doc/misc/edt.texi (Unix): * doc/misc/idlwave.texi (Custom Expression Examination): * doc/misc/viper.texi (Improved Search, Vi Macros): Fix capitalization of F1..F12 keys. diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index d12033f841..3f65972fc6 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -2009,7 +2009,7 @@ Other cursor repositioning keys. @itemx @code{insertline}, @code{deleteline}, @code{insertchar}, @code{deletechar} Miscellaneous function keys. -@item @code{f1}, @code{f2}, @dots{} @code{f35} +@item @code{F1}, @code{F2}, @dots{} @code{F35} Numbered function keys (across the top of the keyboard). @item @code{kp-add}, @code{kp-subtract}, @code{kp-multiply}, @code{kp-divide} diff --git a/doc/misc/edt.texi b/doc/misc/edt.texi index b4dabdb938..b3206d0115 100644 --- a/doc/misc/edt.texi +++ b/doc/misc/edt.texi @@ -524,7 +524,7 @@ So, after executing @samp{xmodmap .xmodmaprc}, a press of the physical @key{F12} key looks like a Num_Lock keypress to X@. Also, a press of the physical @key{NumLock} key looks like a press of the @key{F12} key to X. -Now, @file{edt-mapper.el} will see @samp{f12} when the physical +Now, @file{edt-mapper.el} will see @samp{F12} when the physical @key{NumLock} key is pressed, allowing the @key{NumLock} key to be used as the EDT @key{PF1} (@key{GOLD}) key. diff --git a/doc/misc/idlwave.texi b/doc/misc/idlwave.texi index 3cd53c71da..0d20ff9548 100644 --- a/doc/misc/idlwave.texi +++ b/doc/misc/idlwave.texi @@ -3259,10 +3259,10 @@ Both functions take a single string argument sharing the syntax of the "help,___,/STRUCTURE")))) @end lisp -@noindent Now pressing @key{f9}, or middle-mouse dragging with the +@noindent Now pressing @key{F9}, or middle-mouse dragging with the @key{SUPER} key depressed, will print the dimensions of the nearby or -highlighted expression. Pressing @key{f10} will give the type string, -and @key{f11} will show the contents of a nearby structure. As you can +highlighted expression. Pressing @key{F10} will give the type string, +and @key{F11} will show the contents of a nearby structure. As you can see, the possibilities are only marginally finite. @defopt idlwave-shell-examine-alist diff --git a/doc/misc/viper.texi b/doc/misc/viper.texi index e127f62bb5..2a31d6f091 100644 --- a/doc/misc/viper.texi +++ b/doc/misc/viper.texi @@ -1142,7 +1142,7 @@ either by calling @end example @noindent -or by setting @code{viper-buffer-search-char} to, say, @kbd{f3}: +or by setting @code{viper-buffer-search-char} to, say, @kbd{F3}: @example (setq viper-buffer-search-char ?g) @end example @@ -2763,7 +2763,7 @@ Second, Viper macros are defined in a WYSIWYG style. This means that commands are executed as you type them, so you can see precisely what is being defined. Third, macros can be bound to arbitrary sequences of keys, not just to printable keys. For instance, one can define a macro that will -be invoked by hitting @kbd{f3} then @kbd{f2} function keys. (The keys +be invoked by hitting @kbd{F3} then @kbd{F2} function keys. (The keys @kbd{delete} and @kbd{backspace} are excluded; also, a macro invocation sequence can't start with @key{ESC}. Some other keys, such as @kbd{f1} and @kbd{help}, can't be bound to macros under Emacs, since they @@ -2816,7 +2816,7 @@ To do the same for Vi state and all buffers with the major mode Both macro names and macro definitions are vectors of symbols that denote keys on the keyboard. Some keys, like @kbd{\}, @kbd{ }, or digit-keys must be escaped with a backslash. Modified keys are represented as lists. For -instance, holding Meta and Control and pressing @kbd{f4} is represented as +instance, holding Meta and Control and pressing @kbd{F4} is represented as @kbd{(control meta f4)}. If all members of a vectors are printable characters (or sequences, such as @kbd{\e}, @kbd{\t}, for @key{ESC} and @key{TAB}), then they can also be represented as @@ -2915,7 +2915,7 @@ in that file: To illustrate the above point, Viper provides two canned macros, which, by default, are bound to @kbd{[f12 \1]} and @kbd{[f12 \2]} (invoked by typing -@kbd{f12} then @kbd{1} and @kbd{2}, respectively). These macros are useful +@kbd{F12} then @kbd{1} and @kbd{2}, respectively). These macros are useful shortcuts to Viper's command ring history. The first macro will execute the second-last destructive command (the last one is executed by @kbd{.}, as usual). The second macro executes the third-last command. @@ -2931,7 +2931,7 @@ say, @kbd{f12 \3} like this: @end example -Note that even though the macro uses the function key @kbd{f12}, the key is +Note that even though the macro uses the function key @kbd{F12}, the key is actually free and can still be bound to some Emacs function via @code{define-key} or @code{global-set-key}. @@ -2950,7 +2950,7 @@ twice and then the remaining keys, @kbd{t e x t}, will be processed. When defining macros using @kbd{:map} or @kbd{:map!}, the user enters the actually keys to be used to invoke the macro. For instance, you -should hit the actual key @kbd{f6} if it is to be part of a macro +should hit the actual key @kbd{F6} if it is to be part of a macro name; you do @emph{not} write @kbd{f 6}. When entering keys, Viper displays them as strings or vectors (e.g., @code{"abc"} or @code{[f6 f7 a]}). The same holds for unmapping. Hitting @key{TAB} while commit e6656df59151cb491259492de534acf8d4d0e8ec Author: Mattias Engdegård Date: Sat Sep 25 20:27:28 2021 +0200 ; * lisp/wid-edit.el (natnum): rectify tag string diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 72353b9190..05606fbfb4 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -3646,7 +3646,7 @@ match-alternatives: %S" (define-widget 'natnum 'restricted-sexp "A nonnegative integer." - :tag "Integer (positive)" + :tag "Integer (positive or zero)" :value 0 :type-error "This field should contain a nonnegative integer" :match-alternatives '(natnump)) commit 45c32d7f00e225a78e6c8b2251de335e93e556e0 Author: Mattias Engdegård Date: Sat Sep 25 12:15:21 2021 +0200 Fix byte-compiler crash for legal dynamic-binding code This should really be taken care of by a syntax normalisation step in the frontend, but there is no such step for non-lexbind code yet. * lisp/emacs-lisp/byte-opt.el (byte-optimize-letX): Tolerate bindingsa without initialising expressions. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test cases. diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index c8a96fa22a..c8990f2353 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1367,17 +1367,24 @@ See Info node `(elisp) Integer Basics'." (and (consp binding) (cadr binding))) bindings) ,const) - `(let* ,(butlast bindings) ,(cadar (last bindings)) ,const))) + `(let* ,(butlast bindings) + ,@(and (consp (car (last bindings))) + (cdar (last bindings))) + ,const))) ;; Body is last variable. - (`(,head ,bindings ,(and var (pred symbolp) (pred (not keywordp)) - (pred (not booleanp)) - (guard (eq var (caar (last bindings)))))) + (`(,head ,(and bindings + (let last-var (let ((last (car (last bindings)))) + (if (consp last) (car last) last)))) + ,(and last-var ; non-linear pattern + (pred symbolp) (pred (not keywordp)) (pred (not booleanp)))) (if (eq head 'let) `(progn ,@(mapcar (lambda (binding) (and (consp binding) (cadr binding))) bindings)) - `(let* ,(butlast bindings) ,(cadar (last bindings))))) + `(let* ,(butlast bindings) + ,@(and (consp (car (last bindings))) + (cdar (last bindings)))))) (_ form))) diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index ded6351c5e..d56c60b1f1 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -573,6 +573,14 @@ inner loops respectively." (let ((_a 1) (_b 2)) 'z) + (let (x y) + y) + (let* (x y) + y) + (let (x y) + 'a) + (let* (x y) + 'a) ;; Check empty-list optimisations. (mapcar (lambda (x) (member x nil)) '("a" 2 nil)) commit e93bdfb6dafd4cb8d660e1330a8527f61e831eab Author: Mattias Engdegård Date: Sat Sep 25 09:09:58 2021 +0200 ; * doc/emacs/help.texi (Misc Help): @key{f1} -> @key{F1} diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi index 4ee302fbf7..d1329d561c 100644 --- a/doc/emacs/help.texi +++ b/doc/emacs/help.texi @@ -646,14 +646,14 @@ Emacs Lisp Reference Manual}). @findex describe-prefix-bindings You can get a list of subcommands for a particular prefix key by -typing @kbd{C-h}, @kbd{?}, or @key{f1} +typing @kbd{C-h}, @kbd{?}, or @key{F1} (@code{describe-prefix-bindings}) after the prefix key. (There are a few prefix keys for which not all of these keys work---those that provide their own bindings for that key. One of these prefix keys is @key{ESC}, because @kbd{@key{ESC} C-h} and @kbd{@key{ESC} ?} are actually @kbd{C-M-h} (@code{mark-defun}) and @kbd{M-?} (@code{xref-find-references}), respectively. However, -@w{@kbd{@key{ESC} @key{f1}}} works fine.) +@w{@kbd{@key{ESC} @key{F1}}} works fine.) @findex describe-keymap Finally, @kbd{M-x describe-keymap} prompts for the name of a keymap, commit 8d0ee5e7a9d635a625f87fd8c6eed39a8a749131 Author: Mattias Engdegård Date: Wed Sep 22 11:03:30 2021 +0200 Constant-propagate variables bound outside loops Previously, variables bound outside `while` loops were not substituted inside even in the absense of mutation. Add the necessary mutation checking inside loops to allow propagation of values and aliased variables. * lisp/emacs-lisp/byte-opt.el (byte-optimize--inhibit-outside-loop-constprop): New variable. (byte-optimize-form-code-walker): First traverse each loop without substitution to discover mutation, then without restrictions. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test-loop): New. (bytecomp-tests--test-cases): Add test cases. diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index c15814afa0..c8a96fa22a 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -317,6 +317,10 @@ occur an indeterminate number of times and thus have effect on code sequentially preceding the mutation itself. Same format as `byte-optimize--lexvars', with shared structure and contents.") +(defvar byte-optimize--inhibit-outside-loop-constprop nil + "If t, don't propagate values for variables declared outside the inner loop. +This indicates the loop discovery phase.") + (defvar byte-optimize--dynamic-vars nil "List of variables declared as dynamic during optimisation.") @@ -402,15 +406,13 @@ for speeding up processing.") (cond ((not lexvar) form) (for-effect nil) - ((cddr lexvar) ; Value available? - (if (assq form byte-optimize--vars-outside-loop) - ;; Cannot substitute; mark for retention to avoid the - ;; variable being eliminated. - (progn - (setcar (cdr lexvar) t) - form) - ;; variable value to use - (caddr lexvar))) + ((and (cddr lexvar) ; substitution available + ;; Perform substitution, except during the loop mutation + ;; discovery phase if the variable was bound outside the + ;; innermost loop. + (not (and byte-optimize--inhibit-outside-loop-constprop + (assq form byte-optimize--vars-outside-loop)))) + (caddr lexvar)) (t form)))) (t form))) (`(quote . ,v) @@ -488,14 +490,26 @@ for speeding up processing.") (cons fn (nreverse args)))) (`(while ,exp . ,exps) - ;; FIXME: We conservatively prevent the substitution of any variable - ;; bound outside the loop in case it is mutated later in the loop, - ;; but this misses many opportunities: variables not mutated in the - ;; loop at all, and variables affecting the initial condition (which - ;; is always executed unconditionally). + ;; FIXME: If the loop condition is statically nil after substitution + ;; of surrounding variables then we can eliminate the whole loop, + ;; even if those variables are mutated inside the loop. + ;; We currently don't perform this important optimisation. (let* ((byte-optimize--vars-outside-loop byte-optimize--lexvars) - (condition (byte-optimize-form exp nil)) - (body (byte-optimize-body exps t))) + (condition-body + (if byte-optimize--inhibit-outside-loop-constprop + ;; We are already inside the discovery phase of an outer + ;; loop so there is no need for traversing this loop twice. + (cons exp exps) + ;; Discovery phase: run optimisation without substitution + ;; of variables bound outside this loop. + (let ((byte-optimize--inhibit-outside-loop-constprop t)) + (cons (byte-optimize-form exp nil) + (byte-optimize-body exps t))))) + ;; Optimise again, this time with constprop enabled (unless + ;; we are in discovery of an outer loop), + ;; as mutated variables have been marked as non-substitutable. + (condition (byte-optimize-form (car condition-body) nil)) + (body (byte-optimize-body (cdr condition-body) t))) `(while ,condition . ,body))) (`(interactive . ,_) @@ -793,8 +807,10 @@ for speeding up processing.") (bindings nil)) (dolist (var let-vars) ;; VAR is (NAME EXPR [KEEP [VALUE]]) - (when (or (not (nthcdr 3 var)) (nth 2 var)) - ;; Value not present, or variable marked to be kept. + (when (or (not (nthcdr 3 var)) (nth 2 var) + byte-optimize--inhibit-outside-loop-constprop) + ;; Value not present, or variable marked to be kept, + ;; or we are in the loop discovery phase: keep the binding. (push (list (nth 0 var) (nth 1 var)) bindings))) (cons bindings opt-body))) diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 2832dd0246..ded6351c5e 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -41,6 +41,24 @@ "Identity, but hidden from some optimisations." x) +(defmacro bytecomp-test-loop (outer1 outer2 inner1 inner2) + "Exercise constant propagation inside `while' loops. +OUTER1, OUTER2, INNER1 and INNER2 are forms placed in the outer and +inner loops respectively." + `(let ((x 1) (i 3) (res nil)) + (while (> i 0) + (let ((y 2) (j 2)) + (setq res (cons (list 'outer x y) res)) + (while (> j 0) + (setq res (cons (list 'inner x y) res)) + ,inner1 + ,inner2 + (setq j (1- j))) + ,outer1 + ,outer2) + (setq i (1- i))) + res)) + (defconst bytecomp-tests--test-cases '( ;; some functional tests @@ -454,6 +472,25 @@ (setq x 10)))) 4) + ;; Loop constprop: set the inner and outer variables in the inner + ;; and outer loops, all combinations. + (bytecomp-test-loop nil nil nil nil ) + (bytecomp-test-loop nil nil nil (setq x 6)) + (bytecomp-test-loop nil nil (setq x 5) nil ) + (bytecomp-test-loop nil nil (setq x 5) (setq x 6)) + (bytecomp-test-loop nil (setq x 4) nil nil ) + (bytecomp-test-loop nil (setq x 4) nil (setq x 6)) + (bytecomp-test-loop nil (setq x 4) (setq x 5) nil ) + (bytecomp-test-loop nil (setq x 4) (setq x 5) (setq x 6)) + (bytecomp-test-loop (setq x 3) nil nil nil ) + (bytecomp-test-loop (setq x 3) nil nil (setq x 6)) + (bytecomp-test-loop (setq x 3) nil (setq x 5) nil ) + (bytecomp-test-loop (setq x 3) nil (setq x 5) (setq x 6)) + (bytecomp-test-loop (setq x 3) (setq x 4) nil nil ) + (bytecomp-test-loop (setq x 3) (setq x 4) nil (setq x 6)) + (bytecomp-test-loop (setq x 3) (setq x 4) (setq x 5) nil ) + (bytecomp-test-loop (setq x 3) (setq x 4) (setq x 5) (setq x 6)) + ;; No error, no success handler. (condition-case x (list 42) commit 32de11d8deff2c4df6d3f8a7b0de8d81980a91e4 Author: Mattias Engdegård Date: Fri Sep 24 14:18:57 2021 +0200 ; Remove various duplicated words * doc/lispref/searching.texi (Extending Rx): * doc/lispref/strings.texi (Creating Strings): * doc/misc/modus-themes.org (Measure color contrast (DIY)): * etc/NEWS: * lisp/find-file.el (ff-find-other-file): * lisp/gnus/gnus-group.el (gnus-group-suspend): * lisp/progmodes/cc-langs.el (c-ml-string-any-closer-re): * lisp/progmodes/flymake.el (flymake-list-only-diagnostics): * lisp/progmodes/xref.el (xref--group-name-for-display): * lisp/transient.el (transient-child, transient-files) (transient-infix-value): * src/alloc.c: * src/regex-emacs.c (regex_compile): Remove duplicate words in comments, documentation etc. diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 0dcf3889a5..9451d83def 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -1651,7 +1651,7 @@ package prefix to avoid name clashes with definitions elsewhere, as is usual when naming non-local variables and functions. Forms defined this way only perform simple template substitution. -For arbitrary computations, use them together with with the @code{rx} +For arbitrary computations, use them together with the @code{rx} forms @code{eval}, @code{regexp} or @code{literal}. Example: @example diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index b4d7bc729f..9756e6331c 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -402,7 +402,7 @@ Remove the trailing text that matches @var{regexp} from @var{string}. @defun string-trim string &optional trim-left trim-right Remove the leading text that matches @var{trim-left} and trailing text -that matches @var{trim-right} from from @var{string}. Both regexps +that matches @var{trim-right} from @var{string}. Both regexps default to @samp{[ \t\n\r]+}. @end defun diff --git a/doc/misc/modus-themes.org b/doc/misc/modus-themes.org index 5bb230f892..6c3692b826 100644 --- a/doc/misc/modus-themes.org +++ b/doc/misc/modus-themes.org @@ -2700,7 +2700,7 @@ A couple of examples (rounded numbers): ;; Pure black with pure green (modus-themes-contrast "#000000" "#00ff00") ;; => 15.3 -;; That is is a highly accessible combo +;; That is a highly accessible combo #+end_src It does not matter which color value comes first. The ratio is always diff --git a/etc/NEWS b/etc/NEWS index 61780a3a19..ca167d6099 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3681,7 +3681,7 @@ used in. ** 'condition-case' now allows for a success handler. It is written as '(:success BODY...)' where BODY is executed whenever the protected form terminates without error, with the -specified variable bound to the the value of the protected form. +specified variable bound to the value of the protected form. +++ ** New function 'benchmark-call' to measure the execution time of a function. diff --git a/lisp/find-file.el b/lisp/find-file.el index 4d520c01cc..afe6cb5150 100644 --- a/lisp/find-file.el +++ b/lisp/find-file.el @@ -356,7 +356,7 @@ Variables of interest include: List of functions to be called if the other file has been created." (interactive (list current-prefix-arg nil last-nonmenu-event)) ;; We want to preserve point in the current buffer. But the point of - ;; ff-find-the-other-file is to make the the other file buffer + ;; ff-find-the-other-file is to make the other file buffer ;; current, so we can't use save-excursion here (see bug 48535). (let ((start-buffer (current-buffer)) (start-point (point))) diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 83c953515e..aea8cbbf78 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -4473,7 +4473,7 @@ The hook `gnus-suspend-gnus-hook' is called before actually suspending." (gnus-kill-buffer buf))) (setq gnus-backlog-articles nil) (gnus-kill-gnus-frames) - ;; Closing all the backends is useful (for instance) when when the + ;; Closing all the backends is useful (for instance) when the ;; IP addresses have changed and you need to reconnect. (dolist (elem gnus-opened-servers) (gnus-close-server (car elem))) diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 36f12369fc..53f6206a82 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -680,7 +680,7 @@ A search for this regexp starting at the end of the corresponding opener must find the first closer as the first match. Such a closer must include a \" character. (match-string 1) -matches the actual delimiter and and (match-string 2) matches the +matches the actual delimiter and (match-string 2) matches the actual \". If a delimiter contains several \"s, it is recommended to regard the last of them as \"the\" \"." t nil diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 9418debe5e..5a1455aa7b 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1654,7 +1654,7 @@ buffer." "Diagnostics list meant for listing, not highlighting. This variable holds an alist ((FILE-NAME . DIAGS) ...) where FILE-NAME is a string holding an absolute file name and DIAGS is -a list of diagnostic objects created with with +a list of diagnostic objects created with `flymake-make-diagnostic'. These diagnostics are never annotated as overlays in actual buffers: they merely serve as temporary stand-ins for more accurate diagnostics that are produced once diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index af1413e050..8906f6326a 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1018,7 +1018,7 @@ GROUP is a string for decoration purposes and XREF is an The style is determined by the value of `xref-file-name-display'. If GROUP looks like a file name, its value is formatted according -to that style. Otherwise it it returned unchanged." +to that style. Otherwise it is returned unchanged." ;; XXX: The way we verify that it's indeed a file name and not some ;; other kind of string, e.g. Java package name or TITLE from ;; `tags-apropos-additional-actions', is pretty lax. But we don't diff --git a/lisp/transient.el b/lisp/transient.el index f3d3902a77..c33a4c722a 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -640,7 +640,7 @@ the prototype is stored in the clone's `prototype' slot.") :initarg :if-not-derived :initform nil :documentation "Enable if major-mode does not derive from value.")) - "Abstract superclass for group and and suffix classes. + "Abstract superclass for group and suffix classes. It is undefined what happens if more than one `if*' predicate slot is non-nil." @@ -729,7 +729,7 @@ slot is non-nil." (defclass transient-files (transient-infix) () "Class used for the \"--\" argument. All remaining arguments are treated as files. -They become the value of this this argument.") +They become the value of this argument.") ;;;; Group @@ -2736,7 +2736,7 @@ Usually only infixes have a value, but see the method for (cl-defmethod transient-infix-value ((_ transient-suffix)) "Return nil, which means \"no value\". -Infix arguments contribute the the transient's value while suffix +Infix arguments contribute the transient's value while suffix commands consume it. This function is called for suffixes anyway because a command that both contributes to the transient's value and also consumes it is not completely unconceivable. diff --git a/src/alloc.c b/src/alloc.c index 4ea337ddba..0895a0f52a 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1929,8 +1929,7 @@ allocate_string_data (struct Lisp_String *s, The character is at byte offset CIDX_BYTE in the string. The character being replaced is CLEN bytes long, and the character that will replace it is NEW_CLEN bytes long. - Return the address of where the caller should store the - the new character. */ + Return the address where the caller should store the new character. */ unsigned char * resize_string_data (Lisp_Object string, ptrdiff_t cidx_byte, diff --git a/src/regex-emacs.c b/src/regex-emacs.c index 8350e54b54..3224f65fa4 100644 --- a/src/regex-emacs.c +++ b/src/regex-emacs.c @@ -2407,7 +2407,7 @@ regex_compile (re_char *pattern, ptrdiff_t size, if (lower_bound == 0) { - /* A succeed_n that starts with 0 is really a + /* A succeed_n that starts with 0 is really a simple on_failure_jump_loop. */ INSERT_JUMP (on_failure_jump_loop, laststart, b + 3 + nbytes); @@ -3828,7 +3828,7 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, re_char *p1, /* Matching routines. */ /* re_match_2 matches the compiled pattern in BUFP against the - the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1 + (virtual) concatenation of STRING1 and STRING2 (of length SIZE1 and SIZE2, respectively). We start matching at POS, and stop matching at STOP. commit 0b099e34dc726c3ed0e7b63028f42c2a2720ba7c Author: Mattias Engdegård Date: Thu Sep 23 14:02:21 2021 +0200 Use ambient lexical-binding value in ert-deftest body (bug#50738) * lisp/emacs-lisp/ert.el (ert-deftest): Evaluate the body of `ert-deftest` with the `lexical-binding` value of the source file (or more precisely the value in force when the definition is evaluated), which is what everyone expected, instead of always using dynamic binding which is what they got until now. * test/lisp/emacs-lisp/ert-tests.el (ert-test-deftest-lexical-binding-t): New test. diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index d4d8510064..6d867abd7a 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -218,7 +218,11 @@ it has to be wrapped in `(eval (quote ...))'. `(:expected-result-type ,expected-result)) ,@(when tags-supplied-p `(:tags ,tags)) - :body (lambda () ,@body))) + :body (lambda () + ;; Use the value of `lexical-binding' in + ;; the source file when evaluating the body. + (let ((lexical-binding ,lexical-binding)) + ,@body)))) ',name)))) (defvar ert--find-test-regexp diff --git a/test/lisp/emacs-lisp/ert-tests.el b/test/lisp/emacs-lisp/ert-tests.el index 5c9696105e..a18664bba3 100644 --- a/test/lisp/emacs-lisp/ert-tests.el +++ b/test/lisp/emacs-lisp/ert-tests.el @@ -816,6 +816,10 @@ This macro is used to test if macroexpansion in `should' works." (should (equal (ert-test-failed-condition result) '(ert-test-failed "Boo"))))) +(ert-deftest ert-test-deftest-lexical-binding-t () + "Check that `lexical-binding' in `ert-deftest' has the file value." + (should (equal lexical-binding t))) + (provide 'ert-tests) commit ed02b88bbae18caad650d76876940ffb58cab554 Author: Mattias Engdegård Date: Thu Sep 23 12:43:41 2021 +0200 Renege on anonymous &rest (bug#50268, bug#50720) Allowing &rest without a variable name following turned out not to be very useful, and it never worked properly. Disallow it. * lisp/emacs-lisp/bytecomp.el (byte-compile-check-lambda-list): * src/eval.c (funcall_lambda): Signal error for &rest without variable name. * doc/lispref/functions.texi (Argument List): Adjust manual. * etc/NEWS (file): Announce. * test/src/eval-tests.el (eval-tests--bugs-24912-and-24913): Extend test, also checking with and without lexical binding. (eval-tests-accept-empty-optional-rest): Reduce to... (eval-tests-accept-empty-optional): ...this, again checking with and without lexical binding. diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 77d1465c87..c856557c3c 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -378,7 +378,7 @@ keyword @code{&rest} before one final argument. @group (@var{required-vars}@dots{} @r{[}&optional @r{[}@var{optional-vars}@dots{}@r{]}@r{]} - @r{[}&rest @r{[}@var{rest-var}@r{]}@r{]}) + @r{[}&rest @var{rest-var}@r{]}) @end group @end example diff --git a/etc/NEWS b/etc/NEWS index f211a98678..61780a3a19 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3273,6 +3273,13 @@ local variable would not be heeded. This has now changed, and a file with a 'lexical-binding' cookie is always heeded. To revert to the old behavior, set 'permanently-enabled-local-variables' to nil. ++++ +** '&rest' in argument lists must always be followed by a variable name. +Omitting the variable name after '&rest' was previously tolerated in +some cases but not consistently so; it could lead to crashes or +outright wrong results. Since the utility was marginal at best, it is +now an error to omit the variable. + --- ** 'kill-all-local-variables' has changed how it handles non-symbol hooks. The function is documented to eliminate all buffer-local bindings diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index be74195778..d7da7a2149 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2930,6 +2930,8 @@ If FORM is a lambda or a macro, byte-compile it as a function." (macroexp--const-symbol-p arg t)) (error "Invalid lambda variable %s" arg)) ((eq arg '&rest) + (unless (cdr list) + (error "&rest without variable name")) (when (cddr list) (error "Garbage following &rest VAR in lambda-list")) (when (memq (cadr list) '(&optional &rest)) diff --git a/src/eval.c b/src/eval.c index 2bb7cfe600..66d34808f8 100644 --- a/src/eval.c +++ b/src/eval.c @@ -3245,6 +3245,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs, emacs_abort (); i = optional = rest = 0; + bool previous_rest = false; for (; CONSP (syms_left); syms_left = XCDR (syms_left)) { maybe_quit (); @@ -3255,13 +3256,14 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs, if (EQ (next, Qand_rest)) { - if (rest) + if (rest || previous_rest) xsignal1 (Qinvalid_function, fun); rest = 1; + previous_rest = true; } else if (EQ (next, Qand_optional)) { - if (optional || rest) + if (optional || rest || previous_rest) xsignal1 (Qinvalid_function, fun); optional = 1; } @@ -3287,10 +3289,11 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs, else /* Dynamically bind NEXT. */ specbind (next, arg); + previous_rest = false; } } - if (!NILP (syms_left)) + if (!NILP (syms_left) || previous_rest) xsignal1 (Qinvalid_function, fun); else if (i < nargs) xsignal2 (Qwrong_number_of_arguments, fun, make_fixnum (nargs)); diff --git a/test/src/eval-tests.el b/test/src/eval-tests.el index b2b7dfefda..3c3e703341 100644 --- a/test/src/eval-tests.el +++ b/test/src/eval-tests.el @@ -39,31 +39,40 @@ (ert-deftest eval-tests--bugs-24912-and-24913 () "Check that Emacs doesn't accept weird argument lists. Bug#24912 and Bug#24913." - (dolist (args '((&rest &optional) - (&rest a &optional) (&rest &optional a) - (&optional &optional) (&optional &optional a) - (&optional a &optional b) - (&rest &rest) (&rest &rest a) - (&rest a &rest b))) - (should-error (eval `(funcall (lambda ,args)) t) :type 'invalid-function) - (should-error (byte-compile-check-lambda-list args)) - (let ((byte-compile-debug t)) - (ert-info ((format "bytecomp: args = %S" args)) - (should-error (eval `(byte-compile (lambda ,args)) t)))))) - -(ert-deftest eval-tests-accept-empty-optional-rest () - "Check that Emacs accepts empty &optional and &rest arglists. + (dolist (lb '(t false)) + (ert-info ((prin1-to-string lb) :prefix "lexical-binding: ") + (let ((lexical-binding lb)) + (dolist (args '((&rest &optional) + (&rest a &optional) (&rest &optional a) + (&optional &optional) (&optional &optional a) + (&optional a &optional b) + (&rest &rest) (&rest &rest a) + (&rest a &rest b) + (&rest) (&optional &rest) + )) + (ert-info ((prin1-to-string args) :prefix "args: ") + (should-error + (eval `(funcall (lambda ,args)) lb) :type 'invalid-function) + (should-error (byte-compile-check-lambda-list args)) + (let ((byte-compile-debug t)) + (should-error (eval `(byte-compile (lambda ,args)) lb))))))))) + +(ert-deftest eval-tests-accept-empty-optional () + "Check that Emacs accepts empty &optional arglists. Bug#24912." - (dolist (args '((&optional) (&rest) (&optional &rest) - (&optional &rest a) (&optional a &rest))) - (let ((fun `(lambda ,args 'ok))) - (ert-info ("eval") - (should (eq (funcall (eval fun t)) 'ok))) - (ert-info ("byte comp check") - (byte-compile-check-lambda-list args)) - (ert-info ("bytecomp") - (let ((byte-compile-debug t)) - (should (eq (funcall (byte-compile fun)) 'ok))))))) + (dolist (lb '(t false)) + (ert-info ((prin1-to-string lb) :prefix "lexical-binding: ") + (let ((lexical-binding lb)) + (dolist (args '((&optional) (&optional &rest a))) + (ert-info ((prin1-to-string args) :prefix "args: ") + (let ((fun `(lambda ,args 'ok))) + (ert-info ("eval") + (should (eq (funcall (eval fun lb)) 'ok))) + (ert-info ("byte comp check") + (byte-compile-check-lambda-list args)) + (ert-info ("bytecomp") + (let ((byte-compile-debug t)) + (should (eq (funcall (byte-compile fun)) 'ok))))))))))) (dolist (form '(let let*)) commit 80fddff5d64ff915651eb751685b7430de00c536 Author: Stefan Kangas Date: Sat Sep 25 18:59:37 2021 +0200 Clarify define-derived-mode docstring * lisp/emacs-lisp/derived.el (define-derived-mode): Doc fixes; correctly mention that the mode name is used in the mode line, clarify argument types, and how the mode hook is named. (Bug17567) (derived-mode-hook-name, derived-mode-map-name) (derived-mode-syntax-table-name, derived-mode-abbrev-table-name): Clarify that argument is a symbol. diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el index 5e9644d823..9557f3a463 100644 --- a/lisp/emacs-lisp/derived.el +++ b/lisp/emacs-lisp/derived.el @@ -94,19 +94,19 @@ ;;; PRIVATE: defsubst must be defined before they are first used (defsubst derived-mode-hook-name (mode) - "Construct a mode-hook name based on a MODE name." + "Construct a mode-hook name based on the symbol MODE." (intern (concat (symbol-name mode) "-hook"))) (defsubst derived-mode-map-name (mode) - "Construct a map name based on a MODE name." + "Construct a map name based on the symbol MODE." (intern (concat (symbol-name mode) "-map"))) (defsubst derived-mode-syntax-table-name (mode) - "Construct a syntax-table name based on a MODE name." + "Construct a syntax-table name based on the symbol MODE." (intern (concat (symbol-name mode) "-syntax-table"))) (defsubst derived-mode-abbrev-table-name (mode) - "Construct an abbrev-table name based on a MODE name." + "Construct an abbrev-table name based on the symbol MODE." (intern (concat (symbol-name mode) "-abbrev-table"))) ;; PUBLIC: define a new major mode which inherits from an existing one. @@ -120,7 +120,7 @@ The arguments are as follows: CHILD: the name of the command for the derived mode. PARENT: the name of the command for the parent mode (e.g. `text-mode') or nil if there is no parent. -NAME: a string which will appear in the status line (e.g. \"Hypertext\") +NAME: a string that will appear in the mode line (e.g. \"HTML\") DOCSTRING: an optional documentation string--if you do not supply one, the function will attempt to invent something useful. KEYWORD-ARGS: @@ -132,12 +132,12 @@ KEYWORD-ARGS: to this mode. The command `customize-mode' uses this. :syntax-table TABLE Use TABLE instead of the default (CHILD-syntax-table). - A nil value means to simply use the same syntax-table - as the parent. + TABLE should be an unquoted symbol. A nil value means + to simply use the same syntax-table as the parent. :abbrev-table TABLE Use TABLE instead of the default (CHILD-abbrev-table). - A nil value means to simply use the same abbrev-table - as the parent. + TABLE should be an unquoted symbol. A nil value means + to simply use the same abbrev-table as the parent. :after-hook FORM A single Lisp form which is evaluated after the mode hooks have been run. It should not be quoted. @@ -166,8 +166,8 @@ the parent, and then sets the variable `case-fold-search' to nil: Note that if the documentation string had been left out, it would have been generated automatically, with a reference to the keymap. -The new mode runs the hook constructed by the function -`derived-mode-hook-name'. +The new mode runs the hook named MODE-hook. For `foo-mode', +the hook will be named `foo-mode-hook'. See Info node `(elisp)Derived Modes' for more details. commit 4778e10572cc3d094f27fafa96426ad81af3794b Author: Michael Albinus Date: Sat Sep 25 18:50:32 2021 +0200 ; Fix typo in ert.texi diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index 16315df8b1..19f2d7d609 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -348,7 +348,7 @@ Show the documentation of a test (@code{ert-describe-test}). Display test timings for the last run (@code{ert-results-pop-to-timings}). @item M-x ert-delete-all-tests -@findex ert-delete-all-test +@findex ert-delete-all-tests @cindex delete all tests Delete all tests from the running session. commit f8f5869a6be6a15f299614e31749f569274f0851 Author: Philip Kaludercic Date: Sat Sep 25 18:32:33 2021 +0200 Add myself as rcirc maintainer diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 74ea33e99f..e02d85e21a 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -4,7 +4,8 @@ ;; Author: Ryan Yeske ;; Maintainers: Ryan Yeske , -;; Leo Liu +;; Leo Liu , +;; Philip Kaludercic ;; Keywords: comm ;; This file is part of GNU Emacs. commit 35b8c42bcdae11c0caa172584eb6441f58439fa6 Author: Philip Kaludercic Date: Sat Sep 25 17:59:52 2021 +0200 * rcirc.el (rcirc-sentinel): Use process-status diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 2e49ccb5dd..74ea33e99f 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -855,12 +855,13 @@ If QUIET is non-nil, no not emit a message." #'rcirc-reconnect process t)))))))) (defun rcirc-sentinel (process sentinel) - "Called when PROCESS receives SENTINEL." - (let ((sentinel (string-replace "\n" "" sentinel))) + "Called on a change of the state of PROCESS. +SENTINEL describes the change in form of a string." + (let ((status (process-status process))) (rcirc-debug process (format "SENTINEL: %S %S\n" process sentinel)) (with-rcirc-process-buffer process (cond - ((string= sentinel "open") + ((eq status 'open) (let* ((server (nth 0 rcirc-connection-info)) (user-name (nth 3 rcirc-connection-info)) (full-name (nth 4 rcirc-connection-info)) @@ -904,7 +905,7 @@ If QUIET is non-nil, no not emit a message." (dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist))) (with-current-buffer (or buffer (current-buffer)) (setq mode-line-process nil))))) - ((string= sentinel "deleted") + ((eq status 'closed) (let ((now (current-time))) (with-rcirc-process-buffer process (when (and (< 0 rcirc-reconnect-delay) @@ -912,7 +913,8 @@ If QUIET is non-nil, no not emit a message." (time-subtract now rcirc-last-connect-time))) (setq rcirc-last-connect-time now) (rcirc-reconnect process))))) - ((dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist))) + ((eq status 'failed) + (dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist))) (with-current-buffer (or buffer (current-buffer)) (rcirc-print process "*rcirc*" "ERROR" rcirc-target (format "%s: %s (%S)" commit a51aa94b6edea6d9b464c6728a79dc279e01b37a Author: Philip Kaludercic Date: Sat Sep 25 16:49:26 2021 +0200 * rcirc.texi (Using rcirc with bouncers): Remove confusing sentence diff --git a/doc/misc/rcirc.texi b/doc/misc/rcirc.texi index 47de523737..cbf94cab19 100644 --- a/doc/misc/rcirc.texi +++ b/doc/misc/rcirc.texi @@ -976,9 +976,6 @@ displayed. A simple configuration to fix the above example might be: rcirc-channel-filter #'local/rcirc-soju-suffix) @end smallexample -The effect is that buffer names, nicks in messages, nick-completion -all strip away the suffix introduced by the bouncer. - @node GNU Free Documentation License @appendix GNU Free Documentation License @include doclicense.texi commit 636b2081d14268311202fd79093b234f1b8e4d04 Author: Philip Kaludercic Date: Sat Sep 25 16:27:12 2021 +0200 * rcirc.el (rcirc-reconnect): Use rcirc-reconnect-delay diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 4e0dd5a71f..2e49ccb5dd 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -851,7 +851,7 @@ If QUIET is non-nil, no not emit a message." rcirc-failed-attempts rcirc-reconnect-attempts)) (setq rcirc-reconnection-timer - (run-at-time rcirc-timeout-seconds nil + (run-at-time rcirc-reconnect-delay nil #'rcirc-reconnect process t)))))))) (defun rcirc-sentinel (process sentinel) commit 32cb457529e2adb0feaf079de8e8475f7fbc6737 Author: Philip Kaludercic Date: Sat Sep 25 16:25:03 2021 +0200 * rcirc.el (rcirc-reconnect): Set rcirc-joined diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index bc67562d2d..4e0dd5a71f 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -840,7 +840,8 @@ If QUIET is non-nil, no not emit a message." (dolist (buffer (mapcar #'cdr rcirc-buffer-alist)) (when (buffer-live-p buffer) (with-current-buffer buffer - (setq mode-line-process ":connecting")))) + (setq rcirc-joined (current-time) + mode-line-process ":connecting")))) (let ((nprocess (apply #'rcirc-connect conn-info))) (when (and (< rcirc-failed-attempts rcirc-reconnect-attempts) (eq (process-status nprocess) 'failed)) commit 285f59cbe230701f15d28dfe8036cf2feb9d1d31 Author: Stefan Kangas Date: Sat Sep 25 18:07:24 2021 +0200 * lisp/isearch.el (isearch-forward-regexp): Doc fix. (Bug22483) diff --git a/lisp/isearch.el b/lisp/isearch.el index 242f2b0dd0..d9a48cfcf2 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -1096,7 +1096,8 @@ as a regexp. See the command `isearch-forward' for more information. In incremental searches, a space or spaces normally matches any whitespace defined by the variable `search-whitespace-regexp'. To search for a literal space and nothing else, enter C-q SPC. -To toggle whitespace matching, use `isearch-toggle-lax-whitespace'. +To toggle whitespace matching, use `isearch-toggle-lax-whitespace', +usually bound to `M-s SPC' during isearch. This command does not support character folding." (interactive "P\np") (isearch-mode t (null not-regexp) nil (not no-recursive-edit))) commit 426675a9596e55ac16706b26fdbe4fc5da9bc3fc Merge: 0b7af608c9 293b8c71b2 Author: Eli Zaretskii Date: Sat Sep 25 18:57:17 2021 +0300 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit 0b7af608c9ddccea4d11adb77dd41a02f705e054 Author: Eli Zaretskii Date: Sat Sep 25 18:56:02 2021 +0300 ; Another minor improvement in ERT manual * doc/misc/ert.texi (Running Tests Interactively): State the function run by each key, per conventions. diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index c84d951bcc..16315df8b1 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -273,48 +273,55 @@ point to it and typing @kbd{@key{RET}} jumps to its definition. @itemx S-@key{TAB} @kindex TAB@r{, in ert results buffer} @kindex S-TAB@r{, in ert results buffer} -Cycle between buttons forward and backward. +Cycle between buttons forward (@code{forward-button}) and backward +(@code{backward-button}). @item r @kindex r@r{, in ert results buffer} @findex ert-results-rerun-test-at-point -Re-run the test near point on its own. +Re-run the test near point on its own +(@code{ert-results-rerun-test-at-point}). @item d @kindex d@r{, in ert results buffer} @findex ert-results-rerun-test-at-point-debugging-errors -Re-run the test near point on its own with the debugger enabled. +Re-run the test near point on its own with the debugger enabled +(@code{ert-results-rerun-test-at-point-debugging-errors}). @item R @kindex R@r{, in ert results buffer} @findex ert-results-rerun-all-tests -Re-run all tests. +Re-run all tests (@code{ert-results-rerun-all-tests}). @item . @kindex .@r{, in ert results buffer} @findex ert-results-find-test-at-point-other-window -Jump to the definition of the test near point. This has the same -effect as @kbd{@key{RET}}, but does not require point to be on the -name of the test. +Jump to the definition of the test near point +(@code{ert-results-find-test-at-point-other-window}). This has the +same effect as @kbd{@key{RET}}, but does not require point to be on +the name of the test. @item b @kindex b@r{, in ert results buffer} @findex ert-results-pop-to-backtrace-for-test-at-point @cindex backtrace of a failed test -Show the backtrace of a failed test. @xref{Debugging,, Backtraces, -elisp, GNU Emacs Lisp Reference Manual}, for more information about -backtraces. +Show the backtrace of a failed test +(@code{ert-results-pop-to-backtrace-for-test-at-point}). +@xref{Debugging,, Backtraces, elisp, GNU Emacs Lisp Reference Manual}, +for more information about backtraces. @item l @kindex l@r{, in ert results buffer} @findex ert-results-pop-to-should-forms-for-test-at-point -Show the list of @code{should} forms executed in the test. +Show the list of @code{should} forms executed in the test +(@code{ert-results-pop-to-should-forms-for-test-at-point}). @item m @kindex m@r{, in ert results buffer} @findex ert-results-pop-to-messages-for-test-at-point Show any messages that were generated (with the Lisp function -@code{message}) in in a test or any of the code that it invoked. +@code{message}) in in a test or any of the code that it invoked +(@code{ert-results-pop-to-messages-for-test-at-point}). @item L @kindex L@r{, in ert results buffer} @@ -322,23 +329,23 @@ Show any messages that were generated (with the Lisp function By default, long expressions in the failure details are abbreviated using @code{print-length} and @code{print-level}. Increase the limits to show more of the expression by moving point to a test failure with -this command. +this command (@code{ert-results-toggle-printer-limits-for-test-at-point}). @item D @kindex D@r{, in ert results buffer} @findex ert-delete-test @cindex delete test -Delete a test from the running Emacs session. +Delete a test from the running Emacs session (@code{ert-delete-test}). @item h @kindex h@r{, in ert results buffer} @findex ert-describe-test -Show the documentation of a test. +Show the documentation of a test (@code{ert-describe-test}). @item T @kindex T@r{, in ert results buffer} @findex ert-results-pop-to-timings -Display test timings for the last run. +Display test timings for the last run (@code{ert-results-pop-to-timings}). @item M-x ert-delete-all-tests @findex ert-delete-all-test commit 293b8c71b2d56afdbe9379b00e21a58479fc09a8 Author: Stefan Kangas Date: Sat Sep 25 17:54:49 2021 +0200 Minor clarification of define-minor-mode :keymap argument * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Minor doc fix; clarify by saying that ":keymap" should be an "unquoted variable name". (Bug#25505) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index dfbae746cc..0e4d6eeb7b 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -163,8 +163,8 @@ BODY contains code to execute each time the mode is enabled or disabled. Not used if you also specify :variable. :lighter SPEC Text displayed in the mode line when the mode is on. :keymap MAP Keymap bound to the mode keymap. Defaults to `MODE-map'. - If non-nil, it should be a variable name (whose value is - a keymap), or an expression that returns either a keymap or + If non-nil, it should be an unquoted variable name (whose value + is a keymap), or an expression that returns either a keymap or a list of (KEY . BINDING) pairs where KEY and BINDING are suitable for `define-key'. If you supply a KEYMAP argument that is not a symbol, this macro defines the variable MODE-map commit d9abb06ded6e5bea192072a856e570a81866ea16 Author: Eli Zaretskii Date: Sat Sep 25 18:46:33 2021 +0300 ; * doc/misc/ert.texi (Running Tests Interactively): Fix markup. diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index b1695ac172..c84d951bcc 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -264,13 +264,13 @@ The following key bindings are available in the ERT results buffer: @table @kbd -@item RET +@item @key{RET} @kindex RET@r{, in ert results buffer} Each name of a function or macro in this buffer is a button; moving point to it and typing @kbd{@key{RET}} jumps to its definition. -@item TAB -@itemx S-TAB +@item @key{TAB} +@itemx S-@key{TAB} @kindex TAB@r{, in ert results buffer} @kindex S-TAB@r{, in ert results buffer} Cycle between buttons forward and backward. commit 2d97b1ef5bf0b012c6fdb42d86efb4553f08f32e Author: Stefan Kangas Date: Sat Sep 25 17:03:13 2021 +0200 Buttonize functions in curved quotes in ERC * lisp/erc/erc-button.el (erc-button-alist): Buttonize Emacs functions in curved quotes. (Bug#49964) diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el index 040606ea85..17d5b6129d 100644 --- a/lisp/erc/erc-button.el +++ b/lisp/erc/erc-button.el @@ -130,7 +130,7 @@ longer than `erc-fill-column'." (" ]+\\) *>" 0 t browse-url-button-open-url 1) ;;; ("(\\(\\([^~\n \t@][^\n \t@]*\\)@\\([a-zA-Z0-9.:-]+\\)\\)" 1 t finger 2 3) ;; emacs internal - ("[`]\\([a-zA-Z][-a-zA-Z_0-9!*<=>+]+\\)[']" + ("[`‘]\\([a-zA-Z][-a-zA-Z_0-9!*<=>+]+\\)['’]" 1 t erc-button-describe-symbol 1) ;; pseudo links ("\\bInfo:[\"]\\([^\"]+\\)[\"]" 0 t Info-goto-node 1) commit c7370f7334957e36c49ec6bb65b09656025d554a Author: Stefan Kangas Date: Sat Sep 25 16:55:04 2021 +0200 Extend and improve ERT manual section on running interactively * doc/misc/ert.texi (Running Tests Interactively): Format commands in a table, improve indexing, and add several missing commands. (Bug#41829) diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index fafdb8c4eb..b1695ac172 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -260,36 +260,96 @@ unexpected result. In the example above, there are two failures, both due to failed @code{should} forms. @xref{Understanding Explanations}, for more details. +The following key bindings are available in the ERT results buffer: + +@table @kbd + +@item RET +@kindex RET@r{, in ert results buffer} +Each name of a function or macro in this buffer is a button; moving +point to it and typing @kbd{@key{RET}} jumps to its definition. + +@item TAB +@itemx S-TAB @kindex TAB@r{, in ert results buffer} @kindex S-TAB@r{, in ert results buffer} -In the ERT results buffer, @kbd{@key{TAB}} and @kbd{S-@key{TAB}} cycle between -buttons. Each name of a function or macro in this buffer is a button; -moving point to it and typing @kbd{@key{RET}} jumps to its definition. +Cycle between buttons forward and backward. +@item r @kindex r@r{, in ert results buffer} +@findex ert-results-rerun-test-at-point +Re-run the test near point on its own. + +@item d @kindex d@r{, in ert results buffer} +@findex ert-results-rerun-test-at-point-debugging-errors +Re-run the test near point on its own with the debugger enabled. + +@item R +@kindex R@r{, in ert results buffer} +@findex ert-results-rerun-all-tests +Re-run all tests. + +@item . @kindex .@r{, in ert results buffer} +@findex ert-results-find-test-at-point-other-window +Jump to the definition of the test near point. This has the same +effect as @kbd{@key{RET}}, but does not require point to be on the +name of the test. + +@item b @kindex b@r{, in ert results buffer} +@findex ert-results-pop-to-backtrace-for-test-at-point @cindex backtrace of a failed test -Pressing @kbd{r} re-runs the test near point on its own. Pressing -@kbd{d} re-runs it with the debugger enabled. @kbd{.} jumps to the -definition of the test near point (@kbd{@key{RET}} has the same effect -if point is on the name of the test). On a failed test, @kbd{b} shows -the backtrace of the failure. @xref{Debugging,, Backtraces, elisp, -GNU Emacs Lisp Reference Manual}, for more information about +Show the backtrace of a failed test. @xref{Debugging,, Backtraces, +elisp, GNU Emacs Lisp Reference Manual}, for more information about backtraces. +@item l @kindex l@r{, in ert results buffer} -@kbd{l} shows the list of @code{should} forms executed in the test. -If any messages were generated (with the Lisp function @code{message}) -in a test or any of the code that it invoked, @kbd{m} will show them. +@findex ert-results-pop-to-should-forms-for-test-at-point +Show the list of @code{should} forms executed in the test. +@item m +@kindex m@r{, in ert results buffer} +@findex ert-results-pop-to-messages-for-test-at-point +Show any messages that were generated (with the Lisp function +@code{message}) in in a test or any of the code that it invoked. + +@item L @kindex L@r{, in ert results buffer} +@findex ert-results-toggle-printer-limits-for-test-at-point By default, long expressions in the failure details are abbreviated -using @code{print-length} and @code{print-level}. Pressing @kbd{L} -while point is on a test failure will increase the limits to show more -of the expression. - +using @code{print-length} and @code{print-level}. Increase the limits +to show more of the expression by moving point to a test failure with +this command. + +@item D +@kindex D@r{, in ert results buffer} +@findex ert-delete-test +@cindex delete test +Delete a test from the running Emacs session. + +@item h +@kindex h@r{, in ert results buffer} +@findex ert-describe-test +Show the documentation of a test. + +@item T +@kindex T@r{, in ert results buffer} +@findex ert-results-pop-to-timings +Display test timings for the last run. + +@item M-x ert-delete-all-tests +@findex ert-delete-all-test +@cindex delete all tests +Delete all tests from the running session. + +@item M-x ert-describe-test +@findex ert-results-describe-test-at-point +Prompt for a test and then show its documentation. + +@end table @node Running Tests in Batch Mode @section Running Tests in Batch Mode commit 2148f67d0ef815d4ceead33dcdba193fa496c2a9 Author: Stephen Gildea Date: Sat Sep 25 07:18:50 2021 -0700 ; * lisp/mh-e/mh-scan.el: re-order variables to be actually alphabetical diff --git a/lisp/mh-e/mh-scan.el b/lisp/mh-e/mh-scan.el index bad2085246..5aa599942e 100644 --- a/lisp/mh-e/mh-scan.el +++ b/lisp/mh-e/mh-scan.el @@ -103,15 +103,21 @@ non-empty Newsgroups: field is present." ;; Alphabetical. -(defvar mh-scan-body-regexp "\\(<<\\([^\n]+\\)?\\)" - "This regular expression matches the message body fragment. +(defvar mh-scan-allowlisted-msg-regexp "^\\( *[0-9]+\\)A" + "This regular expression matches allowlisted (non-spam) messages. -Note that the default setting of `mh-folder-font-lock-keywords' -expects this expression to contain at least one parenthesized -expression which matches the body text as in the default of -\"\\\\(<<\\\\([^\\n]+\\\\)?\\\\)\". If this regular expression is -not correct, the body fragment will not be highlighted with the -face `mh-folder-body'.") +It must match from the beginning of the line. Note that the +default setting of `mh-folder-font-lock-keywords' expects this +expression to contain at least one parenthesized expression which +matches the message number as in the default of + + \"^\\\\( *[0-9]+\\\\)A\". + +This expression includes the leading space within parenthesis +since it looks better to highlight it as well. The highlighting +is done with the face `mh-folder-allowlisted'. This regular +expression should be correct as it is needed by non-fontification +functions. See also `mh-note-allowlisted'.") (defvar mh-scan-blocklisted-msg-regexp "^\\( *[0-9]+\\)B" "This regular expression matches blocklisted (spam) messages. @@ -129,6 +135,16 @@ is done with the face `mh-folder-blocklisted'. This regular expression should be correct as it is needed by non-fontification functions. See also `mh-note-blocklisted'.") +(defvar mh-scan-body-regexp "\\(<<\\([^\n]+\\)?\\)" + "This regular expression matches the message body fragment. + +Note that the default setting of `mh-folder-font-lock-keywords' +expects this expression to contain at least one parenthesized +expression which matches the body text as in the default of +\"\\\\(<<\\\\([^\\n]+\\\\)?\\\\)\". If this regular expression is +not correct, the body fragment will not be highlighted with the +face `mh-folder-body'.") + (defvar mh-scan-cur-msg-number-regexp "^\\( *[0-9]+\\+\\).*" "This regular expression matches the current message. @@ -295,22 +311,6 @@ non-fontification functions.") This is used to eliminate error messages that are occasionally produced by \"inc\".") -(defvar mh-scan-allowlisted-msg-regexp "^\\( *[0-9]+\\)A" - "This regular expression matches allowlisted (non-spam) messages. - -It must match from the beginning of the line. Note that the -default setting of `mh-folder-font-lock-keywords' expects this -expression to contain at least one parenthesized expression which -matches the message number as in the default of - - \"^\\\\( *[0-9]+\\\\)A\". - -This expression includes the leading space within parenthesis -since it looks better to highlight it as well. The highlighting -is done with the face `mh-folder-allowlisted'. This regular -expression should be correct as it is needed by non-fontification -functions. See also `mh-note-allowlisted'.") - ;;; Widths, Offsets and Columns @@ -399,17 +399,21 @@ This column will only ever have spaces in it.") ;; Alphabetical. +(defvar mh-note-allowlisted ?A + "Messages that have been allowlisted are marked by this character. +See also `mh-scan-allowlisted-msg-regexp'.") + (defvar mh-note-blocklisted ?B "Messages that have been blocklisted are marked by this character. See also `mh-scan-blocklisted-msg-regexp'.") +(defvar mh-note-copied ?C + "Messages that have been copied are marked by this character.") + (defvar mh-note-cur ?+ "The current message (in MH, not in MH-E) is marked by this character. See also `mh-scan-cur-msg-number-regexp'.") -(defvar mh-note-copied ?C - "Messages that have been copied are marked by this character.") - (defvar mh-note-deleted ?D "Messages that have been deleted are marked by this character. See also `mh-scan-deleted-msg-regexp'.") @@ -436,10 +440,6 @@ See also `mh-scan-refiled-msg-regexp'.") Messages in the \"search\" sequence are marked by this character as well.") -(defvar mh-note-allowlisted ?A - "Messages that have been allowlisted are marked by this character. -See also `mh-scan-allowlisted-msg-regexp'.") - ;;; Utilities commit e41b7f7b4db55a23bb2f55d373c38b837beeaba8 Author: Stephen Gildea Date: Sat Sep 25 07:07:52 2021 -0700 Update mh-scan regexp to match mh-note-allowlisted lisp/mh-e/mh-scan.el (mh-scan-good-msg-regexp, mh-scan-cmd-note-width): Update to match new value ("A") of mh-note-allowlisted. diff --git a/lisp/mh-e/mh-scan.el b/lisp/mh-e/mh-scan.el index 10235209dc..bad2085246 100644 --- a/lisp/mh-e/mh-scan.el +++ b/lisp/mh-e/mh-scan.el @@ -173,7 +173,7 @@ is done with the face `mh-folder-deleted'. This regular expression should be correct as it is needed by non-fontification functions. See also `mh-note-deleted'.") -(defvar mh-scan-good-msg-regexp "^\\( *[0-9]+\\)[^^DBW0-9]" +(defvar mh-scan-good-msg-regexp "^\\( *[0-9]+\\)[^^DBA0-9]" "This regular expression matches \"good\" messages. It must match from the beginning of the line. Note that the @@ -181,7 +181,7 @@ default setting of `mh-folder-font-lock-keywords' expects this expression to contain at least one parenthesized expression which matches the message number as in the default of - \"^\\\\( *[0-9]+\\\\)[^^DBW0-9]\". + \"^\\\\( *[0-9]+\\\\)[^^DBA0-9]\". This expression includes the leading space within the parenthesis since it looks better to highlight it as well. The highlighting @@ -328,7 +328,7 @@ Note that columns in Emacs start with 0.") (defvar mh-scan-cmd-note-width 1 "Number of columns consumed by the cmd-note field in `mh-scan-format'. -This column will have one of the values: \" \", \"^\", \"D\", \"B\", \"W\", \"+\", where +This column will have one of the values: \" \", \"^\", \"D\", \"B\", \"A\", \"+\", where \" \" is the default value, \"^\" is the `mh-note-refiled' character, commit c17eded545c8b718d1357564b699b400593440bb Author: Basil L. Contovounesios Date: Sat Sep 25 14:41:24 2021 +0100 ; Fix omission in recent CONTRIBUTE doc change. diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index eacd295c25..60b5cc7602 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -1353,7 +1353,7 @@ from a normal build). If you would like to make more extensive contributions, see the @file{CONTRIBUTE} file in the Emacs source tree for information on how -to be an Emacs developer. That file is distributed as part of source +to be an Emacs developer. That file is distributed as part of the source tarball of every released Emacs version, and can also be found on-line in the @url{https://git.savannah.gnu.org/cgit/emacs.git/tree/CONTRIBUTE, Emacs on-line source repository}. If you cloned the Emacs repository, commit ea3656191d8dbc009744ee5d2c79c738ba90c9b9 Author: Michael Albinus Date: Sat Sep 25 12:20:46 2021 +0200 ; More instrumentation in autorevert-tests.el diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el index 4a67dae10e..284b352cd7 100644 --- a/test/lisp/autorevert-tests.el +++ b/test/lisp/autorevert-tests.el @@ -528,10 +528,10 @@ This expects `auto-revert--messages' to be bound by (auto-revert-test--wait-for-buffer-text buf-1 "1-b" (auto-revert--timeout)) ;; On emba, `buf-1' is a killed buffer. - (message "Hallo1") - (when (buffer-name buf-1) - (should (buffer-local-value - 'auto-revert-notify-watch-descriptor buf-1))) + (message "Hallo1 %s %s %s" file-1 buf-1 (get-file-buffer file-1)) + (should + (buffer-local-value + 'auto-revert-notify-watch-descriptor (get-file-buffer file-1))) ;; Write a buffer to a new file, then modify the new file on disk. (with-current-buffer buf-2 commit c2b8058c07dfa2aa142c11d9240e7b1fa4f520ff Author: Lars Ingebrigtsen Date: Sat Sep 25 12:11:26 2021 +0200 Document the new paren-space indentation rule * doc/emacs/programs.texi (Lisp Indent): Mention the new paren-space indentation rule. diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index ec11b0c00f..51a48df2e2 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -471,6 +471,23 @@ the function name. This is normally done for macro definitions, using the @code{declare} construct. @xref{Defining Macros,,, elisp, The Emacs Lisp Reference Manual}. + In Emacs Lisp, lists are usually indented as if they are +function-like forms: + +@lisp +(setq foo '(bar zot + gazonk)) +@end lisp + + However, if you add a space after the opening parenthesis, this tells +Emacs that it's a data list instead of a piece of code, and Emacs will +then indent it like this: + +@lisp +(setq foo '( bar zot + gazonk)) +@end lisp + @node C Indent @subsection Commands for C Indentation diff --git a/etc/NEWS b/etc/NEWS index 56fdbecff3..f211a98678 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1703,8 +1703,10 @@ work as before. ** Emacs Lisp mode +--- *** The mode-line now indicates whether we're using lexical or dynamic scoping. ++++ *** A space between an open paren and a symbol changes the indentation rule. The presence of a space between an open paren and a symbol now is taken as a statement by the programmer that this should be indented commit bda831abdc6af54d6942c7d3946c3a03c6e240d1 Author: Lars Ingebrigtsen Date: Sat Sep 25 11:57:13 2021 +0200 Some NEWS tagging diff --git a/etc/NEWS b/etc/NEWS index 33f6f5aacb..56fdbecff3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2485,9 +2485,11 @@ searches. These commands are bound respectively to 'P' and 'N', and navigate to the first item of the previous or next group in the "*xref*" buffer. +--- *** New alternative value for 'xref-show-definitions-function': 'xref-show-definitions-completing-read'. +--- *** The two existing alternatives for 'xref-show-definitions-function' have been renamed to have "proper" public names and documented ('xref-show-definitions-buffer' and commit bcbae720d593e3b1e19315dbb7a5ba73174cbe40 Author: Lars Ingebrigtsen Date: Sat Sep 25 11:54:13 2021 +0200 'xref-search-program'-related doc string fixes * lisp/progmodes/xref.el (xref-search-program): Mention what this variable controls. (xref-matches-in-files): Mention the variables that controls it. diff --git a/etc/NEWS b/etc/NEWS index 68853e423c..33f6f5aacb 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2474,6 +2474,7 @@ visit. 'xref-auto-jump-to-first-xref' changes their behavior much in the same way as 'xref-auto-jump-to-first-definition' affects the "find-definitions" commands. +--- *** New user options 'xref-search-program' and 'xref-search-program-alist'. So far 'grep' and 'ripgrep' are supported. 'ripgrep' seems to offer better performance in certain cases, in particular for case-insensitive diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index fb8090cfb7..af1413e050 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1648,7 +1648,11 @@ The template should have the following fields: (defcustom xref-search-program 'grep "The program to use for regexp search inside files. -This must reference a corresponding entry in `xref-search-program-alist'." +This must reference a corresponding entry in `xref-search-program-alist'. + +This variable is used in `xref-matches-in-files', which is the +utility function used by commands like `dired-do-find-regexp' and +`project-find-regexp'." :type '(choice (const :tag "Use Grep" grep) (const :tag "Use ripgrep" ripgrep) @@ -1660,7 +1664,10 @@ This must reference a corresponding entry in `xref-search-program-alist'." (defun xref-matches-in-files (regexp files) "Find all matches for REGEXP in FILES. Return a list of xref values. -FILES must be a list of absolute file names." +FILES must be a list of absolute file names. + +See `xref-search-program' and `xref-search-program-alist' for how +to control which program to use when looking for matches." (cl-assert (consp files)) (require 'grep) (defvar grep-highlight-matches) commit f90b0269780fd099f29c653f655da7e5cdf6abee Author: Lars Ingebrigtsen Date: Sat Sep 25 11:45:30 2021 +0200 Document the 'string' thingatpt target * doc/lispref/text.texi (Buffer Contents): Mention the 'string' target. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index f83ca97163..41b3138a0d 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -319,7 +319,7 @@ The argument @var{thing} is a symbol which specifies a kind of syntactic entity. Possibilities include @code{symbol}, @code{list}, @code{sexp}, @code{defun}, @code{filename}, @code{existing-filename}, @code{url}, @code{word}, @code{sentence}, @code{whitespace}, -@code{line}, @code{page}, and others. +@code{line}, @code{page}, @code{string}, and others. When the optional argument @var{no-properties} is non-@code{nil}, this function strips text properties from the return value. diff --git a/etc/NEWS b/etc/NEWS index 115808d058..68853e423c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2600,6 +2600,7 @@ This new command (bound to 'C-c C-l') regenerates the current hunk. This is like 'filename', but is a full path, and is nil if the file doesn't exist. ++++ *** New 'thing-at-point' target: 'string'. If point is inside a string, it returns that string. @@ -2809,6 +2810,7 @@ declared obsolete and rewritten as 'erc-track-select-mode-line-face', with different expected arguments (the current and old faces are now separated) and clearer documentation. +--- *** Add '/opme' and '/deopme' convenience commands. The new '/opme' convenience command asks ChanServ to set the operator status for the current nick in the current channel, and '/deopme' commit 297c9aa3deb64596b7ea19ae7d65a3ae614c7d2f Author: Eli Zaretskii Date: Sat Sep 25 12:18:27 2021 +0300 Fix cursor motion around some Emoji sequences * src/character.h: Add TAG_SPACE and CANCEL_TAG to known Unicode characters values. * src/composite.c (char_composable_p): Recognize TAG characters relevant to Emoji as composable regardless of their General Category. (Bug#39799) diff --git a/src/character.h b/src/character.h index 1a745484da..6ee6bcab20 100644 --- a/src/character.h +++ b/src/character.h @@ -82,6 +82,8 @@ enum LEFT_ANGLE_BRACKET = 0x3008, RIGHT_ANGLE_BRACKET = 0x3009, OBJECT_REPLACEMENT_CHARACTER = 0xFFFC, + TAG_SPACE = 0xE0020, + CANCEL_TAG = 0xE007F, }; extern int char_string (unsigned, unsigned char *); diff --git a/src/composite.c b/src/composite.c index e97f8e2b4c..c37b1fd4b9 100644 --- a/src/composite.c +++ b/src/composite.c @@ -953,6 +953,9 @@ char_composable_p (int c) Lisp_Object val; return (c >= ' ' && (c == ZERO_WIDTH_NON_JOINER || c == ZERO_WIDTH_JOINER + /* Per Unicode TR51, these tag characters can be part of + Emoji sequences. */ + || (TAG_SPACE <= c && c <= CANCEL_TAG) /* unicode-category-table may not be available during dumping. */ || (CHAR_TABLE_P (Vunicode_category_table) commit 12b860bd1b5c8e0cdffac195286dffc2a765cb0b Author: Eli Zaretskii Date: Sat Sep 25 10:45:38 2021 +0300 ; Improve text about 'CONTRIBUTE' * doc/emacs/trouble.texi (Contributing): Expand the recently-changed text. diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index 4f9e6cc91f..eacd295c25 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -1352,8 +1352,13 @@ downloaded the repository source, you should read the file from a normal build). If you would like to make more extensive contributions, see the -@file{CONTRIBUTE} file in the development version of Emacs for -information on how to be an Emacs developer. +@file{CONTRIBUTE} file in the Emacs source tree for information on how +to be an Emacs developer. That file is distributed as part of source +tarball of every released Emacs version, and can also be found on-line +in the @url{https://git.savannah.gnu.org/cgit/emacs.git/tree/CONTRIBUTE, +Emacs on-line source repository}. If you cloned the Emacs repository, +per the instructions in @url{https://savannah.gnu.org/projects/emacs/}, +you will find this file in the top directory of the source Emacs tree. For documentation on Emacs (to understand how to implement your desired change), refer to: commit 6d37c9bb50f7d88ea0740915795bbc7936f1ec19 Author: Eli Zaretskii Date: Sat Sep 25 10:30:27 2021 +0300 Use explicit man-page section in references * lisp/dired-aux.el (dired-do-chmod): Use explicit man-page section in the doc string. This avoids inadvertently showing the wrong man page, when several identically-named pages are possible in different sections. E.g., there's also chmod(2). diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 89efa1840a..397c5c67cb 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -493,7 +493,7 @@ are supported. Type M-n to pull the file attributes of the file at point into the minibuffer. See Info node `(coreutils)File permissions' for more information. -Alternatively, see the man page for \"chmod\". +Alternatively, see the man page for \"chmod(1)\". Note that on MS-Windows only the `w' (write) bit is meaningful: resetting it makes the file read-only. Changing any other bit commit f82f3d62adcf40af754bb391e156ad836303a094 Author: Eli Zaretskii Date: Sat Sep 25 09:59:53 2021 +0300 ; Improve recently added documentation * etc/NEWS: * doc/lispref/tips.texi (Documentation Tips): Improve and clarify recently-added documentation of man page references. diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index 1ea439b531..e56ddf3c28 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi @@ -760,9 +760,15 @@ man page, preceded by @samp{Man page}, @samp{man page}, or @samp{man page for}. For example, @smallexample -See the man page `chmod' for details. +See the man page `chmod(1)' for details. @end smallexample +@noindent +The Info documentation is always preferable to man pages, so be sure +to link to an Info manual where available. For example, +@command{chmod} is documented in the GNU Coreutils manual, so it is +better to link to that instead of the man page. + To link to a customization group, write the single-quoted name of the group, preceded by @samp{customization group} (the first character in each word is case-insensitive). For example, diff --git a/etc/NEWS b/etc/NEWS index 40e85c67c0..115808d058 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3710,7 +3710,7 @@ customization group. +++ ** Doc strings can now link to man pages. -Text like "man page `chmod'" will be made into a button. When +Text like "man page `chmod(1)'" will be made into a button. When clicked, it will open a Man mode buffer displaying that man page. +++ commit 83e08dfef338e23c90fa9a75eda30d198a7d026b Author: Lars Ingebrigtsen Date: Sat Sep 25 07:32:48 2021 +0200 save-some-buffers-root doc string change * lisp/files.el (save-some-buffers-root): Improve doc string. diff --git a/etc/NEWS b/etc/NEWS index 94df3de155..40e85c67c0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1001,10 +1001,10 @@ If nil, Emacs does not prompt, but instead shows the buffer with its contents before the change, and provides instructions how to revert the buffer. +--- ** New value 'save-some-buffers-root' of 'save-some-buffers-default-predicate'. -They allow to ask about saving only those files that are under the -project root or in subdirectories of the directory that was default -during command invocation. +When using this predicate, only buffers under the current project root +will be considered when saving buffers with 'save-some-buffers'. --- ** New user option 'save-place-abbreviate-file-names'. diff --git a/lisp/files.el b/lisp/files.el index 2f7e936ff6..05875b48e3 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5756,7 +5756,7 @@ be saved." :version "26.1") (defun save-some-buffers-root () - "A predicate to check whether the buffer is under the root directory. + "A predicate to check whether the buffer is under the project root directory. Can be used as a value of `save-some-buffers-default-predicate' to save buffers only under the project root or in subdirectories of the directory that was default during command invocation." commit 78d76d26730d79a4d4e5faba50c9054b70f1c011 Author: Lars Ingebrigtsen Date: Sat Sep 25 07:24:39 2021 +0200 Do some NEWS tagging diff --git a/etc/NEWS b/etc/NEWS index 1ee8588375..94df3de155 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -752,12 +752,14 @@ 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. +--- *** Obsolete aliases are no longer hidden from command completion. Completion of command names now considers obsolete aliases as candidates, if they were marked obsolete in the current major version of Emacs. Invoking a command via an obsolete alias now mentions the obsolescence fact and shows the new name of the command. ++++ *** Support for '(box . SIZE)' 'cursor-type'. By default, 'box' cursor always has a filled box shape. But if you specify 'cursor-type' to be '(box . SIZE)', the cursor becomes a hollow commit 1ea434b19161949936b57458d10edf9241893a43 Author: Lars Ingebrigtsen Date: Sat Sep 25 07:22:07 2021 +0200 Document redisplay-skip-fontification-on-input * doc/emacs/display.texi (Scrolling): Mention redisplay-skip-fontification-on-input. diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index 996c5a6654..7ea754612e 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -150,6 +150,14 @@ gives you less jerky scrolling when you hold down @kbd{C-v}, but the window contents after any action which scrolls into a fresh portion of the buffer will be momentarily unfontified. +@vindex redisplay-skip-fontification-on-input +Finally, a third alternative to these variables is +@code{redisplay-skip-fontification-on-input}. If this variable is +non-@code{nil}, skip some fontifications is there's input pending. +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. + @vindex scroll-up @vindex scroll-down @findex scroll-up-line diff --git a/etc/NEWS b/etc/NEWS index 32982122e2..1ee8588375 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -745,6 +745,7 @@ Applies to headings of shortdoc sections. *** New face 'separator-line'. This is used by 'make-separator-line' (see below). ++++ *** '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 commit e971e0868de64a381576a19c13ffa348c5fc1a17 Author: Bastien Guerry Date: Sat Sep 25 07:15:31 2021 +0200 ; * doc/misc/gnus.texi (Gnus Registry Setup): Fix missing parenthesis. diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 5eeffbdeca..9e433e11c8 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -26324,7 +26324,7 @@ Fortunately, setting up the Gnus registry is pretty easy: @end lisp This adds registry saves to Gnus newsrc saves (which happen on exit -and when you press @kbd{s} from the @file{*Group*} buffer. It also +and when you press @kbd{s} from the @file{*Group*} buffer). It also adds registry calls to article actions in Gnus (copy, move, etc.)@: so it's not easy to undo the initialization. See @code{gnus-registry-initialize} for the gory details. commit 00556cf805347c6e9084a771ab74861b6b623943 Author: Stephen Gildea Date: Fri Sep 24 21:59:17 2021 -0700 ; tramp-auto-save-directory: set mode atomically when creating * lisp/net/tramp.el (tramp-handle-make-auto-save-file-name): Use with-file-modes around make-directory. We can do this because Tramp now honors default file modes in make-directory. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 2804b4d37d..62628363b7 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -5429,8 +5429,8 @@ this file, if that variable is non-nil." ;; Create directory. (unless (or (null tramp-auto-save-directory) (file-exists-p tramp-auto-save-directory)) - (make-directory tramp-auto-save-directory t) - (set-file-modes tramp-auto-save-directory #o0700)) + (with-file-modes #o0700 + (make-directory tramp-auto-save-directory t))) (let ((system-type (if (and (stringp tramp-auto-save-directory) commit 9bc2ac4a95ed2c1d6d7b56c3a1fd72e5ee1dc5f5 Author: Lars Ingebrigtsen Date: Sat Sep 25 04:22:57 2021 +0200 Add new user option ispell-help-timeout * lisp/textmodes/ispell.el (ispell-help-timeout): New user option. (ispell-help): Use it. diff --git a/etc/NEWS b/etc/NEWS index 84a6b3f10a..32982122e2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1256,6 +1256,10 @@ These arguments default to active region when used interactively. +++ *** New command 'ispell-comment-or-string-at-point'. +--- +*** New user option 'ispell-help-timeout'. +This controls how long the ispell help (on the '?' key) is displayed. + ** Flyspell mode +++ diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index b650ab3871..27a60c376c 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -398,6 +398,10 @@ re-start Emacs." (const :tag "default" nil)) (coding-system :tag "Coding System")))) +(defcustom ispell-help-timeout 5 + "The number of seconds to display the help text." + :type 'number + :version "28.1") (defvar ispell-dictionary-base-alist '((nil ; default @@ -2460,7 +2464,7 @@ SPC: Accept word this time. (with-current-buffer buffer (insert (concat help-1 "\n" help-2 "\n" help-3))) (ispell-display-buffer buffer) - (sit-for 5) + (sit-for ispell-help-timeout) (kill-buffer "*Ispell Help*")) (unwind-protect (let ((resize-mini-windows 'grow-only)) @@ -2470,7 +2474,7 @@ SPC: Accept word this time. ;;(set-minibuffer-window (selected-window)) (enlarge-window 2) (insert (concat help-1 "\n" help-2 "\n" help-3)) - (sit-for 5)) + (sit-for ispell-help-timeout)) (erase-buffer))))))) (define-obsolete-function-alias 'lookup-words 'ispell-lookup-words "24.4") commit dc9d0da3c2c85de0a1a15576268db98b42162803 Author: Stefan Kangas Date: Sat Sep 25 01:25:47 2021 +0200 Set :type of suggest-key-bindings to natnum * lisp/simple.el (suggest-key-bindings): Set :type to natnum. (Bug#15809) diff --git a/lisp/simple.el b/lisp/simple.el index 298e3ea5ee..dd480396f6 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2144,7 +2144,7 @@ Equivalent key-bindings are also shown in the completion list of \\[execute-extended-command] for all commands that have them." :group 'keyboard :type '(choice (const :tag "off" nil) - (integer :tag "time" 2) + (natnum :tag "time" 2) (other :tag "on"))) (defcustom extended-command-suggest-shorter t commit f1071bf08e246d0820edfb66163acb65e90d9482 Author: Stefan Kangas Date: Sat Sep 25 01:15:49 2021 +0200 New :type natnum for defcustom * lisp/wid-edit.el (natnum): New widget type. (Bug#15809) * doc/lispref/customize.texi (Simple Types): Document it. diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi index bc35982c17..b93b8bc015 100644 --- a/doc/lispref/customize.texi +++ b/doc/lispref/customize.texi @@ -594,6 +594,9 @@ want to take the time to work out a more specific type to use. @item integer The value must be an integer. +@item natnum +The value must be a nonnegative integer. + @item number The value must be a number (floating point or integer). diff --git a/etc/NEWS b/etc/NEWS index 31b09dad24..84a6b3f10a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3737,6 +3737,11 @@ instead of only becoming available after doing (for instance) --- ** ':safe' settings in 'defcustom' are now propagated to the loaddefs files. ++++ +** New ':type' for 'defcustom' for nonnegative integers. +The new 'natnum' type can be used for options that should be +nonnegative integers. + +++ ** ERT can now output more verbose test failure reports. If the 'EMACS_TEST_VERBOSE' environment variable is set, failure diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index ab358da7e3..72353b9190 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -3644,6 +3644,13 @@ match-alternatives: %S" :type-error "This field should contain an integer" :match-alternatives '(integerp)) +(define-widget 'natnum 'restricted-sexp + "A nonnegative integer." + :tag "Integer (positive)" + :value 0 + :type-error "This field should contain a nonnegative integer" + :match-alternatives '(natnump)) + (define-widget 'number 'restricted-sexp "A number (floating point or integer)." :tag "Number" commit 988428df7d1fc071bea5fbe7ed696f4bf62f3b5c Author: Stefan Kangas Date: Sat Sep 25 04:00:09 2021 +0200 * lisp/dired-aux.el (dired-do-chmod): Simplify docstring. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 1bb5b92935..89efa1840a 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -493,8 +493,7 @@ are supported. Type M-n to pull the file attributes of the file at point into the minibuffer. See Info node `(coreutils)File permissions' for more information. -Alternatively, see the man page for \"chmod\", using the command -\\[man] in Emacs. +Alternatively, see the man page for \"chmod\". Note that on MS-Windows only the `w' (write) bit is meaningful: resetting it makes the file read-only. Changing any other bit commit 091791933704cd706f90c1685ac4b35f51c98199 Author: Stefan Kangas Date: Sat Sep 25 03:03:34 2021 +0200 Add support for man page hyperlinks in doc strings * lisp/help-mode.el (help-man): New button type. (help-xref-man-regexp): New const. (help-make-xrefs): Use them to allow making man page buttons. * doc/lispref/tips.texi (Documentation Tips): Document the new hyperlink type. (Bug#39215) diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index a72ab88cef..1ea439b531 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi @@ -755,6 +755,14 @@ anchor}. The Info file name defaults to @samp{emacs}. For example, See Info node `Font Lock' and Info node `(elisp)Font Lock Basics'. @end smallexample +To make a hyperlink to a man page, write the single-quoted name of the +man page, preceded by @samp{Man page}, @samp{man page}, or @samp{man +page for}. For example, + +@smallexample +See the man page `chmod' for details. +@end smallexample + To link to a customization group, write the single-quoted name of the group, preceded by @samp{customization group} (the first character in each word is case-insensitive). For example, diff --git a/etc/NEWS b/etc/NEWS index 2f8fbc7614..31b09dad24 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3698,8 +3698,13 @@ initial frame used in batch mode. +++ ** Doc strings can now link to customization groups. Text like "customization group `whitespace'" will be made into a -button. When clicked, it'll take the user to a Custom buffer -displaying that customization group. +button. When clicked, it will open a Custom buffer displaying that +customization group. + ++++ +** Doc strings can now link to man pages. +Text like "man page `chmod'" will be made into a button. When +clicked, it will open a Man mode buffer displaying that man page. +++ ** Buffers can now be created with certain hooks disabled. diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 551cf7e1a3..0b404fe89f 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -224,6 +224,11 @@ The format is (FUNCTION ARGS...).") 'help-function #'info 'help-echo (purecopy "mouse-2, RET: read this Info node")) +(define-button-type 'help-man + :supertype 'help-xref + 'help-function #'man + 'help-echo (purecopy "mouse-2, RET: read this man page")) + (define-button-type 'help-customization-group :supertype 'help-xref 'help-function #'customize-group @@ -438,6 +443,11 @@ when help commands related to multilingual environment (e.g., "\\<[Ii]nfo[ \t\n]+\\(node\\|anchor\\)[ \t\n]+['`‘]\\([^'’]+\\)['’]") "Regexp matching doc string references to an Info node.") +(defconst help-xref-man-regexp + (purecopy + "\\<[Mm]an[ \t\n]+page[ \t\n]+\\(?:for[ \t\n]+\\)?['`‘\"]\\([^'’\"]+\\)['’\"]") + "Regexp matching doc string references to a man page.") + (defconst help-xref-customization-group-regexp (purecopy "\\<[Cc]ustomization[ \t\n]+[Gg]roup[ \t\n]+['`‘]\\([^'’]+\\)['’]") "Regexp matching doc string references to a customization group.") @@ -548,6 +558,10 @@ that." (setq data ;; possible newlines if para filled (replace-regexp-in-string "[ \t\n]+" " " data t t))) (help-xref-button 2 'help-info data)))) + ;; Man references + (save-excursion + (while (re-search-forward help-xref-man-regexp nil t) + (help-xref-button 1 'help-man (match-string 1)))) ;; Customization groups. (save-excursion (while (re-search-forward commit 0b2596432d8e29226ec2a52bf6292d65f7f28164 Author: Lars Ingebrigtsen Date: Sat Sep 25 03:59:42 2021 +0200 Fix some instances in the Emacs manual with misleading prefix syntax * doc/emacs/msdos.texi (Windows Keyboard): * doc/emacs/misc.texi (Editing Binary Files): * doc/emacs/macos.texi (Mac / GNUstep Events): * doc/emacs/kmacro.texi (Basic Keyboard Macro): * doc/emacs/glossary.texi (Glossary): * doc/emacs/fixit.texi (Spelling): Fix some instances where the syntax seems to imply we're talking about a prefix key (bug#50792). diff --git a/doc/emacs/fixit.texi b/doc/emacs/fixit.texi index 85cdbff5fa..7feebddee8 100644 --- a/doc/emacs/fixit.texi +++ b/doc/emacs/fixit.texi @@ -463,7 +463,7 @@ use @code{flyspell-region} or @code{flyspell-buffer} for that. it with @kbd{mouse-2} (@code{flyspell-correct-word}) to display a menu of possible corrections and actions. If you want this menu on @kbd{mouse-3} instead, enable @code{context-menu-mode}. In addition, -@kbd{C-.} or @kbd{@key{ESC}-@key{TAB}} (@code{flyspell-auto-correct-word}) +@kbd{C-.} or @kbd{@key{ESC} @key{TAB}} (@code{flyspell-auto-correct-word}) will propose various successive corrections for the word at point, and @w{@kbd{C-c $}} (@code{flyspell-correct-word-before-point}) will pop up a menu of possible corrections. Of course, you can always correct diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi index 63f690712a..9c06bcc4af 100644 --- a/doc/emacs/glossary.texi +++ b/doc/emacs/glossary.texi @@ -1113,7 +1113,7 @@ Emacs. @xref{Query Replace}. @anchor{Glossary---Quitting} @item Quitting Quitting means canceling a partially typed command or a running -command, using @kbd{C-g} (or @kbd{C-@key{BREAK}} on MS-DOS). @xref{Quitting}. +command, using @kbd{C-g} (or @kbd{C-@key{Break}} on MS-DOS). @xref{Quitting}. @item Quoting Quoting means depriving a character of its usual special significance. diff --git a/doc/emacs/kmacro.texi b/doc/emacs/kmacro.texi index 16a97db54c..78964bb903 100644 --- a/doc/emacs/kmacro.texi +++ b/doc/emacs/kmacro.texi @@ -102,7 +102,7 @@ are in the process of defining one, or calls the last macro otherwise.) You can also supply @key{F4} with a numeric prefix argument @samp{n}, which means to invoke the macro @samp{n} times. An argument of zero repeats the macro indefinitely, until it gets an -error or you type @kbd{C-g} (or, on MS-DOS, @kbd{C-@key{BREAK}}). +error or you type @kbd{C-g} (or, on MS-DOS, @kbd{C-@key{Break}}). The above example demonstrates a handy trick that you can employ with keyboard macros: if you wish to repeat an operation at regularly diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi index cd1db1a7ba..99c67ed09e 100644 --- a/doc/emacs/macos.texi +++ b/doc/emacs/macos.texi @@ -290,7 +290,7 @@ The default behavior is to save all file-visiting buffers. @cindex using Nextstep services (macOS) Emacs also allows users to make use of Nextstep services, via a set of commands whose names begin with @samp{ns-service-} and end with the -name of the service. Type @kbd{M-x ns-service-@key{TAB}} to +name of the service. Type @kbd{M-x ns-service- @key{TAB}} to see a list of these commands. These functions either operate on marked text (replacing it with the result) or take a string argument and return the result as a string. You can also use the Lisp function diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 47e3e11d33..5123a716dc 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -2602,7 +2602,7 @@ invoked @code{hexl-mode}. @noindent Other Hexl commands let you insert strings (sequences) of binary bytes, move by @code{short}s or @code{int}s, etc.; type @kbd{C-h a -hexl-@key{RET}} for details. +hexl- @key{TAB}} for details. Hexl mode can also be used for editing text files. This could come in handy if the text file includes unusual characters or uses unusual diff --git a/doc/emacs/msdos.texi b/doc/emacs/msdos.texi index 33d389acd5..0f8f429b3f 100644 --- a/doc/emacs/msdos.texi +++ b/doc/emacs/msdos.texi @@ -543,7 +543,7 @@ keyboard input in Emacs. conventional uses in MS-Windows programs conflict with traditional Emacs key bindings. (These Emacs key bindings were established years before Microsoft was founded.) Examples of conflicts include -@kbd{C-c}, @kbd{C-x}, @kbd{C-z}, @kbd{C-a}, and @kbd{W-@key{SPC}}. +@kbd{C-c}, @kbd{C-x}, @kbd{C-z}, and @kbd{C-a}. You can redefine some of them with meanings more like the MS-Windows meanings by enabling CUA Mode (@pxref{CUA Bindings}). Another optional feature which will make Emacs behave like other Windows commit f6f87917fc5eb151aff0facc390983012644a681 Author: Manuel Giraud Date: Sat Sep 25 03:38:43 2021 +0200 Make 'C-u C-x v v' handle unregistered files. * lisp/vc/vc.el (vc-next-action): Make 'C-u C-x v v' handle unregistered files (bug#50602). diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 8767969163..7d3b0f56f6 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1216,7 +1216,11 @@ For old-style locking-based version control systems, like RCS: ((eq state 'ignored) (error "Fileset files are ignored by the version-control system")) ((or (null state) (eq state 'unregistered)) - (vc-register vc-fileset)) + (cond (verbose + (let ((backend (vc-read-backend "Backend to register to: "))) + (vc-register (cons backend (cdr vc-fileset))))) + (t + (vc-register vc-fileset)))) ;; Files are up-to-date, or need a merge and user specified a revision ((or (eq state 'up-to-date) (and verbose (eq state 'needs-update))) (cond commit 67a0eee727925264041b610b8cf0360654590d51 Author: Daniel Martín Date: Fri Sep 24 15:32:01 2021 +0200 Mention the 'r' key in ask-user-about-supersession-help * lisp/userlock.el (ask-user-about-supersession-help): Replace "n, and then M-x revert-buffer" in the help message with "r", which does the same thing. (Bug#50780) diff --git a/lisp/userlock.el b/lisp/userlock.el index a38f6ac422..87a8b7b451 100644 --- a/lisp/userlock.el +++ b/lisp/userlock.el @@ -201,13 +201,10 @@ really edit the buffer? (%s, %s, %s or %s) " (defun ask-user-about-supersession-help () (with-output-to-temp-buffer "*Help*" - (let ((revert-buffer-binding - ;; This takes place in the original buffer. - (substitute-command-keys "\\[revert-buffer]"))) - (with-current-buffer standard-output - (insert - (format - "You want to modify a buffer whose disk file has changed + (with-current-buffer standard-output + (insert + (format + "You want to modify a buffer whose disk file has changed since you last read it in or saved it with this buffer. If you say %s to go ahead and modify this buffer, @@ -216,14 +213,13 @@ If you say %s to revert, the contents of the buffer are refreshed from the file on disk. If you say %s, the change you started to make will be aborted. -Usually, you should type %s and then %s, -to get the latest version of the file, then make the change again." - (userlock--fontify-key "y") - (userlock--fontify-key "r") - (userlock--fontify-key "n") - (userlock--fontify-key "n") - revert-buffer-binding)) - (help-mode))))) +Usually, you should type %s to get the latest version of the +file, then make the change again." + (userlock--fontify-key "y") + (userlock--fontify-key "r") + (userlock--fontify-key "n") + (userlock--fontify-key "r"))) + (help-mode)))) ;;;###autoload (defun userlock--handle-unlock-error (error) commit 38037e04cb05cb1f2b604f0b1602d36b0bcf6985 Author: akater Date: Sat Sep 25 03:27:29 2021 +0200 Indent bodies of local function definitions properly in elisp-mode * lisp/emacs-lisp/lisp-mode.el (lisp-indent-function): Check for local defforms (`cl-flet' and `cl-labels'). (lisp--local-defform-body): New auxiliary function (bug#9622). diff --git a/etc/NEWS b/etc/NEWS index c266dddafa..2f8fbc7614 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3220,6 +3220,14 @@ file: (add-hook 'foo-mode-hook (lambda () (auto-fill-mode -1)) +--- +** Indentation of 'cl-flet' and 'cl-labels' has changed. +These forms now indent like this: + + (cl-flet ((bla (x) + (* x x))) + (bla 42)) + * Incompatible Lisp Changes in Emacs 28.1 diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index eac3c03cd1..7ce857e990 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -29,6 +29,7 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'subr-x)) (defvar font-lock-comment-face) (defvar font-lock-doc-face) @@ -1105,6 +1106,27 @@ is the buffer position of the start of the containing expression." (t normal-indent)))))) +(defun lisp--local-defform-body (state) + "Return non-nil if at local definition body according to STATE. +STATE is the `parse-partial-sexp' state for current position." + (when-let ((start-of-innermost-containing-list (nth 1 state))) + (let* ((parents (nth 9 state)) + (second-cons-after (cddr parents)) + second-order-parent) + (while second-cons-after + (when (= start-of-innermost-containing-list + (car second-cons-after)) + (setq second-order-parent (car parents) + ;; Leave the loop. + second-cons-after nil)) + (pop second-cons-after) + (pop parents)) + (and second-order-parent + (save-excursion + (goto-char (1+ second-order-parent)) + (memq (read (current-buffer)) + '(cl-flet cl-labels))))))) + (defun lisp-indent-function (indent-point state) "This function is the normal value of the variable `lisp-indent-function'. The function `calculate-lisp-indent' calls this to determine @@ -1138,16 +1160,17 @@ Lisp function does not specify a special indentation." (if (and (elt state 2) (not (looking-at "\\sw\\|\\s_"))) ;; car of form doesn't seem to be a symbol - (progn + (if (lisp--local-defform-body state) + (lisp-indent-defform state indent-point) (if (not (> (save-excursion (forward-line 1) (point)) calculate-lisp-indent-last-sexp)) - (progn (goto-char calculate-lisp-indent-last-sexp) - (beginning-of-line) - (parse-partial-sexp (point) - calculate-lisp-indent-last-sexp 0 t))) - ;; Indent under the list or under the first sexp on the same - ;; line as calculate-lisp-indent-last-sexp. Note that first - ;; thing on that line has to be complete sexp since we are + (progn (goto-char calculate-lisp-indent-last-sexp) + (beginning-of-line) + (parse-partial-sexp (point) + calculate-lisp-indent-last-sexp 0 t))) + ;; Indent under the list or under the first sexp on the same + ;; line as calculate-lisp-indent-last-sexp. Note that first + ;; thing on that line has to be complete sexp since we are ;; inside the innermost containing sexp. (backward-prefix-chars) (current-column)) @@ -1160,13 +1183,15 @@ Lisp function does not specify a special indentation." (cond ((or (eq method 'defun) (and (null method) (> (length function) 3) - (string-match "\\`def" function))) + (string-match "\\`def" function)) + ;; Check whether we are in flet or labels. + (lisp--local-defform-body state)) (lisp-indent-defform state indent-point)) ((integerp method) (lisp-indent-specform method state indent-point normal-indent)) (method - (funcall method indent-point state))))))) + (funcall method indent-point state))))))) (defcustom lisp-body-indent 2 "Number of columns to indent the second line of a `(def...)' form." diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el index e2cecdf6b0..5e533b370e 100644 --- a/test/lisp/emacs-lisp/lisp-mode-tests.el +++ b/test/lisp/emacs-lisp/lisp-mode-tests.el @@ -330,5 +330,16 @@ Expected initialization file: `%s'\" (faceup-clean-buffer) (should (faceup-test-font-lock-buffer 'emacs-lisp-mode faceup))))) +(ert-deftest test-cl-flet-indentation () + (should (equal + (with-temp-buffer + (lisp-mode) + (insert "(cl-flet ((bla (x)\n(* x x)))\n(bla 42))") + (indent-region (point-min) (point-max)) + (buffer-string)) + "(cl-flet ((bla (x) + (* x x))) + (bla 42))"))) + (provide 'lisp-mode-tests) ;;; lisp-mode-tests.el ends here commit c74816470281616da095ca885362b15bb0ce6cfb Author: Stefan Kangas Date: Sat Sep 25 03:24:14 2021 +0200 Clarify where to find CONTRIBUTE * doc/emacs/trouble.texi (Contributing): Say that CONTRIBUTE is found in the development version of Emacs. (Bug#37414) diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index 9a638818c9..4f9e6cc91f 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -1352,8 +1352,8 @@ downloaded the repository source, you should read the file from a normal build). If you would like to make more extensive contributions, see the -@file{CONTRIBUTE} file in the Emacs distribution for information on -how to be an Emacs developer. +@file{CONTRIBUTE} file in the development version of Emacs for +information on how to be an Emacs developer. For documentation on Emacs (to understand how to implement your desired change), refer to: commit f9071a23a986dcb4ea0ab72395f88daeef357cf3 Author: Lars Ingebrigtsen Date: Sat Sep 25 03:05:27 2021 +0200 Use gzip to uncompess .xz files on MacOS * lisp/jka-cmpr-hook.el (jka-compr-compression-info-list): Use gzip to uncompess .xz files on MacOS (bug#29235). diff --git a/lisp/jka-cmpr-hook.el b/lisp/jka-cmpr-hook.el index 6933a7c1d0..ed00caedb5 100644 --- a/lisp/jka-cmpr-hook.el +++ b/lisp/jka-cmpr-hook.el @@ -203,7 +203,7 @@ options through Custom does this automatically." ;; can-append strip-extension-flag file-magic-bytes ;; uncompress-function] (mapcar 'purecopy - '(["\\.Z\\'" + `(["\\.Z\\'" "compressing" "compress" ("-c") ;; gzip is more common than uncompress. It can only read, not write. "uncompressing" "gzip" ("-c" "-q" "-d") @@ -239,7 +239,8 @@ options through Custom does this automatically." "LZMA uncompressing" "lzma" ("-c" "-q" "-d") t t ""] ["\\.xz\\'" - "XZ compressing" "xz" ("-c" "-q") + ;; On MacOS, gzip can uncompress xz files. + "XZ compressing" ,(if (featurep 'ns) "gzip" "xz") ("-c" "-q") "XZ uncompressing" "xz" ("-c" "-q" "-d") t t "\3757zXZ\0"] ["\\.txz\\'" commit 7a7235899429d5adaec92d7184208db53448d81a Author: Lars Ingebrigtsen Date: Sat Sep 25 02:55:55 2021 +0200 Use `temporary-file-directory' in `with-existing-directory' * lisp/subr.el (with-existing-directory): Use `temporary-file-directory' over TMPDIR. diff --git a/lisp/subr.el b/lisp/subr.el index 2d2794cfd1..fd1ceb95f5 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4636,6 +4636,7 @@ If `default-directory' is already an existing directory, it's not changed." (file-exists-p dir))) (list default-directory (expand-file-name "~/") + temporary-file-directory (getenv "TMPDIR") "/tmp/") "/"))) commit 2767c89db729a6106146d0aeff76678c64d4fc53 Author: Stefan Kangas Date: Sat Sep 25 00:33:21 2021 +0200 Fix alignment on font size change in tabulated-list-mode * lisp/emacs-lisp/tabulated-list.el (tabulated-list-print-col): Fix bug where the columns didn't align correctly when using 'text-scale-mode' to decrease the font size. (Bug#48639) diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el index f148bc1768..5210b2be5e 100644 --- a/lisp/emacs-lisp/tabulated-list.el +++ b/lisp/emacs-lisp/tabulated-list.el @@ -581,7 +581,8 @@ Return the column number after insertion." (when not-last-col (when (> pad-right 0) (insert (make-string pad-right ?\s))) (insert (propertize - (make-string (- width (min width label-width)) ?\s) + ;; We need at least one space to align correctly. + (make-string (- width (min 1 width label-width)) ?\s) 'display `(space :align-to ,next-x)))) (put-text-property opoint (point) 'tabulated-list-column-name name) next-x))) commit d03995197dcc1a2a26636fe466bf4691175c89ad Author: Stefan Kangas Date: Sat Sep 25 00:05:55 2021 +0200 Doc fix; cl-random is only pseudo-random * lisp/emacs-lisp/cl-extra.el (cl-random): Doc fix; say it's only pseudo-random. diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 3840d13ecf..0ed7547509 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -455,7 +455,7 @@ as an integer unless JUNK-ALLOWED is non-nil." ;;;###autoload (defun cl-random (lim &optional state) - "Return a random nonnegative number less than LIM, an integer or float. + "Return a pseudo-random nonnegative number less than LIM, an integer or float. Optional second arg STATE is a random-state object." (or state (setq state cl--random-state)) ;; Inspired by "ran3" from Numerical Recipes. Additive congruential method. commit 79a9b50621ec22640358bd6b94b65d14d747c644 Author: Stefan Kangas Date: Fri Sep 24 23:42:08 2021 +0200 checkdoc: Don't ask to disambiguate mode names * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine): Don't ask to disambiguate mode names. (Bug#4110) diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 0862e66ac5..74c27343bc 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -1653,7 +1653,10 @@ mouse-[0-3]\\)\\)\\>")) me (match-end 1)) (if (and sym (boundp sym) (fboundp sym) checkdoc--disambiguate-symbol-flag - (save-excursion + ;; Mode names do not need disambiguating. (Bug#4110) + (not (string-match (rx "-mode" string-end) + (symbol-name sym))) + (save-excursion (goto-char mb) (forward-word-strictly -1) (not (looking-at commit f17fb37c517573652de538e2843043db7603f9e9 Author: Stefan Kangas Date: Fri Sep 24 23:00:57 2021 +0200 Fix recently introduced bug in checkdoc * lisp/emacs-lisp/checkdoc.el (checkdoc-in-abbreviation-p): Fix recently introduced bug where some abbreviations weren't recognized. * test/lisp/emacs-lisp/checkdoc-tests.el (checkdoc-tests-in-abbrevation-p/basic-case): Extend test. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index df93d39241..0862e66ac5 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -2105,14 +2105,15 @@ Examples of recognized abbreviations: \"e.g.\", \"i.e.\", \"cf.\"." (save-excursion (goto-char begin) (condition-case nil - (let ((single-letter t)) + (let (single-letter) (forward-word -1) ;; Skip over all dots backwards, as `forward-word' will only ;; go one dot at a time in a string like "e.g.". (while (save-excursion (forward-char -1) (looking-at (rx "."))) - (setq single-letter nil) (forward-word -1)) + (when (= (point) (1- begin)) + (setq single-letter t)) ;; Piece of an abbreviation. (looking-at (if single-letter diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el b/test/lisp/emacs-lisp/checkdoc-tests.el index 13b6d134e5..d452024b8f 100644 --- a/test/lisp/emacs-lisp/checkdoc-tests.el +++ b/test/lisp/emacs-lisp/checkdoc-tests.el @@ -131,7 +131,10 @@ See the comments in Bug#24998." (checkdoc-in-abbreviation-p (point)))) (ert-deftest checkdoc-tests-in-abbrevation-p/basic-case () - (should (checkdoc-tests--abbrev-test "foo bar e.g. baz" "e.g"))) + (should (checkdoc-tests--abbrev-test "foo bar e.g. baz" "e.g")) + (should (checkdoc-tests--abbrev-test "behavior/errors etc. that" "etc")) + (should (checkdoc-tests--abbrev-test "foo vs. bar" "vs")) + (should (checkdoc-tests--abbrev-test "spy a.k.a. spy" "a.k.a"))) (ert-deftest checkdoc-tests-in-abbrevation-p/with-parens () (should (checkdoc-tests--abbrev-test "foo bar (e.g. baz)" "e.g"))) commit 2ee5c80ff5454320a0bbe8c2d5b32eb2f0b46bdb Author: Stefan Kangas Date: Fri Sep 24 22:17:04 2021 +0200 Revert change to use seq-random-elt in Tramp test * test/lisp/net/tramp-tests.el (tramp-test44-asynchronous-requests): Revert change to use seq-random-elt, as Tramp needs to be compatible with Emacs 25, and the function was only added in 26.1. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index f105c6f60b..358f87d84c 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -6787,7 +6787,10 @@ process sentinels. They shall not disturb each other." (let ((time (float-time)) (default-directory tmp-name) (file - (buffer-name (seq-random-elt buffers))) + (buffer-name + ;; Use `seq-random-elt' once <26.1 support + ;; is dropped. + (nth (random (length buffers)) buffers))) ;; A remote operation in a timer could ;; confuse Tramp heavily. So we ignore this ;; error here. @@ -6852,7 +6855,8 @@ process sentinels. They shall not disturb each other." ;; the buffers. Mix with regular operation. (let ((buffers (copy-sequence buffers))) (while buffers - (let* ((buf (seq-random-elt buffers)) + ;; Use `seq-random-elt' once <26.1 support is dropped. + (let* ((buf (nth (random (length buffers)) buffers)) (proc (get-buffer-process buf)) (file (process-get proc 'foo)) (count (process-get proc 'bar))) commit 54cfadd92f080572f6f2ccf89829d38daaa56529 Author: Stefan Kangas Date: Fri Sep 24 22:04:55 2021 +0200 checkdoc: Improve wide line warning to decrease false positives * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine): Respect 'byte-compile-docstring-max-column' if it is set. Allow the first line to be three characters longer than the others to account for indentation and the opening string character. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 06720cfa2e..df93d39241 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -1685,20 +1685,28 @@ function,command,variable,option or symbol." ms1)))))) ;; first line can be wider if necessary to fit the ;; information that ought to be there. (save-excursion - (let ((start (point)) - (eol nil)) + (let* ((start (point)) + (eol nil) + ;; Respect this file local variable. + (max-column (max 80 byte-compile-docstring-max-column)) + ;; Allow the first line to be three characters longer, to + ;; fit the leading ` "' while still having a docstring + ;; shorter than e.g. 80 characters. + (first t) + (get-max-column (lambda () (+ max-column (if first 3 0))))) (while (and (< (point) e) (or (progn (end-of-line) (setq eol (point)) - (< (current-column) 80)) + (< (current-column) (funcall get-max-column))) (progn (beginning-of-line) (re-search-forward "\\\\\\\\[[<{]" eol t)) - (checkdoc-in-sample-code-p start e))) + (checkdoc-in-sample-code-p start e))) + (setq first nil) (forward-line 1)) (end-of-line) - (if (and (< (point) e) (> (current-column) 80)) + (if (and (< (point) e) (> (current-column) (funcall get-max-column))) (checkdoc-create-error - "Some lines are over 80 columns wide" + (format "Some lines are over %d columns wide" max-column) s (save-excursion (goto-char s) (line-end-position)))))) ;; Here we deviate to tests based on a variable or function. ;; We must do this before checking for symbols in quotes because there commit 0da8118dcbf3c54dd6ecc9c0e3314a56ca82ec51 Author: Stefan Kangas Date: Fri Sep 24 20:59:32 2021 +0200 Use command substitution instead of raw keys in more places * admin/authors.el (authors): * lisp/abbrev.el (abbrev-suggest-show-report): * lisp/calc/calc.el (calc-display-trail, calc): * lisp/completion.el (completion-locate-db-error): * lisp/dired-x.el (dired-extra-startup): * lisp/emacs-lisp/package.el (package-install-selected-packages): * lisp/emulation/viper.el (viper-mode): * lisp/facemenu.el (list-colors-display): * lisp/mail/emacsbug.el (report-emacs-bug-hook): * lisp/mail/sendmail.el (mail): * lisp/menu-bar.el (menu-bar-mode): * lisp/org/org.el (org-revert-all-org-buffers): * lisp/progmodes/antlr-mode.el (antlr-help-rules-intro) (antlr-insert-makefile-rules): * lisp/progmodes/gdb-mi.el (gdb--check-interpreter): * lisp/progmodes/xscheme.el (xscheme-process-sentinel): * lisp/ps-print.el (ps-font-info-database): * lisp/recentf.el (recentf-edit-list, recentf-open-files): * lisp/vc/ediff-util.el (ediff-suspend): * lisp/vc/pcvs.el (cvs-mode): * lisp/vc/vc-bzr.el (vc-bzr-dir-extra-headers): Use command substitution. diff --git a/admin/authors.el b/admin/authors.el index 3dec23c191..fd46dabaa3 100644 --- a/admin/authors.el +++ b/admin/authors.el @@ -1610,7 +1610,8 @@ and a buffer *Authors Errors* containing references to unknown files." ;; the versioned ChangeLog.N rather than the unversioned ChangeLog. (zerop (call-process "make" nil nil nil "-C" root "change-history-nocommit")) - (error "Problem updating ChangeLog, try \"C-u M-x authors RET\"")) + (error (substitute-command-keys + "Problem updating ChangeLog, try \"\\[universal-argument] \\[authors]\""))) (let ((logs (process-lines find-program root "-name" "ChangeLog*")) (table (make-hash-table :test 'equal)) (buffer-name "*Authors*") diff --git a/lisp/abbrev.el b/lisp/abbrev.el index f370bd3ea6..b0e8a4fa99 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el @@ -973,11 +973,11 @@ full text instead of the abbrevs that expand into that text." (buf (get-buffer-create "*abbrev-suggest*"))) (set-buffer buf) (erase-buffer) - (insert "** Abbrev expansion usage ** + (insert (substitute-command-keys "** Abbrev expansion usage ** Below is a list of expansions for which abbrevs are defined, and the number of times the expansion was typed manually. To display -and edit all abbrevs, type `M-x edit-abbrevs RET'\n\n") +and edit all abbrevs, type \\[edit-abbrevs].\n\n")) (dolist (expansion totals) (insert (format " %s: %d\n" (car expansion) (cdr expansion)))) (display-buffer buf))) diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 45a4d56a37..b9bdc0fd8d 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -731,7 +731,7 @@ If nil, symbolic math routines make no assumptions about variables.") "Initial height of Calculator window.") (defcalcmodevar calc-display-trail t - "If non-nil, M-x calc creates a window to display Calculator trail.") + "If non-nil, \\[calc] creates a window to display Calculator trail.") (defcalcmodevar calc-show-selections t "If non-nil, selected sub-formulas are shown by obscuring rest of formula. @@ -1468,7 +1468,9 @@ See `window-dedicated-p' for what that means." (with-current-buffer (calc-trail-buffer) (and calc-display-trail (calc-trail-display 1 t))) - (message "Welcome to the GNU Emacs Calculator! Press `?' or `h' for help, `q' to quit") + (message (substitute-command-keys + (concat "Welcome to the GNU Emacs Calculator! \\" + "Press \\[calc-help] or \\[calc-help-prefix] for help, \\[calc-quit] to quit"))) (run-hooks 'calc-start-hook) (and (windowp full-display) (window-point full-display) diff --git a/lisp/completion.el b/lisp/completion.el index e36c722841..643f2da0d2 100644 --- a/lisp/completion.el +++ b/lisp/completion.el @@ -1088,7 +1088,8 @@ Must be called after `find-exact-completion'." #'completion-locate-db-error "27.1") (defun completion-locate-db-error () ;; recursive error: really scrod - (error "Completion database corrupted. Try M-x clear-all-completions. Send bug report")) + (error (substitute-command-keys + "Completion database corrupted. Try \\[clear-all-completions]. Send bug report"))) ;; WRITES (defun add-completion-to-tail-if-new (string) diff --git a/lisp/dired-x.el b/lisp/dired-x.el index cf257c8169..7c6f49f2ae 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -293,7 +293,7 @@ files"] \\[dired-omit-mode]\t-- toggle omitting of files \\[dired-mark-sexp]\t-- mark by Lisp expression -To see the options you can set, use M-x customize-group RET dired-x RET. +To see the options you can set, use \\[customize-group] RET dired-x RET. See also the functions: `dired-flag-extension' `dired-virtual' diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index a204966644..a0bfcbb24f 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2268,7 +2268,9 @@ confirmation to install packages." (mapconcat #'symbol-name available " ")))) (mapc (lambda (p) (package-install p 'dont-select)) available))) ((> difference 0) - (message "Packages that are not available: %d (the rest is already installed), maybe you need to `M-x package-refresh-contents'" + (message (substitute-command-keys + "Packages that are not available: %d (the rest is already \ +installed), maybe you need to \\[package-refresh-contents]") difference)) (t (message "All your packages are already installed")))))) diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index 6ba265f8ab..e9c0fb5e24 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el @@ -577,7 +577,7 @@ For more information on Viper: To submit a bug report or to contact the author, type :submitReport in Vi command mode. To shoo Viper away and return to pure Emacs (horror!), type: - M-x viper-go-away + \\[viper-go-away] This startup message appears whenever you load Viper, unless you type `y' now." )) diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 7229d6163d..7417bb1203 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -541,10 +541,11 @@ If the optional argument LIST is non-nil, it should be a list of colors to display. Otherwise, this command computes a list of colors that the current display can handle. Customize `list-colors-sort' to change the order in which colors are shown. -Type `g' or \\[revert-buffer] after customizing `list-colors-sort' -to redisplay colors in the new order. +Type \\\\[revert-buffer] after customizing \ +`list-colors-sort' to redisplay colors in +the new order. -If the optional argument BUFFER-NAME is nil, it defaults to *Colors*. +If the optional argument BUFFER-NAME is nil, it defaults to \"*Colors*\". If the optional argument CALLBACK is non-nil, it should be a function to call each time the user types RET or clicks on a diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index 3da1e8b25e..7c3f6ba5e6 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -426,7 +426,7 @@ usually do not have translators for other languages.\n\n"))) (with-output-to-temp-buffer "*Bug Help*" (princ (substitute-command-keys (format "\ -You invoked the command M-x report-emacs-bug, +You invoked the command \\[report-emacs-bug], but you decided not to mail the bug report to the Emacs maintainers. If you want to mail it to someone else instead, diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index 312805f6d8..d0aff093df 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -1950,7 +1950,8 @@ The seventh argument ACTIONS is a list of actions to take (setq initialized t))) (if (and buffer-auto-save-file-name (file-exists-p buffer-auto-save-file-name)) - (message "Auto save file for draft message exists; consider M-x mail-recover")) + (message (substitute-command-keys + "Auto save file for draft message exists; consider \\[mail-recover]"))) initialized)) (declare-function dired-view-file "dired" ()) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index ede8186782..b2577c085f 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -2490,7 +2490,9 @@ created in the future." ;; after this function returns, overwriting any message we do here. (when (and (called-interactively-p 'interactive) (not menu-bar-mode)) (run-with-idle-timer 0 nil 'message - "Menu Bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear."))) + (substitute-command-keys + "Menu Bar mode disabled. \ +Use \\[menu-bar-mode] to make the menu bar appear.")))) ;;;###autoload ;; (This does not work right unless it comes after the above definition.) diff --git a/lisp/org/org.el b/lisp/org/org.el index d03676e3fb..4a74eda842 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -15215,9 +15215,9 @@ This function is useful in a setup where one tracks Org files with a version control system, to revert on one machine after pulling changes from another. I believe the procedure must be like this: -1. M-x org-save-all-org-buffers +1. \\[org-save-all-org-buffers] 2. Pull changes from the other machine, resolve conflicts -3. M-x org-revert-all-org-buffers" +3. \\[org-revert-all-org-buffers]" (interactive) (unless (yes-or-no-p "Revert all Org buffers from their files? ") (user-error "Abort")) diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el index a74ca1ed23..0b7945430d 100644 --- a/lisp/progmodes/antlr-mode.el +++ b/lisp/progmodes/antlr-mode.el @@ -570,7 +570,7 @@ See \\[antlr-show-makefile-rules] and `antlr-unknown-file-formats'.") "The following Makefile rules define the dependencies for all (non- expanded) grammars in directory \"%s\".\n They are stored in the kill-ring, i.e., you can insert them with C-y -into your Makefile. You can also invoke M-x antlr-show-makefile-rules +into your Makefile. You can also invoke \\[antlr-show-makefile-rules] from within a Makefile to insert them directly.\n\n\n" "Introduction to use with \\[antlr-show-makefile-rules]. It is a format string and used with substitution DIRECTORY/%s where @@ -2167,7 +2167,8 @@ command `antlr-show-makefile-rules' for detail." (unless in-makefile (copy-region-as-kill (point-min) (point-max)) (goto-char (point-min)) - (insert (format antlr-help-rules-intro dirname))))) + (insert (format (substitute-command-keys antlr-help-rules-intro) + dirname))))) ;;;###autoload (defun antlr-show-makefile-rules () diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 3e5b8e2f32..fa54f51160 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -766,7 +766,9 @@ NOARG must be t when this macro is used outside `gud-def'." ;; Apparently we're not running with -i=mi (or we're, for ;; instance, debugging something inside a Docker instance with ;; Emacs on the outside). - (let ((msg "Error: Either -i=mi wasn't specified on the GDB command line, or the extra socket couldn't be established. Consider using `M-x gud-gdb' instead.")) + (let ((msg (substitute-command-keys + "Error: Either -i=mi wasn't specified on the GDB command line,\ + or the extra socket couldn't be established. Consider using \\[gud-gdb] instead."))) (message msg) (setq string (concat (propertize msg 'font-lock-face 'error) "\n" string))) diff --git a/lisp/progmodes/xscheme.el b/lisp/progmodes/xscheme.el index 7076331984..1874f2698a 100644 --- a/lisp/progmodes/xscheme.el +++ b/lisp/progmodes/xscheme.el @@ -908,8 +908,8 @@ the remaining input.") xscheme-signal-death-message) (progn (beep) - (message -"The Scheme process has died! Do M-x reset-scheme to restart it")))))) + (message (substitute-command-keys +"The Scheme process has died! Type \\[reset-scheme] to restart it"))))))) (defun xscheme-process-filter-initialize (running-p) (setq xscheme-process-filter-state 'idle) diff --git a/lisp/ps-print.el b/lisp/ps-print.el index 38671b58e2..1f4ed4e44d 100644 --- a/lisp/ps-print.el +++ b/lisp/ps-print.el @@ -2788,7 +2788,7 @@ Each element comprises: font family (the key), name, bold, italic, bold-italic, reference size, line height, space width, average character width. To get the info for another specific font (say Helvetica), do the following: - create a new buffer -- generate the PostScript image to a file (C-u M-x ps-print-buffer) +- generate the PostScript image to a file (\\[universal-argument] \\[ps-print-buffer]) - open this file and delete the leading `%' (which is the PostScript comment character) from the line `% 3 cm 20 cm moveto 10/Courier ReportFontInfo showpage' diff --git a/lisp/recentf.el b/lisp/recentf.el index 9ae059a70d..57cbaf0deb 100644 --- a/lisp/recentf.el +++ b/lisp/recentf.el @@ -1122,8 +1122,9 @@ IGNORE arguments." (setq-local recentf-edit-list nil) (widget-insert (format-message - "Click on OK to delete selected files from the recent list. -Click on Cancel or type `q' to cancel.\n")) + (substitute-command-keys + "Click on OK to delete selected files from the recent list. +Click on Cancel or type \\[recentf-cancel-dialog] to cancel.\n"))) ;; Insert the list of files as checkboxes (dolist (item recentf-list) (widget-create 'checkbox @@ -1221,7 +1222,8 @@ use for the dialog. It defaults to \"*`recentf-menu-title'*\"." ", or type the corresponding digit key," "") " to open it.\n" - (format-message "Click on Cancel or type `q' to cancel.\n")) + (substitute-command-keys + "Click on Cancel or type \\[recentf-cancel-dialog] to cancel.\n")) ;; Use a L&F that looks like the recentf menu. (tree-widget-set-theme "folder") (apply #'widget-create diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index 5646fd3d42..9016d1df5c 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -2777,8 +2777,8 @@ up an appropriate window config." (interactive) (ediff-barf-if-not-control-buffer) (run-hooks 'ediff-suspend-hook) - (message - "To resume, type M-x eregistry and select the desired Ediff session")) + (message (substitute-command-keys + "To resume, type \\[eregistry] and select the desired Ediff session"))) ;; ediff-barf-if-not-control-buffer ensures only called from ediff. (declare-function ediff-version "ediff" ()) diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el index 726fe4e283..bbc81ef195 100644 --- a/lisp/vc/pcvs.el +++ b/lisp/vc/pcvs.el @@ -1144,7 +1144,8 @@ Full documentation is in the Texinfo file." ("->" cvs-secondary-branch-prefix)))) " " cvs-mode-line-process)) (if buffer-file-name - (error "Use M-x cvs-quickdir to get a *cvs* buffer")) + (error (substitute-command-keys + "Use \\[cvs-quickdir] to get a *cvs* buffer"))) (buffer-disable-undo) ;;(setq-local goal-column cvs-cursor-column) (setq-local revert-buffer-function 'cvs-mode-revert-buffer) diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index bfe3293e45..48fedeca5a 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el @@ -1054,7 +1054,8 @@ stream. Standard error output is discarded." (vc-bzr-command "info" t 0 dir) (buffer-string))) (shelve (vc-bzr-shelve-list)) - (shelve-help-echo "Use M-x vc-bzr-shelve to create shelves") + (shelve-help-echo (substitute-command-keys + "Use \\[vc-bzr-shelve] to create shelves")) (root-dir (vc-bzr-root dir)) (pending-merge ;; FIXME: looking for .bzr/checkout/merge-hashes is not a commit 35d0675467e61aff30c21544f87f55b1b1a2cfd3 Author: Stefan Kangas Date: Fri Sep 24 19:41:03 2021 +0200 Prefer seq-random-elt to nth+random * lisp/emacs-lisp/seq.el (seq-random-elt): Autoload. * lisp/avoid.el (mouse-avoidance-random-shape): * lisp/epa-ks.el (epa-ks--query-url): * lisp/erc/erc-networks.el (erc-server-select): * lisp/gnus/gnus-fun.el (gnus--random-face-with-type) (gnus-fun-ppm-change-string): * lisp/net/soap-inspect.el (soap-sample-value-for-xs-simple-type): * lisp/obsolete/landmark.el (landmark-random-move): * lisp/play/mpuz.el (mpuz-build-random-perm): * lisp/play/zone.el (zone-pgm-stress): * lisp/vc/add-log.el (add-change-log-entry): * test/lisp/net/tramp-tests.el (tramp-test44-asynchronous-requests): Prefer seq-random-elt to nth+random. diff --git a/lisp/avoid.el b/lisp/avoid.el index d3afecf8cc..03707d1046 100644 --- a/lisp/avoid.el +++ b/lisp/avoid.el @@ -43,7 +43,7 @@ ;; ;; (if (eq window-system 'x) ;; (mouse-avoidance-set-pointer-shape -;; (nth (random 4) +;; (seq-random-elt ;; (list x-pointer-man x-pointer-spider ;; x-pointer-gobbler x-pointer-gumby)))) ;; @@ -125,7 +125,6 @@ TOP-OR-BOTTOM-POS: Distance from top or bottom edge of frame or window." ;; Internal variables (defvar mouse-avoidance-state nil) (defvar mouse-avoidance-pointer-shapes nil) -(defvar mouse-avoidance-n-pointer-shapes 0) (defvar mouse-avoidance-old-pointer-shape nil) (defvar mouse-avoidance-animating-pointer nil) @@ -306,11 +305,8 @@ redefine this function to suit your own tastes." (all-completions "x-pointer-" obarray (lambda (x) (and (boundp x) - (integerp (symbol-value x))))))) - (setq mouse-avoidance-n-pointer-shapes - (length mouse-avoidance-pointer-shapes)))) - (nth (random mouse-avoidance-n-pointer-shapes) - mouse-avoidance-pointer-shapes)) + (integerp (symbol-value x))))))))) + (seq-random-elt mouse-avoidance-pointer-shapes)) (defun mouse-avoidance-ignore-p () (let ((mp (mouse-position))) diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index ae5988296d..baafc51693 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -570,6 +570,7 @@ SEQUENCE must be a sequence of numbers or markers." If no element is found, return nil." (ignore-errors (seq-elt sequence n))) +;;;###autoload (cl-defgeneric seq-random-elt (sequence) "Return a random element from SEQUENCE. Signal an error if SEQUENCE is empty." diff --git a/lisp/epa-ks.el b/lisp/epa-ks.el index ebdb127421..35caa1a93c 100644 --- a/lisp/epa-ks.el +++ b/lisp/epa-ks.el @@ -149,8 +149,7 @@ If EXACT is non-nil, don't accept approximate matches." (cond ((null epa-keyserver) (user-error "Empty keyserver pool")) ((listp epa-keyserver) - (nth (random (length epa-keyserver)) - epa-keyserver)) + (seq-random-elt epa-keyserver)) ((stringp epa-keyserver) epa-keyserver) ((error "Invalid type for `epa-keyserver'"))) diff --git a/lisp/erc/erc-networks.el b/lisp/erc/erc-networks.el index 1c7742afd2..678c596760 100644 --- a/lisp/erc/erc-networks.el +++ b/lisp/erc/erc-networks.el @@ -824,7 +824,7 @@ As an example: (ports (if (listp (nth 3 srv)) (erc-ports-list (nth 3 srv)) (list (nth 3 srv)))) - (port (nth (random (length ports)) ports))) + (port (and ports (seq-random-elt ports)))) (erc :server host :port port))) ;;; The following experimental diff --git a/lisp/gnus/gnus-fun.el b/lisp/gnus/gnus-fun.el index 8bca4ffe38..bfc57a2d60 100644 --- a/lisp/gnus/gnus-fun.el +++ b/lisp/gnus/gnus-fun.el @@ -103,7 +103,7 @@ PNG format." (remove nil (mapcar (lambda (f) (unless (string-match (or omit "^$") f) f)) (directory-files dir t ext)))) - (file (nth (random (length files)) files))) + (file (and files (seq-random-elt files)))) (when file (funcall fun file))))) @@ -315,7 +315,7 @@ colors of the displayed X-Faces." (let* ((possibilities '("%02x0000" "00%02x00" "0000%02x" "%02x%02x00" "00%02x%02x" "%02x00%02x")) (format (concat "'#%02x%02x%02x' '#" - (nth (random 6) possibilities) + (seq-random-elt possibilities) "'")) (values nil)) (dotimes (i 255) diff --git a/lisp/net/soap-inspect.el b/lisp/net/soap-inspect.el index b994b0ed86..5207ca8ff1 100644 --- a/lisp/net/soap-inspect.el +++ b/lisp/net/soap-inspect.el @@ -114,7 +114,7 @@ This is a specialization of `soap-sample-value' for (cond ((soap-xs-simple-type-enumeration type) (let ((enumeration (soap-xs-simple-type-enumeration type))) - (nth (random (length enumeration)) enumeration))) + (and enumeration (seq-random-elt enumeration)))) ((soap-xs-simple-type-pattern type) (format "a string matching %s" (soap-xs-simple-type-pattern type))) ((soap-xs-simple-type-length-range type) @@ -134,7 +134,7 @@ This is a specialization of `soap-sample-value' for (t (random 100))))) ((consp (soap-xs-simple-type-base type)) ; an union of values (let ((base (soap-xs-simple-type-base type))) - (soap-sample-value (nth (random (length base)) base)))) + (soap-sample-value (and base (seq-random-elt base))))) ((soap-xs-basic-type-p (soap-xs-simple-type-base type)) (soap-sample-value (soap-xs-simple-type-base type)))))) diff --git a/lisp/obsolete/landmark.el b/lisp/obsolete/landmark.el index cc4fd19c38..83e7649a69 100644 --- a/lisp/obsolete/landmark.el +++ b/lisp/obsolete/landmark.el @@ -1470,7 +1470,7 @@ push him out of it." (mapc (lambda (direction) (put direction 'y_t 0)) landmark-directions) - (dolist (direction (nth (random 8) landmark-8-directions)) + (dolist (direction (seq-random-elt landmark-8-directions)) (put direction 'y_t 1.0)) (landmark-move)) diff --git a/lisp/play/mpuz.el b/lisp/play/mpuz.el index ff174fed6c..df2b6fc867 100644 --- a/lisp/play/mpuz.el +++ b/lisp/play/mpuz.el @@ -153,7 +153,7 @@ You may abort a game by typing \\\\[mpuz-offer-abort]." (index 10) elem) (while letters - (setq elem (nth (random index) letters) + (setq elem (seq-random-elt letters) letters (delq elem letters) index (1- index)) (aset mpuz-digit-to-letter index elem) diff --git a/lisp/play/zone.el b/lisp/play/zone.el index 27aa48f4c9..a5d4ac9dc6 100644 --- a/lisp/play/zone.el +++ b/lisp/play/zone.el @@ -596,7 +596,7 @@ If the element is a function or a list of a function and a number, (forward-line -1) (delete-region (point) (line-beginning-position 2)) (goto-char (point-min)) - (insert (nth (random (length lines)) lines))) + (insert (seq-random-elt lines))) (message (concat (make-string (random (- (frame-width) 5)) ? ) "grrr")) (sit-for 0.1))))) diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el index 2e20284951..1290d7e03a 100644 --- a/lisp/vc/add-log.el +++ b/lisp/vc/add-log.el @@ -930,8 +930,7 @@ non-nil, otherwise in local time." (not (looking-at "[ \t]+.*<.*>$"))) (setq hit t))))) (forward-line 1) - (insert (nth (random (length new-entries)) - new-entries) + (insert (and new-entries (seq-random-elt new-entries)) (if use-hard-newlines hard-newline "\n") (if use-hard-newlines hard-newline "\n")) (forward-line -1)))) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 9f0264abc1..f105c6f60b 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -6787,8 +6787,7 @@ process sentinels. They shall not disturb each other." (let ((time (float-time)) (default-directory tmp-name) (file - (buffer-name - (nth (random (length buffers)) buffers))) + (buffer-name (seq-random-elt buffers))) ;; A remote operation in a timer could ;; confuse Tramp heavily. So we ignore this ;; error here. @@ -6853,7 +6852,7 @@ process sentinels. They shall not disturb each other." ;; the buffers. Mix with regular operation. (let ((buffers (copy-sequence buffers))) (while buffers - (let* ((buf (nth (random (length buffers)) buffers)) + (let* ((buf (seq-random-elt buffers)) (proc (get-buffer-process buf)) (file (process-get proc 'foo)) (count (process-get proc 'bar))) commit 8fbf816ccd0fe223568d6c31c4571ca45dffaa8d Author: Michael Albinus Date: Fri Sep 24 18:09:49 2021 +0200 Fix auto-revert-test05-global-notify * test/lisp/autorevert-tests.el (auto-revert-test05-global-notify): Adapt test for killed buffer. diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el index a235d60dc7..4a67dae10e 100644 --- a/test/lisp/autorevert-tests.el +++ b/test/lisp/autorevert-tests.el @@ -529,7 +529,7 @@ This expects `auto-revert--messages' to be bound by buf-1 "1-b" (auto-revert--timeout)) ;; On emba, `buf-1' is a killed buffer. (message "Hallo1") - (when (buffer-live-p buf-1) + (when (buffer-name buf-1) (should (buffer-local-value 'auto-revert-notify-watch-descriptor buf-1))) commit 68b8f3128f89b0e85508d01df9c5eaae4d045c64 Author: Robert Pluim Date: Fri Sep 24 13:31:32 2021 +0200 ; * doc/misc/tramp.texi: Grammar fixes for process-connection-type diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 7109ca67dc..e1bf2f2bae 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2610,7 +2610,7 @@ where @samp{192.168.0.1} is the remote host IP address @node FUSE setup @section @acronym{FUSE} setup hints -The @acronym{FUSE} file systems are mounted per default at +The @acronym{FUSE} file systems are mounted by default at @file{/tmp/tramp.method.user@@host#port}. The user name and port number are optional. If the file system is already mounted, it will be used as it is. If the mount point does not exist yet, @@ -3741,27 +3741,27 @@ To open @command{powershell} as a remote shell, use this: @vindex process-connection-type @cindex tramp-process-connection-type -Asynchronous processes differ in the way, whether they use a pseudo -tty, or not. This is controlled by the variable +Asynchronous processes behave differently based on whether they use a +pseudo tty or not. This is controlled by the variable @code{process-connection-type}, which can be @code{t} or @code{pty} -(use a pseudo tty), or @code{nil} or @code{pipe} (don't use it). +(use a pseudo tty), or @code{nil} or @code{pipe} (don't use one). @value{tramp} is based on running shells on the remote host, which -require a pseudo tty. Therefore, it declares the variable +requires a pseudo tty. Therefore, it declares the variable @code{tramp-process-connection-type}, which carries this information -for remote processes. Per default, its value is @code{t}, and there's -no need to change it. The name of the remote pseudo tty is returned -by the function @code{process-tty-name}. +for remote processes. Its default value is @code{t}, and there is no +need to change it. The name of the remote pseudo tty is returned by +the function @code{process-tty-name}. -If a remote process, started by @code{start-file-process}, shouldn't -use a pseudo tty, this can be indicated by setting +If a remote process, started by @code{start-file-process}, should +@emph{not} use a pseudo tty, this can be requested by setting @code{process-connection-type} to @code{nil} or @code{pipe}. There is still a pseudo tty for the started process, but some terminal properties are changed, like suppressing translation of carriage return characters into newline. -The function @code{make-process} allows an explicit setting by the -@code{:connection-type} keyword. If this keyword is not used, the -value of @code{process-connection-type} is applied instead. +The function @code{make-process} allows controlling this explicitly by +using the @code{:connection-type} keyword. If this keyword is not +used, the value of @code{process-connection-type} is applied instead. @anchor{Improving performance of asynchronous remote processes} commit 3ced9e30dbec66c76745a854d1a0522722ded5e5 Author: Robert Pluim Date: Fri Sep 24 13:30:10 2021 +0200 ; * etc/NEWS: improve some recently added entries diff --git a/etc/NEWS b/etc/NEWS index 7fef21b1d0..c266dddafa 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -4208,8 +4208,8 @@ first COUNT file names that match the expression. The same COUNT parameter has been added to 'directory-files-and-attributes'. +++ -** 'count-lines' now takes an optional parameter to -ignore invisible lines. +** 'count-lines' can now ignore invisible lines. +This is controlled by the optional parameter IGNORE-INVISIBLE-LINES. --- ** 'count-words' now crosses field boundaries. @@ -4229,7 +4229,7 @@ The new optional "," parameter has been added, and +++ ** 'parse-time-string' can now parse ISO 8601 format strings. -These have the format like "2020-01-15T16:12:21-08:00". +These have a format like "2020-01-15T16:12:21-08:00". --- ** 'make-network-process', 'make-serial-process' ':coding' behavior change. commit 6738111ae2baa45f1eb53e0d208f49855af128d6 Author: Robert Pluim Date: Thu Sep 23 11:31:46 2021 +0200 Generate skin tone compositions from emoji-sequences.txt Read skin tone modifier sequences from emoji-sequences.txt and add them to the per-character composition rules derived from emoji-zwj-sequences.txt, rather than adding them as lookback rules for the skin tone modifiers. This avoids an issue with the application of such lookback rules. See Bug#39799, specifically for more details. * admin/unidata/Makefile.in (zwj): Add emoji-sequences.txt as a dependency. * admin/unidata/emoji-zwj.awk: Match RGI_Emoji_ZWJ_Sequence and RGI_Emoji_Modifier_Sequence. Remove manual addition of skin tone composition rules with lookback. diff --git a/admin/unidata/Makefile.in b/admin/unidata/Makefile.in index a2a2e425ff..a953044a11 100644 --- a/admin/unidata/Makefile.in +++ b/admin/unidata/Makefile.in @@ -91,8 +91,8 @@ emoji-zwj.el: ${unidir}/emoji-zwj.el zwj = ${srcdir}/emoji-zwj.awk -${unidir}/emoji-zwj.el: ${srcdir}/emoji-zwj-sequences.txt ${zwj} - $(AM_V_GEN)$(AWK) -f ${zwj} < $< > $@ +${unidir}/emoji-zwj.el: ${srcdir}/emoji-zwj-sequences.txt $(srcdir)/emoji-sequences.txt ${zwj} + $(AM_V_GEN)$(AWK) -f ${zwj} $^ > $@ .PHONY: clean bootstrap-clean distclean maintainer-clean gen-clean diff --git a/admin/unidata/emoji-zwj.awk b/admin/unidata/emoji-zwj.awk index bdc50f5047..5aca157cbd 100644 --- a/admin/unidata/emoji-zwj.awk +++ b/admin/unidata/emoji-zwj.awk @@ -39,7 +39,7 @@ ### Code: -/^[0-9A-F]/ { +/^[0-9A-F].*; RGI_Emoji_(ZWJ|Modifier)_Sequence/ { sub(/ *;.*/, "", $0) num = split($0, elts) if (ch[elts[1]] == "") @@ -62,7 +62,7 @@ END { print ";;; emoji-zwj.el --- emoji zwj character composition table -*- lexical-binding:t -*-" - print ";;; Automatically generated from admin/unidata/emoji-zwj-sequences.txt" + print ";;; Automatically generated from admin/unidata/emoji-{zwj-,}sequences.txt" print "(eval-when-compile (require 'regexp-opt))" print "(dolist (elt `(" @@ -78,7 +78,7 @@ END { print " 0" print " 'compose-gstring-for-graphic)))))" - print ";; The following three blocks are derived by hand from emoji-sequences.txt" + print ";; The following two blocks are derived by hand from emoji-sequences.txt" print ";; FIXME: add support for Emoji_Keycap_Sequence once we learn how to respect FE0F/VS-16" print ";; for ASCII characters." @@ -98,14 +98,6 @@ END { print " 0" print " 'compose-gstring-for-graphic))))" - print ";; Skin tones" - print "(set-char-table-range composition-function-table" - print " '(#x1F3FB . #x1F3FF)" - print " (nconc (char-table-range composition-function-table '(#x1F3FB . #x1F3FF))" - print " (list (vector \".[\\U0001F3FB-\\U0001F3FF]\"" - print " 1" - print " 'compose-gstring-for-graphic))))" - print "\n" print "(provide 'emoji-zwj)" } commit 184469df13ed6e2b6b9e17cd41a31db9e3dd2dc2 Author: Robert Pluim Date: Fri Sep 24 13:05:05 2021 +0200 Add a few more missing emoji overrides * admin/unidata/blocks.awk: Add some more emoji overrides. diff --git a/admin/unidata/blocks.awk b/admin/unidata/blocks.awk index c1966cce22..b0303d7e66 100755 --- a/admin/unidata/blocks.awk +++ b/admin/unidata/blocks.awk @@ -237,8 +237,11 @@ END { override_start[idx] = "1F441" override_end[idx] = "1F441" idx++ - override_start[idx] = "1F575" + override_start[idx] = "1F574" override_end[idx] = "1F575" + idx++ + override_start[idx] = "1F590" + override_end[idx] = "1F590" for (k in override_start) { commit fdaae2e7bee5512047dc2ae67979d40cf60a5104 Author: Robert Pluim Date: Tue Sep 21 17:46:32 2021 +0200 Move compose-gstring-for-variation-glyph It logically belongs in composite.el, not japanese.el * lisp/language/japanese.el (compose-gstring-for-variation-glyph): Remove from here. * lisp/composite.el (compose-gstring-for-variation-glyph): And add here. diff --git a/lisp/composite.el b/lisp/composite.el index a16c0cc237..859253ec7e 100644 --- a/lisp/composite.el +++ b/lisp/composite.el @@ -815,6 +815,28 @@ prepending a space before it." (setq i (1+ i))))))) gstring)) +(defun compose-gstring-for-variation-glyph (gstring _direction) + "Compose glyph-string GSTRING for graphic display. +GSTRING must have two glyphs; the first is a glyph for a han character, +and the second is a glyph for a variation selector." + (let* ((font (lgstring-font gstring)) + (han (lgstring-char gstring 0)) + (vs (lgstring-char gstring 1)) + (glyphs (font-variation-glyphs font han)) + (g0 (lgstring-glyph gstring 0)) + (g1 (lgstring-glyph gstring 1))) + (catch 'tag + (dolist (elt glyphs) + (if (= (car elt) vs) + (progn + (lglyph-set-code g0 (cdr elt)) + (lglyph-set-from-to g0 (lglyph-from g0) (lglyph-to g1)) + (lgstring-set-glyph gstring 1 nil) + (throw 'tag gstring))))))) + +(let ((elt '([".." 1 compose-gstring-for-variation-glyph]))) + (set-char-table-range composition-function-table '(#xFE00 . #xFE0F) elt) + (set-char-table-range composition-function-table '(#xE0100 . #xE01EF) elt)) (defun auto-compose-chars (func from to font-object string direction) "Compose the characters at FROM by FUNC. diff --git a/lisp/language/japanese.el b/lisp/language/japanese.el index bd8ef6ec85..d9bd42093a 100644 --- a/lisp/language/japanese.el +++ b/lisp/language/japanese.el @@ -264,29 +264,6 @@ eucJP-ms is defined in ." (define-translation-table 'unicode-to-jisx0213 (char-table-extra-slot table 0))) -(defun compose-gstring-for-variation-glyph (gstring _direction) - "Compose glyph-string GSTRING for graphic display. -GSTRING must have two glyphs; the first is a glyph for a han character, -and the second is a glyph for a variation selector." - (let* ((font (lgstring-font gstring)) - (han (lgstring-char gstring 0)) - (vs (lgstring-char gstring 1)) - (glyphs (font-variation-glyphs font han)) - (g0 (lgstring-glyph gstring 0)) - (g1 (lgstring-glyph gstring 1))) - (catch 'tag - (dolist (elt glyphs) - (if (= (car elt) vs) - (progn - (lglyph-set-code g0 (cdr elt)) - (lglyph-set-from-to g0 (lglyph-from g0) (lglyph-to g1)) - (lgstring-set-glyph gstring 1 nil) - (throw 'tag gstring))))))) - -(let ((elt '([".." 1 compose-gstring-for-variation-glyph]))) - (set-char-table-range composition-function-table '(#xFE00 . #xFE0F) elt) - (set-char-table-range composition-function-table '(#xE0100 . #xE01EF) elt)) - (provide 'japanese) ;;; japanese.el ends here commit 04e236044acfb77f2be0b66cd2e0b2a172159546 Author: Robert Pluim Date: Thu Sep 23 11:22:00 2021 +0200 Update provenance comment in charscript.el * admin/unidata/blocks.awk: Update comment about sources used to generate charscript.el. diff --git a/admin/unidata/blocks.awk b/admin/unidata/blocks.awk index eab778cb1e..c1966cce22 100755 --- a/admin/unidata/blocks.awk +++ b/admin/unidata/blocks.awk @@ -250,7 +250,7 @@ END { } print ";;; charscript.el --- character script table -*- lexical-binding:t -*-" - print ";;; Automatically generated from admin/unidata/Blocks.txt" + print ";;; Automatically generated from admin/unidata/{Blocks,emoji-data}.txt" print "(let (script-list)" print " (dolist (elt '(" commit c6fc066bcb6f641fdca2cb66c65c486986dacbb5 Author: Eli Zaretskii Date: Fri Sep 24 14:07:15 2021 +0300 ; * etc/NEWS: Fix a recently modified entry. diff --git a/etc/NEWS b/etc/NEWS index e251fa4de8..7fef21b1d0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2594,7 +2594,7 @@ This is like 'filename', but is a full path, and is nil if the file doesn't exist. *** New 'thing-at-point' target: 'string'. -If point is inside a string, it returns the enclosed string. +If point is inside a string, it returns that string. +++ *** New variable 'thing-at-point-provider-alist'. commit b4cabc06e29fbe2595722faac8c9c7a5f66245d9 Author: Stefan Kangas Date: Fri Sep 24 12:26:09 2021 +0200 ; * etc/NEWS: Fix typo. diff --git a/etc/NEWS b/etc/NEWS index 02cbaa51ed..e251fa4de8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3889,7 +3889,7 @@ quotes, as well as backslash quoting (like\ this). +++ ** New function 'string-clean-whitespace'. -This removed whitespace from a string +This removes whitespace from a string. +++ ** New function 'string-fill'. commit 2932592469ae2bc9081f01fa9726b5bae2cc9fa7 Author: Stefan Kangas Date: Thu Sep 23 23:01:25 2021 +0200 ; * lisp/emacs-lisp/checkdoc.el (checkdoc-in-abbreviation-p): Doc fix. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index cae65eba8e..06720cfa2e 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -2093,7 +2093,7 @@ The text checked is between START and LIMIT." (defun checkdoc-in-abbreviation-p (begin) "Return non-nil if point is at an abbreviation. -Examples of abbreviations handled: \"e.g.\", \"i.e.\", \"cf.\"." +Examples of recognized abbreviations: \"e.g.\", \"i.e.\", \"cf.\"." (save-excursion (goto-char begin) (condition-case nil @@ -2120,7 +2120,7 @@ Examples of abbreviations handled: \"e.g.\", \"i.e.\", \"cf.\"." "etc" ; etc. "vs" ; vs. ;; Some non-standard or less common ones that we - ;; might as well ignore. + ;; might as well accept. "Inc" "Univ" "misc" "resp") ".")))) (error t)))) commit 01e17fd4e9d671fa92411f8fd3a00766df0e0787 Author: Michael Albinus Date: Fri Sep 24 09:56:02 2021 +0200 ; Instrument autorevert-tests.el diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el index 96169c75d3..a235d60dc7 100644 --- a/test/lisp/autorevert-tests.el +++ b/test/lisp/autorevert-tests.el @@ -514,6 +514,7 @@ This expects `auto-revert--messages' to be bound by (lambda () (buffer-local-value 'auto-revert-notify-watch-descriptor buf-3)) (auto-revert--timeout)) + (message "Hallo0") (should (buffer-local-value 'auto-revert-notify-watch-descriptor buf-3)) (auto-revert-test--write-file "3-a" file-3) @@ -527,6 +528,7 @@ This expects `auto-revert--messages' to be bound by (auto-revert-test--wait-for-buffer-text buf-1 "1-b" (auto-revert--timeout)) ;; On emba, `buf-1' is a killed buffer. + (message "Hallo1") (when (buffer-live-p buf-1) (should (buffer-local-value 'auto-revert-notify-watch-descriptor buf-1))) @@ -538,6 +540,7 @@ This expects `auto-revert--messages' to be bound by (auto-revert-test--write-file "2-b" file-2b) (auto-revert-test--wait-for-buffer-text buf-2 "2-b" (auto-revert--timeout)) + (message "Hallo2") (should (buffer-local-value 'auto-revert-notify-watch-descriptor buf-2))) commit 4e8e2a18dabdc3fa4f879cff5aa43fb43bcba8e1 Author: Eli Zaretskii Date: Fri Sep 24 10:25:08 2021 +0300 ; * doc/emacs/glossary.texi (Glossary): Improve the "symbol" entry. diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi index f7137284d2..63f690712a 100644 --- a/doc/emacs/glossary.texi +++ b/doc/emacs/glossary.texi @@ -86,8 +86,8 @@ delimiter for you (@pxref{Matching,,Matching Parens}). @anchor{Glossary---Balanced Expression} @item Balanced Expressions A balanced expression is a syntactically recognizable expression, such -as a symbol, number, string constant, block, or parenthesized expression -in C@. @xref{Expressions,Balanced Expressions}. +as a symbol (q.v.@:), number, string constant, block, or parenthesized +expression in C@. @xref{Expressions,Balanced Expressions}. @item Balloon Help @xref{Glossary---Tooltips}. @@ -238,7 +238,7 @@ a key binding in Emacs or to be invoked by its name @anchor{Glossary---Command Name} @item Command Name -A command name is the name of a Lisp symbol that is a command +A command name is the name of a Lisp symbol (q.v.@:) that is a command (@pxref{Commands}). You can invoke any command by its name using @kbd{M-x} (@pxref{M-x,M-x,Running Commands by Name}). @@ -1335,8 +1335,9 @@ allowed as well. @xref{Glossary---Global Substitution}. @item Symbol -A symbol in Emacs Lisp is an object with a name. The -symbol name serves as the printed representation of the symbol. +A symbol in Emacs Lisp is an object with a name. The object can be a +variable (q.v.@:), a function or command (q.v.@:), or a face (q.v.@:). +The symbol's name serves as the printed representation of the symbol. @xref{Symbol Type,, Symbol Type, elisp, The Emacs Lisp Reference Manual}. commit c18db73f1c3812bc63e776af99ee061190ff6262 Author: Juri Linkov Date: Fri Sep 24 09:44:47 2021 +0300 * lisp/gnus/mm-uu.el (mm-uu-type-alist): Add markdown-diff/-emacs-sources (Bug#50763) diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el index 494221adee..a52613a092 100644 --- a/lisp/gnus/mm-uu.el +++ b/lisp/gnus/mm-uu.el @@ -145,6 +145,14 @@ This can be either \"inline\" or \"attachment\".") ,#'mm-uu-pgp-key-extract ,#'mm-uu-gpg-key-skip-to-last nil) + (markdown-emacs-sources + "^```\\(?:elisp\\|emacs-lisp\\|\n(\\)" + "^```$" + ,#'mm-uu-emacs-sources-extract) + (markdown-diff ;; this should be higher than `git-format-patch' + "^```\\(?:diff\\|patch\\|\ndiff --git \\)" + "^```$" + ,#'mm-uu-diff-extract) (emacs-sources "^;;;?[ \t]*[^ \t]+\\.el[ \t]*--" "^;;;?[ \t]*\\([^ \t]+\\.el\\)[ \t]+ends here" commit 2abf143f8185fced544c4f8d144ea710142d7a59 Author: Juri Linkov Date: Fri Sep 24 09:29:52 2021 +0300 New thing-at-point target 'string' used in context-menu-region * lisp/mouse.el (context-menu-region): Use separate "List" and "String". * lisp/thingatpt.el (string): New target 'string'. (thing-at-point-bounds-of-string-at-point): New function. (thing-at-point-bounds-of-list-at-point): Revert previous commit by removing optional args 'escape-strings' and 'no-syntax-crossing'. (list-or-string): Remove recently added target 'list-or-string'. (thing-at-point-bounds-of-list-or-string-at-point): Remove function. https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg01737.html diff --git a/etc/NEWS b/etc/NEWS index b0e2d2c060..02cbaa51ed 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2593,11 +2593,8 @@ This new command (bound to 'C-c C-l') regenerates the current hunk. This is like 'filename', but is a full path, and is nil if the file doesn't exist. -*** New 'thing-at-point' target: 'list-or-string'. -This is like 'list, but if point is inside a string that's enclosed in -the list, it returns the enclosed string and not the enclosing list. - -This is like 'list', but also prefers to find of any enclosing string. +*** New 'thing-at-point' target: 'string'. +If point is inside a string, it returns the enclosed string. +++ *** New variable 'thing-at-point-provider-alist'. diff --git a/lisp/mouse.el b/lisp/mouse.el index 8ad3f7664a..9f1417f420 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -482,12 +482,17 @@ Some context functions add menu items below the separator." `(menu-item "Defun" ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'defun)) :help "Mark the defun at click for a subsequent cut/copy")) - (define-key-after submenu [mark-list-or-string] - `(menu-item ,(if (nth 8 (save-excursion - (syntax-ppss (posn-point (event-end click))))) - "String" "List") - ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'list-or-string)) - :help "Mark list or string at click for a subsequent cut/copy")) + (define-key-after submenu [mark-list] + `(menu-item "List" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'list)) + :help "Mark the list at click for a subsequent cut/copy")) + (when (let ((pos (posn-point (event-end click)))) + (or (eq (char-syntax (char-after pos)) ?\") + (nth 3 (save-excursion (syntax-ppss pos))))) + (define-key-after submenu [mark-string] + `(menu-item "String" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'string)) + :help "Mark the string at click for a subsequent cut/copy"))) (define-key-after submenu [mark-line] `(menu-item "Line" ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'line)) diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index efe33982c3..32e66184d7 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -231,7 +231,27 @@ The bounds of THING are determined by `bounds-of-thing-at-point'." (put 'line 'beginning-op (lambda () (if (bolp) (forward-line -1) (beginning-of-line)))) -;; Sexps +;; Strings + +(put 'string 'bounds-of-thing-at-point 'thing-at-point-bounds-of-string-at-point) + +(defun thing-at-point-bounds-of-string-at-point () + "Return the bounds of the string at point. +Prefer the enclosing string with fallback on sexp at point. +\[Internal function used by `bounds-of-thing-at-point'.]" + (save-excursion + (let ((ppss (syntax-ppss))) + (if (nth 3 ppss) + ;; Inside the string + (ignore-errors + (goto-char (nth 8 ppss)) + (cons (point) (progn (forward-sexp) (point)))) + ;; At the beginning of the string + (if (eq (char-syntax (char-after)) ?\") + (let ((bound (bounds-of-thing-at-point 'sexp))) + (and bound + (<= (car bound) (point)) (< (point) (cdr bound)) + bound))))))) (defun in-string-p () "Return non-nil if point is in a string." @@ -241,6 +261,8 @@ The bounds of THING are determined by `bounds-of-thing-at-point'." (beginning-of-defun) (nth 3 (parse-partial-sexp (point) orig))))) +;; Sexps + (defun thing-at-point--end-of-sexp () "Move point to the end of the current sexp." (let ((char-syntax (syntax-after (point)))) @@ -284,29 +306,18 @@ The bounds of THING are determined by `bounds-of-thing-at-point'." (put 'list 'bounds-of-thing-at-point 'thing-at-point-bounds-of-list-at-point) -(defun thing-at-point-bounds-of-list-at-point (&optional escape-strings no-syntax-crossing) +(defun thing-at-point-bounds-of-list-at-point () "Return the bounds of the list at point. Prefer the enclosing list with fallback on sexp at point. \[Internal function used by `bounds-of-thing-at-point'.]" (save-excursion - (if (ignore-errors (up-list -1 escape-strings no-syntax-crossing)) + (if (ignore-errors (up-list -1)) (ignore-errors (cons (point) (progn (forward-sexp) (point)))) (let ((bound (bounds-of-thing-at-point 'sexp))) (and bound (<= (car bound) (point)) (< (point) (cdr bound)) bound))))) -(put 'list-or-string 'bounds-of-thing-at-point - 'thing-at-point-bounds-of-list-or-string-at-point) - -(defun thing-at-point-bounds-of-list-or-string-at-point () - "Return the bounds of the list or string at point. -Like `thing-at-point-bounds-of-list-at-point', but if -point is inside a string that's enclosed in the list, this -function will return the enclosed string and not the -enclosing list." - (thing-at-point-bounds-of-list-at-point t t)) - ;; Defuns (put 'defun 'beginning-op 'beginning-of-defun) commit 4c891b2a05748c7a16ac6ac94f01e017187c4949 Author: Basil L. Contovounesios Date: Fri Sep 24 00:30:06 2021 +0100 Pacify recent warnings in ansi-color-tests.el * test/lisp/ansi-color-tests.el: Remove invalid package keyword 'ansi', and unused dependency on cl-lib. (yellow, bright-yellow): Replace prefix-less dynvars with corresponding local lexvars. (test-strings): Rename prefix-less dynvar... (ansi-color-tests--strings): ...to this. All users updated. (ansi-color-apply-on-region-test) (ansi-color-apply-on-region-bold-is-bright-test): Simplify. (ansi-color-apply-on-region-preserving-test): Reindent. diff --git a/test/lisp/ansi-color-tests.el b/test/lisp/ansi-color-tests.el index df674dfc7f..953fdff893 100644 --- a/test/lisp/ansi-color-tests.el +++ b/test/lisp/ansi-color-tests.el @@ -3,7 +3,6 @@ ;; Copyright (C) 2020-2021 Free Software Foundation, Inc. ;; Author: Pablo Barbáchano -;; Keywords: ansi ;; This file is part of GNU Emacs. @@ -25,49 +24,48 @@ ;;; Code: (require 'ansi-color) -(eval-when-compile (require 'cl-lib)) -(defvar yellow (face-foreground 'ansi-color-yellow nil 'default)) -(defvar bright-yellow (face-foreground 'ansi-color-bright-yellow nil 'default)) - -(defvar test-strings - `(("Hello World" "Hello World") - ("\e[33mHello World\e[0m" "Hello World" - (:foreground ,yellow)) - ("\e[43mHello World\e[0m" "Hello World" - (:background ,yellow)) - ("\e[93mHello World\e[0m" "Hello World" - (:foreground ,bright-yellow)) - ("\e[103mHello World\e[0m" "Hello World" - (:background ,bright-yellow)) - ("\e[1;33mHello World\e[0m" "Hello World" - (ansi-color-bold (:foreground ,yellow)) - (ansi-color-bold (:foreground ,bright-yellow))) - ("\e[33;1mHello World\e[0m" "Hello World" - (ansi-color-bold (:foreground ,yellow)) - (ansi-color-bold (:foreground ,bright-yellow))) - ("\e[1m\e[33mHello World\e[0m" "Hello World" - (ansi-color-bold (:foreground ,yellow)) - (ansi-color-bold (:foreground ,bright-yellow))) - ("\e[33m\e[1mHello World\e[0m" "Hello World" - (ansi-color-bold (:foreground ,yellow)) - (ansi-color-bold (:foreground ,bright-yellow))) - ("\e[1m\e[3m\e[5mbold italics blink\e[0m" "bold italics blink" - (ansi-color-bold ansi-color-italic ansi-color-slow-blink)) - ("\e[10munrecognized\e[0m" "unrecognized"))) +(defvar ansi-color-tests--strings + (let ((bright-yellow (face-foreground 'ansi-color-bright-yellow nil 'default)) + (yellow (face-foreground 'ansi-color-yellow nil 'default))) + `(("Hello World" "Hello World") + ("\e[33mHello World\e[0m" "Hello World" + (:foreground ,yellow)) + ("\e[43mHello World\e[0m" "Hello World" + (:background ,yellow)) + ("\e[93mHello World\e[0m" "Hello World" + (:foreground ,bright-yellow)) + ("\e[103mHello World\e[0m" "Hello World" + (:background ,bright-yellow)) + ("\e[1;33mHello World\e[0m" "Hello World" + (ansi-color-bold (:foreground ,yellow)) + (ansi-color-bold (:foreground ,bright-yellow))) + ("\e[33;1mHello World\e[0m" "Hello World" + (ansi-color-bold (:foreground ,yellow)) + (ansi-color-bold (:foreground ,bright-yellow))) + ("\e[1m\e[33mHello World\e[0m" "Hello World" + (ansi-color-bold (:foreground ,yellow)) + (ansi-color-bold (:foreground ,bright-yellow))) + ("\e[33m\e[1mHello World\e[0m" "Hello World" + (ansi-color-bold (:foreground ,yellow)) + (ansi-color-bold (:foreground ,bright-yellow))) + ("\e[1m\e[3m\e[5mbold italics blink\e[0m" "bold italics blink" + (ansi-color-bold ansi-color-italic ansi-color-slow-blink)) + ("\e[10munrecognized\e[0m" "unrecognized")))) (ert-deftest ansi-color-apply-on-region-test () - (pcase-dolist (`(,input ,text ,face) test-strings) + (pcase-dolist (`(,input ,text ,face) ansi-color-tests--strings) (with-temp-buffer (insert input) (ansi-color-apply-on-region (point-min) (point-max)) (should (equal (buffer-string) text)) (should (equal (get-char-property (point-min) 'face) face)) (when face - (should (not (equal (overlays-at (point-min)) nil))))))) + (should (overlays-at (point-min))))))) (ert-deftest ansi-color-apply-on-region-bold-is-bright-test () - (pcase-dolist (`(,input ,text ,normal-face ,bright-face) test-strings) + (pcase-dolist (`(,input ,text ,normal-face ,bright-face) + ansi-color-tests--strings) (with-temp-buffer (let ((ansi-color-bold-is-bright t) (face (or bright-face normal-face))) @@ -76,14 +74,14 @@ (should (equal (buffer-string) text)) (should (equal (get-char-property (point-min) 'face) face)) (when face - (should (not (equal (overlays-at (point-min)) nil)))))))) + (should (overlays-at (point-min)))))))) (ert-deftest ansi-color-apply-on-region-preserving-test () - (dolist (pair test-strings) - (with-temp-buffer - (insert (car pair)) - (ansi-color-apply-on-region (point-min) (point-max) t) - (should (equal (buffer-string) (car pair)))))) + (dolist (pair ansi-color-tests--strings) + (with-temp-buffer + (insert (car pair)) + (ansi-color-apply-on-region (point-min) (point-max) t) + (should (equal (buffer-string) (car pair)))))) (provide 'ansi-color-tests) commit 6ff8c47cf02573fe05127e03dfae44fe2eb69db8 Author: Lars Ingebrigtsen Date: Thu Sep 23 23:38:21 2021 +0200 Add `info-lookup-symbol' to the menu * lisp/menu-bar.el (menu-bar-search-documentation-menu): Add entry for `info-lookup-symbol' (bug#50759). diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index e84eec5002..ede8186782 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1960,6 +1960,9 @@ key, a click, or a menu-item")) :help "Find commands whose names match a regexp")) (bindings--define-key menu [sep1] menu-bar-separator) + (bindings--define-key menu [lookup-symbol-in-manual] + '(menu-item "Look Up Symbol in Manual..." info-lookup-symbol + :help "Display manual section that describes a symbol")) (bindings--define-key menu [lookup-command-in-manual] '(menu-item "Look Up Command in User Manual..." Info-goto-emacs-command-node :help "Display manual section that describes a command")) commit 794c5a0ba773508cd643e577b6718ec5271c7e55 Author: Lars Ingebrigtsen Date: Thu Sep 23 23:33:36 2021 +0200 Add s Symbol entry in the glossary * doc/emacs/glossary.texi (Glossary): Add an entry for Symbol (bug#50760). diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi index 4f971eb1e0..f7137284d2 100644 --- a/doc/emacs/glossary.texi +++ b/doc/emacs/glossary.texi @@ -1334,6 +1334,12 @@ allowed as well. @item String Substitution @xref{Glossary---Global Substitution}. +@item Symbol +A symbol in Emacs Lisp is an object with a name. The +symbol name serves as the printed representation of the symbol. +@xref{Symbol Type,, Symbol Type, elisp, The Emacs Lisp Reference +Manual}. + @item Syntax Highlighting @xref{Glossary---Font Lock}. commit 150fc9c8458281fd281da37728515afb4640a650 Author: Konstantin Kharlamov Date: Thu Sep 23 23:25:41 2021 +0200 Do not count git markers as "deleted lines" * lisp/vc/diff-mode.el (diff-fixup-modifs): Skip "end of patch" markers that `git-format-patch` leaves around (bug#50761). diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 0852f8790e..057ffcd06e 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -1355,7 +1355,11 @@ else cover the whole buffer." (pcase (char-after) (?\s (cl-incf space)) (?+ (cl-incf plus)) - (?- (cl-incf minus)) + (?- (unless ;; In git format-patch "^-- $" signifies + ;; the end of the patch. + (and (eq diff-buffer-type 'git) + (looking-at "^-- $")) + (cl-incf minus))) (?! (cl-incf bang)) ((or ?\\ ?#) nil) (?\n (if diff-valid-unified-empty-line commit 66d15137629a5224e16a0269e0e3181500962de2 Author: Miha Rihtaršič Date: Thu Sep 23 23:18:40 2021 +0200 Fix problems with 'C-c C-n' in sh-script-mode * lisp/progmodes/sh-script.el (sh-shell-process): If a *shell* buffer doesn't exist, 'C-c C-n' creates one and displays it. This patch prevents it from being displayed in the selected window. Additionally, it ensures that the local `sh-shell-process' variable is set in the correct buffer (bug#50765). diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index cccd70f06c..3b6774aa14 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1396,8 +1396,15 @@ If FORCE is non-nil and no process found, create one." (or found (and force (get-buffer-process - (let ((explicit-shell-file-name sh-shell-file)) - (shell))))))))) + (let ((explicit-shell-file-name sh-shell-file) + (display-buffer-overriding-action + '(nil . ((inhibit-same-window . t))))) + ;; We must prevent this `(shell)' call from + ;; switching buffers, so that the variable + ;; `sh-shell-process' is set locally in the + ;; correct buffer. + (save-current-buffer + (shell)))))))))) (defun sh-show-shell () "Pop the shell interaction buffer." commit b12b278c2aeda4fd0d9984d319ead609117f14f4 Author: Stefan Kangas Date: Thu Sep 23 22:58:12 2021 +0200 checkdoc: Add abbreviation and simplify * lisp/emacs-lisp/checkdoc.el (checkdoc-in-abbreviation-p): Add abbreviation "a.k.a.". Simplify. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 4243e82800..cae65eba8e 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -2113,11 +2113,12 @@ Examples of abbreviations handled: \"e.g.\", \"i.e.\", \"cf.\"." (rx letter ".") (rx (or ;; The abbreviations: - (seq (or (seq (any "cC") "f") ; cf. - (seq (any "eE") ".g") ; e.g. - (seq (any "iI") "." (any "eE")))) ; i.e. - "etc" ; etc. - "vs" ; vs. + (seq (any "cC") "f") ; cf. + (seq (any "eE") ".g") ; e.g. + (seq (any "iI") "." (any "eE")) ; i.e. + "a.k.a" ; a.k.a. + "etc" ; etc. + "vs" ; vs. ;; Some non-standard or less common ones that we ;; might as well ignore. "Inc" "Univ" "misc" "resp") commit cee5bda68dccfc2cdefba1e2604011a3aaf7881a Author: Lars Ingebrigtsen Date: Thu Sep 23 22:57:49 2021 +0200 Fix typo in previous man.el change * lisp/man.el (Man-ansi-color-map): Fix typo in last checkin. diff --git a/lisp/man.el b/lisp/man.el index 84287c9f9d..4ef2deac4f 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -147,7 +147,7 @@ the manpage buffer." (defvar Man-ansi-color-map (with-no-warnings - (let ((ansi-color-faces-vector Man-ansi-color-basic-faces-vector)) + (let ((ansi-color-faces-vector [ default Man-overstrike default Man-underline Man-underline default default Man-reverse ])) (ansi-color-make-color-map))) commit d4a6e42e92ee215659d09b0456032714aab73ca5 Author: Jim Porter Date: Wed Sep 22 18:39:52 2021 -0700 Add support for "bright" ANSI colors in term-mode * list/term.el (ansi-term-color-vector): Add new faces. (term-color-black, term-color-red, term-color-green, term-color-yellow) (term-color-blue, term-color-magenta, term-color-cyan, term-color-white): Inherit from 'ansi-color-COLOR'. (term-color-bright-black, term-color-bright-red, term-color-bright-green) (term-color-bright-yellow, term-color-bright-blue) (term-color-bright-magenta, term-color-bright-cyan) (term-color-bright-white): New faces. (term--maybe-brighten-color): New function. (term-handle-colors-array): Handle bright colors. * test/lisp/term-tests.el (term-colors, term-colors-bold-is-bright): New functions. diff --git a/etc/NEWS b/etc/NEWS index 99da578308..b0e2d2c060 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1509,6 +1509,13 @@ based on the current window size. In previous versions of Emacs, this was always done (and that could lead to odd displays when resizing the window after starting). This variable defaults to nil. +--- +*** 'term-mode' now supports "bright" color codes. +"Bright" ANSI color codes are now displayed using the color values +defined in 'term-color-bright-*'. In addition, bold text with regular +ANSI colors can be displayed as "bright" if 'ansi-color-bold-is-bright' +is non-nil. + ** Eshell --- diff --git a/lisp/term.el b/lisp/term.el index af93089104..e76eb77647 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -727,7 +727,15 @@ Buffer local variable.") term-color-blue term-color-magenta term-color-cyan - term-color-white]) + term-color-white + term-color-bright-black + term-color-bright-red + term-color-bright-green + term-color-bright-yellow + term-color-bright-blue + term-color-bright-magenta + term-color-bright-cyan + term-color-bright-white]) (defcustom term-default-fg-color nil "If non-nil, default color for foreground in Term mode." @@ -752,54 +760,112 @@ Buffer local variable.") :group 'term) (defface term-bold - '((t :bold t)) + '((t :inherit ansi-color-bold)) "Default face to use for bold text." - :group 'term) + :group 'term + :version "28.1") (defface term-underline - '((t :underline t)) + '((t :inherit ansi-color-underline)) "Default face to use for underlined text." - :group 'term) + :group 'term + :version "28.1") (defface term-color-black - '((t :foreground "black" :background "black")) + '((t :inherit ansi-color-black)) "Face used to render black color code." - :group 'term) + :group 'term + :version "28.1") (defface term-color-red - '((t :foreground "red3" :background "red3")) + '((t :inherit ansi-color-red)) "Face used to render red color code." - :group 'term) + :group 'term + :version "28.1") (defface term-color-green - '((t :foreground "green3" :background "green3")) + '((t :inherit ansi-color-green)) "Face used to render green color code." - :group 'term) + :group 'term + :version "28.1") (defface term-color-yellow - '((t :foreground "yellow3" :background "yellow3")) + '((t :inherit ansi-color-yellow)) "Face used to render yellow color code." - :group 'term) + :group 'term + :version "28.1") (defface term-color-blue - '((t :foreground "blue2" :background "blue2")) + '((t :inherit ansi-color-blue)) "Face used to render blue color code." - :group 'term) + :group 'term + :version "28.1") (defface term-color-magenta - '((t :foreground "magenta3" :background "magenta3")) + '((t :inherit ansi-color-magenta)) "Face used to render magenta color code." - :group 'term) + :group 'term + :version "28.1") (defface term-color-cyan - '((t :foreground "cyan3" :background "cyan3")) + '((t :inherit ansi-color-cyan)) "Face used to render cyan color code." - :group 'term) + :group 'term + :version "28.1") (defface term-color-white - '((t :foreground "white" :background "white")) + '((t :inherit ansi-color-white)) "Face used to render white color code." - :group 'term) + :group 'term + :version "28.1") + +(defface term-color-bright-black + '((t :inherit ansi-color-bright-black)) + "Face used to render bright black color code." + :group 'term + :version "28.1") + +(defface term-color-bright-red + '((t :inherit ansi-color-bright-red)) + "Face used to render bright red color code." + :group 'term + :version "28.1") + +(defface term-color-bright-green + '((t :inherit ansi-color-bright-green)) + "Face used to render bright green color code." + :group 'term + :version "28.1") + +(defface term-color-bright-yellow + '((t :inherit ansi-color-bright-yellow)) + "Face used to render bright yellow color code." + :group 'term + :version "28.1") + +(defface term-color-bright-blue + '((t :inherit ansi-color-bright-blue)) + "Face used to render bright blue color code." + :group 'term + :version "28.1") + +(defface term-color-bright-magenta + '((t :inherit ansi-color-bright-magenta)) + "Face used to render bright magenta color code." + :group 'term + :version "28.1") + +(defface term-color-bright-cyan + '((t :inherit ansi-color-bright-cyan)) + "Face used to render bright cyan color code." + :group 'term + :version "28.1") + +(defface term-color-bright-white + '((t :inherit ansi-color-bright-white)) + "Face used to render bright white color code." + :group 'term + :version "28.1") (defcustom term-buffer-maximum-size 8192 "The maximum size in lines for term buffers. @@ -3223,6 +3289,15 @@ option is enabled. See `term-set-goto-process-mark'." ;; FIXME: No idea why this is here, it looks wrong. --Stef (setq term-ansi-face-already-done nil)) +(defun term--maybe-brighten-color (color bold) + "Possibly convert COLOR to its bright variant. +COLOR is an index into `ansi-term-color-vector'. If BOLD and +`ansi-color-bold-is-bright' are non-nil and COLOR is a regular color, +return the bright version of COLOR; otherwise, return COLOR." + (if (and ansi-color-bold-is-bright bold (<= 1 color 8)) + (+ color 8) + color)) + ;; New function to deal with ansi colorized output, as you can see you can ;; have any bold/underline/fg/bg/reverse combination. -mm @@ -3262,6 +3337,10 @@ option is enabled. See `term-set-goto-process-mark'." ((and (>= parameter 30) (<= parameter 37)) (setq term-ansi-current-color (- parameter 29))) + ;; Bright foreground + ((and (>= parameter 90) (<= parameter 97)) + (setq term-ansi-current-color (- parameter 81))) + ;; Reset foreground ((eq parameter 39) (setq term-ansi-current-color 0)) @@ -3270,6 +3349,10 @@ option is enabled. See `term-set-goto-process-mark'." ((and (>= parameter 40) (<= parameter 47)) (setq term-ansi-current-bg-color (- parameter 39))) + ;; Bright foreground + ((and (>= parameter 100) (<= parameter 107)) + (setq term-ansi-current-bg-color (- parameter 91))) + ;; Reset background ((eq parameter 49) (setq term-ansi-current-bg-color 0)) @@ -3288,37 +3371,43 @@ option is enabled. See `term-set-goto-process-mark'." ;; term-ansi-current-bg-color) (unless term-ansi-face-already-done - (if term-ansi-current-invisible - (let ((color - (if term-ansi-current-reverse - (face-foreground - (elt ansi-term-color-vector term-ansi-current-color) - nil 'default) - (face-background - (elt ansi-term-color-vector term-ansi-current-bg-color) - nil 'default)))) - (setq term-current-face - (list :background color - :foreground color)) - ) ;; No need to bother with anything else if it's invisible. - (setq term-current-face - (list :foreground - (face-foreground - (elt ansi-term-color-vector term-ansi-current-color) - nil 'default) - :background - (face-background - (elt ansi-term-color-vector term-ansi-current-bg-color) - nil 'default) - :inverse-video term-ansi-current-reverse)) - - (when term-ansi-current-bold + (let ((current-color (term--maybe-brighten-color + term-ansi-current-color + term-ansi-current-bold)) + (current-bg-color (term--maybe-brighten-color + term-ansi-current-bg-color + term-ansi-current-bold))) + (if term-ansi-current-invisible + (let ((color + (if term-ansi-current-reverse + (face-foreground + (elt ansi-term-color-vector current-color) + nil 'default) + (face-background + (elt ansi-term-color-vector current-bg-color) + nil 'default)))) + (setq term-current-face + (list :background color + :foreground color)) + ) ;; No need to bother with anything else if it's invisible. (setq term-current-face - `(,term-current-face :inherit term-bold))) + (list :foreground + (face-foreground + (elt ansi-term-color-vector current-color) + nil 'default) + :background + (face-background + (elt ansi-term-color-vector current-bg-color) + nil 'default) + :inverse-video term-ansi-current-reverse)) + + (when term-ansi-current-bold + (setq term-current-face + `(,term-current-face :inherit term-bold))) - (when term-ansi-current-underline - (setq term-current-face - `(,term-current-face :inherit term-underline))))) + (when term-ansi-current-underline + (setq term-current-face + `(,term-current-face :inherit term-underline)))))) ;; (message "Debug %S" term-current-face) ;; FIXME: shouldn't we set term-ansi-face-already-done to t here? --Stef diff --git a/test/lisp/term-tests.el b/test/lisp/term-tests.el index 50ac370b5b..96b6d73488 100644 --- a/test/lisp/term-tests.el +++ b/test/lisp/term-tests.el @@ -28,6 +28,51 @@ (defvar term-height) ; Number of lines in window. (defvar term-width) ; Number of columns in window. +(defvar yellow-fg-props + `( :foreground ,(face-foreground 'term-color-yellow nil 'default) + :background "unspecified-bg" :inverse-video nil)) +(defvar yellow-bg-props + `( :foreground "unspecified-fg" + :background ,(face-background 'term-color-yellow nil 'default) + :inverse-video nil)) +(defvar bright-yellow-fg-props + `( :foreground ,(face-foreground 'term-color-bright-yellow nil 'default) + :background "unspecified-bg" :inverse-video nil)) +(defvar bright-yellow-bg-props + `( :foreground "unspecified-fg" + :background ,(face-background 'term-color-bright-yellow nil 'default) + :inverse-video nil)) + +(defvar ansi-test-strings + `(("\e[33mHello World\e[0m" + ,(propertize "Hello World" 'font-lock-face yellow-fg-props)) + ("\e[43mHello World\e[0m" + ,(propertize "Hello World" 'font-lock-face yellow-bg-props)) + ("\e[93mHello World\e[0m" + ,(propertize "Hello World" 'font-lock-face bright-yellow-fg-props)) + ("\e[103mHello World\e[0m" + ,(propertize "Hello World" 'font-lock-face bright-yellow-bg-props)) + ("\e[1;33mHello World\e[0m" + ,(propertize "Hello World" 'font-lock-face + `(,yellow-fg-props :inherit term-bold)) + ,(propertize "Hello World" 'font-lock-face + `(,bright-yellow-fg-props :inherit term-bold))) + ("\e[33;1mHello World\e[0m" + ,(propertize "Hello World" 'font-lock-face + `(,yellow-fg-props :inherit term-bold)) + ,(propertize "Hello World" 'font-lock-face + `(,bright-yellow-fg-props :inherit term-bold))) + ("\e[1m\e[33mHello World\e[0m" + ,(propertize "Hello World" 'font-lock-face + `(,yellow-fg-props :inherit term-bold)) + ,(propertize "Hello World" 'font-lock-face + `(,bright-yellow-fg-props :inherit term-bold))) + ("\e[33m\e[1mHello World\e[0m" + ,(propertize "Hello World" 'font-lock-face + `(,yellow-fg-props :inherit term-bold)) + ,(propertize "Hello World" 'font-lock-face + `(,bright-yellow-fg-props :inherit term-bold))))) + (defun term-test-screen-from-input (width height input &optional return-var) (with-temp-buffer (term-mode) @@ -48,7 +93,7 @@ (mapc (lambda (input) (term-emulate-terminal proc input)) input) (term-emulate-terminal proc input)) (if return-var (buffer-local-value return-var (current-buffer)) - (buffer-substring-no-properties (point-min) (point-max)))))) + (buffer-substring (point-min) (point-max)))))) (ert-deftest term-simple-lines () (skip-unless (not (memq system-type '(windows-nt ms-dos)))) @@ -77,6 +122,24 @@ first line\r_next line\r\n")) (term-test-screen-from-input 40 12 (let ((str (make-string 30 ?a))) (list str str)))))) +(ert-deftest term-colors () + (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (pcase-dolist (`(,str ,expected) ansi-test-strings) + (let ((result (term-test-screen-from-input 40 12 str))) + (should (equal result expected)) + (should (equal (text-properties-at 0 result) + (text-properties-at 0 expected)))))) + +(ert-deftest term-colors-bold-is-bright () + (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (let ((ansi-color-bold-is-bright t)) + (pcase-dolist (`(,str ,expected ,bright-expected) ansi-test-strings) + (let ((expected (or bright-expected expected)) + (result (term-test-screen-from-input 40 12 str))) + (should (equal result expected)) + (should (equal (text-properties-at 0 result) + (text-properties-at 0 expected))))))) + (ert-deftest term-cursor-movement () (skip-unless (not (memq system-type '(windows-nt ms-dos)))) ;; Absolute positioning. commit ceb9da3b7125fbdf0da04a3b158ac1e792c87f4f Author: Jim Porter Date: Wed Sep 22 18:37:52 2021 -0700 Add support for "bright" ANSI colors in ansi-color * lisp/ansi-color.el (ansi-color-bold, ansi-color-faint, ansi-color-italic) (ansi-color-underline, ansi-color-slow-blink, ansi-color-fast-blink) (ansi-color-inverse, ansi-color-red, ansi-color-green, ansi-color-yellow) (ansi-color-blue, ansi-color-magenta, ansi-color-cyan, ansi-color-white) (ansi-color-bright-red, ansi-color-bright-green, ansi-color-bright-yellow) (ansi-color-bright-blue, ansi-color-bright-magenta, ansi-color-bright-cyan) (ansi-color-bright-white): New faces. (ansi-color-basic-faces-vector, ansi-color-normal-colors-vector) (ansi-color-bright-colors-vector): New constants. (ansi-color-faces-vector, ansi-color-names-vector): Make obsolete. (ansi-color-bold-is-bright): New defcustom. (ansi-color--find-face): Sort ANSI codes and check 'ansi-color-bold-is-bright'. (ansi-color-apply-sequence): Support bright ANSI colors. (ansi-color-make-color-map, ansi-color-map, ansi-color-map-update): Make obsolete. (ansi-color-get-face-1): Add BRIGHT parameter. * lisp/man.el (Man-ansi-color-basic-faces-vector): New variable. (Man-ansi-color-map): Make obsolete. (Man-fontify-manpage): Use 'Man-ansi-color-basic-faces-vector' here. * test/lisp/ansi-color-tests.el (ansi-color-apply-on-region-bold-is-bright-test): New function. diff --git a/etc/NEWS b/etc/NEWS index 1b67ef98b6..99da578308 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2721,6 +2721,21 @@ sequences. *** 'comint-delete-output' can now save deleted text in the kill-ring. Interactively, 'C-u C-c C-o' triggers this new optional behavior. +** ansi-color.el + +--- +*** Colors are now defined by faces. +ANSI SGR codes now have corresponding faces to describe their +appearance, e.g. 'ansi-color-bold'. + +--- +*** Support for "bright" color codes. +"Bright" ANSI color codes are now displayed when applying ANSI color +filters using the color values defined by the faces +'ansi-color-bright-COLOR'. In addition, bold text with regular ANSI +colors can be displayed as "bright" if 'ansi-color-bold-is-bright' is +non-nil. + ** ERC --- diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index 4315a7f3ce..b1c9cdaeca 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -90,53 +90,168 @@ as a PDF file." :version "21.1" :group 'processes) +(defface ansi-color-bold + '((t :inherit 'bold)) + "Face used to render bold text." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-faint + '((t :weight light)) + "Face used to render faint text." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-italic + '((t :inherit 'italic)) + "Face used to render italic text." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-underline + '((t :inherit 'underline)) + "Face used to render underlined text." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-slow-blink + '((t :box (:line-width -1))) + "Face used to render slowly blinking text." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-fast-blink + '((t :box (:line-width -1))) + "Face used to render rapidly blinking text." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-inverse + '((t :inverse-video t)) + "Face used to render inverted video text." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-black + '((t :foreground "black" :background "black")) + "Face used to render black color code." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-red + '((t :foreground "red3" :background "red3")) + "Face used to render red color code." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-green + '((t :foreground "green3" :background "green3")) + "Face used to render green color code." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-yellow + '((t :foreground "yellow3" :background "yellow3")) + "Face used to render yellow color code." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-blue + '((t :foreground "blue2" :background "blue2")) + "Face used to render blue color code." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-magenta + '((t :foreground "magenta3" :background "magenta3")) + "Face used to render magenta color code." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-cyan + '((t :foreground "cyan3" :background "cyan3")) + "Face used to render cyan color code." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-white + '((t :foreground "grey90" :background "gray90")) + "Face used to render white color code." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-bright-black + '((t :foreground "gray30" :background "gray30")) + "Face used to render bright black color code." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-bright-red + '((t :foreground "red2" :background "red2")) + "Face used to render bright red color code." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-bright-green + '((t :foreground "green2" :background "green2")) + "Face used to render bright green color code." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-bright-yellow + '((t :foreground "yellow2" :background "yellow2")) + "Face used to render bright yellow color code." + :group 'ansi-colors) + +(defface ansi-color-bright-blue + '((t :foreground "blue1" :background "blue1")) + "Face used to render bright blue color code." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-bright-magenta + '((t :foreground "magenta2" :background "magenta2")) + "Face used to render bright magenta color code." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-bright-cyan + '((t :foreground "cyan2" :background "cyan2")) + "Face used to render bright cyan color code." + :group 'ansi-colors + :version "28.1") + +(defface ansi-color-bright-white + '((t :foreground "white" :background "white")) + "Face used to render bright white color code." + :group 'ansi-colors + :version "28.1") + (defcustom ansi-color-faces-vector [default bold default italic underline success warning error] "Faces used for SGR control sequences determining a face. This vector holds the faces used for SGR control sequence parameters 0 to 7. -Parameter Description Face used by default - 0 default default - 1 bold bold - 2 faint default - 3 italic italic - 4 underlined underline - 5 slowly blinking success - 6 rapidly blinking warning - 7 negative image error - -Note that the symbol `default' is special: It will not be combined -with the current face. - -This vector is used by `ansi-color-make-color-map' to create a color -map. This color map is stored in the variable `ansi-color-map'." +This variable is obsolete. To customize the display of faces used by +ansi-color, change 'ansi-color-FACE', e.g. `ansi-color-bold'. To +customize the actual faces used (e.g. to temporarily display SGR +control sequences differently), use `ansi-color-basic-faces-vector'." :type '(vector face face face face face face face face) - :set 'ansi-color-map-update - :initialize 'custom-initialize-default :group 'ansi-colors) +(make-obsolete-variable 'ansi-color-faces-vector 'ansi-color-basic-faces-vector + "28.1") (defcustom ansi-color-names-vector ["black" "red3" "green3" "yellow3" "blue2" "magenta3" "cyan3" "gray90"] "Colors used for SGR control sequences determining a color. -This vector holds the colors used for SGR control sequences parameters +This vector holds the colors used for SGR control sequence parameters 30 to 37 (foreground colors) and 40 to 47 (background colors). -Parameter Color - 30 40 black - 31 41 red - 32 42 green - 33 43 yellow - 34 44 blue - 35 45 magenta - 36 46 cyan - 37 47 white - -This vector is used by `ansi-color-make-color-map' to create a color -map. This color map is stored in the variable `ansi-color-map'. - -Each element may also be a cons cell where the car and cdr specify the -foreground and background colors, respectively." +This variable is obsolete. To customize the display of colors used by +ansi-color, change 'ansi-color-COLOR', e.g. `ansi-color-red'. To +customize the actual faces used (e.g. to temporarily display SGR +control sequences differently), use `ansi-color-normal-colors-vector'." :type '(vector (choice color (cons color color)) (choice color (cons color color)) (choice color (cons color color)) @@ -145,10 +260,87 @@ foreground and background colors, respectively." (choice color (cons color color)) (choice color (cons color color)) (choice color (cons color color))) - :set 'ansi-color-map-update - :initialize 'custom-initialize-default :version "24.4" ; default colors copied from `xterm-standard-colors' :group 'ansi-colors) +(make-obsolete-variable 'ansi-color-faces-vector + 'ansi-color-normal-colors-vector "28.1") + +(defvar ansi-color-basic-faces-vector + [nil + ansi-color-bold + ansi-color-faint + ansi-color-italic + ansi-color-underline + ansi-color-slow-blink + ansi-color-fast-blink + ansi-color-inverse] + "Faces used for SGR control sequences determining a face. +This vector holds the faces used for SGR control sequence parameters 0 +to 7. + +Parameter Description + 0 default + 1 bold + 2 faint + 3 italic + 4 underlined + 5 slowly blinking + 6 rapidly blinking + 7 negative image") + +(defvar ansi-color-normal-colors-vector + [ansi-color-black + ansi-color-red + ansi-color-green + ansi-color-yellow + ansi-color-blue + ansi-color-magenta + ansi-color-cyan + ansi-color-white] + "Faces used for SGR control sequences determining a color. +This vector holds the faces used for SGR control sequence parameters +30 to 37 (foreground colors) and 40 to 47 (background colors). + +Parameter Color + 30 40 black + 31 41 red + 32 42 green + 33 43 yellow + 34 44 blue + 35 45 magenta + 36 46 cyan + 37 47 white") + +(defvar ansi-color-bright-colors-vector + [ansi-color-bright-black + ansi-color-bright-red + ansi-color-bright-green + ansi-color-bright-yellow + ansi-color-bright-blue + ansi-color-bright-magenta + ansi-color-bright-cyan + ansi-color-bright-white] + "Faces used for SGR control sequences determining a \"bright\" color. +This vector holds the faces used for SGR control sequence parameters +90 to 97 (bright foreground colors) and 100 to 107 (bright background +colors). + +Parameter Color + 90 100 bright black + 91 101 bright red + 92 102 bright green + 93 103 bright yellow + 94 104 bright blue + 95 105 bright magenta + 96 106 bright cyan + 97 107 bright white") + +(defcustom ansi-color-bold-is-bright nil + "If set to non-nil, combining ANSI bold and a color produces the bright +version of that color." + :type 'boolean + :version "28.1" + :group 'ansi-colors) (defconst ansi-color-control-seq-regexp ;; See ECMA 48, section 5.4 "Control Sequences". @@ -304,13 +496,15 @@ This function can be added to `comint-preoutput-filter-functions'." (defun ansi-color--find-face (codes) "Return the face corresponding to CODES." - (let (faces) + ;; Sort the codes in ascending order to guarantee that "bold" comes before + ;; any of the colors. This ensures that `ansi-color-bold-is-bright' is + ;; applied correctly. + (let (faces bright (codes (sort (copy-sequence codes) #'<))) (while codes - (let ((face (ansi-color-get-face-1 (pop codes)))) - ;; In the (default underline) face, say, the value of the - ;; "underline" attribute of the `default' face wins. - (unless (eq face 'default) - (push face faces)))) + (when-let ((face (ansi-color-get-face-1 (pop codes) bright))) + (when (and ansi-color-bold-is-bright (eq face 'ansi-color-bold)) + (setq bright t)) + (push face faces))) ;; Avoid some long-lived conses in the common case. (if (cdr faces) (nreverse faces) @@ -321,9 +515,8 @@ This function can be added to `comint-preoutput-filter-functions'." Delete all other control sequences without processing them. Applies SGR control sequences setting foreground and background colors -to STRING using text properties and returns the result. The colors used -are given in `ansi-color-faces-vector' and `ansi-color-names-vector'. -See function `ansi-color-apply-sequence' for details. +to STRING using text properties and returns the result. See function +`ansi-color-apply-sequence' for details. Every call to this function will set and use the buffer-local variable `ansi-color-context' to save partial escape sequences and current ansi codes. @@ -402,8 +595,7 @@ Delete all other control sequences without processing them. SGR control sequences are applied by calling the function specified by `ansi-color-apply-face-function'. The default function sets foreground and background colors to the text -between BEGIN and END, using overlays. The colors used are given -in `ansi-color-faces-vector' and `ansi-color-names-vector'. See +between BEGIN and END, using overlays. See function `ansi-color-apply-sequence' for details. Every call to this function will set and use the buffer-local @@ -570,11 +762,11 @@ ESCAPE-SEQUENCE is an escape sequence parsed by For each new code, the following happens: if it is 1-7, add it to the list of codes; if it is 21-25 or 27, delete appropriate -parameters from the list of codes; if it is 30-37 resp. 39, the -foreground color code is replaced or added resp. deleted; if it -is 40-47 resp. 49, the background color code is replaced or added -resp. deleted; any other code is discarded together with the old -codes. Finally, the so changed list of codes is returned." +parameters from the list of codes; if it is 30-37 (or 90-97) resp. 39, +the foreground color code is replaced or added resp. deleted; if it +is 40-47 (or 100-107) resp. 49, the background color code is replaced +or added resp. deleted; any other code is discarded together with the +old codes. Finally, the so changed list of codes is returned." (let ((new-codes (ansi-color-parse-sequence escape-sequence))) (while new-codes (let* ((new (pop new-codes)) @@ -591,7 +783,7 @@ codes. Finally, the so changed list of codes is returned." (22 (remq 1 codes)) (25 (remq 6 codes)) (_ codes))))) - ((or 3 4) (let ((r (mod new 10))) + ((or 3 4 9 10) (let ((r (mod new 10))) (unless (= r 8) (let (beg) (while (and codes (/= q (/ (car codes) 10))) @@ -610,7 +802,9 @@ The index into the vector is an ANSI code. See the documentation of `ansi-color-map' for an example. The face definitions are based upon the variables -`ansi-color-faces-vector' and `ansi-color-names-vector'." +`ansi-color-faces-vector' and `ansi-color-names-vector'. + +This function is obsolete, and no longer needed to use ansi-color." (let ((map (make-vector 50 nil)) (index 0)) ;; miscellaneous attributes @@ -638,34 +832,57 @@ The face definitions are based upon the variables (setq index (1+ index)) ) ansi-color-names-vector) map)) +(make-obsolete 'ansi-color-make-color-map "you can remove it." "28.1") -(defvar ansi-color-map (ansi-color-make-color-map) - "A brand new color map suitable for `ansi-color-get-face'. +(defvar ansi-color-map + (with-no-warnings (ansi-color-make-color-map)) + "A brand new color map, formerly suitable for `ansi-color-get-face'. The value of this variable is usually constructed by `ansi-color-make-color-map'. The values in the array are such that the numbers included in an SGR control sequences point to the correct foreground or background colors. -Example: The sequence \\033[34m specifies a blue foreground. Therefore: - (aref ansi-color-map 34) - => (foreground-color . \"blue\")") +This variable is obsolete, and no longer needed to use ansi-color.") +(make-obsolete-variable 'ansi-color-map "you can remove it." "28.1") (defun ansi-color-map-update (symbol value) "Update `ansi-color-map'. -Whenever the vectors used to construct `ansi-color-map' are changed, -this function is called. Therefore this function is listed as the :set -property of `ansi-color-faces-vector' and `ansi-color-names-vector'." +This function is obsolete, and no longer needed to use ansi-color." (set-default symbol value) - (setq ansi-color-map (ansi-color-make-color-map))) - -(defun ansi-color-get-face-1 (ansi-code) - "Get face definition from `ansi-color-map'. -ANSI-CODE is used as an index into the vector." - (condition-case nil - (aref ansi-color-map ansi-code) - (args-out-of-range nil))) + (with-no-warnings + (setq ansi-color-map (ansi-color-make-color-map)))) +(make-obsolete 'ansi-color-map-update "you can remove it." "28.1") + +(defun ansi-color-get-face-1 (ansi-code &optional bright) + "Get face definition for ANSI-CODE. +BRIGHT, if non-nil, requests \"bright\" ANSI colors, even if ANSI-CODE +is a normal-intensity color." + (when (and bright (<= 30 ansi-code 49)) + (setq ansi-code (+ ansi-code 60))) + (cond ((<= 0 ansi-code 7) + (aref ansi-color-basic-faces-vector ansi-code)) + ((<= 30 ansi-code 38) + (list :foreground + (face-foreground + (aref ansi-color-normal-colors-vector (- ansi-code 30)) + nil 'default))) + ((<= 40 ansi-code 48) + (list :background + (face-background + (aref ansi-color-normal-colors-vector (- ansi-code 40)) + nil 'default))) + ((<= 90 ansi-code 98) + (list :foreground + (face-foreground + (aref ansi-color-bright-colors-vector (- ansi-code 90)) + nil 'default))) + ((<= 100 ansi-code 108) + (list :background + (face-background + (aref ansi-color-bright-colors-vector (- ansi-code 100)) + nil 'default))))) (provide 'ansi-color) diff --git a/lisp/man.el b/lisp/man.el index 6009a31919..84287c9f9d 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -141,11 +141,21 @@ the manpage buffer." :group 'man :version "24.3") -(defvar Man-ansi-color-map (let ((ansi-color-faces-vector - [ default Man-overstrike default Man-underline - Man-underline default default Man-reverse ])) - (ansi-color-make-color-map)) - "The value used here for `ansi-color-map'.") +(defvar Man-ansi-color-basic-faces-vector + [nil Man-overstrike nil Man-underline Man-underline nil nil Man-reverse] + "The value used here for `ansi-color-basic-faces-vector'.") + +(defvar Man-ansi-color-map + (with-no-warnings + (let ((ansi-color-faces-vector Man-ansi-color-basic-faces-vector)) + [ default Man-overstrike default Man-underline + Man-underline default default Man-reverse ])) + (ansi-color-make-color-map))) + "The value formerly used here for `ansi-color-map'. +This variable is obsolete. To customize the faces used by ansi-color, +set `Man-ansi-color-basic-faces-vector'.") +(make-obsolete-variable 'Man-ansi-color-map + 'Man-ansi-color-basic-faces-vector "28.1") (defcustom Man-notify-method 'friendly "Selects the behavior when manpage is ready. @@ -1243,7 +1253,7 @@ Same for the ANSI bold and normal escape sequences." (goto-char (point-min)) ;; Fontify ANSI escapes. (let ((ansi-color-apply-face-function #'ansi-color-apply-text-property-face) - (ansi-color-map Man-ansi-color-map)) + (ansi-color-basic-faces-vector Man-ansi-color-basic-faces-vector)) (ansi-color-apply-on-region (point-min) (point-max))) ;; Other highlighting. (let ((buffer-undo-list t)) diff --git a/test/lisp/ansi-color-tests.el b/test/lisp/ansi-color-tests.el index 107dc8e400..df674dfc7f 100644 --- a/test/lisp/ansi-color-tests.el +++ b/test/lisp/ansi-color-tests.el @@ -25,17 +25,58 @@ ;;; Code: (require 'ansi-color) +(eval-when-compile (require 'cl-lib)) -(defvar test-strings '(("\e[33mHello World\e[0m" . "Hello World") - ("\e[1m\e[3m\e[5mbold italics blink\e[0m" . "bold italics blink"))) +(defvar yellow (face-foreground 'ansi-color-yellow nil 'default)) +(defvar bright-yellow (face-foreground 'ansi-color-bright-yellow nil 'default)) + +(defvar test-strings + `(("Hello World" "Hello World") + ("\e[33mHello World\e[0m" "Hello World" + (:foreground ,yellow)) + ("\e[43mHello World\e[0m" "Hello World" + (:background ,yellow)) + ("\e[93mHello World\e[0m" "Hello World" + (:foreground ,bright-yellow)) + ("\e[103mHello World\e[0m" "Hello World" + (:background ,bright-yellow)) + ("\e[1;33mHello World\e[0m" "Hello World" + (ansi-color-bold (:foreground ,yellow)) + (ansi-color-bold (:foreground ,bright-yellow))) + ("\e[33;1mHello World\e[0m" "Hello World" + (ansi-color-bold (:foreground ,yellow)) + (ansi-color-bold (:foreground ,bright-yellow))) + ("\e[1m\e[33mHello World\e[0m" "Hello World" + (ansi-color-bold (:foreground ,yellow)) + (ansi-color-bold (:foreground ,bright-yellow))) + ("\e[33m\e[1mHello World\e[0m" "Hello World" + (ansi-color-bold (:foreground ,yellow)) + (ansi-color-bold (:foreground ,bright-yellow))) + ("\e[1m\e[3m\e[5mbold italics blink\e[0m" "bold italics blink" + (ansi-color-bold ansi-color-italic ansi-color-slow-blink)) + ("\e[10munrecognized\e[0m" "unrecognized"))) (ert-deftest ansi-color-apply-on-region-test () - (dolist (pair test-strings) - (with-temp-buffer - (insert (car pair)) + (pcase-dolist (`(,input ,text ,face) test-strings) + (with-temp-buffer + (insert input) + (ansi-color-apply-on-region (point-min) (point-max)) + (should (equal (buffer-string) text)) + (should (equal (get-char-property (point-min) 'face) face)) + (when face + (should (not (equal (overlays-at (point-min)) nil))))))) + +(ert-deftest ansi-color-apply-on-region-bold-is-bright-test () + (pcase-dolist (`(,input ,text ,normal-face ,bright-face) test-strings) + (with-temp-buffer + (let ((ansi-color-bold-is-bright t) + (face (or bright-face normal-face))) + (insert input) (ansi-color-apply-on-region (point-min) (point-max)) - (should (equal (buffer-string) (cdr pair))) - (should (not (equal (overlays-at (point-min)) nil)))))) + (should (equal (buffer-string) text)) + (should (equal (get-char-property (point-min) 'face) face)) + (when face + (should (not (equal (overlays-at (point-min)) nil)))))))) (ert-deftest ansi-color-apply-on-region-preserving-test () (dolist (pair test-strings) commit 55083d90a30628d9eaa5b94196291ca15098aed0 Author: Stefan Kangas Date: Thu Sep 23 21:10:08 2021 +0200 Avoid jumping too far in checkdoc-in-abbreviation-p * lisp/emacs-lisp/checkdoc.el (checkdoc-in-abbreviation-p): Use 'forward-ward' instead of 'forward-sexp' to avoid jumping too far in some situations. (Bug#50731) * test/lisp/emacs-lisp/checkdoc-tests.el (checkdoc-tests--abbrev-test): New helper function. (checkdoc-tests-in-abbrevation-p/basic-case): Rename from 'checkdoc-tests-in-abbrevation-p'. (checkdoc-tests-in-abbrevation-p/with-parens) (checkdoc-tests-in-abbrevation-p/with-escaped-parens): Use above new helper function. (checkdoc-tests-in-abbrevation-p/single-char) (checkdoc-tests-in-abbrevation-p/with-em-dash) (checkdoc-tests-in-abbrevation-p/incorrect-abbreviation): New tests. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 5224a943ac..4243e82800 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -2097,27 +2097,31 @@ Examples of abbreviations handled: \"e.g.\", \"i.e.\", \"cf.\"." (save-excursion (goto-char begin) (condition-case nil - (progn - (forward-sexp -1) + (let ((single-letter t)) + (forward-word -1) + ;; Skip over all dots backwards, as `forward-word' will only + ;; go one dot at a time in a string like "e.g.". + (while (save-excursion (forward-char -1) + (looking-at (rx "."))) + (setq single-letter nil) + (forward-word -1)) ;; Piece of an abbreviation. (looking-at - (rx (or letter ; single letter, as in "a." - (seq - ;; There might exist an escaped parenthesis, as - ;; this is often used in docstrings. In this - ;; case, `forward-sexp' will have skipped over it, - ;; so we need to skip it here too. - (? "\\(") - ;; The abbreviations: - (or (seq (any "cC") "f") ; cf. - (seq (any "eE") ".g") ; e.g. - (seq (any "iI") "." (any "eE")))) ; i.e. - "etc" ; etc. - "vs" ; vs. - ;; Some non-standard or less common ones that we - ;; might as well ignore. - "Inc" "Univ" "misc" "resp") - "."))) + (if single-letter + ;; Handle a single letter, as in "a.", as this might be + ;; a part of a list. + (rx letter ".") + (rx (or + ;; The abbreviations: + (seq (or (seq (any "cC") "f") ; cf. + (seq (any "eE") ".g") ; e.g. + (seq (any "iI") "." (any "eE")))) ; i.e. + "etc" ; etc. + "vs" ; vs. + ;; Some non-standard or less common ones that we + ;; might as well ignore. + "Inc" "Univ" "misc" "resp") + ".")))) (error t)))) (defun checkdoc-proper-noun-region-engine (begin end) diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el b/test/lisp/emacs-lisp/checkdoc-tests.el index 3eb7da3d4a..13b6d134e5 100644 --- a/test/lisp/emacs-lisp/checkdoc-tests.el +++ b/test/lisp/emacs-lisp/checkdoc-tests.el @@ -122,29 +122,31 @@ See the comments in Bug#24998." (should (looking-at-p "\"baz\")")) (should-not (checkdoc-next-docstring)))) -(ert-deftest checkdoc-tests-in-abbrevation-p () +(defun checkdoc-tests--abbrev-test (buffer-contents goto-string) (with-temp-buffer (emacs-lisp-mode) - (insert "foo bar e.g. baz") + (insert buffer-contents) (goto-char (point-min)) - (re-search-forward "e.g") - (should (checkdoc-in-abbreviation-p (point))))) + (re-search-forward goto-string) + (checkdoc-in-abbreviation-p (point)))) + +(ert-deftest checkdoc-tests-in-abbrevation-p/basic-case () + (should (checkdoc-tests--abbrev-test "foo bar e.g. baz" "e.g"))) (ert-deftest checkdoc-tests-in-abbrevation-p/with-parens () - (with-temp-buffer - (emacs-lisp-mode) - (insert "foo bar (e.g. baz)") - (goto-char (point-min)) - (re-search-forward "e.g") - (should (checkdoc-in-abbreviation-p (point))))) + (should (checkdoc-tests--abbrev-test "foo bar (e.g. baz)" "e.g"))) (ert-deftest checkdoc-tests-in-abbrevation-p/with-escaped-parens () - (with-temp-buffer - (emacs-lisp-mode) - (insert "foo\n\\(e.g. baz)") - (goto-char (point-min)) - (re-search-forward "e.g") - (should (checkdoc-in-abbreviation-p (point))))) + (should (checkdoc-tests--abbrev-test "foo\n\\(e.g. baz)" "e.g"))) + +(ert-deftest checkdoc-tests-in-abbrevation-p/single-char () + (should (checkdoc-tests--abbrev-test "a. foo bar" "a"))) + +(ert-deftest checkdoc-tests-in-abbrevation-p/with-em-dash () + (should (checkdoc-tests--abbrev-test "foo bar baz---e.g." "e.g"))) + +(ert-deftest checkdoc-tests-in-abbrevation-p/incorrect-abbreviation () + (should-not (checkdoc-tests--abbrev-test "foo bar a.b.c." "a.b.c"))) (ert-deftest checkdoc-tests-fix-y-or-n-p () (with-temp-buffer commit 387af85c4d51dd98267f296bc91cf22d7ecc5374 Author: Philip Kaludercic Date: Wed Sep 15 10:58:50 2021 +0200 Handle updates flags when setting flags * nnmaildir.el (nnmaildir--article-set-flags): Handle updated flags more gracefully diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index 171f0813b3..690761a2d6 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -194,7 +194,15 @@ This variable is set by `nnmaildir-request-article'.") (article-file (concat curdir prefix suffix)) (new-name (concat curdir prefix new-suffix))) (unless (file-exists-p article-file) - (error "Couldn't find article file %s" article-file)) + (let ((possible (file-expand-wildcards (concat curdir prefix "*")))) + (cond ((length= possible 1) + (unless (string-match-p "\\`\\(.+\\):2,.*?\\'" (car possible)) + (error "Couldn't find updated article file %s" article-file)) + (setq article-file (car possible))) + ((length> possible 1) + (error "Couldn't determine exact article file %s" article-file)) + ((null possible) + (error "Couldn't find article file %s" article-file))))) (rename-file article-file new-name 'replace) (setf (nnmaildir--art-suffix article) new-suffix))) commit e646cb4e7a46132a7717a94fe3632ecb03f080fc Author: Dmitry Gutov Date: Thu Sep 23 21:40:36 2021 +0300 A bit less overhead when converting hits * lisp/progmodes/xref.el (xref--collect-matches): Move 'remote-id' and 'syntax-needed' definitions to the caller function. Bind 'inhibit-modification-hooks' to t (bug#50733). diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 62f66b2018..fb8090cfb7 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1831,18 +1831,20 @@ Such as the current syntax table and the applied syntax properties." (defun xref--convert-hits (hits regexp) (let (xref--last-file-buffer - (tmp-buffer (generate-new-buffer " *xref-temp*"))) + (tmp-buffer (generate-new-buffer " *xref-temp*")) + (remote-id (file-remote-p default-directory)) + (syntax-needed (xref--regexp-syntax-dependent-p regexp))) (unwind-protect - (mapcan (lambda (hit) (xref--collect-matches hit regexp tmp-buffer)) + (mapcan (lambda (hit) + (xref--collect-matches hit regexp tmp-buffer remote-id syntax-needed)) hits) (kill-buffer tmp-buffer)))) -(defun xref--collect-matches (hit regexp tmp-buffer) +(defun xref--collect-matches (hit regexp tmp-buffer remote-id syntax-needed) (pcase-let* ((`(,line ,file ,text) hit) - (remote-id (file-remote-p default-directory)) (file (and file (concat remote-id file))) (buf (xref--find-file-buffer file)) - (syntax-needed (xref--regexp-syntax-dependent-p regexp))) + (inhibit-modification-hooks t)) (if buf (with-current-buffer buf (save-excursion commit 0101e86df2378cbe4eff1814fe86cd3760ca6d99 Author: Eli Zaretskii Date: Thu Sep 23 21:08:19 2021 +0300 ; Fix recently installed documentation * etc/NEWS: * lisp/thingatpt.el (thing-at-point-bounds-of-list-or-string-at-point): Clarify wording of the documentation of 'list-or-string'. diff --git a/etc/NEWS b/etc/NEWS index e9b60e9594..1b67ef98b6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2587,6 +2587,9 @@ This is like 'filename', but is a full path, and is nil if the file doesn't exist. *** New 'thing-at-point' target: 'list-or-string'. +This is like 'list, but if point is inside a string that's enclosed in +the list, it returns the enclosed string and not the enclosing list. + This is like 'list', but also prefers to find of any enclosing string. +++ diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 09a86d2243..efe33982c3 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -301,8 +301,10 @@ Prefer the enclosing list with fallback on sexp at point. (defun thing-at-point-bounds-of-list-or-string-at-point () "Return the bounds of the list or string at point. -Like `thing-at-point-bounds-of-list-at-point', but also -prefer to find of any enclosing string." +Like `thing-at-point-bounds-of-list-at-point', but if +point is inside a string that's enclosed in the list, this +function will return the enclosed string and not the +enclosing list." (thing-at-point-bounds-of-list-at-point t t)) ;; Defuns commit 90a7233199a134fcab9f89e46e1b02e74011b4da Author: Dmitry Gutov Date: Thu Sep 23 20:36:59 2021 +0300 More per-match overhead reduction * lisp/progmodes/xref.el (xref--show-common-initialize) (xref-revert-buffer): Inhibit modification hooks (bug#50733). (xref--insert-xrefs): Cosmetics (no measurable difference here). diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 88ee1d5d16..62f66b2018 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -966,20 +966,25 @@ XREF-ALIST is of the form ((GROUP . (XREF ...)) ...), where GROUP is a string for decoration purposes and XREF is an `xref-item' object." (require 'compile) ; For the compilation faces. - (cl-loop for ((group . xrefs) . more1) on xref-alist + (cl-loop for (group . xrefs) in xref-alist for max-line-width = (cl-loop for xref in xrefs maximize (let ((line (xref-location-line (oref xref location)))) - (length (and line (format "%d" line))))) + (and line (1+ (floor (log line 10)))))) for line-format = (and max-line-width (format "%%%dd: " max-line-width)) + with item-text-props = (list 'mouse-face 'highlight + 'keymap xref--button-map + 'help-echo + (concat "mouse-2: display in another window, " + "RET or mouse-1: follow reference")) with prev-group = nil with prev-line = nil do (xref--insert-propertized '(face xref-file-header xref-group t) group "\n") - (cl-loop for (xref . more2) on xrefs do + (cl-loop for xref in xrefs do (with-slots (summary location) xref (let* ((line (xref-location-line location)) (prefix @@ -995,14 +1000,9 @@ GROUP is a string for decoration purposes and XREF is an (or (null line) (not (equal prev-line line)))) (insert "\n")) - (xref--insert-propertized - (list 'xref-item xref - 'mouse-face 'highlight - 'keymap xref--button-map - 'help-echo - (concat "mouse-2: display in another window, " - "RET or mouse-1: follow reference")) - prefix summary) + (xref--insert-propertized (nconc (list 'xref-item xref) + item-text-props) + prefix summary) (setq prev-line line prev-group group)))) (insert "\n")) @@ -1084,7 +1084,8 @@ Return an alist of the form ((GROUP . (XREF ...)) ...)." (defun xref--show-common-initialize (xref-alist fetcher alist) (setq buffer-undo-list nil) (let ((inhibit-read-only t) - (buffer-undo-list t)) + (buffer-undo-list t) + (inhibit-modification-hooks t)) (erase-buffer) (setq overlay-arrow-position nil) (xref--insert-xrefs xref-alist) @@ -1098,7 +1099,8 @@ Return an alist of the form ((GROUP . (XREF ...)) ...)." "Refresh the search results in the current buffer." (interactive) (let ((inhibit-read-only t) - (buffer-undo-list t)) + (buffer-undo-list t) + (inhibit-modification-hooks t)) (save-excursion (condition-case err (let ((alist (xref--analyze (funcall xref--fetcher)))) commit d0e9b88bf744ad956c8be345789e3d8acfe69def Author: Dmitry Gutov Date: Thu Sep 23 19:08:36 2021 +0300 xref-matches-in-files: Decrease per match and per group overhead * lisp/progmodes/xref.el (xref-search-program-alist): Add '--null' argument for slightly faster parsing and probably better behavior with weirder file names. (xref--alistify): Don't accept TEST argument, use 'assoc' instead of 'cl-assoc', use a tash table during sorting (bug#50733). diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 772e6646d9..88ee1d5d16 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -307,20 +307,19 @@ recognize and then delegate the work to an external process." ;;; misc utilities -(defun xref--alistify (list key test) +(defun xref--alistify (list key) "Partition the elements of LIST into an alist. -KEY extracts the key from an element and TEST is used to compare -keys." - (let ((alist '())) +KEY extracts the key from an element." + (let ((table (make-hash-table :test #'equal))) (dolist (e list) (let* ((k (funcall key e)) - (probe (cl-assoc k alist :test test))) + (probe (gethash k table))) (if probe - (setcdr probe (cons e (cdr probe))) - (push (cons k (list e)) alist)))) + (puthash k (cons e probe) table) + (puthash k (list e) table)))) ;; Put them back in order. - (cl-loop for (key . value) in (reverse alist) - collect (cons key (reverse value))))) + (cl-loop for key being hash-keys of table using (hash-values value) + collect (cons key (nreverse value))))) (defun xref--insert-propertized (props &rest strings) "Insert STRINGS with text properties PROPS." @@ -1046,8 +1045,7 @@ Return an alist of the form ((GROUP . (XREF ...)) ...)." (let* ((alist (xref--alistify xrefs (lambda (x) - (xref-location-group (xref-item-location x))) - #'equal)) + (xref-location-group (xref-item-location x))))) (project (and (eq xref-file-name-display 'project-relative) (project-current))) @@ -1622,11 +1620,11 @@ IGNORES is a list of glob patterns for files to ignore." '((grep . ;; '-s' because 'git ls-files' can output broken symlinks. - "xargs -0 grep -snHE -e ") + "xargs -0 grep --null -snHE -e ") (ripgrep . ;; '!*/' is there to filter out dirs (e.g. submodules). - "xargs -0 rg -nH --no-messages -g '!*/' -e " + "xargs -0 rg --null -nH --no-messages -g '!*/' -e " )) "Associative list mapping program identifiers to command templates. commit c44190ca5b9873fceae8aee7034ce8e89c42d4dd Author: Philip Kaludercic Date: Thu Sep 23 18:12:41 2021 +0200 Fix string-distance for two empty strings * fns.c (Fstring_distance): Avoid using uninitialized memory. * test/src/fns-tests.el (test-string-distance): Add test cases. diff --git a/src/fns.c b/src/fns.c index 4e74589ef2..a72e41aee5 100644 --- a/src/fns.c +++ b/src/fns.c @@ -322,7 +322,7 @@ Letter-case is significant, but text properties are ignored. */) USE_SAFE_ALLOCA; ptrdiff_t *column = SAFE_ALLOCA ((len1 + 1) * sizeof (ptrdiff_t)); - for (y = 1; y <= len1; y++) + for (y = 0; y <= len1; y++) column[y] = y; if (use_byte_compare) diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 9f6593a177..bd5a4358e6 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -786,7 +786,15 @@ ;; string containing hanzi character, compare by character (should (equal 2 (string-distance "ab" "ab我她"))) (should (equal 1 (string-distance "ab" "a我b"))) - (should (equal 1 (string-distance "我" "她")))) + (should (equal 1 (string-distance "我" "她"))) + + ;; correct behaviour with empty strings + (should (equal 0 (string-distance "" ""))) + (should (equal 0 (string-distance "" "" t))) + (should (equal 1 (string-distance "x" ""))) + (should (equal 1 (string-distance "x" "" t))) + (should (equal 1 (string-distance "" "x"))) + (should (equal 1 (string-distance "" "x" t)))) (ert-deftest test-bignum-eql () "Test that `eql' works for bignums." commit 13d930deddd2e0529a0fb0f2fb93dd621d6d35be Author: Juri Linkov Date: Thu Sep 23 19:52:49 2021 +0300 * lisp/mouse.el (context-menu-region): Use save-excursion for syntax-ppss. diff --git a/lisp/mouse.el b/lisp/mouse.el index 382c101159..8ad3f7664a 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -483,7 +483,8 @@ Some context functions add menu items below the separator." ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'defun)) :help "Mark the defun at click for a subsequent cut/copy")) (define-key-after submenu [mark-list-or-string] - `(menu-item ,(if (nth 8 (syntax-ppss (posn-point (event-end click)))) + `(menu-item ,(if (nth 8 (save-excursion + (syntax-ppss (posn-point (event-end click))))) "String" "List") ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'list-or-string)) :help "Mark list or string at click for a subsequent cut/copy")) commit 5d96fad27863497a427c80550070e435a4c9e0d9 Author: Juri Linkov Date: Thu Sep 23 19:32:36 2021 +0300 New thing-at-point target 'list-or-string' used in context-menu-region * lisp/mouse.el (context-menu-region): Rearrange the order to All>Defun>List>Line>Symbol. Show title either "List" or "String" depending on syntax-ppss, then use thing 'list-or-string' (bug#9054). * lisp/thingatpt.el (thing-at-point-bounds-of-list-at-point): Add optional args 'escape-strings' and 'no-syntax-crossing' like in 'up-list'. (list-or-string): New target 'list-or-string'. (thing-at-point-bounds-of-list-or-string-at-point): New function. diff --git a/etc/NEWS b/etc/NEWS index 175bae09e8..e9b60e9594 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2586,6 +2586,9 @@ This new command (bound to 'C-c C-l') regenerates the current hunk. This is like 'filename', but is a full path, and is nil if the file doesn't exist. +*** New 'thing-at-point' target: 'list-or-string'. +This is like 'list', but also prefers to find of any enclosing string. + +++ *** New variable 'thing-at-point-provider-alist'. This allows mode-specific alterations to how 'thing-at-point' works. diff --git a/lisp/mouse.el b/lisp/mouse.el index 41333eb7f7..382c101159 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -455,10 +455,11 @@ Some context functions add menu items below the separator." `(menu-item "Paste" mouse-yank-at-click :help "Paste (yank) text most recently cut/copied"))) (when (and (cdr yank-menu) (not buffer-read-only)) - (let ((submenu (make-sparse-keymap (propertize "Paste from Kill Menu")))) - (dolist (item yank-menu) + (let ((submenu (make-sparse-keymap (propertize "Paste from Kill Menu"))) + (i 0)) + (dolist (item (reverse yank-menu)) (when (consp item) - (define-key-after submenu (vector (car item)) + (define-key submenu (vector (setq i (1+ i))) `(menu-item ,(cadr item) ,(lambda () (interactive) (mouse-yank-from-menu click (car item))))))) @@ -477,18 +478,19 @@ Some context functions add menu items below the separator." `(menu-item "All" ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'buffer)) :help "Mark the whole buffer for a subsequent cut/copy")) - (define-key-after submenu [mark-line] - `(menu-item "Line" - ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'line)) - :help "Mark the line at click for a subsequent cut/copy")) (define-key-after submenu [mark-defun] `(menu-item "Defun" ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'defun)) :help "Mark the defun at click for a subsequent cut/copy")) - (define-key-after submenu [mark-list] - `(menu-item "List" - ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'list)) - :help "Mark the list at click for a subsequent cut/copy")) + (define-key-after submenu [mark-list-or-string] + `(menu-item ,(if (nth 8 (syntax-ppss (posn-point (event-end click)))) + "String" "List") + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'list-or-string)) + :help "Mark list or string at click for a subsequent cut/copy")) + (define-key-after submenu [mark-line] + `(menu-item "Line" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'line)) + :help "Mark the line at click for a subsequent cut/copy")) (define-key-after submenu [mark-symbol] `(menu-item "Symbol" ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'symbol)) diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 58ef2cfd91..09a86d2243 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -284,18 +284,27 @@ The bounds of THING are determined by `bounds-of-thing-at-point'." (put 'list 'bounds-of-thing-at-point 'thing-at-point-bounds-of-list-at-point) -(defun thing-at-point-bounds-of-list-at-point () +(defun thing-at-point-bounds-of-list-at-point (&optional escape-strings no-syntax-crossing) "Return the bounds of the list at point. Prefer the enclosing list with fallback on sexp at point. \[Internal function used by `bounds-of-thing-at-point'.]" (save-excursion - (if (ignore-errors (up-list -1)) + (if (ignore-errors (up-list -1 escape-strings no-syntax-crossing)) (ignore-errors (cons (point) (progn (forward-sexp) (point)))) (let ((bound (bounds-of-thing-at-point 'sexp))) (and bound (<= (car bound) (point)) (< (point) (cdr bound)) bound))))) +(put 'list-or-string 'bounds-of-thing-at-point + 'thing-at-point-bounds-of-list-or-string-at-point) + +(defun thing-at-point-bounds-of-list-or-string-at-point () + "Return the bounds of the list or string at point. +Like `thing-at-point-bounds-of-list-at-point', but also +prefer to find of any enclosing string." + (thing-at-point-bounds-of-list-at-point t t)) + ;; Defuns (put 'defun 'beginning-op 'beginning-of-defun) commit da50b7ec133eeb7cdcdb56ade5ad7d2f2c337f6a Author: Juri Linkov Date: Thu Sep 23 19:14:56 2021 +0300 * lisp/outline.el (outline-minor-mode-cycle-filter): New defcustom (bug#50679) (outline-minor-mode-cycle--bind): New helper function. (outline-minor-mode-cycle-map): Rename from outline-mode-cycle-map. (outline-mode-map): Revert part of 6458e16f33 to disassociate keymaps outline-mode-map and outline-minor-mode-cycle-map. (outline-font-lock-keywords, outline-minor-mode-highlight-buffer): Use outline-minor-mode-cycle-map instead of outline-mode-cycle-map. * lisp/help.el (describe-bindings): Rename outline-mode-cycle-map to outline-minor-mode-cycle-map. diff --git a/lisp/help.el b/lisp/help.el index 29ae340481..8f77167040 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -597,7 +597,7 @@ or a buffer name." (let ((inhibit-read-only t)) (goto-char (point-min)) (insert (substitute-command-keys - (concat "\\Type " + (concat "\\Type " "\\[outline-cycle] or \\[outline-cycle-buffer] " "on headings to cycle their visibility.\n\n"))) ;; Hide the longest body diff --git a/lisp/outline.el b/lisp/outline.el index 0bb74ffd64..52a94b4d9f 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -175,23 +175,45 @@ in the file it applies to.") outline-mode-menu-bar-map)))))) map)) -(defvar outline-mode-cycle-map +(defcustom outline-minor-mode-cycle-filter nil + "Filter out positions on the heading available for cycling." + :type '(choice (const :tag "Everywhere" nil) + (const :tag "At line beginning" bolp) + (const :tag "Not at line beginning" + (lambda () (not (bolp)))) + (const :tag "At line end" eolp) + (function :tag "Custom filter")) + :version "28.1") + +(defun outline-minor-mode-cycle--bind (map key binding &optional filter) + (define-key map key + `(menu-item + "" ,binding + ;; Filter out specific positions on the heading. + :filter + ,(or filter + (lambda (cmd) + (when (or (not (functionp outline-minor-mode-cycle-filter)) + (funcall outline-minor-mode-cycle-filter)) + cmd)))))) + +(defvar outline-minor-mode-cycle-map (let ((map (make-sparse-keymap))) - (let ((tab-binding `(menu-item - "" outline-cycle - ;; Only takes effect if point is on a heading. - :filter ,(lambda (cmd) - (when (outline-on-heading-p) cmd))))) - (define-key map (kbd "TAB") tab-binding) - (define-key map (kbd "") #'outline-cycle-buffer)) + (outline-minor-mode-cycle--bind map (kbd "TAB") #'outline-cycle) + (outline-minor-mode-cycle--bind map (kbd "") #'outline-cycle-buffer) map) - "Keymap used by `outline-mode-map' and `outline-minor-mode-cycle'.") + "Keymap used by `outline-minor-mode-cycle'.") (defvar outline-mode-map (let ((map (make-sparse-keymap))) - (set-keymap-parent map outline-mode-cycle-map) (define-key map "\C-c" outline-mode-prefix-map) (define-key map [menu-bar] outline-mode-menu-bar-map) + ;; Only takes effect if point is on a heading. + (define-key map (kbd "TAB") + `(menu-item "" outline-cycle + :filter ,(lambda (cmd) + (when (outline-on-heading-p) cmd)))) + (define-key map (kbd "") #'outline-cycle-buffer) map)) (defvar outline-font-lock-keywords @@ -202,9 +224,9 @@ in the file it applies to.") (if outline-minor-mode-cycle (if outline-minor-mode-highlight (list 'face (outline-font-lock-face) - 'keymap outline-mode-cycle-map) + 'keymap outline-minor-mode-cycle-map) (list 'face nil - 'keymap outline-mode-cycle-map)) + 'keymap outline-minor-mode-cycle-map)) (if outline-minor-mode-highlight (list 'face (outline-font-lock-face)))) (outline-font-lock-face)) @@ -367,7 +389,7 @@ faces to major mode's faces." (not (get-text-property (point) 'face)))) (overlay-put overlay 'face (outline-font-lock-face))) (when outline-minor-mode-cycle - (overlay-put overlay 'keymap outline-mode-cycle-map))) + (overlay-put overlay 'keymap outline-minor-mode-cycle-map))) (goto-char (match-end 0)))))) ;;;###autoload commit ebe8b8f89e970af2bef3852c6fc175daf9f1d2e7 Author: Wilson Snyder Date: Thu Sep 23 11:43:29 2021 -0400 ; * lisp/progmodes/verilog-mode.el: Untabify doc-strings. diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index 547787f8d8..ac6a8fbbcb 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -9,7 +9,7 @@ ;; Keywords: languages ;; The "Version" is the date followed by the decimal rendition of the Git ;; commit hex. -;; Version: 2021.09.23.139584433 +;; Version: 2021.09.23.089128420 ;; Yoni Rabkin contacted the maintainer of this ;; file on 19/3/2008, and the maintainer agreed that when a bug is @@ -124,7 +124,7 @@ ;; ;; This variable will always hold the version number of the mode -(defconst verilog-mode-version "2021-09-23-851e3b1-vpo-GNU" +(defconst verilog-mode-version "2021-09-23-54ffde4-vpo-GNU" "Version of this Verilog mode.") (defconst verilog-mode-release-emacs t "If non-nil, this version of Verilog mode was released with Emacs itself.") @@ -591,19 +591,19 @@ If `all' is selected, then all line ups described below are done. If `declarations', then just declarations are lined up with any preceding declarations, taking into account widths and the like, so or example the code: - reg [31:0] a; - reg b; + reg [31:0] a; + reg b; would become - reg [31:0] a; - reg b; + reg [31:0] a; + reg b; If `assignment', then assignments are lined up with any preceding assignments, so for example the code - a_long_variable <= b + c; - d = e + f; + a_long_variable <= b + c; + d = e + f; would become - a_long_variable <= b + c; - d = e + f; + a_long_variable <= b + c; + d = e + f; In order to speed up editing, large blocks of statements are lined up only when a \\[verilog-pretty-expr] is typed; and large blocks of declarations @@ -641,13 +641,13 @@ Set to 0 to get them list right under containing block." (defcustom verilog-indent-declaration-macros nil "How to treat macro expansions in a declaration. If nil, indent as: - input [31:0] a; - input \\=`CP; - output c; + input [31:0] a; + input \\=`CP; + output c; If non-nil, treat as: - input [31:0] a; - input \\=`CP ; - output c;" + input [31:0] a; + input \\=`CP ; + output c;" :group 'verilog-mode-indent :type 'boolean) (put 'verilog-indent-declaration-macros 'safe-local-variable #'verilog-booleanp) @@ -655,12 +655,12 @@ If non-nil, treat as: (defcustom verilog-indent-lists t "How to treat indenting items in a list. If t (the default), indent as: - always @( posedge a or - reset ) begin + always @( posedge a or + reset ) begin If nil, treat as: - always @( posedge a or - reset ) begin" + always @( posedge a or + reset ) begin" :group 'verilog-mode-indent :type 'boolean) (put 'verilog-indent-lists 'safe-local-variable #'verilog-booleanp) @@ -5425,7 +5425,7 @@ Useful for creating tri's and other expanded fields." (defun verilog-lint-off () "Convert a Verilog linter warning line into a disable statement. For example: - pci_bfm_null.v, line 46: Unused input: pci_rst_ + pci_bfm_null.v, line 46: Unused input: pci_rst_ becomes a comment for the appropriate tool. The first word of the `compile-command' or `verilog-linter' @@ -5449,9 +5449,9 @@ Run from Verilog source window; assumes there is a *compile* buffer with point set appropriately. For example: - WARNING [STD-UDDONX]: xx.v, line 8: output out is never assigned. + WARNING [STD-UDDONX]: xx.v, line 8: output out is never assigned. becomes: - // surefire lint_line_off UDDONX" + // surefire lint_line_off UDDONX" (interactive) (let ((buff (if (boundp 'next-error-last-buffer) next-error-last-buffer @@ -5510,9 +5510,9 @@ becomes: "Convert a Verilint warning line into a disable statement. For example: - (W240) pci_bfm_null.v, line 46: Unused input: pci_rst_ + (W240) pci_bfm_null.v, line 46: Unused input: pci_rst_ becomes: - //Verilint 240 off // WARNING: Unused input" + //Verilint 240 off // WARNING: Unused input" (interactive) (save-excursion (beginning-of-line) @@ -9812,11 +9812,11 @@ variable over and over when many modules are compiled together, put a test around the inside each include file: foo.v (an include file): - \\=`ifdef _FOO_V // include if not already included - \\=`else - \\=`define _FOO_V - ... contents of file - \\=`endif // _FOO_V" + \\=`ifdef _FOO_V // include if not already included + \\=`else + \\=`define _FOO_V + ... contents of file + \\=`endif // _FOO_V" ;;slow: (verilog-read-defines nil t) (save-excursion (verilog-getopt-flags) @@ -12596,7 +12596,7 @@ You may also provide an optional regular expression, in which case only signals matching the regular expression will be included. For example the same expansion will result from only extracting outputs starting with ov: - /*AUTOOUTPUT(\"^ov\")*/" + /*AUTOOUTPUT(\"^ov\")*/" (save-excursion ;; Point must be at insertion point. (let* ((indent-pt (current-indentation)) @@ -12747,7 +12747,7 @@ included. or excluded if the regexp begins with expansion will result from only extracting inputs starting with i: - /*AUTOINPUT(\"^i\")*/" + /*AUTOINPUT(\"^i\")*/" (save-excursion (let* ((indent-pt (current-indentation)) (params (verilog-read-auto-params 0 1)) @@ -13461,7 +13461,7 @@ Constant signals: is put into the AUTOSENSE list and is not desired, use the AUTO_CONSTANT declaration anywhere in the module (parenthesis are required): - /* AUTO_CONSTANT ( \\=`this_is_really_constant_dont_autosense_it ) */ + /* AUTO_CONSTANT( \\=`this_is_really_constant_dont_autosense_it ) */ Better yet, use a parameter, which will be understood to be constant automatically. @@ -13477,7 +13477,7 @@ OOps! An example: always @ (/*AS*/) begin - /*AUTO_CONSTANT (\\=`constant) */ + /*AUTO_CONSTANT(\\=`constant) */ outin = ina | inb | \\=`constant; out = outin; end @@ -13485,7 +13485,7 @@ An example: Typing \\[verilog-auto] will make this into: always @ (/*AS*/ina or inb) begin - /*AUTO_CONSTANT (\\=`constant) */ + /*AUTO_CONSTANT(\\=`constant) */ outin = ina | inb | \\=`constant; out = outin; end @@ -14141,14 +14141,14 @@ For example: endmodule You can also update the AUTOs from the shell using: - emacs --batch -f verilog-batch-auto + emacs --batch -f verilog-batch-auto Or fix indentation with: - emacs --batch -f verilog-batch-indent + emacs --batch -f verilog-batch-indent Likewise, you can delete or inject AUTOs with: - emacs --batch -f verilog-batch-delete-auto - emacs --batch -f verilog-batch-inject-auto + emacs --batch -f verilog-batch-delete-auto + emacs --batch -f verilog-batch-inject-auto Or check if AUTOs have the same expansion - emacs --batch -f verilog-batch-diff-auto + emacs --batch -f verilog-batch-diff-auto Using \\[describe-function], see also: `verilog-auto-arg' for AUTOARG module instantiations commit de7b9e31c49a3d55e6ceba8a20edbe1a290f6781 Author: Michael Albinus Date: Thu Sep 23 16:04:35 2021 +0200 * test/infra/Dockerfile.emba: Do not run 'make -j4 bootstrap'. diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba index 0b61c74aef..e79f370f17 100644 --- a/test/infra/Dockerfile.emba +++ b/test/infra/Dockerfile.emba @@ -41,7 +41,8 @@ COPY . /checkout WORKDIR /checkout RUN ./autogen.sh autoconf RUN ./configure -RUN make -j4 bootstrap +# 'make -j4 bootstrap' does not work reliably. +RUN make bootstrap RUN make -j4 FROM emacs-base as emacs-filenotify-gio @@ -55,7 +56,7 @@ COPY . /checkout WORKDIR /checkout RUN ./autogen.sh autoconf RUN ./configure --with-file-notification=gfile -RUN make -j4 bootstrap +RUN make bootstrap RUN make -j4 FROM emacs-base as emacs-gnustep commit 35e29d9d074f5bcf906b53605e2fde78797959bd Author: Eli Zaretskii Date: Thu Sep 23 16:22:31 2021 +0300 ; * etc/NEWS: Fix typos and punctuation in recently added entries. diff --git a/etc/NEWS b/etc/NEWS index a64c714e2c..175bae09e8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2412,18 +2412,18 @@ This specifies the file in which to save the list of known projects. +++ *** New command 'project-remember-projects-under'. This command can automatically locate and index projects in a -directory and optionally also it's subdirectories, storing them in +directory and optionally also its subdirectories, storing them in 'project-list-file'. +++ -*** New commands 'project-forget-project' and 'project-forget-projects-under' +*** New commands 'project-forget-project' and 'project-forget-projects-under'. These command lets you interactively remove entries from the list of projects in 'project-list-file'. +++ -*** New command 'project-forget-zombie-projects' +*** New command 'project-forget-zombie-projects'. This command detects indexed projects that have since been deleted, -and removes them from the list of known projects in 'project-list-file' +and removes them from the list of known projects in 'project-list-file'. --- *** 'project-find-file' now accepts non-existent file names. commit 72f8a9dd08132119a9a5e2b4c3dcb5b5a5e28ad2 Author: Michael Albinus Date: Thu Sep 23 14:29:28 2021 +0200 Fix Tramp's make-process on macOS * lisp/net/tramp-sh.el (tramp-get-remote-mknod-or-mkfifo): New defun. (tramp-sh-handle-make-process): Use it. (Bug#50748) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 18599f7c39..7f1a52fa93 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2883,10 +2883,14 @@ implementation will be used." ;; Handle error buffer. (when (bufferp stderr) + (unless (tramp-get-remote-mknod-or-mkfifo v) + (tramp-error + v 'file-error "Stderr buffer `%s' not supported" stderr)) (with-current-buffer stderr (setq buffer-read-only nil)) ;; Create named pipe. - (tramp-send-command v (format "mknod %s p" tmpstderr)) + (tramp-send-command + v (format (tramp-get-remote-mknod-or-mkfifo v) tmpstderr)) ;; Create stderr process. (make-process :name (buffer-name stderr) @@ -2963,7 +2967,7 @@ implementation will be used." (ignore-errors (set-process-query-on-exit-flag p (null noquery)) (set-marker (process-mark p) (point))) - ;; Kill stderr process delete and named pipe. + ;; Kill stderr process and delete named pipe. (when (bufferp stderr) (add-function :after (process-sentinel p) @@ -5796,6 +5800,23 @@ This command is returned only if `delete-by-moving-to-trash' is non-nil." (tramp-file-local-name tmpfile) (tramp-file-local-name tmpfile))) (delete-file tmpfile))))) +(defun tramp-get-remote-mknod-or-mkfifo (vec) + "Determine remote `mknod' or `mkfifo' command." + (with-tramp-connection-property vec "mknod-or-mkfifo" + (tramp-message vec 5 "Finding a suitable `mknod' or `mkfifo' command") + (let ((tmpfile (tramp-make-tramp-temp-name vec)) + command) + (prog1 + (or (and (setq command "mknod %s p") + (tramp-send-command-and-check + vec (format command (tramp-file-local-name tmpfile))) + command) + (and (setq command "mkfifo %s") + (tramp-send-command-and-check + vec (format command (tramp-file-local-name tmpfile))) + command)) + (delete-file tmpfile))))) + ;; Some predefined connection properties. (defun tramp-get-inline-compress (vec prop size) "Return the compress command related to PROP. commit 23970e27eeee1f33e3e1869a8ef1676b0e48cdc5 Author: Michael Albinus Date: Thu Sep 23 14:28:42 2021 +0200 * lisp/net/tramp-cmds.el (tramp-cleanup-connection): Remove trace buffer. diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index bfd928731a..63eab1b31a 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -131,6 +131,8 @@ When called interactively, a Tramp connection has to be selected." (buf (list (get-buffer (tramp-buffer-name vec)) (unless keep-debug (get-buffer (tramp-debug-buffer-name vec))) + (unless keep-debug + (get-buffer (tramp-trace-buffer-name vec))) (tramp-get-connection-property vec "process-buffer" nil))) (when (bufferp buf) (kill-buffer buf))) commit aef84c5f17c33714bda402e9408a3cb2ae928b61 Author: Philip Kaludercic Date: Tue Aug 31 14:12:13 2021 +0200 Add aggregate project discovery and maintenance functions * project.el (project-remember-project): Add optional no-write argument (project-remember-projects-under): Add command (project-forget-zombie-projects): Add command (project-forget-projects-under): Add command * etc/NEWS: Document new commands diff --git a/etc/NEWS b/etc/NEWS index fb7a7f628a..a64c714e2c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2410,10 +2410,21 @@ project's root directory, respectively. This specifies the file in which to save the list of known projects. +++ -*** New command 'project-forget-project'. -This command lets you interactively remove an entry from the list of projects +*** New command 'project-remember-projects-under'. +This command can automatically locate and index projects in a +directory and optionally also it's subdirectories, storing them in +'project-list-file'. + ++++ +*** New commands 'project-forget-project' and 'project-forget-projects-under' +These command lets you interactively remove entries from the list of projects in 'project-list-file'. ++++ +*** New command 'project-forget-zombie-projects' +This command detects indexed projects that have since been deleted, +and removes them from the list of known projects in 'project-list-file' + --- *** 'project-find-file' now accepts non-existent file names. This is to allow easy creation of files inside some nested diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 9b63f4b1bc..57a961c260 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1296,9 +1296,10 @@ With some possible metadata (to be decided).") (write-region nil nil filename nil 'silent)))) ;;;###autoload -(defun project-remember-project (pr) +(defun project-remember-project (pr &optional no-write) "Add project PR to the front of the project list. -Save the result in `project-list-file' if the list of projects has changed." +Save the result in `project-list-file' if the list of projects +has changed, and NO-WRITE is nil." (project--ensure-read-project-list) (let ((dir (project-root pr))) (unless (equal (caar project--list) dir) @@ -1306,7 +1307,8 @@ Save the result in `project-list-file' if the list of projects has changed." (when (equal dir (car ent)) (setq project--list (delq ent project--list)))) (push (list dir) project--list) - (project--write-project-list)))) + (unless no-write + (project--write-project-list))))) (defun project--remove-from-project-list (project-root report-message) "Remove directory PROJECT-ROOT of a missing project from the project list. @@ -1363,6 +1365,70 @@ It's also possible to enter an arbitrary directory not in the list." (let ((default-directory (project-root (project-current t)))) (call-interactively #'execute-extended-command))) +(defun project-remember-projects-under (dir &optional recursive) + "Index all projects below a directory DIR. +If RECURSIVE is non-nil, recurse into all subdirectories to find +more projects. After finishing, a message is printed summarizing +the progress. The function returns the number of detected +projects." + (interactive "DDirectory: \nP") + (project--ensure-read-project-list) + (let ((queue (directory-files dir t nil t)) (count 0) + (known (make-hash-table + :size (* 2 (length project--list)) + :test #'equal ))) + (dolist (project (mapcar #'car project--list)) + (puthash project t known)) + (while queue + (when-let ((subdir (pop queue)) + ((file-directory-p subdir)) + ((not (gethash subdir known)))) + (when-let (pr (project--find-in-directory subdir)) + (project-remember-project pr t) + (message "Found %s..." (project-root pr)) + (setq count (1+ count))) + (when (and recursive (file-symlink-p subdir)) + (setq queue (nconc (directory-files subdir t nil t) queue)) + (puthash subdir t known)))) + (unless (eq recursive 'in-progress) + (if (zerop count) + (message "No projects were found") + (project--write-project-list) + (message "%d project%s were found" + count (if (= count 1) "" "s")))) + count)) + +(defun project-forget-zombie-projects () + "Forget all known projects that don't exist any more." + (interactive) + (dolist (proj (project-known-project-roots)) + (unless (file-exists-p proj) + (project-forget-project proj)))) + +(defun project-forget-projects-under (dir &optional recursive) + "Forget all known projects below a directory DIR. +If RECURSIVE is non-nil, recurse into all subdirectories to +remove all known projects. After finishing, a message is printed +summarizing the progress. The function returns the number of +forgotten projects." + (interactive "DDirectory: \nP") + (let ((count 0)) + (if recursive + (dolist (proj (project-known-project-roots)) + (when (file-in-directory-p proj dir) + (project-forget-project proj) + (setq count (1+ count)))) + (dolist (proj (project-known-project-roots)) + (when (file-equal-p (file-name-directory proj) dir) + (project-forget-project proj) + (setq count (1+ count))))) + (if (zerop count) + (message "No projects were forgotten") + (project--write-project-list) + (message "%d project%s were forgotten" + count (if (= count 1) "" "s"))) + count)) + ;;; Project switching commit 46a2c191f2cdda4144dfe7bfce064588f2b2f780 Author: Dmitry Gutov Date: Thu Sep 23 14:53:31 2021 +0300 Fix vc-annotate-show-log-revision-at-line * lisp/vc/vc-annotate.el (vc-annotate-show-log-revision-at-line): Stop from being affected by 'vc-git-print-log-follow'. * lisp/vc/vc-git.el (vc-git-print-log-follow): Mention caveats in a comment. diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el index 82531f742e..45bb17749b 100644 --- a/lisp/vc/vc-annotate.el +++ b/lisp/vc/vc-annotate.el @@ -545,6 +545,7 @@ Return a cons (REV . FILENAME)." (defvar log-view-vc-backend) (defvar log-view-vc-fileset) +(defvar vc-git-print-log-follow) (defun vc-annotate-show-log-revision-at-line () "Visit the log of the revision at line. @@ -559,6 +560,8 @@ the file in question, search for the log entry required and move point." (message "Cannot extract revision number from the current line") (let ((backend vc-annotate-backend) (log-buf (get-buffer "*vc-change-log*")) + ;; No need to follow renames: we specify the historical file name. + vc-git-print-log-follow pos) (if (and log-buf diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 8332600c69..eca8d547a9 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1147,6 +1147,14 @@ This prompts for a branch to merge from." (autoload 'vc-setup-buffer "vc-dispatcher") +;; It's a weird option due to how Git handles '--follow', and it can +;; hide certain (usually merge) commits in the `vc-print-log' buffers. +;; +;; (setq vc-git-log-switches '("-m")) can fix that, but at the cost of +;; duplicating many merge commits in the log. +;; +;; Long explanation here: +;; https://stackoverflow.com/questions/46487476/git-log-follow-graph-skips-commits (defcustom vc-git-print-log-follow nil "If true, follow renames in Git logs for a single file." :type 'boolean commit a6a1c8600f2a919948412401b8602450f23bb338 Author: Wilson Snyder Date: Thu Sep 23 07:36:02 2021 -0400 verilog-mode.el: Backout part of recent change showing wrong comment diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index dabf9c479e..547787f8d8 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -9,7 +9,7 @@ ;; Keywords: languages ;; The "Version" is the date followed by the decimal rendition of the Git ;; commit hex. -;; Version: 2021.09.22.045357537 +;; Version: 2021.09.23.139584433 ;; Yoni Rabkin contacted the maintainer of this ;; file on 19/3/2008, and the maintainer agreed that when a bug is @@ -124,7 +124,7 @@ ;; ;; This variable will always hold the version number of the mode -(defconst verilog-mode-version "2021-09-22-2b419e1-vpo-GNU" +(defconst verilog-mode-version "2021-09-23-851e3b1-vpo-GNU" "Version of this Verilog mode.") (defconst verilog-mode-release-emacs t "If non-nil, this version of Verilog mode was released with Emacs itself.") @@ -13380,7 +13380,7 @@ Typing \\[verilog-auto] will call my-verilog-insert-hello and expand the above into: /*AUTOINSERTLISP(my-verilog-insert-hello \"world\")*/ - // Beginning of automatic insert Lisp + // Beginning of automatic insert lisp initial $write(\"hello world\"); // End of automatics commit d817f885789a562fd2c3960e312661838fb134f0 Author: Stefan Kangas Date: Thu Sep 23 13:20:55 2021 +0200 Clarify which-function tooltip text * lisp/progmodes/which-func.el (which-func-format): Clarify tooltip text. diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index eb170baa5d..8946e2c3f4 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -141,12 +141,14 @@ Zero means compute the Imenu menu regardless of size." local-map ,which-func-keymap face which-func mouse-face mode-line-highlight - help-echo "mouse-1: go to beginning\n\ -mouse-2: toggle rest visibility\n\ -mouse-3: go to end") + help-echo ,(concat + "Current function\n" + "mouse-1: go to beginning\n" + "mouse-2: toggle rest visibility\n" + "mouse-3: go to end")) "]") "Format for displaying the function in the mode line." - :version "24.2" ; added mouse-face; 24point2 is correct + :version "28.1" :type 'sexp) ;;;###autoload (put 'which-func-format 'risky-local-variable t) commit 6f790403a2df3a52cc4be492cc6101a10fa8afda Author: Robert Pluim Date: Thu Sep 23 11:06:57 2021 +0200 Improve NEWS entry for 'ffap-file-name-with-spaces' * etc/NEWS: Mention default value of 'ffap-file-name-with-spaces'. diff --git a/etc/NEWS b/etc/NEWS index 6eaa143308..fb7a7f628a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2973,9 +2973,10 @@ point leaves the text. If nil, the text is not hidden again. Instead 'M-x reveal-hide-revealed' can be used to hide all the revealed text. --- -*** New variable 'ffap-file-name-with-spaces'. +*** New user option 'ffap-file-name-with-spaces'. If non-nil, 'find-file-at-point' and friends will try to guess more -expansively to identify a file name with spaces. +expansively to identify a file name with spaces. Default value is +nil. --- *** Two new commands for centering in 'doc-view-mode'. commit d75b5c977d83bec9023e9ed58d7f69c2705606fe Author: Martin Rudalics Date: Thu Sep 23 09:41:32 2021 +0200 ;* lisp/whitespace.el (whitespace-display-window): Add doc-string. diff --git a/lisp/whitespace.el b/lisp/whitespace.el index e193be6cdd..d4f2b2890a 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -1836,6 +1836,7 @@ cleaning up these problems." (defun whitespace-display-window (buffer) + "Display BUFFER, preferably below the selected window." (goto-char (point-min)) (set-buffer-modified-p nil) (let ((window (display-buffer commit 47376da7e27722570c742020a7052b4881580c2b Author: Eli Zaretskii Date: Thu Sep 23 10:36:59 2021 +0300 ; * lisp/subr.el (match-string): Clarify doc string. diff --git a/lisp/subr.el b/lisp/subr.el index 029302a4f3..2d2794cfd1 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4668,19 +4668,20 @@ rather than your caller's match data." (defun match-string (num &optional string) "Return the string of text matched by the previous search or regexp operation. -NUM specifies which parenthesized expression in the last regexp. -Zero means the entire text matched by the whole regexp or whole string. +NUM specifies the number of the parenthesized sub-expression in the last +regexp whose match to return. Zero means return the text matched by the +entire regexp or the whole string. -The return value is nil if NUMth pair didn't match, or there were -less than NUM pairs. +The return value is nil if NUMth pair didn't match anything, or if there +were fewer than NUM sub-expressions in the regexp used in the search. STRING should be given if the last search was by `string-match' on STRING. If STRING is nil, the current buffer should be the -same buffer the search/match was performed in. +same buffer as the one in which the search/match was performed. Note that many functions in Emacs modify the match data, so this function should be called \"close\" to the function that did the -match. In particular, saying (for instance) +regexp search. In particular, saying (for instance) `M-: (looking-at \"[0-9]\") RET' followed by `M-: (match-string 0) RET' interactively is seldom meaningful, since the Emacs command loop may modify the match data." commit 90547d370f7c75b95b1d1e64b84e624e752ea6e3 Author: Lars Ingebrigtsen Date: Thu Sep 23 00:18:17 2021 +0200 Clarify align-regexp doc string * lisp/align.el (align-regexp): Clarify what REGEXP has to contain, and which bits are added automatically interactively (bug#33541). diff --git a/lisp/align.el b/lisp/align.el index 2f380a8077..7ced7b7044 100644 --- a/lisp/align.el +++ b/lisp/align.el @@ -897,22 +897,24 @@ align them so that the opening parentheses would line up: Mary-Anne (123) 456-7890 Joe (123) 456-7890 -There is no predefined rule to handle this, but you could easily do it -using a REGEXP like \"(\". Interactively, all you would have to do is -to mark the region, call `align-regexp' and enter that regular expression. - -REGEXP must contain at least one parenthesized subexpression, typically -whitespace of the form \"\\\\(\\\\s-*\\\\)\". In normal interactive use, -this is automatically added to the start of your regular expression after -you enter it. You only need to supply the characters to be lined up, and -any preceding whitespace is replaced. - -If you specify a prefix argument (or use this function non-interactively), -you must enter the full regular expression, including the subexpression. -The function also then prompts for which subexpression parenthesis GROUP -\(default 1) within REGEXP to modify, the amount of SPACING (default -`align-default-spacing') to use, and whether or not to REPEAT the rule -throughout the line. +There is no predefined rule to handle this, but interactively, +all you would have to do is to mark the region, call `align-regexp' +and enter \"(\". + +REGEXP must contain at least one parenthesized subexpression, +typically whitespace of the form \"\\\\(\\\\s-*\\\\)\", but in +interactive use, this is automatically added to the start of your +regular expression after you enter it. Interactively, you only +need to supply the characters to be lined up, and any preceding +whitespace is replaced. + +Non-interactively (or if you specify a prefix argument), you must +enter the full regular expression, including the subexpression. +Interactively, the function also then prompts for which +subexpression parenthesis GROUP (default 1) within REGEXP to +modify, the amount of SPACING (default `align-default-spacing') +to use, and whether or not to REPEAT the rule throughout the +line. See `align-rules-list' for more information about these options. commit bf0c072913c2c3c4e3ef4936762215b8f83a9498 Author: Stefan Kangas Date: Tue Sep 21 22:07:05 2021 +0200 Add section to refcard explaining our keybinding notation * etc/refcards/refcard.tex (Starting Emacs): Delete section. (Key Binding Notation): New section. (Bug#41403) diff --git a/etc/refcards/refcard.tex b/etc/refcards/refcard.tex index f066dc93ea..bc057569a7 100644 --- a/etc/refcards/refcard.tex +++ b/etc/refcards/refcard.tex @@ -273,9 +273,11 @@ \centerline{(for version \versionemacs)} -\section{Starting Emacs} +\section{Key Binding Notation} -To enter GNU Emacs \versionemacs, just type its name: \kbd{emacs} +In the Emacs key binding notation, \kbd{C-x} +is \kbd{Ctrl+X}; \kbd{M-x} is usually \kbd{Alt+X}; \kbd{S-x} is +\kbd{Shift+X}; and \kbd{C-M-x} is \kbd{Ctrl+Alt+X}, etc. \section{Leaving Emacs} commit 344350615961c1cacac3f0eff183f5eb60526644 Author: Stefan Kangas Date: Wed Sep 22 23:48:36 2021 +0200 Use lexical-binding in emoji-zwj.el * admin/unidata/emoji-zwj.awk: Add lexical-binding cookie to generated fie emoji-zwj.el. diff --git a/admin/unidata/emoji-zwj.awk b/admin/unidata/emoji-zwj.awk index b55379a532..bdc50f5047 100644 --- a/admin/unidata/emoji-zwj.awk +++ b/admin/unidata/emoji-zwj.awk @@ -61,7 +61,7 @@ } END { - print ";;; emoji-zwj.el --- emoji zwj character composition table" + print ";;; emoji-zwj.el --- emoji zwj character composition table -*- lexical-binding:t -*-" print ";;; Automatically generated from admin/unidata/emoji-zwj-sequences.txt" print "(eval-when-compile (require 'regexp-opt))" print "(dolist (elt `(" commit 866c1f56a3d7ecb02d58aa8ee2979cff0b1f044f Author: Lars Ingebrigtsen Date: Thu Sep 23 00:09:47 2021 +0200 Expand the `match-string' doc string * lisp/subr.el (match-string): Mention some caveats (bug#34214). diff --git a/lisp/subr.el b/lisp/subr.el index a6434bf28a..029302a4f3 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4667,13 +4667,23 @@ rather than your caller's match data." '(set-match-data save-match-data-internal 'evaporate)))) (defun match-string (num &optional string) - "Return string of text matched by last search. + "Return the string of text matched by the previous search or regexp operation. NUM specifies which parenthesized expression in the last regexp. - Value is nil if NUMth pair didn't match, or there were less than NUM pairs. Zero means the entire text matched by the whole regexp or whole string. -STRING should be given if the last search was by `string-match' on STRING. -If STRING is nil, the current buffer should be the same buffer -the search/match was performed in." + +The return value is nil if NUMth pair didn't match, or there were +less than NUM pairs. + +STRING should be given if the last search was by `string-match' +on STRING. If STRING is nil, the current buffer should be the +same buffer the search/match was performed in. + +Note that many functions in Emacs modify the match data, so this +function should be called \"close\" to the function that did the +match. In particular, saying (for instance) +`M-: (looking-at \"[0-9]\") RET' followed by `M-: (match-string 0) RET' +interactively is seldom meaningful, since the Emacs command loop +may modify the match data." (declare (side-effect-free t)) (if (match-beginning num) (if string commit bb3a045501281f7aafe800f729c253688780fc48 Author: Lars Ingebrigtsen Date: Wed Sep 22 23:46:59 2021 +0200 Improve error messaging from byte-compiling dotted lists * lisp/emacs-lisp/cconv.el (cconv-analyze-form): Improve error messaging when byte-compiling dotted lists (bug#35186). Test case -- byte-compile the following file: ;;; -*- lexical-binding: t -*- (defun foo () (+ 1 2) (a . b)) diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index ba29e4ec85..0a6b04b4c1 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -794,6 +794,8 @@ This function does not return anything but instead fills the ;; (`(declare . ,_) nil) ;The args don't contain code. (`(,_ . ,body-forms) ; First element is a function or whatever. + (unless (listp body-forms) + (signal 'wrong-type-argument (list 'proper-list-p form))) (dolist (form body-forms) (cconv-analyze-form form env))) ((pred symbolp) commit 25019f5e249f39614f4f48b34a461b9f85b5416a Author: Stefan Kangas Date: Wed Sep 22 23:43:49 2021 +0200 ; * etc/NEWS: Fix typo in last commit. diff --git a/etc/NEWS b/etc/NEWS index 70995bb5ea..6eaa143308 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1047,7 +1047,7 @@ Set the variable 'auto-save-visited-mode' buffer-locally to nil to achieve that. +++ -** New command 'kdb-macro-redisplay to force redisplay in keyboard macros. +** New command 'kdb-macro-redisplay' to force redisplay in keyboard macros. This command is bound to 'C-x C-k d'. --- commit efdb89f15b4d0dae334952bfe11073534e244d75 Author: Lars Ingebrigtsen Date: Wed Sep 22 21:56:31 2021 +0200 Move 'kdb-macro-redisplay' key binding * doc/emacs/kmacro.texi (Basic Keyboard Macro): Adjust. * lisp/kmacro.el (kmacro-keymap): Move 'kdb-macro-redisplay' to `C-x C-k d' since upper-case letters are reserved for users (bug#50727). diff --git a/doc/emacs/kmacro.texi b/doc/emacs/kmacro.texi index e713c6ef8c..16a97db54c 100644 --- a/doc/emacs/kmacro.texi +++ b/doc/emacs/kmacro.texi @@ -180,11 +180,11 @@ define it, so @kbd{C-u 4 C-x )} executes the macro immediately 3 additional times. @findex kdb-macro-redisplay -@kindex C-x C-k Q +@kindex C-x C-k d While executing a long-running keyboard macro, it can sometimes be useful to trigger a redisplay (to show how far we've gotten). The -@kbd{C-x C-k Q} can be used for this. As a not very useful example, -@kbd{C-x ( M-f C-x C-k Q C-x )} will create a macro that will +@kbd{C-x C-k d} command can be used for this. As a not very useful +example, @kbd{C-x ( M-f C-x C-k d C-x )} will create a macro that will redisplay once per iteration when saying @kbd{C-u 42 C-x e}. @node Keyboard Macro Ring diff --git a/etc/NEWS b/etc/NEWS index f273b8e82a..70995bb5ea 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1047,7 +1047,8 @@ Set the variable 'auto-save-visited-mode' buffer-locally to nil to achieve that. +++ -** New command 'C-x C-k Q' to force redisplay in keyboard macros. +** New command 'kdb-macro-redisplay to force redisplay in keyboard macros. +This command is bound to 'C-x C-k d'. --- ** 'blink-cursor-mode' is now enabled by default regardless of the UI. diff --git a/lisp/kmacro.el b/lisp/kmacro.el index 53e6e5e288..bb41a962c3 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -172,7 +172,7 @@ macro to be executed before appending to it." (define-key map "\C-k" #'kmacro-end-or-call-macro-repeat) (define-key map "r" #'apply-macro-to-region-lines) (define-key map "q" #'kbd-macro-query) ;; Like C-x q - (define-key map "Q" #'kdb-macro-redisplay) + (define-key map "d" #'kdb-macro-redisplay) ;; macro ring (define-key map "\C-n" #'kmacro-cycle-ring-next) commit aebba085cba13ad1439462923ffa0520456f1aad Author: Stefan Kangas Date: Wed Sep 22 20:26:40 2021 +0200 ; More minor stylistic fixes found by checkdoc diff --git a/lisp/allout.el b/lisp/allout.el index bb36524658..c123e8ded4 100644 --- a/lisp/allout.el +++ b/lisp/allout.el @@ -116,7 +116,7 @@ Do NOT set the value of this variable. Instead, customize "Create the allout keymap according to the keybinding specs, and set it. Useful standalone or to effect customizations of the -respective allout-mode keybinding variables, `allout-command-prefix', +respective `allout-mode' keybinding variables, `allout-command-prefix', `allout-prefixed-keybindings', and `allout-unprefixed-keybindings'" ;; Set the customization variable, if any: (when varname @@ -145,7 +145,7 @@ respective allout-mode keybinding variables, `allout-command-prefix', (allout-institute-keymap map))) ;;;_ > allout-institute-keymap (map) (defun allout-institute-keymap (map) - "Associate allout-mode bindings with allout as a minor mode." + "Associate `allout-mode' bindings with allout as a minor mode." ;; Architecture: ;; allout-mode-map var is a keymap by virtue of being a defalias for ;; allout-mode-map-value, which has the actual keymap value. @@ -358,7 +358,7 @@ Examples: See `allout-expose-topic' for more about the exposure process. Also, allout's mode-specific provisions will make topic prefixes default -to the comment-start string, if any, of the language of the file. This +to the `comment-start' string, if any, of the language of the file. This is modulo the setting of `allout-use-mode-specific-leader', which see." :type 'allout-layout-type :group 'allout) @@ -429,8 +429,7 @@ those that do not have the variable `comment-start' set. A value of ;;;_ = allout-show-bodies (defcustom allout-show-bodies nil - "If non-nil, show entire body when exposing a topic, rather than -just the header." + "If non-nil, show entire body when exposing a topic, rather than just the header." :type 'boolean :group 'allout) (make-variable-buffer-local 'allout-show-bodies) @@ -596,16 +595,16 @@ strings." "When non-nil, use mode-specific topic-header prefixes. Allout outline mode will use the mode-specific `allout-mode-leaders' or -comment-start string, if any, to lead the topic prefix string, so topic +`comment-start' string, if any, to lead the topic prefix string, so topic headers look like comments in the programming language. It will also use -the comment-start string, with an `_' appended, for `allout-primary-bullet'. +the `comment-start' string, with an `_' appended, for `allout-primary-bullet'. String values are used as literals, not regular expressions, so do not escape any regular-expression characters. Value t means to first check for assoc value in `allout-mode-leaders' -alist, then use comment-start string, if any, then use default (`.'). -\(See note about use of comment-start strings, below.) +alist, then use `comment-start' string, if any, then use default (`.'). +\(See note about use of `comment-start' strings, below.) Set to the symbol for either of `allout-mode-leaders' or `comment-start' to use only one of them, respectively. @@ -613,9 +612,9 @@ Set to the symbol for either of `allout-mode-leaders' or Value nil means to always use the default (`.') and leave `allout-primary-bullet' unaltered. -comment-start strings that do not end in spaces are tripled in +`comment-start' strings that do not end in spaces are tripled in the header-prefix, and an `_' underscore is tacked on the end, to -distinguish them from regular comment strings. comment-start +distinguish them from regular comment strings. `comment-start' strings that do end in spaces are not tripled, but an underscore is substituted for the space. [This presumes that the space is for appearance, not comment syntax. You can use @@ -633,8 +632,8 @@ undesired.]" (defvar allout-mode-leaders '() "Specific allout-prefix leading strings per major modes. -Use this if the mode's comment-start string isn't what you -prefer, or if the mode lacks a comment-start string. See +Use this if the mode's `comment-start' string isn't what you +prefer, or if the mode lacks a `comment-start' string. See `allout-use-mode-specific-leader' for more details. If you're constructing a string that will comment-out outline @@ -860,7 +859,7 @@ For details, see `allout-toggle-current-subtree-encryption's docstring." ;;;_ : Version ;;;_ = allout-version (defvar allout-version "2.3" - "Version of currently loaded outline package. (allout.el)") + "Version of currently loaded allout.el package.") ;;;_ > allout-version (defun allout-version (&optional here) "Return string describing the loaded outline version." @@ -1509,7 +1508,7 @@ See `allout-encryption-ciphertext-rejection-regexps' for rejection reasons.") 'allout-mode) ;;;_ > allout-write-contents-hook-handler () (defun allout-write-contents-hook-handler () - "Implement `allout-encrypt-unencrypted-on-saves' for file writes + "Implement `allout-encrypt-unencrypted-on-saves' for file writes. Return nil if all goes smoothly, or else return an informative message if an error is encountered. The message will serve as a @@ -3998,8 +3997,7 @@ With repeat count, shift topic depth by that amount." index do-successors sans-offspring) - "Like `allout-rebullet-topic', but on nearest containing topic -\(visible or not). + "Like `allout-rebullet-topic', but on nearest containing topic (visible or not). See `allout-rebullet-heading' for rebulleting behavior. @@ -5056,8 +5054,7 @@ Examples: max-pos))) ;;;_ > allout-old-expose-topic (spec &rest followers) (defun allout-old-expose-topic (spec &rest followers) - "Deprecated. Use `allout-expose-topic' (with different schema -format) instead. + "Deprecated. Use `allout-expose-topic' (with different schema format) instead. Dictate wholesale exposure scheme for current topic, according to SPEC. diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index 79b1c9912f..4315a7f3ce 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -604,7 +604,7 @@ codes. Finally, the so changed list of codes is returned." codes)) (defun ansi-color-make-color-map () - "Creates a vector of face definitions and returns it. + "Create a vector of face definitions and return it. The index into the vector is an ANSI code. See the documentation of `ansi-color-map' for an example. diff --git a/lisp/apropos.el b/lisp/apropos.el index 513175d751..fc15cd3e01 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -1305,7 +1305,7 @@ as a heading." (error "There is nothing to follow here")))) (defun apropos-next-symbol () - "Move cursor down to the next symbol in an apropos-mode buffer." + "Move cursor down to the next symbol in an `apropos-mode' buffer." (interactive) (forward-line) (while (and (not (eq (face-at-point) 'apropos-symbol)) @@ -1313,7 +1313,7 @@ as a heading." (forward-line))) (defun apropos-previous-symbol () - "Move cursor back to the last symbol in an apropos-mode buffer." + "Move cursor back to the last symbol in an `apropos-mode' buffer." (interactive) (forward-line -1) (while (and (not (eq (face-at-point) 'apropos-symbol)) diff --git a/lisp/auth-source.el b/lisp/auth-source.el index d938522c80..3c1a6feaee 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -176,7 +176,7 @@ Overrides `password-cache-expiry' through a let-binding." ;; TODO: or maybe leave as (setq auth-source-netrc-use-gpg-tokens 'never) (defcustom auth-source-netrc-use-gpg-tokens 'never - "Set this to tell auth-source when to create GPG password + "Set this to tell `auth-source' when to create GPG password tokens in netrc files. It's either an alist or `never'. Note that if EPA/EPG is not available, this should NOT be used." :version "23.2" ;; No Gnus @@ -503,7 +503,7 @@ soon as a function returns non-nil.") (add-hook 'auth-source-backend-parser-functions #'auth-source-backends-parser-secrets) (defun auth-source-backend-parse-parameters (entry backend) - "Fill in the extra auth-source-backend parameters of ENTRY. + "Fill in the extra `auth-source-backend' parameters of ENTRY. Using the plist ENTRY, get the :host, :port, and :user search parameters." (let ((entry (if (stringp entry) @@ -1227,7 +1227,7 @@ FILE is the file from which we obtained this token." &key backend require create type max host user port &allow-other-keys) - "Given a property list SPEC, return search matches from the :backend. + "Given a property list SPEC, return search matches from the `:backend'. See `auth-source-search' for details on SPEC." ;; just in case, check that the type is correct (null or same as the backend) (cl-assert (or (null type) (eq type (oref backend type))) @@ -2274,7 +2274,7 @@ entries for git.gnus.org: &key backend require type max host user port &allow-other-keys) - "Given a property list SPEC, return search matches from the :backend. + "Given a property list SPEC, return search matches from the `:backend'. See `auth-source-search' for details on SPEC." ;; just in case, check that the type is correct (null or same as the backend) (cl-assert (or (null type) (eq type (oref backend type))) diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el index 995d9e2e0f..063d0a14d6 100644 --- a/lisp/autoinsert.el +++ b/lisp/autoinsert.el @@ -83,10 +83,11 @@ When this is `function', only ask when called non-interactively." (const :tag "Ask if called non-interactively" function) (other :tag "Ask" t))) -(defcustom auto-insert-prompt "Perform %s auto-insertion? " - "Prompt to use when querying whether to auto-insert. +(defcustom auto-insert-prompt "Perform %s auto-insertion?" + "Prompt to use when querying whether to `auto-insert'. If this contains a %s, that will be replaced by the matching rule." - :type 'string) + :type 'string + :version "28.1") (defcustom auto-insert-alist diff --git a/lisp/bindings.el b/lisp/bindings.el index 5c1adef9b5..343f1ba0fa 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -184,8 +184,8 @@ mouse-3: Remove current window from display")) (defvar mode-line-front-space '(:eval (if (display-graphic-p) " " "-")) "Mode line construct to put at the front of the mode line. By default, this construct is displayed right at the beginning of -the mode line, except that if there is a memory-full message, it -is displayed first.") +the mode line, except that if there is a \"memory full\" message, +it is displayed first.") (put 'mode-line-front-space 'risky-local-variable t) (defun mode-line-mule-info-help-echo (window _object _point) @@ -1086,7 +1086,7 @@ if `inhibit-field-text-motion' is non-nil." (define-key map "p" 'previous-error) (define-key map "\M-p" 'previous-error) map) - "Keymap to repeat next-error key sequences. Used in `repeat-mode'.") + "Keymap to repeat `next-error' key sequences. Used in `repeat-mode'.") (put 'next-error 'repeat-map 'next-error-repeat-map) (put 'previous-error 'repeat-map 'next-error-repeat-map) diff --git a/lisp/bookmark.el b/lisp/bookmark.el index ac63c8f1b0..d64966df5a 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -905,7 +905,9 @@ others are still there, should the user decide to delete the most recent one. To yank words from the text of the buffer and use them as part of the -bookmark name, type C-w while setting a bookmark. Successive C-w's +bookmark name, type \\\ +\\[bookmark-yank-word] while setting a bookmark. Successive \ +\\[bookmark-yank-word]'s yank successive words. Typing \\[universal-argument] inserts (at the bookmark name prompt) the name of the last @@ -938,7 +940,9 @@ Otherwise, if a bookmark named NAME already exists but PUSH-BOOKMARK is nil, raise an error. To yank words from the text of the buffer and use them as part of the -bookmark name, type C-w while setting a bookmark. Successive C-w's +bookmark name, type \\\ +\\[bookmark-yank-word] while setting a bookmark. Successive \ +\\[bookmark-yank-word]'s yank successive words. Typing \\[universal-argument] inserts (at the bookmark name prompt) the name of the last @@ -1361,7 +1365,8 @@ If called from Lisp, prompt for NEW-NAME if only OLD-NAME was passed as an argument. If called with two strings, then no prompting is done. You must pass at least OLD-NAME when calling from Lisp. -While you are entering the new name, consecutive C-w's insert +While you are entering the new name, consecutive \ +\\\\[bookmark-yank-word]'s insert consecutive words from the text of the buffer into the new bookmark name." (interactive (list (bookmark-completing-read "Old bookmark name"))) @@ -1734,8 +1739,8 @@ unique numeric suffixes \"<2>\", \"<3>\", etc." (define-key map [mouse-2] 'bookmark-bmenu-other-window-with-mouse) map)) -(easy-menu-define - bookmark-menu bookmark-bmenu-mode-map "Bookmark Menu" +(easy-menu-define bookmark-menu bookmark-bmenu-mode-map + "Menu for `bookmark-bmenu'." '("Bookmark" ["Select Bookmark in This Window" bookmark-bmenu-this-window t] ["Select Bookmark in Full-Frame Window" bookmark-bmenu-1-window t] @@ -2062,7 +2067,7 @@ You can mark bookmarks with the \\\\[bookmark-bmenu-mar (defun bookmark-bmenu-save () "Save the current list into a bookmark file. -With a prefix arg, prompts for a file to save them in. +With a prefix arg, prompt for a file to save them in. See also the related behaviors of `bookmark-load' and `bookmark-bmenu-load'." diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index 340c926f8d..1013a7c497 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -222,7 +222,7 @@ In Buffer Menu mode, the following commands are defined: so the Buffer Menu remains visible in its window. \\[Buffer-menu-view] Select current line's buffer, in View mode. \\[Buffer-menu-view-other-window] Select that buffer in - another window, in view-mode. + another window, in `view-mode'. \\[Buffer-menu-switch-other-window] Make another window display that buffer. \\[Buffer-menu-mark] Mark current line's buffer to be displayed. \\[Buffer-menu-select] Select current line's buffer. @@ -233,7 +233,7 @@ In Buffer Menu mode, the following commands are defined: \\[Buffer-menu-isearch-buffers] Incremental search in the marked buffers. \\[Buffer-menu-isearch-buffers-regexp] Isearch for regexp in the marked buffers. \\[Buffer-menu-multi-occur] Show lines matching regexp in the marked buffers. -\\[Buffer-menu-visit-tags-table] visit-tags-table this buffer. +\\[Buffer-menu-visit-tags-table] `visit-tags-table' this buffer. \\[Buffer-menu-not-modified] Clear modified-flag on that buffer. \\[Buffer-menu-save] Mark that buffer to be saved, and move down. \\[Buffer-menu-delete] Mark that buffer to be deleted, and move down. @@ -306,7 +306,7 @@ ARG, show only buffers that are visiting files." (display-buffer (list-buffers-noselect arg))) (defun Buffer-menu-toggle-files-only (arg) - "Toggle whether the current buffer-menu displays only file buffers. + "Toggle whether the current `buffer-menu' displays only file buffers. With a positive ARG, display only file buffers. With zero or negative ARG, display other buffers as well." (interactive "P" Buffer-menu-mode) diff --git a/lisp/button.el b/lisp/button.el index 74dfb5d541..aedd07b762 100644 --- a/lisp/button.el +++ b/lisp/button.el @@ -113,21 +113,22 @@ Mode-specific keymaps may want to use this as their parent keymap.") ;; [this is an internal function] (defsubst button-category-symbol (type) - "Return the symbol used by button-type TYPE to store properties. + "Return the symbol used by `button-type' TYPE to store properties. Buttons inherit them by setting their `category' property to that symbol." (or (get type 'button-category-symbol) (error "Unknown button type `%s'" type))) (defun define-button-type (name &rest properties) "Define a `button type' called NAME (a symbol). -The remaining arguments form a plist of PROPERTY VALUE pairs, -specifying properties to use as defaults for buttons with this type -\(a button's type may be set by giving it a `type' property when -creating the button, using the :type keyword argument). +The remaining PROPERTIES arguments form a plist of PROPERTY VALUE +pairs, specifying properties to use as defaults for buttons with +this type (a button's type may be set by giving it a `type' +property when creating the button, using the :type keyword +argument). In addition, the keyword argument :supertype may be used to specify a -button-type from which NAME inherits its default property values -\(however, the inheritance happens only when NAME is defined; subsequent +`button-type' from which NAME inherits its default property values +(however, the inheritance happens only when NAME is defined; subsequent changes to a supertype are not reflected in its subtypes)." (let ((catsym (make-symbol (concat (symbol-name name) "-button"))) (super-catsym @@ -156,15 +157,15 @@ changes to a supertype are not reflected in its subtypes)." name)) (defun button-type-put (type prop val) - "Set the button-type TYPE's PROP property to VAL." + "Set the `button-type' TYPE's PROP property to VAL." (put (button-category-symbol type) prop val)) (defun button-type-get (type prop) - "Get the property of button-type TYPE named PROP." + "Get the property of `button-type' TYPE named PROP." (get (button-category-symbol type) prop)) (defun button-type-subtype-p (type supertype) - "Return non-nil if button-type TYPE is a subtype of SUPERTYPE." + "Return non-nil if `button-type' TYPE is a subtype of SUPERTYPE." (or (eq type supertype) (and type (button-type-subtype-p (button-type-get type 'supertype) @@ -271,11 +272,11 @@ This function only works when BUTTON is in the current buffer." (button-end button)))) (defsubst button-type (button) - "Return BUTTON's button-type." + "Return BUTTON's `button-type'." (button-get button 'type)) (defun button-has-type-p (button type) - "Return non-nil if BUTTON has button-type TYPE, or one of its subtypes." + "Return non-nil if BUTTON has `button-type' TYPE, or one of its subtypes." (button-type-subtype-p (button-get button 'type) type)) (defun button--area-button-p (b) @@ -290,10 +291,10 @@ Such area buttons are used for buttons in the mode-line and header-line." (defun make-button (beg end &rest properties) "Make a button from BEG to END in the current buffer. -The remaining arguments form a plist of PROPERTY VALUE pairs, -specifying properties to add to the button. +The remaining PROPERTIES arguments form a plist of PROPERTY VALUE +pairs, specifying properties to add to the button. In addition, the keyword argument :type may be used to specify a -button-type from which to inherit other properties; see +`button-type' from which to inherit other properties; see `define-button-type'. Also see `make-text-button', `insert-button'." @@ -314,7 +315,7 @@ Also see `make-text-button', `insert-button'." The remaining arguments form a plist of PROPERTY VALUE pairs, specifying properties to add to the button. In addition, the keyword argument :type may be used to specify a -button-type from which to inherit other properties; see +`button-type' from which to inherit other properties; see `define-button-type'. Also see `insert-text-button', `make-button'." @@ -328,10 +329,10 @@ Also see `insert-text-button', `make-button'." (defun make-text-button (beg end &rest properties) "Make a button from BEG to END in the current buffer. -The remaining arguments form a plist of PROPERTY VALUE pairs, -specifying properties to add to the button. +The remaining PROPERTIES arguments form a plist of PROPERTY VALUE +pairs, specifying properties to add to the button. In addition, the keyword argument :type may be used to specify a -button-type from which to inherit other properties; see +`button-type' from which to inherit other properties; see `define-button-type'. This function is like `make-button', except that the button is actually @@ -382,10 +383,10 @@ Also see `insert-text-button'." (defun insert-text-button (label &rest properties) "Insert a button with the label LABEL. -The remaining arguments form a plist of PROPERTY VALUE pairs, -specifying properties to add to the button. +The remaining PROPERTIES arguments form a plist of PROPERTY VALUE +pairs, specifying properties to add to the button. In addition, the keyword argument :type may be used to specify a -button-type from which to inherit other properties; see +`button-type' from which to inherit other properties; see `define-button-type'. This function is like `insert-button', except that the button is diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el index 0e913ddfdb..52c024865a 100644 --- a/lisp/calc/calc-aent.el +++ b/lisp/calc/calc-aent.el @@ -537,8 +537,7 @@ The value t means abort and give an error message.") ("₋" "-") ; - ("₍" "(") ; ( ("₎" ")")) ; ) - "A list whose elements (old new) indicate replacements to make -in Calc algebraic input.") + "A list indicating replacements to make in Calc algebraic input.") (defvar math-read-superscripts "⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁽⁾ⁿⁱ" ; 0123456789+-()ni diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el index ac57011da0..ce8e3579f4 100644 --- a/lisp/calc/calc-forms.el +++ b/lisp/calc/calc-forms.el @@ -703,16 +703,19 @@ in the Gregorian calendar." fmt)))) (defconst math-julian-date-beginning '(float 17214245 -1) - "The beginning of the Julian date calendar, -as measured in the number of days before December 31, 1 BC (Gregorian).") + "The beginning of the Julian date calendar. +This is measured in the number of days before December 31, 1 +BC (Gregorian).") (defconst math-julian-date-beginning-int 1721425 - "The beginning of the Julian date calendar, -as measured in the integer number of days before December 31, 1 BC (Gregorian).") + "The beginning of the Julian date calendar. +This is measured in the integer number of days before December +31, 1 BC (Gregorian).") (defconst math-unix-epoch 719163 - "The beginning of Unix time: days from December 31, 1 BC (Gregorian) -to Jan 1, 1970 AD.") + "The beginning of Unix time. +This is measured in the integer number of days from December 31, +1 BC (Gregorian) to Jan 1, 1970 AD.") (defun math-format-date-part (x) (cond ((stringp x) diff --git a/lisp/calc/calc-poly.el b/lisp/calc/calc-poly.el index 77587cc4b8..5d74a8f106 100644 --- a/lisp/calc/calc-poly.el +++ b/lisp/calc/calc-poly.el @@ -454,7 +454,7 @@ This returns only the remainder from the pseudo-division." (defun math-atomic-factorp (expr) - "Return true if is a factor containing no sums or quotients." + "Return non-nil if is a factor containing no sums or quotients." (cond ((eq (car-safe expr) '*) (and (math-atomic-factorp (nth 1 expr)) (math-atomic-factorp (nth 2 expr)))) diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index afb43c0f33..45a4d56a37 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -400,8 +400,7 @@ This is not required to be present for user-written mode annotations." :type 'boolean) (defcustom calc-ensure-consistent-units nil - "If non-nil, make sure new units are consistent with current units -when converting units." + "If non-nil, ensure new units are consistent with current units when converting." :version "24.3" :type 'boolean) @@ -468,11 +467,11 @@ This is 1 unless `calc-truncate-stack' has been used.") (defvar calc-display-sci-high 0 "Floating-point numbers with this positive exponent or higher above the -current precision are displayed in scientific notation in calc-mode.") +current precision are displayed in scientific notation in `calc-mode'.") (defvar calc-display-sci-low -3 "Floating-point numbers with this negative exponent or lower are displayed -scientific notation in calc-mode.") +scientific notation in `calc-mode'.") (defvar calc-digit-after-point nil "If t, display at least one digit after the decimal point, as in `12.0'. @@ -493,8 +492,7 @@ This setting only applies to floats in normal display mode.") "List of variables used in customizing GNU Calc.") (defmacro defcalcmodevar (var defval &optional doc) - "Declare VAR as a Calc variable, with default value DEFVAL -and doc-string DOC. + "Declare VAR as a Calc variable, with default value DEFVAL and doc-string DOC. The variable VAR will be added to `calc-mode-var-list'." `(progn (defvar ,var ,defval ,doc) @@ -912,7 +910,7 @@ Used by `calc-user-invocation'.") (defvar calc-trail-pointer nil "The \"current\" entry in trail buffer.") (defvar calc-trail-overlay nil - "The value of overlay-arrow-string.") + "The value of `overlay-arrow-string'.") (defvar calc-undo-list nil "The list of previous operations for undo.") (defvar calc-redo-list nil diff --git a/lisp/calculator.el b/lisp/calculator.el index 415e0b4c77..6bcea2d885 100644 --- a/lisp/calculator.el +++ b/lisp/calculator.el @@ -833,8 +833,7 @@ The result should not exceed the screen width." (concat prompt (if (<= trim 0) expr (substring expr trim))))) (defun calculator-string-to-number (str) - "Convert the given STR to a number, according to the value of -`calculator-input-radix'." + "Convert STR to number according to `calculator-input-radix'." (if calculator-input-radix (string-to-number str (cadr (assq calculator-input-radix '((bin 2) (oct 8) (hex 16))))) @@ -1171,9 +1170,9 @@ arguments." ;;; Input interaction (defun calculator-last-input (&optional keys) - "Return the last key sequence that was used to invoke this command, or -the input KEYS. Uses the `function-key-map' translate keypad numbers to -plain ones." + "Return the last key sequence used to invoke this command, or the input KEYS. +Uses the `function-key-map' translate keypad numbers to plain +ones." (let* ((inp (or keys (this-command-keys))) (inp (or (and (arrayp inp) (not (stringp inp)) (lookup-key function-key-map inp)) diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 9ca7ce3f00..2eb7977a16 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -1223,8 +1223,7 @@ ensure that all relevant variables are set. \(diary-mail-entries) -# diary-rem.el ends here -" +# diary-rem.el ends here" (interactive "P") (if (string-equal diary-mail-addr "") (user-error "You must set `diary-mail-addr' to use this command") @@ -1254,10 +1253,10 @@ the regexp with parentheses." paren)) (defvar diary-marking-entries-flag nil - "True during the marking of diary entries, nil otherwise.") + "Non-nil during the marking of diary entries, nil otherwise.") (defvar diary-marking-entry-flag nil - "True during the marking of diary entries, if current entry is marking.") + "Non-nil during the marking of diary entries, if current entry is marking.") ;; file-glob-attrs bound in diary-mark-entries. (defun diary-mark-entries-1 (markfunc &optional months symbol absfunc) diff --git a/lisp/char-fold.el b/lisp/char-fold.el index 46a3f93d0a..e3ab7d5b64 100644 --- a/lisp/char-fold.el +++ b/lisp/char-fold.el @@ -20,6 +20,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Commentary: + ;;; Code: (eval-and-compile diff --git a/lisp/cmuscheme.el b/lisp/cmuscheme.el index 0910ea6187..e197069d6b 100644 --- a/lisp/cmuscheme.el +++ b/lisp/cmuscheme.el @@ -186,7 +186,7 @@ Return before the end of the process' output copies the sexp ending at point Delete converts tabs to spaces as it moves back. Tab indents for Scheme; with argument, shifts rest of expression rigidly with the current line. -C-M-q does Tab on each line starting within following expression. +\\[indent-pp-sexp] does Tab on each line starting within following expression. Paragraphs are separated only by blank lines. Semicolons start comments. If you accidentally suspend your process, use \\[comint-continue-subjob] to continue it." diff --git a/lisp/comint.el b/lisp/comint.el index 56d4420e60..8bf23897f9 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -2830,7 +2830,7 @@ if necessary." (when (>= count 0) (comint-update-fence)))) (defun comint-kill-region (beg end) - "Like `kill-region', but ignores read-only properties, if safe. + "Like `kill-region', but ignore read-only properties, if safe. This command assumes that the buffer contains read-only \"prompts\" which are regions with front-sticky read-only properties at the beginning of a line, with the preceding newline diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 7eae2e416b..69baf17f5e 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -5123,8 +5123,8 @@ If several parents are listed, go to the first of them." The following commands are available: \\\ -Move to next button, link or editable field. \\[widget-forward] -Move to previous button, link or editable field. \\[widget-backward] +Move to next button, link or editable field. \\[widget-forward] +Move to previous button, link or editable field. \\[widget-backward] \\\ Complete content of editable text field. \\[widget-complete] \\\ diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el index 7457d9e323..07881e9b74 100644 --- a/lisp/cus-theme.el +++ b/lisp/cus-theme.el @@ -22,6 +22,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Commentary: + ;;; Code: (require 'widget) diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el index e113cc94c3..037787797b 100644 --- a/lisp/dabbrev.el +++ b/lisp/dabbrev.el @@ -568,8 +568,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]." major-mode))) (defun dabbrev--goto-start-of-abbrev () - "Back over all abbrev type characters and then moves forward over -all skip characters." + "Back over all abbrev type characters then move forward over all skip characters." ;; Move backwards over abbrev chars (save-match-data (when (> (point) (minibuffer-prompt-end)) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 4549f45ef6..1bb5b92935 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1326,7 +1326,7 @@ Return nil if no change in files." (user-error "No compression rule found for \ `dired-compress-directory-default-suffix' %s, see `dired-compress-files-alist' for\ - the supported suffixes list." + the supported suffixes list" dired-compress-directory-default-suffix))) (let* ((suffix (or dired-compress-file-default-suffix ".gz")) (out-name (concat file suffix)) @@ -1335,7 +1335,7 @@ Return nil if no change in files." dired-compress-file-alist))) (if (not rule) (user-error "No compression rule found for suffix %s, \ -see `dired-compress-file-alist' for the supported suffixes list." +see `dired-compress-file-alist' for the supported suffixes list" dired-compress-file-default-suffix) (and (file-exists-p file) (or (not (file-exists-p out-name)) diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 9f9f170173..cf257c8169 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -589,7 +589,7 @@ This is useful if you want to peruse and move around in an ls -lR output file, for example one you got from an ftp server. With ange-ftp, you can even Dired a directory containing an ls-lR file, visit that file and turn on Virtual Dired mode. But don't try to save -this file, as dired-virtual indents the listing and thus changes the +this file, as `dired-virtual' indents the listing and thus changes the buffer. If you have saved a Dired buffer in a file you can use \\[dired-virtual] to @@ -956,7 +956,7 @@ as the variable `file'. If several COMMANDs are given, the first one will be the default and the rest will be added temporarily to the history and can be retrieved -with \\[previous-history-element] (M-p) . +with `previous-history-element' (\\\\[previous-history-element]). The variable `dired-guess-shell-case-fold-search' controls whether REGEXP is matched case-sensitively." diff --git a/lisp/dired.el b/lisp/dired.el index 266a03e6cc..07c13e18b9 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2219,8 +2219,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." ;; Autoload cookie needed by desktop.el ;;;###autoload (defun dired-mode (&optional dirname switches) - "\ -Mode for \"editing\" directory listings. + "Mode for \"editing\" directory listings. In Dired, you are \"editing\" a list of the files in a directory and (optionally) its subdirectories, in the format of `ls -lR'. Each directory is a page: use \\[backward-page] and \\[forward-page] to move pagewise. @@ -3697,7 +3696,7 @@ no ARGth marked file is found before this line." (defun dired-mark-files-in-region (start end) (let ((inhibit-read-only t)) (if (> start end) - (error "start > end")) + (error "Start > End")) (goto-char start) ; assumed at beginning of line (while (< (point) end) ;; Skip subdir line and following garbage like the `total' line: diff --git a/lisp/display-fill-column-indicator.el b/lisp/display-fill-column-indicator.el index 50252af453..7e9d62c5d1 100644 --- a/lisp/display-fill-column-indicator.el +++ b/lisp/display-fill-column-indicator.el @@ -45,7 +45,7 @@ ;;;###autoload (define-minor-mode display-fill-column-indicator-mode - "Toggle display of fill-column indicator. + "Toggle display of `fill-column' indicator. This uses `display-fill-column-indicator' internally. To change the position of the column displayed by default diff --git a/lisp/dos-vars.el b/lisp/dos-vars.el index 2f7b3760e3..7fcbb56d22 100644 --- a/lisp/dos-vars.el +++ b/lisp/dos-vars.el @@ -34,9 +34,9 @@ :type '(repeat string)) (defcustom dos-codepage-setup-hook nil - "List of functions to be called after the DOS terminal and coding -systems are set up. This is the place, e.g., to set specific entries -in `standard-display-table' as appropriate for your codepage, if + "List of functions to call after setting up DOS terminal and coding systems. +This is the place, e.g., to set specific entries in +`standard-display-table' as appropriate for your codepage, if `IT-display-table-setup' doesn't do a perfect job." :type '(hook) :version "20.3.3") diff --git a/lisp/edmacro.el b/lisp/edmacro.el index 8ee413acd0..e90b3a006e 100644 --- a/lisp/edmacro.el +++ b/lisp/edmacro.el @@ -108,7 +108,7 @@ With a prefix argument, format the macro in a more concise way." (memq cmd-noremap '(call-last-kbd-macro kmacro-call-macro kmacro-end-or-call-macro kmacro-end-and-call-macro)) (member keys '("\r" [return]))) (or last-kbd-macro - (y-or-n-p "No keyboard macro defined. Create one? ") + (y-or-n-p "No keyboard macro defined. Create one?") (keyboard-quit)) (setq mac (or last-kbd-macro "")) (setq keys nil) @@ -244,8 +244,9 @@ or nil, use a compact 80-column format." (and (fboundp cmd) (not (arrayp (symbol-function cmd))) (not (get cmd 'kmacro)) (not (y-or-n-p - (format "Command %s is already defined; %s" - cmd "proceed? "))) + (format + "Command %s is already defined; proceed?" + cmd))) (keyboard-quit)))) t) ((looking-at "Key:\\(.*\\)$") @@ -264,9 +265,9 @@ or nil, use a compact 80-column format." (not (or (arrayp (symbol-function b)) (get b 'kmacro)))) (not (y-or-n-p - (format "Key %s is already defined; %s" - (edmacro-format-keys key 1) - "proceed? "))) + (format + "Key %s is already defined; proceed?" + (edmacro-format-keys key 1)))) (keyboard-quit)))))) t) ((looking-at "Counter:[ \t]*\\([^ \t\n]*\\)[ \t]*$") diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el index 45bc270db6..ba88c81913 100644 --- a/lisp/elec-pair.el +++ b/lisp/elec-pair.el @@ -63,7 +63,7 @@ When inserting a closing paren character right before the same character, just skip that character instead, so that hitting ( followed by ) results in \"()\" rather than \"())\". -This can be convenient for people who find it easier to hit ) than C-f. +This can be convenient for people who find it easier to hit ) than \\[forward-char]. Can also be a function of one argument (the closer char just inserted), in which case that function's return value is diff --git a/lisp/epa-dired.el b/lisp/epa-dired.el index 8a4f8933bf..18f3f05574 100644 --- a/lisp/epa-dired.el +++ b/lisp/epa-dired.el @@ -21,6 +21,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Commentary: + ;;; Code: (require 'epa) diff --git a/lisp/epa-file.el b/lisp/epa-file.el index 33bf5adabe..fe187589aa 100644 --- a/lisp/epa-file.el +++ b/lisp/epa-file.el @@ -21,8 +21,9 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Commentary: + ;;; Code: -;;; Dependencies (require 'epa) (require 'epa-hook) diff --git a/lisp/epa-hook.el b/lisp/epa-hook.el index 99a432c236..aa196851d4 100644 --- a/lisp/epa-hook.el +++ b/lisp/epa-hook.el @@ -21,6 +21,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Commentary: + ;;; Code: (defgroup epa-file nil diff --git a/lisp/epa-mail.el b/lisp/epa-mail.el index b9dd437ed1..9b3aa0c7fd 100644 --- a/lisp/epa-mail.el +++ b/lisp/epa-mail.el @@ -21,8 +21,9 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Commentary: + ;;; Code: -;;; Dependencies (require 'epa) (require 'mail-utils) diff --git a/lisp/epa.el b/lisp/epa.el index ed1dae3e8a..57d355cb3e 100644 --- a/lisp/epa.el +++ b/lisp/epa.el @@ -20,8 +20,9 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Commentary: + ;;; Code: -;;; Dependencies (require 'epg) (eval-when-compile (require 'subr-x)) @@ -461,7 +462,7 @@ q trust status questionable. - trust status unspecified. ;;;###autoload (defun epa-select-keys (context prompt &optional names secret) "Display a user's keyring and ask him to select keys. -CONTEXT is an epg-context. +CONTEXT is an `epg-context'. PROMPT is a string to prompt with. NAMES is a list of strings to be matched with keys. If it is nil, all the keys are listed. @@ -968,8 +969,7 @@ For example: ;;;###autoload (defun epa-verify-cleartext-in-region (start end) - "Verify OpenPGP cleartext signed messages in the current region -between START and END. + "Verify OpenPGP cleartext signed messages in current region from START to END. Don't use this command in Lisp programs! See the reason described in the `epa-verify-region' documentation." @@ -1202,8 +1202,7 @@ If no one is selected, symmetric encryption will be performed. ") ;;;###autoload (defun epa-import-armor-in-region (start end) - "Import keys in the OpenPGP armor format in the current region -between START and END." + "Import keys in the OpenPGP armor format in the current region from START to END." (interactive "r") (save-excursion (save-restriction diff --git a/lisp/epg.el b/lisp/epg.el index 1d37cbcfb5..ea7aa869a0 100644 --- a/lisp/epg.el +++ b/lisp/epg.el @@ -21,6 +21,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Commentary: + ;;; Code: ;;; Prelude @@ -804,7 +806,7 @@ callback data (if any)." (when (and epg-key-id (string-match "\\`passphrase\\." string)) (unless (epg-context-passphrase-callback context) - (error "passphrase-callback not set")) + (error "Variable `passphrase-callback' not set")) (let (inhibit-quit passphrase passphrase-with-new-line diff --git a/lisp/face-remap.el b/lisp/face-remap.el index c84742be5a..50302b9682 100644 --- a/lisp/face-remap.el +++ b/lisp/face-remap.el @@ -397,7 +397,7 @@ a top-level keymap, `text-scale-increase' or (defcustom buffer-face-mode-face 'variable-pitch "The face specification used by `buffer-face-mode'. It may contain any value suitable for a `face' text property, -including a face name, a list of face names, a face-attribute +including a face name, a list of face names, a face attribute plist, etc." :type '(choice (face) (repeat :tag "List of faces" face) diff --git a/lisp/faces.el b/lisp/faces.el index a5aef757b1..7b96d938c5 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1796,8 +1796,8 @@ If FRAME is nil, that stands for the selected frame." (defalias 'x-defined-colors 'defined-colors) (defun defined-colors-with-face-attributes (&optional frame foreground) - "Return a list of colors supported for a particular frame. -See `defined-colors' for arguments and return value. In contrast + "Return a list of colors supported for a particular FRAME. +See `defined-colors' for arguments and return value. In contrast to `defined-colors' the elements of the returned list are color strings with text properties, that make the color names render with the color they represent as background color (if FOREGROUND diff --git a/lisp/ffap.el b/lisp/ffap.el index b6e419b2d6..db38016427 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -465,11 +465,11 @@ Returned values: mesg) nil) ((string-match "not responding$" mesg) mesg) ;; v19: - ;; (file-error "connection failed" "permission denied" + ;; (file-error "Connection failed" "permission denied" ;; "nonesuch" "ffap-machine-p") - ;; (file-error "connection failed" "host is unreachable" + ;; (file-error "Connection failed" "host is unreachable" ;; "gopher.house.gov" "ffap-machine-p") - ;; (file-error "connection failed" "address already in use" + ;; (file-error "Connection failed" "address already in use" ;; "ftp.uu.net" "ffap-machine-p") ((equal mesg "connection failed") (if (string= (downcase (nth 2 error)) "permission denied") @@ -1088,8 +1088,8 @@ If a given RFC isn't in these then `ffap-rfc-path' is offered." (latex-mode "--:\\\\$+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:") (tex-mode "--:\\\\$+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:") ) - "Alist of (MODE CHARS BEG END), where MODE is a symbol, -possibly a major-mode name, or one of the symbols + "Alist of (MODE CHARS BEG END), where MODE is a symbol. +This is possibly a major-mode name, or one of the symbols `file', `url', `machine', and `nocolon'. Function `ffap-string-at-point' uses the data fields as follows: 1. find a maximal string of CHARS around point, diff --git a/lisp/fileloop.el b/lisp/fileloop.el index 45b9cea939..cd60600a25 100644 --- a/lisp/fileloop.el +++ b/lisp/fileloop.el @@ -44,6 +44,7 @@ (defcustom fileloop-revert-buffers 'silent "Whether to revert files during fileloop operation. +This can be one of: `silent' means to only do it if `revert-without-query' is applicable; t means to offer to do it for all applicable files; nil means never to do it" diff --git a/lisp/files.el b/lisp/files.el index b113ff32f2..2f7e936ff6 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1584,7 +1584,7 @@ Signals a `file-already-exists' error if a file of the new name already exists unless optional fourth argument OK-IF-ALREADY-EXISTS is non-nil. A number as fourth arg means request confirmation if the new name already exists. This is what happens in interactive -use with M-x." +use with \\[execute-extended-command]." (interactive (let ((default-coding (or file-name-coding-system default-file-name-coding-system)) @@ -2520,7 +2520,7 @@ Do you want to revisit the file normally now? "))) (current-buffer)))) (defun insert-file-contents-literally (filename &optional visit beg end replace) - "Like `insert-file-contents', but only reads in the file literally. + "Like `insert-file-contents', but only read in the file literally. See `insert-file-contents' for an explanation of the parameters. A buffer may be modified in several ways after reading into the buffer, due to Emacs features such as format decoding, character code diff --git a/lisp/filesets.el b/lisp/filesets.el index 63f0e8ba3f..9182c53945 100644 --- a/lisp/filesets.el +++ b/lisp/filesets.el @@ -112,7 +112,8 @@ (defvar filesets-updated-buffers nil "A list of buffers with updated menu bars.") (defvar filesets-menu-use-cached-flag nil - "Use cached data. See `filesets-menu-ensure-use-cached' for details.") + "Non-nil means use cached data. +See `filesets-menu-ensure-use-cached' for details.") (defvar filesets-update-cache-file-flag nil "Non-nil means the cache needs updating.") (defvar filesets-ignore-next-set-default nil @@ -607,8 +608,8 @@ the filename." (:ignore-on-read-text t) ;; (:constraintp ,pic-cmd) )))) - "Alist of file patterns and external viewers for use with -`filesets-find-or-display-file'. + "Alist of file patterns and external viewers. +This is intended for use with `filesets-find-or-display-file'. Has the form ((FILE-PATTERN VIEWER PROPERTIES) ...), VIEWER being either a function or a command name as string. @@ -1770,7 +1771,7 @@ User will be queried, if no fileset name is provided." filesets-data nil))) (entry (or (assoc name filesets-data) (when (y-or-n-p - (format "Fileset %s does not exist. Create it? " + (format "Fileset %s does not exist. Create it?" name)) (progn (add-to-list 'filesets-data (list name '(:files))) @@ -2198,8 +2199,9 @@ FS is a fileset's name. FLIST is a list returned by nil)) (defun filesets-build-dir-submenu (entry lookup-name dir patt) - "Build a :tree submenu named LOOKUP-NAME with base directory DIR including -all files matching PATT for filesets ENTRY." + "Build a `:tree' submenu named LOOKUP-NAME. +It has base directory DIR including all files matching PATT for +filesets ENTRY." (let ((fd (filesets-entry-get-filter-dirs-flag entry)) (depth (or (filesets-entry-get-tree-max-level entry) filesets-tree-max-level))) diff --git a/lisp/find-dired.el b/lisp/find-dired.el index 87a7407a86..ebdb10ae9f 100644 --- a/lisp/find-dired.el +++ b/lisp/find-dired.el @@ -266,7 +266,7 @@ it finishes, type \\[kill-find]." ;;;###autoload (defun find-name-dired (dir pattern) - "Search DIR recursively for files matching the globbing pattern PATTERN, + "Search DIR recursively for files matching the globbing PATTERN, and run Dired on those files. PATTERN is a shell wildcard (not an Emacs regexp) and need not be quoted. The default command run (after changing into DIR) is diff --git a/lisp/foldout.el b/lisp/foldout.el index cadf2746ba..8925241df3 100644 --- a/lisp/foldout.el +++ b/lisp/foldout.el @@ -239,7 +239,7 @@ An end marker of nil means the fold ends after (point-max).") Normally the body and the immediate subheadings are exposed, but optional arg EXPOSURE \(interactively with prefix arg) changes this:- - EXPOSURE > 0 exposes n levels of subheadings (c.f. show-children) + EXPOSURE > 0 exposes n levels of subheadings (c.f. `show-children') EXPOSURE < 0 exposes only the body EXPOSURE = 0 exposes the entire subtree" (interactive "P") diff --git a/lisp/font-core.el b/lisp/font-core.el index db06a60766..95bf46c9b8 100644 --- a/lisp/font-core.el +++ b/lisp/font-core.el @@ -21,6 +21,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Commentary: + ;;; Code: ;; This variable is used by mode packages that support Font Lock mode by diff --git a/lisp/forms.el b/lisp/forms.el index e1de011133..551a1ba3c9 100644 --- a/lisp/forms.el +++ b/lisp/forms.el @@ -1705,7 +1705,7 @@ As a side effect: re-calculates the number of records in the data file." ;;; Other commands (defun forms-toggle-read-only (arg) - "Toggles read-only mode of a forms mode buffer. + "Toggle read-only mode of a forms mode buffer. With an argument, enables read-only mode if the argument is positive. Otherwise enables edit mode if the visited file is writable." @@ -1878,7 +1878,7 @@ after the current record." (setq forms--search-regexp regexp)) (defun forms-save-buffer (&optional args) - "Forms mode replacement for save-buffer. + "Forms mode replacement for `save-buffer'. It saves the data buffer instead of the forms buffer. Calls `forms-write-file-filter' before, and `forms-read-file-filter' after writing out the data." diff --git a/lisp/hexl.el b/lisp/hexl.el index 4a7bf9479a..79dd5c40c6 100644 --- a/lisp/hexl.el +++ b/lisp/hexl.el @@ -1165,7 +1165,7 @@ This function is assumed to be used as callback function for `hl-line-mode'." ;; startup stuff. -(easy-menu-define hexl-menu hexl-mode-map "Hexl Mode menu" +(easy-menu-define hexl-menu hexl-mode-map "Hexl Mode menu." '("Hexl" :help "Hexl-specific Features" diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index 4c924e9d52..7d126cb558 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el @@ -244,7 +244,7 @@ by cycling through the faces in `hi-lock-face-defaults'." "String used to identify hi-lock patterns at the start of files.") (defvar hi-lock-archaic-interface-message-used nil - "True if user alerted that `global-hi-lock-mode' is now the global switch. + "Non-nil if user alerted that `global-hi-lock-mode' is now the global switch. Earlier versions of hi-lock used `hi-lock-mode' as the global switch; the message is issued if it appears that `hi-lock-mode' is used assuming that older functionality. This variable avoids multiple reminders.") diff --git a/lisp/image-dired.el b/lisp/image-dired.el index b92a9371ec..3ca47300a9 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -519,7 +519,7 @@ Used by `image-dired-copy-with-exif-file-name'." (defcustom image-dired-show-all-from-dir-max-files 50 "Maximum number of files to show using `image-dired-show-all-from-dir' -before warning the user." +before warning." :type 'integer) (defmacro image-dired--with-db-file (&rest body) @@ -1958,7 +1958,7 @@ With prefix argument ARG, display image in its original size." (image-dired-display-image (dired-get-filename) arg)) (defun image-dired-image-at-point-p () - "Return true if there is an image-dired thumbnail at point." + "Return non-nil if there is an `image-dired' thumbnail at point." (get-text-property (point) 'image-dired-thumbnail)) (defun image-dired-rotate-thumbnail (degrees) diff --git a/lisp/imenu.el b/lisp/imenu.el index 788755a2d7..22412d5f88 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -829,8 +829,7 @@ A trivial interface to `imenu-add-to-menubar' suitable for use in a hook." (defvar imenu-buffer-menubar nil) (defvar-local imenu-menubar-modified-tick 0 - "The value of (buffer-chars-modified-tick) as of the last call -to `imenu-update-menubar'.") + "Value of (buffer-chars-modified-tick) when `imenu-update-menubar' was called.") (defun imenu-update-menubar () (when (and (current-local-map) diff --git a/lisp/indent.el b/lisp/indent.el index aa2bfbceeb..aa6b8d17c4 100644 --- a/lisp/indent.el +++ b/lisp/indent.el @@ -463,7 +463,7 @@ Optional fifth argument OBJECT specifies the string or buffer to operate on." (put-text-property begin to prop (funcall func val) object)))) (defun increase-left-margin (from to inc) - "Increase or decrease the left-margin of the region. + "Increase or decrease the `left-margin' of the region. With no prefix argument, this adds `standard-indent' of indentation. A prefix arg (optional third arg INC noninteractively) specifies the amount to change the margin by, in characters. @@ -520,11 +520,14 @@ If `auto-fill-mode' is active, re-fills region to fit in new margin." (defun beginning-of-line-text (&optional n) "Move to the beginning of the text on this line. -With optional argument, move forward N-1 lines first. -From the beginning of the line, moves past the left-margin indentation, the -fill-prefix, and any indentation used for centering or right-justifying the -line, but does not move past any whitespace that was explicitly inserted -\(such as a tab used to indent the first line of a paragraph)." + +With optional argument N, move forward N-1 lines first. + +From the beginning of the line, moves past the `left-margin' +indentation, the `fill-prefix', and any indentation used for +centering or right-justifying the line, but does not move past +any whitespace that was explicitly inserted (such as a tab used +to indent the first line of a paragraph)." (interactive "^p") (beginning-of-line n) (skip-chars-forward " \t") diff --git a/lisp/info-look.el b/lisp/info-look.el index 33f15a34e9..7cc5462dd4 100644 --- a/lisp/info-look.el +++ b/lisp/info-look.el @@ -262,7 +262,8 @@ system." (defun info-lookup-symbol (symbol &optional mode) "Display the definition of SYMBOL, as found in the relevant manual. When this command is called interactively, it reads SYMBOL from the -minibuffer. In the minibuffer, use M-n to yank the default argument +minibuffer. In the minibuffer, use \\\ +\\[next-history-element] to yank the default argument value into the minibuffer so you can edit it. The default symbol is the one found at point. @@ -276,7 +277,8 @@ With prefix arg MODE a query for the symbol help mode is offered." (defun info-lookup-file (file &optional mode) "Display the documentation of a file. When this command is called interactively, it reads FILE from the minibuffer. -In the minibuffer, use M-n to yank the default file name +In the minibuffer, use \\\ +\\[next-history-element] to yank the default file name into the minibuffer so you can edit it. The default file name is the one found at point. diff --git a/lisp/international/ccl.el b/lisp/international/ccl.el index 0eb009fa52..9be4d1ee95 100644 --- a/lisp/international/ccl.el +++ b/lisp/international/ccl.el @@ -213,8 +213,7 @@ proper index number for SYMBOL. PROP should be (ccl-embed-data (cons symbol prop))) (defun ccl-embed-string (len str) - "Embed string STR of length LEN in `ccl-program-vector' at -`ccl-current-ic'." + "Embed string STR of length LEN in `ccl-program-vector' at `ccl-current-ic'." (if (> len #xFFFFF) (error "CCL: String too long: %d" len)) (if (> (string-bytes str) len) @@ -282,8 +281,7 @@ changed to a relative jump address." (defvar ccl-loop-head nil "If non-nil, index of the start of the current loop.") (defvar ccl-breaks nil - "If non-nil, list of absolute addresses of the breaking points of -the current loop.") + "If non-nil, list of absolute addresses of breaking points of the current loop.") ;;;###autoload (defun ccl-compile (ccl-program) @@ -568,8 +566,8 @@ If READ-FLAG is non-nil, this statement has the form (cdr (cdr cmd)))) (defun ccl-compile-branch-expression (expr cmd) - "Compile EXPRESSION part of BRANCH statement and return register -which holds a value of the expression." + "Compile EXPRESSION part of BRANCH statement. +Return register which holds a value of the expression." (if (listp expr) ;; EXPR has the form `(EXPR2 OP ARG)'. Compile it as SET ;; statement of the form `(r7 = (EXPR2 OP ARG))'. @@ -1554,8 +1552,7 @@ MAP := MAP-IDs := MAP-ID ... MAP-SET := MAP-IDs | (MAP-IDs) MAP-SET -MAP-ID := integer -" +MAP-ID := integer" (declare (doc-string 3)) `(let ((prog ,(unwind-protect (progn diff --git a/lisp/international/quail.el b/lisp/international/quail.el index c0e53d26fb..50ff307b73 100644 --- a/lisp/international/quail.el +++ b/lisp/international/quail.el @@ -471,7 +471,8 @@ conversion region is active. It is an alist of single key character vs. corresponding command to be called. If SIMPLE is non-nil, then we do not alter the meanings of -commands such as C-f, C-b, C-n, C-p and TAB; they are treated as +commands such as \\[forward-char], \\[backward-char], \\[next-line], \ +\\[previous-line] and \\[indent-for-tab-command]; they are treated as non-Quail commands." (let (translation-keymap conversion-keymap) (if deterministic (setq forget-last-selection t)) diff --git a/lisp/international/robin.el b/lisp/international/robin.el index e4a11801c3..c38cd82269 100644 --- a/lisp/international/robin.el +++ b/lisp/international/robin.el @@ -276,8 +276,7 @@ this robin package will be the following. (?c \"AC\" (?d \"ACD\") (?e \"ACE\"))) - (?b \"B\")) -") + (?b \"B\"))") ;;;###autoload (defmacro robin-define-package (name docstring &rest rules) diff --git a/lisp/isearch.el b/lisp/isearch.el index 952caa7ac2..242f2b0dd0 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -1221,7 +1221,7 @@ is processed. (It is not called after characters that exit the search.) When the arg RECURSIVE-EDIT is non-nil, this function behaves modally and does not return to the calling function until the search is completed. -To behave this way it enters a recursive-edit and exits it when done +To behave this way it enters a recursive edit and exits it when done isearching. The arg REGEXP-FUNCTION, if non-nil, should be a function. It is diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index c1a5bbe947..bb2df2b1ff 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el @@ -47,7 +47,7 @@ Preserves the `buffer-modified-p' state of the current buffer." (defcustom jit-lock-chunk-size 1500 "Jit-lock fontifies chunks of at most this many characters at a time. -This variable controls both display-time and stealth fontification. +This variable controls both `display-time' and stealth fontification. The optimum value is a little over the typical number of buffer characters which fit in a typical window." diff --git a/lisp/kmacro.el b/lisp/kmacro.el index a39f433cdc..53e6e5e288 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -820,8 +820,8 @@ If kbd macro currently being defined end it before activating it." (defun kmacro-bind-to-key (_arg) "When not defining or executing a macro, offer to bind last macro to a key. -The key sequences [C-x C-k 0] through [C-x C-k 9] and [C-x C-k A] -through [C-x C-k Z] are reserved for user bindings, and to bind to +The key sequences `C-x C-k 0' through `C-x C-k 9' and `C-x C-k A' +through `C-x C-k Z' are reserved for user bindings, and to bind to one of these sequences, just enter the digit or letter, rather than the whole sequence. diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 0b12bdad05..4a7946a212 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -168,8 +168,7 @@ documentation of `unload-feature' for details.") ;; So we use this auxiliary variable to keep track of the last (t . SYMBOL) ;; that occurred. (defvar loadhist--restore-autoload nil - "If non-nil, this is a symbol for which we should -restore a previous autoload if possible.") + "If non-nil, is a symbol for which to try to restore a previous autoload.") (cl-defmethod loadhist-unload-element ((x (head t))) (setq loadhist--restore-autoload (cdr x))) diff --git a/lisp/locate.el b/lisp/locate.el index 008d65e055..6190fc6302 100644 --- a/lisp/locate.el +++ b/lisp/locate.el @@ -50,7 +50,7 @@ ;; from a shell prompt. GNU locate and BSD find expect the file databases ;; to either be in standard places or located via environment variables. ;; If the latter, make sure these environment variables are set in -;; your emacs process. +;; your Emacs process. ;; ;; Locate-mode assumes that each line output from the locate-command ;; consists exactly of a file name, possibly preceded or trailed by diff --git a/lisp/macros.el b/lisp/macros.el index 689c4210cd..89e38abab2 100644 --- a/lisp/macros.el +++ b/lisp/macros.el @@ -148,11 +148,16 @@ use this command, and then save the file." ;;;###autoload (defun kbd-macro-query (flag) "Query user during kbd macro execution. - With prefix argument, enters recursive edit, reading keyboard -commands even within a kbd macro. You can give different commands -each time the macro executes. - Without prefix argument, asks whether to continue running the macro. + +With prefix argument FLAG, enter recursive edit, reading +keyboard commands even within a kbd macro. You can give +different commands each time the macro executes. + +Without prefix argument, ask whether to continue running the +macro. + Your options are: \\ + \\[act] Finish this iteration normally and continue with the next. \\[skip] Skip the rest of this iteration, and start the next. \\[exit] Stop the macro entirely right now. diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 07f7beb92c..e84eec5002 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -2156,7 +2156,7 @@ otherwise it could decide to silently do nothing." (> count 1))) (defcustom yank-menu-length 20 - "Maximum length to display in the yank-menu." + "Maximum length to display in the `yank-menu'." :type 'integer :group 'menu) @@ -2289,7 +2289,7 @@ Buffers menu is regenerated." It must accept a buffer as its only required argument.") (defun menu-bar-buffer-vector (alist) - ;; turn ((name . buffer) ...) into a menu + "Turn ((name . buffer) ...) into a menu." (let ((buffers-vec (make-vector (length alist) nil)) (i (length alist))) (dolist (pair alist) @@ -2303,7 +2303,7 @@ It must accept a buffer as its only required argument.") buffers-vec)) (defun menu-bar-update-buffers (&optional force) - ;; If user discards the Buffers item, play along. + "If user discards the Buffers item, play along." (and (lookup-key (current-global-map) [menu-bar buffer]) (or force (frame-or-buffer-changed-p)) (let ((buffers (buffer-list)) diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el index b424b6edfe..ecfb359b36 100644 --- a/lisp/mouse-drag.el +++ b/lisp/mouse-drag.el @@ -147,7 +147,7 @@ Keep the cursor on the screen as needed." (= (cdr start-col-row) (cdr end-col-row))))) (defvar mouse-drag-electric-col-scrolling t - "If non-nil, mouse-drag on a long line enables truncate-lines.") + "If non-nil, mouse-drag on a long line enables `truncate-lines'.") (defun mouse-drag-should-do-col-scrolling () "Determine if it's wise to enable col-scrolling for the current window. diff --git a/lisp/mouse.el b/lisp/mouse.el index edac5085ff..41333eb7f7 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -46,7 +46,7 @@ :type 'boolean) (defcustom mouse-drag-copy-region nil - "If non-nil, copy to kill-ring upon mouse adjustments of the region. + "If non-nil, copy to kill ring upon mouse adjustments of the region. This affects `mouse-save-then-kill' (\\[mouse-save-then-kill]) in addition to mouse drags. diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index c5c9dfb2af..98ce1d6993 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -455,8 +455,9 @@ reference.") ;; because Emacs turns C-c C-i into C-c TAB which is hard to type and ;; not mnemonic. "Major mode for editing XML. - +\\ \\[nxml-finish-element] finishes the current element by inserting an end-tag. + C-c C-i closes a start-tag with `>' and then inserts a balancing end-tag leaving point between the start-tag and end-tag. \\[nxml-balanced-close-start-tag-block] is similar but for block rather than inline elements: diff --git a/lisp/nxml/rng-loc.el b/lisp/nxml/rng-loc.el index a38da79422..c8b19e8c22 100644 --- a/lisp/nxml/rng-loc.el +++ b/lisp/nxml/rng-loc.el @@ -501,7 +501,7 @@ saved to the first writable file in `rng-schema-locating-files'." nil (error "Buffer does not have a filename"))) ((and prompt - (not (y-or-n-p (format "Save %s to %s " + (not (y-or-n-p (format "Save %s to %s?" (if type-id "type identifier" "schema location") @@ -539,7 +539,7 @@ saved to the first writable file in `rng-schema-locating-files'." locating-file-uri)))))) (indent-according-to-mode) (when (or (not modified) - (y-or-n-p (format "Save file %s " + (y-or-n-p (format "Save file %s?" (buffer-file-name)))) (save-buffer)))))))) diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el index fca666115a..9df20a16b1 100644 --- a/lisp/nxml/rng-valid.el +++ b/lisp/nxml/rng-valid.el @@ -962,9 +962,8 @@ Return nil at end of buffer, t otherwise." (and type t))) (defun rng-process-start-tag (tag-type) - "TAG-TYPE is `start-tag' for a start-tag, `empty-element' for -an empty element. `partial-empty-element' should be passed -as empty-element." + "TAG-TYPE is `start-tag' for a start-tag, `empty-element' for an empty element. +`partial-empty-element' should be passed as empty-element." (and rng-collecting-text (rng-flush-text)) (setq rng-collecting-text nil) (setq rng-pending-contents nil) diff --git a/lisp/pcmpl-x.el b/lisp/pcmpl-x.el index fd147101b6..d9479edf6a 100644 --- a/lisp/pcmpl-x.el +++ b/lisp/pcmpl-x.el @@ -21,6 +21,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Commentary: + ;;; Code: (eval-when-compile (require 'cl-lib)) diff --git a/lisp/play/5x5.el b/lisp/play/5x5.el index 1d19330629..085c97f5d8 100644 --- a/lisp/play/5x5.el +++ b/lisp/play/5x5.el @@ -387,7 +387,7 @@ Mutate the result." (defun 5x5-crack (breeder) "Attempt to find a solution for 5x5. -5x5-crack takes the argument BREEDER which should be a function that takes +`5x5-crack' takes the argument BREEDER which should be a function that takes two parameters, the first will be a grid vector array that is the current solution and the second will be the best solution so far. The function should return a grid vector array that is the new solution." @@ -474,8 +474,8 @@ position." grid))) (defun 5x5-vec-to-grid (grid-matrix) - "Convert a grid matrix GRID-MATRIX in Calc format to a grid in -5x5 format. See function `5x5-grid-to-vec'." + "Convert a grid matrix GRID-MATRIX in Calc format to a grid in 5x5 format. +See function `5x5-grid-to-vec'." (apply #'vector (mapcar diff --git a/lisp/play/doctor.el b/lisp/play/doctor.el index 9777fc3ea2..b855f7e35a 100644 --- a/lisp/play/doctor.el +++ b/lisp/play/doctor.el @@ -115,7 +115,7 @@ (defun doc// (x) x) (defmacro doc$ (what) - "Quoted arg form of doctor-$." + "Quoted arg form of `doctor-$'." `(doctor-$ ',what)) (defun doctor-$ (what) @@ -1011,7 +1011,7 @@ Put dialogue in buffer." (defun doctor-subjsearch (sent key type) "Search for the subject of a sentence SENT, looking for the noun closest -to and preceding KEY by at least TYPE words. Set global variable doctor-subj to +to and preceding KEY by at least TYPE words. Set global variable `doctor-subj' to the subject noun, and return the portion of the sentence following it." (let ((i (- (length sent) (length (memq key sent)) type))) (while (and (> i -1) (not (doctor-nounp (nth i sent)))) diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index d9acad8e43..706c1be81e 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el @@ -944,8 +944,8 @@ handled specially by 'dun-describe-room.") (list obj-pc) ;; pc-area nil nil nil nil nil nil ) - "These are objects in a room that are only described in the -room description. They are permanent.") + "These are objects in a room that are only described in the room description. +They are permanent.") (defvar dun-inventory '(1)) (defconst dun-objects @@ -1010,8 +1010,7 @@ the inventory.") nil nil ("There is a bus here.") nil nil nil) - "These are the descriptions for the negative numbered objects from -`dun-room-objects'.") + "Descriptions for the negative numbered objects from `dun-room-objects'.") (defconst dun-physobj-desc '( @@ -1216,8 +1215,9 @@ Otherwise short. Also give long if we were called with negative room number." (dun-mprincl "You are on the bus.")))) (defun dun-special-object () - "There is a special object in the room. This object's description, -or lack thereof, depends on certain conditions." + "There is a special object in the room. +This object's description, or lack thereof, depends on certain +conditions." (cond ((= dun-current-room computer-room) (if dun-computer diff --git a/lisp/play/hanoi.el b/lisp/play/hanoi.el index d3d0ad1309..227dd790af 100644 --- a/lisp/play/hanoi.el +++ b/lisp/play/hanoi.el @@ -133,7 +133,7 @@ Repent before ring 31 moves." (defun hanoi-unix-64 () "Like `hanoi-unix', but pretend to have a 64-bit clock. This is, necessarily (as of Emacs 20.3), a crock. When the -current-time interface is made s2G-compliant, hanoi.el will need +`current-time' interface is made s2G-compliant, hanoi.el will need to be updated." (interactive) (let* ((start (ftruncate (float-time))) diff --git a/lisp/play/mpuz.el b/lisp/play/mpuz.el index 5ac1d7c60c..ff174fed6c 100644 --- a/lisp/play/mpuz.el +++ b/lisp/play/mpuz.el @@ -119,7 +119,7 @@ You may abort a game by typing \\\\[mpuz-offer-abort]." ;; Some variables for game tracking ;;--------------------------------- (defvar mpuz-in-progress nil - "True if a game is currently in progress.") + "Non-nil if a game is currently in progress.") (defvar mpuz-found-digits (make-bool-vector 10 nil) "A vector recording which digits have been decrypted.") diff --git a/lisp/play/tetris.el b/lisp/play/tetris.el index f43aa47326..3d6ddd5307 100644 --- a/lisp/play/tetris.el +++ b/lisp/play/tetris.el @@ -620,7 +620,7 @@ Shapes drop from the top of the screen, and the user has to move and rotate the shape to fit in with those at the bottom of the screen so as to form complete rows. -tetris-mode keybindings: +`tetris-mode' keybindings: \\ \\[tetris-start-game] Start a new game of Tetris \\[tetris-end-game] Terminate the current game diff --git a/lisp/printing.el b/lisp/printing.el index 89e49ccb2a..fb718f9aa6 100644 --- a/lisp/printing.el +++ b/lisp/printing.el @@ -1672,7 +1672,7 @@ DEFAULT It's a way to set default values when this entry is selected. (set VARIABLE (eval VALUE)) - Note that VALUE can be any valid lisp expression. So, don't + Note that VALUE can be any valid Lisp expression. So, don't forget to quote symbols and constant lists. If VARIABLE is the special keyword `inherits-from:', VALUE must be a symbol name setting defined in `pr-setting-database' from @@ -1772,8 +1772,7 @@ Useful links: `https://linux.die.net/man/1/lp' * GNU utilities for w32 (cp.exe) - `http://unxutils.sourceforge.net/' -" + `http://unxutils.sourceforge.net/'" :type '(repeat (list :tag "PostScript Printer" @@ -2181,7 +2180,7 @@ DEFAULT It's a way to set default values when this entry is selected. (set (make-local-variable VARIABLE-SYM) (eval VALUE)) - Note that VALUE can be any valid lisp expression. So, don't + Note that VALUE can be any valid Lisp expression. So, don't forget to quote symbols and constant lists. If VARIABLE is the special keyword `inherits-from:', VALUE must be a symbol name setting defined in `pr-setting-database' from @@ -2413,8 +2412,7 @@ Useful links: * GNU Enscript documentation (Windows, GNU or Unix) `https://people.ssh.com/mtr/genscript/enscript.man.html' - (on GNU or Unix, type `man enscript') -" + (on GNU or Unix, type `man enscript')" :type '(repeat (list :tag "PS File Utility" (symbol :tag "Utility Symbol") @@ -4276,7 +4274,7 @@ printed using `pr-ps-mode-ps-print'. Interactively, you have the following situations: - M-x pr-ps-fast-fire RET + \\[pr-ps-fast-fire] The command prompts the user for a N-UP value and printing will immediately be done using the current active printer. diff --git a/lisp/profiler.el b/lisp/profiler.el index 0b456bb3e3..fa74fe8de2 100644 --- a/lisp/profiler.el +++ b/lisp/profiler.el @@ -105,8 +105,8 @@ ;;; Entries (defun profiler-format-entry (entry) - "Format ENTRY in human readable string. ENTRY would be a -function name of a function itself." + "Format ENTRY in human readable string. +ENTRY would be a function name of a function itself." (cond ((memq (car-safe entry) '(closure lambda)) (format "#" (sxhash entry))) ((byte-code-function-p entry) @@ -463,7 +463,7 @@ Optional argument MODE means only check for the specified mode (cpu or mem)." "The current profile.") (defvar-local profiler-report-reversed nil - "True if calltree is rendered in bottom-up. + "Non-nil if calltree is rendered in bottom-up. Do not touch this variable directly.") (defvar-local profiler-report-order nil diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el index f07f18678a..b6805898b0 100644 --- a/lisp/progmodes/cc-bytecomp.el +++ b/lisp/progmodes/cc-bytecomp.el @@ -339,8 +339,8 @@ should be a string. CONDITION should not be quoted." '(progn))) (defmacro cc-provide (feature) - "A replacement for the `provide' form that restores the environment -after the compilation. Don't use within `eval-when-compile'." + "A replacement for `provide' that restores the environment after the compilation. +Don't use within `eval-when-compile'." (declare (debug t)) `(progn (eval-when-compile (cc-bytecomp-restore-environment)) @@ -381,8 +381,9 @@ afterwards. Don't use within `eval-when-compile'." (eval-when-compile (cc-bytecomp-setup-environment)))) (defmacro cc-bytecomp-defvar (var) - "Bind the symbol as a variable during compilation of the file, -to silence the byte compiler. Don't use within `eval-when-compile'." + "Bind the symbol VAR as a variable during compilation of the file. +This can be used to silence the byte compiler. Don't use within +`eval-when-compile'." (declare (debug nil)) `(eval-when-compile (if (boundp ',var) @@ -403,8 +404,9 @@ to silence the byte compiler. Don't use within `eval-when-compile'." "cc-bytecomp-defvar: Covered variable %s" ',var)))))) (defmacro cc-bytecomp-defun (fun) - "Bind the symbol as a function during compilation of the file, -to silence the byte compiler. Don't use within `eval-when-compile'. + "Bind the symbol FUN as a function during compilation of the file. +This can be used to silence the byte compiler. Don't use within +`eval-when-compile'. If the symbol already is bound as a function, it will keep that definition. That means that this macro will not shut up warnings @@ -431,8 +433,8 @@ at compile time, e.g. for macros and inline functions." "cc-bytecomp-defun: Covered function %s" ',fun)))))) (defmacro cc-bytecomp-put (symbol propname value) - "Set a property on a symbol during compilation (and evaluation) of -the file. Don't use outside `eval-when-compile'." + "Set a property on SYMBOL during compilation (and evaluation) of the file. +Don't use outside `eval-when-compile'." (declare (debug t)) `(eval-when-compile (if (not (assoc (cons ,symbol ,propname) cc-bytecomp-original-properties)) @@ -450,9 +452,9 @@ the file. Don't use outside `eval-when-compile'." ,propname ,symbol ,value))) (defmacro cc-bytecomp-boundp (symbol) - "Return non-nil if the given symbol is bound as a variable outside -the compilation. This is the same as using `boundp' but additionally -exclude any variables that have been bound during compilation with + "Return non-nil if SYMBOL is bound as a variable outside the compilation. +This is the same as using `boundp' but additionally exclude any +variables that have been bound during compilation with `cc-bytecomp-defvar'." (declare (debug t)) (if (and (cc-bytecomp-is-compiling) @@ -461,9 +463,9 @@ exclude any variables that have been bound during compilation with `(boundp ,symbol))) (defmacro cc-bytecomp-fboundp (symbol) - "Return non-nil if the given symbol is bound as a function outside -the compilation. This is the same as using `fboundp' but additionally -exclude any functions that have been bound during compilation with + "Return non-nil if SYMBOL is bound as a function outside the compilation. +This is the same as using `fboundp' but additionally exclude any +functions that have been bound during compilation with `cc-bytecomp-defun'." (declare (debug t)) (let (fun-elem) diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 217281b8a2..6c3da667bf 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -5113,8 +5113,9 @@ inside a preprocessor directive." (defun c-context-open-line () "Insert a line break suitable to the context and leave point before it. -This is the `c-context-line-break' equivalent to `open-line', which is -normally bound to C-o. See `c-context-line-break' for the details." +This is the `c-context-line-break' equivalent to `open-line' +\(bound to \\[open-line]). See `c-context-line-break' for the +details." (interactive "*") (let ((here (point))) (unwind-protect diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index be0b40fd6c..12e10c26ee 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -827,9 +827,9 @@ right side of it." ;; impossible to get a feel for how that function works. (defmacro c-go-list-forward (&optional pos limit) - "Move forward across one balanced group of parentheses starting at POS or -point. Return POINT when we succeed, NIL when we fail. In the latter case, -leave point unmoved. + "Move forward across one balanced group of parentheses starting at POS or point. +Return POINT when we succeed, NIL when we fail. In the latter +case, leave point unmoved. A LIMIT for the search may be given. The start position is assumed to be before it." @@ -838,9 +838,9 @@ before it." (when dest (goto-char dest) dest))) (defmacro c-go-list-backward (&optional pos limit) - "Move backward across one balanced group of parentheses starting at POS or -point. Return POINT when we succeed, NIL when we fail. In the latter case, -leave point unmoved. + "Move backward across one balanced group of parentheses starting at POS or point. +Return POINT when we succeed, NIL when we fail. In the latter +case, leave point unmoved. A LIMIT for the search may be given. The start position is assumed to be after it." @@ -2593,7 +2593,7 @@ quoted." (defvar c-lang-constants-under-evaluation nil "Alist of constants in the process of being evaluated. The `cdr' of each entry indicates how far we've looked in the list -of definitions, so that the def for var FOO in c-mode can be defined in +of definitions, so that the def for var FOO in `c-mode' can be defined in terms of the def for that same var FOO (which will then rely on the fallback definition for all modes, to break the cycle).") diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 53c382f018..20cdb72ccf 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -1545,7 +1545,7 @@ comment at the start of cc-engine.el for more info." nil)))))) (defun c-at-statement-start-p () - "Return non-nil if the point is at the first token in a statement + "Return non-nil if point is at the first token in a statement or somewhere in the syntactic whitespace before it. A \"statement\" here is not restricted to those inside code blocks. @@ -1574,7 +1574,7 @@ comment at the start of cc-engine.el for more info." (c-crosses-statement-barrier-p (point) end))))) (defun c-at-expression-start-p () - "Return non-nil if the point is at the first token in an expression or + "Return non-nil if point is at the first token in an expression or statement, or somewhere in the syntactic whitespace before it. An \"expression\" here is a bit different from the normal language @@ -4969,7 +4969,7 @@ out of an enclosing paren." nil)))) (defun c-forward-over-token-and-ws (&optional balanced) - "Move forward over a token and any following whitespace + "Move forward over a token and any following whitespace. Return t if we moved, nil otherwise (i.e. we were at EOB, or a non-token or BALANCED is non-nil and we can't move). If we are at syntactic whitespace, move over this in place of a token. @@ -5384,8 +5384,8 @@ comment at the start of cc-engine.el for more info." (defvar safe-pos-list) ; bound in c-syntactic-skip-backward (defun c-syntactic-skip-backward (skip-chars &optional limit paren-level) - "Like `skip-chars-backward' but only look at syntactically relevant chars, -i.e. don't stop at positions inside syntactic whitespace or string + "Like `skip-chars-backward' but only look at syntactically relevant chars. +This means don't stop at positions inside syntactic whitespace or string literals. Preprocessor directives are also ignored, with the exception of the one that the point starts within, if any. If LIMIT is given, it's assumed to be at a syntactically relevant position. diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 7e7053b98e..bc0ae6cc95 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1765,7 +1765,7 @@ casts and declarations are fontified. Used on level 2 and higher." (> (match-beginning 0) (point-min)) (memq (c-get-char-property (1- (match-beginning 0)) 'face) '(font-lock-comment-face font-lock-string-face - font-lock-comment-delimiter-face)))) + font-lock-comment-delimiter-face)))) (when found (setq open-delim (cons (match-beginning 1) (cons (match-end 1) (match-beginning 2))) diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index b106454b11..36f12369fc 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -4178,8 +4178,7 @@ aliases in Emacs are resolved." (cdr c-emacs-variable-inits)))) (defun c-make-init-lang-vars-fun (mode) - "Create a function that initializes all the language dependent variables -for the given mode. + "Create a function that initializes all language dependent variables for MODE. This function should be evaluated at compile time, so that the function it returns is byte compiled with all the evaluated results diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index c818c1a358..8b30241449 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1648,7 +1648,7 @@ Note that the style variables are always made local to the buffer." (and (memq (char-before) c-string-delims) (not (nth 4 s))))) ; Check we're actually out of the ; comment. not stuck at EOB - (unless + (unless (and c-ml-string-opener-re (c-maybe-re-mark-ml-string)) (if (c-unescaped-nls-in-string-p (1- (point))) diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index dcd9546d9a..8869c56573 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1227,7 +1227,7 @@ can always override the use of `c-default-style' by making calls to ;; Anchor pos: None. )) (defcustom c-offsets-alist nil - "Association list of syntactic element symbols and indentation offsets. + "Alist of syntactic element symbols and indentation offsets. As described below, each cons cell in this list has the form: (SYNTACTIC-SYMBOL . OFFSET) diff --git a/lisp/progmodes/cmacexp.el b/lisp/progmodes/cmacexp.el index 0f7c8c6f31..07648ac623 100644 --- a/lisp/progmodes/cmacexp.el +++ b/lisp/progmodes/cmacexp.el @@ -101,7 +101,7 @@ :type 'boolean) (defcustom c-macro-prompt-flag nil - "Non-nil makes `c-macro-expand' prompt for preprocessor arguments." + "Non-nil means `c-macro-expand' will prompt for preprocessor arguments." :type 'boolean) (defcustom c-macro-preprocessor diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 6b521e8d90..73f9806811 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -687,11 +687,13 @@ matched file names, and weeding out false positives." ,(expand-file-name "compilation.txt" data-directory))) (defvar compilation-error-case-fold-search nil - "If non-nil, use case-insensitive matching of compilation errors -by the regexps of `compilation-error-regexp-alist' and -`compilation-error-regexp-alist-alist'. + "If non-nil, use case-insensitive matching of compilation errors. If nil, matching is case-sensitive. +Compilation errors are given by the regexps in +`compilation-error-regexp-alist' and +`compilation-error-regexp-alist-alist'. + This variable should only be set for backward compatibility as a temporary measure. The proper solution is to use a regexp that matches the messages without case-folding.") diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 634dd29bad..c371a84b9d 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -361,14 +361,14 @@ Affects: `cperl-font-lock', `cperl-electric-lbrace-space', ;; :group 'cperl) (defcustom cperl-info-on-command-no-prompt nil - "Not-nil (and non-null) means not to prompt on C-h f. + "Not-nil (and non-null) means not to prompt on \\[cperl-info-on-command]. The opposite behavior is always available if prefixed with C-c. Can be overwritten by `cperl-hairy' if nil." :type '(choice (const null) boolean) :group 'cperl-affected-by-hairy) (defcustom cperl-clobber-lisp-bindings nil - "Not-nil (and non-null) means not overwrite C-h f. + "Not-nil (and non-null) means not overwrite \\[describe-function]. The function is available on \\[cperl-info-on-command], \\[cperl-get-help]. Can be overwritten by `cperl-hairy' if nil." :type '(choice (const null) boolean) diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el index 6602a79b2a..d800365e66 100644 --- a/lisp/progmodes/cpp.el +++ b/lisp/progmodes/cpp.el @@ -711,8 +711,8 @@ BRANCH should be either nil (false branch), t (true branch) or `both'." default)) (defun cpp-choose-default-face (type) - ;; Choose default face list for screen of TYPE. - ;; Type must be one of the types defined in `cpp-face-type-list'. + "Choose default face list for screen of TYPE. +Type must be one of the types defined in `cpp-face-type-list'." (interactive (list (if cpp-button-event (x-popup-menu cpp-button-event (list "Screen type" @@ -789,7 +789,7 @@ BRANCH should be either nil (false branch), t (true branch) or `both'." (if data (list 'cpp-data data)))))) (defun cpp-push-button (event) - ;; Pushed a CPP button. + "Pushed a CPP button." (interactive "@e") (set-buffer (window-buffer (posn-window (event-start event)))) (let ((pos (posn-point (event-start event)))) diff --git a/lisp/progmodes/dcl-mode.el b/lisp/progmodes/dcl-mode.el index ed024f2434..b74b558f8d 100644 --- a/lisp/progmodes/dcl-mode.el +++ b/lisp/progmodes/dcl-mode.el @@ -494,7 +494,7 @@ Variables controlling indentation style and extra features: These variables control the look of expanded templates. dcl-imenu-generic-expression - Default value for imenu-generic-expression. The default includes + Default value for `imenu-generic-expression'. The default includes SUBROUTINE labels in the main listing and sub-listings for other labels, CALL, GOTO and GOSUB statements. @@ -1463,7 +1463,7 @@ Inserts continuation marks and splits character strings." ;;;------------------------------------------------------------------------- (defun dcl-delete-indentation (&optional arg) - "Join this line to previous like delete-indentation. + "Join this line to previous like `delete-indentation'. Also remove the continuation mark if easily detected." (interactive "*P") (delete-indentation arg) diff --git a/lisp/progmodes/ebnf-yac.el b/lisp/progmodes/ebnf-yac.el index 816cc432d1..84950e45f5 100644 --- a/lisp/progmodes/ebnf-yac.el +++ b/lisp/progmodes/ebnf-yac.el @@ -113,7 +113,7 @@ ;;; YACC-Code = "any C definition". (defun ebnf-yac-parser (start) - "yacc/Bison parser." + "Yacc/Bison parser." (let ((total (+ (- ebnf-limit start) 1)) (bias (1- start)) (origin (point)) diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index 3f2c9b7148..f9e6101e7a 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el @@ -65,8 +65,8 @@ ;; the variable f90-comment-region in every line of the region. ;; One common convention for free vs. fixed format is that free format -;; files have the ending .f90 or .f95 while fixed format files have -;; the ending .f. Emacs automatically loads Fortran files in the +;; files have the ending ".f90" or ".f95" while fixed format files have +;; the ending ".f". Emacs automatically loads Fortran files in the ;; appropriate mode based on extension. You can modify this by ;; adjusting the variable `auto-mode-alist'. ;; For example: @@ -984,7 +984,7 @@ Used in the F90 entry in `hs-special-modes-alist'.") ;; FIXME trivial to extend this to enum. Worth it? (defun f90-imenu-type-matcher () "Search backward for the start of a derived type. -Set subexpression 1 in the match-data to the name of the type." +Set subexpression 1 in the `match-data' to the name of the type." (let (found) (while (and (re-search-backward "^[ \t0-9]*type[ \t]*" nil t) (not (setq found diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index e8ce0e723e..9418debe5e 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -559,7 +559,7 @@ Currently accepted REPORT-KEY arguments are: (put :warning 'flymake-category 'flymake-warning) (put :note 'flymake-category 'flymake-note) -(defvar flymake-diagnostic-types-alist '() "") +(defvar flymake-diagnostic-types-alist '()) (make-obsolete-variable 'flymake-diagnostic-types-alist "Set properties on the diagnostic symbols instead. See Info @@ -1329,7 +1329,7 @@ default) no filter is applied." ;;; Mode-line and menu ;;; -(easy-menu-define flymake-menu flymake-mode-map "Flymake" +(easy-menu-define flymake-menu flymake-mode-map "Flymake menu." '("Flymake" [ "Go to next problem" flymake-goto-next-error t ] [ "Go to previous problem" flymake-goto-prev-error t ] diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 902466e4fe..3e5b8e2f32 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -467,8 +467,8 @@ GDB session needs to be restarted for this setting to take effect." ;; TODO Some commands can't be called with --all (give a notice about ;; it in setting doc) (defcustom gdb-gud-control-all-threads t - "When non-nil, GUD execution commands affect all threads when -in non-stop mode. Otherwise, only current thread is affected." + "When non-nil, GUD execution commands affect all threads when in non-stop mode. +Otherwise, only current thread is affected." :type 'boolean :group 'gdb-non-stop :version "23.2") @@ -1483,7 +1483,7 @@ INDENT is the current indentation depth." (expr (nth 1 var)) (children (nth 2 var))) (if (or (<= (string-to-number children) gdb-max-children) (y-or-n-p - (format "%s has %s children. Continue? " expr children))) + (format "%s has %s children. Continue?" expr children))) (gdb-var-list-children token)))) ((string-search "-" text) ;contract this node (dolist (var gdb-var-list) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index d7f4582dd0..ec2850737c 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -72,7 +72,7 @@ SYMBOL should be one of `grep-command', `grep-template', Some grep programs are able to surround matches with special markers in grep output. Such markers can be used to highlight matches in grep mode. This requires `font-lock-mode' to be active -in grep buffers, so if you have globally disabled font-lock-mode, +in grep buffers, so if you have globally disabled `font-lock-mode', you will not get highlighting. This option sets the environment variable GREP_COLORS to specify @@ -137,7 +137,7 @@ The following place holders should be present in the string: - file names and wildcards to search. - file names and wildcards to exclude. - the regular expression searched for. - - place to insert null-device. + - place to insert `null-device'. In interactive usage, the actual value of this variable is set up by `grep-compute-defaults'; to change the default value, use diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index b2557587c6..e2ad480281 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -62,7 +62,7 @@ ;; activated or deactivated, `hs-minor-mode-hook' is run w/ `run-hooks'. ;; ;; Additionally, Joseph Eydelnant writes: -;; I enjoy your package hideshow.el Ver. 5.24 2001/02/13 +;; I enjoy your package hideshow.el Version 5.24 2001/02/13 ;; a lot and I've been looking for the following functionality: ;; toggle hide/show all with a single key. ;; Here are a few lines of code that lets me do just that. diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index 36f8a6d6b6..d6828eeffb 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -5316,7 +5316,7 @@ directories and save the routine info. (defun idlwave-delete-user-catalog-file (&rest _ignore) (if (yes-or-no-p - (format "Delete file %s " idlwave-user-catalog-file)) + (format "Delete file %s?" idlwave-user-catalog-file)) (progn (delete-file idlwave-user-catalog-file) (message "%s has been deleted" idlwave-user-catalog-file)))) diff --git a/lisp/progmodes/opascal.el b/lisp/progmodes/opascal.el index 51c888d25f..e55b09d8fc 100644 --- a/lisp/progmodes/opascal.el +++ b/lisp/progmodes/opascal.el @@ -51,7 +51,7 @@ :group 'languages) (defconst opascal-debug nil - "True if in debug mode.") + "Non-nil if in debug mode.") (define-obsolete-variable-alias 'delphi-search-path 'opascal-search-path "24.4") @@ -1732,7 +1732,8 @@ comment block. If not in a // comment, just does a normal newline." (define-obsolete-function-alias 'delphi-mode #'opascal-mode "24.4") ;;;###autoload (define-derived-mode opascal-mode prog-mode "OPascal" - "Major mode for editing OPascal code.\\ + "Major mode for editing OPascal code. +\\ \\[opascal-find-unit]\t- Search for a OPascal source file. \\[opascal-fill-comment]\t- Fill the current comment. \\[opascal-new-comment-line]\t- If in a // comment, do a new comment line. diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 7f70e02b72..6c09dcf881 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -127,7 +127,7 @@ which case it will be used to compose the new symbol as per the third argument of `compose-region'.") (defun prettify-symbols-default-compose-p (start end _match) - "Return true iff the symbol MATCH should be composed. + "Return non-nil iff the symbol MATCH should be composed. The symbol starts at position START and ends at position END. This is the default for `prettify-symbols-compose-predicate' which is suitable for most programming languages such as C or Lisp." @@ -145,7 +145,7 @@ which is suitable for most programming languages such as C or Lisp." "A predicate for deciding if the currently matched symbol is to be composed. The matched symbol is the car of one entry in `prettify-symbols-alist'. The predicate receives the match's start and end positions as well -as the match-string as arguments.") +as the `match-string' as arguments.") (defun prettify-symbols--compose-symbol (alist) "Compose a sequence of characters into a symbol. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 2eead0d069..9b63f4b1bc 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1033,8 +1033,8 @@ command \\[fileloop-continue]." (defun project-query-replace-regexp (from to) "Query-replace REGEXP in all the files of the project. Stops when a match is found and prompts for whether to replace it. -If you exit the query-replace, you can later continue the query-replace -loop using the command \\[fileloop-continue]." +If you exit the `query-replace', you can later continue the +`query-replace' loop using the command \\[fileloop-continue]." (interactive (pcase-let ((`(,from ,to) (query-replace-read-args "Query replace (regexp)" t t))) diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index d47bb8bcb9..dabf9c479e 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -414,7 +414,7 @@ wherever possible, since it is slow." ;; "----" ["MB" nil :help "Help MB"])) (defun verilog-define-abbrev-table (tablename definitions &optional docstring &rest props) - "Filter `define-abbrev-table' TABLENAME DEFINITIONS + "Filter `define-abbrev-table' TABLENAME DEFINITIONS. Provides DOCSTRING PROPS in newer Emacs (23.1)." (condition-case nil (apply #'define-abbrev-table tablename definitions docstring props) @@ -13380,7 +13380,7 @@ Typing \\[verilog-auto] will call my-verilog-insert-hello and expand the above into: /*AUTOINSERTLISP(my-verilog-insert-hello \"world\")*/ - // Beginning of automatic insert lisp + // Beginning of automatic insert Lisp initial $write(\"hello world\"); // End of automatics diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index fef7dff65e..fc0d406f73 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -2197,8 +2197,8 @@ is pair matching KEY." (setq alist alist-cdr))))) (defun vhdl-aget (alist key) - "Return the value in ALIST that is associated with KEY. If KEY is -not found, then nil is returned." + "Return the value in ALIST that is associated with KEY. +If KEY is not found, then nil is returned." (cdr (assoc key alist))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -4275,8 +4275,7 @@ STRING are replaced by `-' and substrings are converted to lower case." (defvar vhdl-sources-menu nil) (defun vhdl-directory-files (directory &optional full match) - "Call `directory-files' if DIRECTORY exists, otherwise generate error -message." + "Call `directory-files' if DIRECTORY exists, otherwise generate error message." (if (not (file-directory-p directory)) (vhdl-warning-when-idle "No such directory: \"%s\"" directory) (let ((dir (directory-files directory full match))) @@ -5734,8 +5733,8 @@ the offset is simply returned." (save-excursion (re-search-forward "\\\\" (vhdl-point 'eol) t))))) (defun vhdl-forward-comment (&optional direction) - "Skip all comments (including whitespace). Skip backwards if DIRECTION is -negative, skip forward otherwise." + "Skip all comments (including whitespace). +Skip backwards if DIRECTION is negative, skip forward otherwise." (interactive "p") (if (and direction (< direction 0)) ;; skip backwards @@ -6912,9 +6911,9 @@ previous libunit keyword)." (concat vhdl-case-alternative-re "\\|" vhdl-case-header-key)) (defun vhdl-skip-case-alternative (&optional lim) - "Skip forward over case/when bodies, with optional maximal -limit. If no next case alternative is found, nil is returned and -point is not moved." + "Skip forward over case/when bodies, with optional maximal limit. +If no next case alternative is found, nil is returned and point +is not moved." (let ((lim (or lim (point-max))) (here (point)) donep foundp) @@ -6939,9 +6938,8 @@ point is not moved." foundp)) (defun vhdl-backward-skip-label (&optional lim) - "Skip backward over a label, with optional maximal -limit. If label is not found, nil is returned and point -is not moved." + "Skip backward over a label, with optional maximal limit. +If label is not found, nil is returned and point is not moved." (let ((lim (or lim (point-min))) placeholder) (if (save-excursion @@ -6955,9 +6953,8 @@ is not moved." )) (defun vhdl-forward-skip-label (&optional lim) - "Skip forward over a label, with optional maximal -limit. If label is not found, nil is returned and point -is not moved." + "Skip forward over a label, with optional maximal limit. +If label is not found, nil is returned and point is not moved." (let ((lim (or lim (point-max)))) (if (looking-at vhdl-label-key) (progn @@ -7327,9 +7324,9 @@ after the containing paren which starts the arglist." (- ce-curcol cs-curcol -1)))) (defun vhdl-lineup-comment (_langelem) - "Support old behavior for comment indentation. We look at -vhdl-comment-only-line-offset to decide how to indent comment -only-lines." + "Support old behavior for comment indentation. +We look at `vhdl-comment-only-line-offset' to decide how to +indent comment only-lines." (save-excursion (back-to-indentation) ;; at or to the right of comment-column @@ -7445,7 +7442,7 @@ else indent `correctly'." (setq this-command 'vhdl-electric-tab))) (defun vhdl-electric-return () - "newline-and-indent or indent-new-comment-line if in comment and preceding + "`newline-and-indent' or `indent-new-comment-line' if in comment and preceding character is a space." (interactive) (if (and (= (preceding-char) ? ) (vhdl-in-comment-p)) @@ -7456,8 +7453,8 @@ character is a space." (newline-and-indent))) (defun vhdl-indent-line () - "Indent the current line as VHDL code. Returns the amount of -indentation change." + "Indent the current line as VHDL code. +Return the amount of indentation change." (interactive) (let* ((syntax (and vhdl-indent-syntax-based (vhdl-get-syntactic-context))) (pos (- (point-max) (point))) @@ -7617,8 +7614,8 @@ ALIGN-PATTERN matches the white space to be expanded/contracted.") ;; Align code (defvar vhdl-align-try-all-clauses t - "If REGEXP is not found on the first line of the region that clause -is ignored. If this variable is non-nil, then the clause is tried anyway.") + "If REGEXP is not found on the first line of the region that clause is ignored. +If this variable is non-nil, then the clause is tried anyway.") (defun vhdl-do-group (function &optional spacing) "Apply FUNCTION on group of lines between empty lines." @@ -7637,8 +7634,7 @@ is ignored. If this variable is non-nil, then the clause is tried anyway.") (funcall function beg end spacing))) (defun vhdl-do-list (function &optional spacing) - "Apply FUNCTION to the lines of a list surrounded by a balanced group of -parentheses." + "Apply FUNCTION to lines of a list surrounded by a balanced group of parentheses." (let (beg end) (save-excursion ;; search for beginning of balanced group of parentheses @@ -7683,11 +7679,11 @@ parentheses." (funcall function beg end spacing))) (defun vhdl-align-region-1 (begin end &optional spacing alignment-list _indent) - "Attempt to align a range of lines based on the content of the -lines. The definition of `alignment-list' determines the matching -order and the manner in which the lines are aligned. If ALIGNMENT-LIST -is not specified `vhdl-align-alist' is used. If INDENT is non-nil, -indentation is done before aligning." + "Attempt to align a range of lines based on the content of the lines. +The definition of `alignment-list' determines the matching order +and the manner in which the lines are aligned. If ALIGNMENT-LIST +is not specified `vhdl-align-alist' is used. If INDENT is +non-nil, indentation is done before aligning." (interactive "r\np") (setq alignment-list (or alignment-list vhdl-align-alist)) (setq spacing (or spacing 1)) @@ -11070,7 +11066,7 @@ Point is left between them." ;; Help functions (defun vhdl-electric-space (count) - "Expand abbreviations and self-insert space(s), do indent-new-comment-line + "Expand abbreviations and self-insert space(s), do `indent-new-comment-line' if in comment and past end-comment-column." (interactive "p") (cond ((vhdl-in-comment-p) @@ -11619,8 +11615,7 @@ but not if inside a comment or quote." string))) (defun vhdl-paste-group-comment (string indent) - "Paste comment and empty lines from STRING between groups of lines -with INDENT." + "Paste comment and empty lines from STRING between groups of lines with INDENT." (let ((pos (point-marker))) (when (> indent 0) (while (string-match "^\\(--\\)" string) @@ -14919,7 +14914,8 @@ if required." (setq project-alist (cdr project-alist))))) (defun vhdl-speedbar-insert-project-hierarchy (project indent &optional rescan) - "Insert hierarchy of PROJECT. Rescan directories if RESCAN is non-nil, + "Insert hierarchy of PROJECT. +Rescan directories if optional argument RESCAN is non-nil, otherwise use cached data." (when (or rescan (and (not (assoc project vhdl-file-alist)) (not (vhdl-load-cache project)))) @@ -14937,7 +14933,8 @@ otherwise use cached data." (vhdl-speedbar-expand-units project)) (defun vhdl-speedbar-insert-dir-hierarchy (directory depth &optional rescan) - "Insert hierarchy of DIRECTORY. Rescan directory if RESCAN is non-nil, + "Insert hierarchy of DIRECTORY. +Rescan directory if optional argument RESCAN is non-nil, otherwise use cached data." (when (or rescan (and (not (assoc directory vhdl-file-alist)) (not (vhdl-load-cache directory)))) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 69cabd0b5a..772e6646d9 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -760,7 +760,7 @@ references displayed in the current *xref* buffer." (defun xref--outdated-p (item) "Check that the match location at current position is up-to-date. -ITEMS is an xref item which " +ITEMS is an xref item which " ; FIXME: Expand documentation. ;; FIXME: The check should most likely be a generic function instead ;; of the assumption that all matches' summaries relate to the ;; buffer text in a particular way. diff --git a/lisp/rect.el b/lisp/rect.el index 504be41b67..d288adfbaf 100644 --- a/lisp/rect.el +++ b/lisp/rect.el @@ -202,8 +202,8 @@ rectangles, as conses of the form (WIDTH . HEIGHT)." (<= (+ y2 h2) y1))))) (defun rectangle-dimensions (start end) - "Return the dimensions of the rectangle with corners at START -and END. The returned value has the form of (WIDTH . HEIGHT)." + "Return the dimensions of the rectangle with corners at START and END. +The returned value has the form of (WIDTH . HEIGHT)." (save-excursion (let* ((height (1+ (abs (- (line-number-at-pos end) (line-number-at-pos start))))) diff --git a/lisp/repeat.el b/lisp/repeat.el index 0b761fff1e..ee9e14b515 100644 --- a/lisp/repeat.el +++ b/lisp/repeat.el @@ -218,7 +218,7 @@ recently executed command not bound to an input event\"." ((null last-repeatable-command) (error "There is nothing to repeat")) ((eq last-repeatable-command 'mode-exit) - (error "last-repeatable-command is mode-exit & can't be repeated")) + (error "`last-repeatable-command' is `mode-exit' and can't be repeated")) ((memq last-repeatable-command repeat-too-dangerous) (error "Command %S too dangerous to repeat automatically" last-repeatable-command))) diff --git a/lisp/replace.el b/lisp/replace.el index e4155d4c27..84ec042f45 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -63,7 +63,7 @@ it will match any sequence matched by the regexp `search-whitespace-regexp'." :version "24.3") (defvar query-replace-history nil - "Default history list for query-replace commands. + "Default history list for `query-replace' commands. See `query-replace-from-history-variable' and `query-replace-to-history-variable'.") @@ -202,7 +202,7 @@ by this function to the end of values available via (car (symbol-value query-replace-from-history-variable))))) (defun query-replace-read-from (prompt regexp-flag) - "Query and return the `from' argument of a query-replace operation. + "Query and return the `from' argument of a `query-replace' operation. Prompt with PROMPT. REGEXP-FLAG non-nil means the response should be a regexp. The return value can also be a pair (FROM . TO) indicating that the user wants to replace FROM with TO." @@ -326,8 +326,9 @@ the original string if not." (defun query-replace-read-to (from prompt regexp-flag) - "Query and return the `to' argument of a query-replace operation. -Prompt with PROMPT. REGEXP-FLAG non-nil means the response should a regexp." + "Query and return the `to' argument of a `query-replace' operation. +Prompt with PROMPT. REGEXP-FLAG non-nil means the response +should a regexp." (query-replace-compile-replacement (save-excursion (let* ((history-add-new-input nil) @@ -1300,7 +1301,7 @@ See `occur-revert-function'.") (defcustom occur-mode-find-occurrence-hook nil "Hook run by Occur after locating an occurrence. This will be called with the cursor position at the occurrence. An application -for this is to reveal context in an outline-mode when the occurrence is hidden." +for this is to reveal context in an outline mode when the occurrence is hidden." :type 'hook :group 'matching) @@ -2606,7 +2607,7 @@ passed in. If LITERAL is set, no checking is done, anyway." noedit) (defvar replace-update-post-hook nil - "Function(s) to call after query-replace has found a match in the buffer.") + "Function(s) to call after `query-replace' has found a match in the buffer.") (defvar replace-search-function nil "Function to use when searching for strings to replace. diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el index a0d4f6e96c..84c9d06ece 100644 --- a/lisp/ruler-mode.el +++ b/lisp/ruler-mode.el @@ -348,7 +348,7 @@ nothing is dragged.") (defun ruler-mode-text-scaled-width (width) "Compute scaled text width according to current font scaling. Convert a width of char units into a text-scaled char width units, -Ex. `window-hscroll'." +for example `window-hscroll'." (/ (* width (frame-char-width)) (default-font-width))) (defun ruler-mode-text-scaled-window-hscroll () diff --git a/lisp/server.el b/lisp/server.el index 5dd30db195..6359a76199 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1078,7 +1078,7 @@ The following commands are accepted by the client: `-suspend' Suspend this terminal, i.e., stop the client process. - Sent when the user presses C-z." + Sent when the user presses \\[suspend-frame]." (server-log (concat "Received " string) proc) ;; First things first: let's check the authentication (unless (process-get proc :authenticated) diff --git a/lisp/ses.el b/lisp/ses.el index 9250f7ede0..ea966295b1 100644 --- a/lisp/ses.el +++ b/lisp/ses.el @@ -299,11 +299,11 @@ Used for listing local printers or renamed cells.") ses-center-span ses-dashfill ses-dashfill-span ses-tildefill-span ses-prin1) - "List of print functions to be included in initial history of -printer functions. None of these standard-printer functions, -except function `ses-prin1', is suitable for use as a column -printer or a global-default printer because they invoke the -column or default printer and then modify its output.") + "List of print functions to be included in initial history of printer functions. +None of these standard-printer functions, except function +`ses-prin1', is suitable for use as a column printer or a +global-default printer because they invoke the column or default +printer and then modify its output.") ;;---------------------------------------------------------------------------- diff --git a/lisp/shell.el b/lisp/shell.el index 5cdc0385a6..b575024e01 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -517,7 +517,8 @@ Shell buffers. It implements `shell-completion-execonly' for (put 'shell-mode 'mode-class 'special) (define-derived-mode shell-mode comint-mode "Shell" - "Major mode for interacting with an inferior shell.\\ + "Major mode for interacting with an inferior shell. +\\ \\[comint-send-input] after the end of the process' output sends the text from the end of process to the end of the current line. \\[comint-send-input] before end of process output copies the current line minus the prompt to diff --git a/lisp/simple.el b/lisp/simple.el index 1267c92fe5..298e3ea5ee 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -241,7 +241,7 @@ all other buffers." (defun next-error-buffer-on-selected-frame (&optional _avoid-current extra-test-inclusive extra-test-exclusive) - "Return a single visible next-error buffer on the selected frame." + "Return a single visible `next-error' buffer on the selected frame." (let ((window-buffers (delete-dups (delq nil (mapcar (lambda (w) @@ -2133,21 +2133,23 @@ or (if one of MODES is a minor mode), if it is switched on in BUFFER." command-names))) (defcustom suggest-key-bindings t - "Non-nil means show the equivalent key-binding when M-x command has one. + "Non-nil means show the equivalent keybinding when \ +\\[execute-extended-command] has one. The value can be a length of time to show the message for. If the value is non-nil and not a number, we wait 2 seconds. Also see `extended-command-suggest-shorter'. Equivalent key-bindings are also shown in the completion list of -M-x for all commands that have them." +\\[execute-extended-command] for all commands that have them." :group 'keyboard :type '(choice (const :tag "off" nil) (integer :tag "time" 2) (other :tag "on"))) (defcustom extended-command-suggest-shorter t - "If non-nil, show a shorter M-x invocation when there is one. + "If non-nil, show a shorter \\[execute-extended-command] invocation \ +when there is one. Also see `suggest-key-bindings'." :group 'keyboard @@ -3522,7 +3524,7 @@ with < or <= based on USE-<." ;; called or in some cases on a timer called after a change is made in ;; any buffer. (defvar-local undo-auto--last-boundary-cause nil - "Describe the cause of the last undo-boundary. + "Describe the cause of the last `undo-boundary'. If `explicit', the last boundary was caused by an explicit call to `undo-boundary', that is one not called by the code in this @@ -9817,11 +9819,13 @@ warning using STRING as the message.") The argument `COMMAND' should be a symbol. -Running `M-x COMMAND RET' for the first time prompts for which +Running `\\[execute-extended-command] COMMAND RET' for \ +the first time prompts for which alternative to use and records the selected command as a custom variable. -Running `C-u M-x COMMAND RET' prompts again for an alternative +Running `\\[universal-argument] \\[execute-extended-command] COMMAND RET' \ +prompts again for an alternative and overwrites the previous choice. The variable `COMMAND-alternatives' contains an alist with diff --git a/lisp/so-long.el b/lisp/so-long.el index 65570bf253..c975384ddb 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -492,7 +492,7 @@ ;; considered internal-use only (with `global-so-long-mode' the interface ;; for enabling or disabling the automated behaviour). FIXME: Establish a ;; way to support the original use-case, or rename to `so-long--enabled'. - "Internal use. Non-nil when any so-long functionality has been used.") + "Internal use. Non-nil when any `so-long' functionality has been used.") (defvar-local so-long--active nil ; internal use "Non-nil when `so-long' mitigations are in effect.") @@ -1100,7 +1100,7 @@ This command calls `so-long' with the selected action as an argument.") ;;;###autoload (defun so-long-commentary () - "View the so-long library's documentation in `outline-mode'." + "View the `so-long' library's documentation in `outline-mode'." (interactive) (let ((buf "*So Long: Commentary*")) (when (buffer-live-p (get-buffer buf)) @@ -1862,14 +1862,14 @@ invoked." ;;;###autoload (defun so-long-enable () - "Enable the so-long library's functionality. + "Enable the `so-long' library's functionality. Equivalent to calling (global-so-long-mode 1)" (interactive) (global-so-long-mode 1)) (defun so-long-disable () - "Disable the so-long library's functionality. + "Disable the `so-long' library's functionality. Equivalent to calling (global-so-long-mode 0)" (interactive) diff --git a/lisp/sort.el b/lisp/sort.el index be373fba99..d6767ed509 100644 --- a/lisp/sort.el +++ b/lisp/sort.el @@ -507,7 +507,8 @@ Use \\[untabify] to convert tabs to spaces before sorting." (setq col-start (min col-beg1 col-end1)) (setq col-end (max col-beg1 col-end1)) (if (search-backward "\t" beg1 t) - (error "sort-columns does not work with tabs -- use M-x untabify")) + (error (substitute-command-keys + "sort-columns does not work with tabs -- use \\[untabify]"))) (if (not (or (memq system-type '(windows-nt)) (let ((pos beg1) plist fontified) (catch 'found diff --git a/lisp/subr.el b/lisp/subr.el index 0793cbca5e..a6434bf28a 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -22,6 +22,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Commentary: + ;;; Code: ;; declare-function's args use &rest, not &optional, for compatibility diff --git a/lisp/tempo.el b/lisp/tempo.el index 25f54af3c9..b722cc04ca 100644 --- a/lisp/tempo.el +++ b/lisp/tempo.el @@ -445,7 +445,7 @@ never prompted." ;;; tempo-is-user-element (defun tempo-is-user-element (element) - "Tries all the user-defined element handlers in `tempo-user-elements'." + "Try all the user-defined element handlers in `tempo-user-elements'." ;; Sigh... I need (some list) (catch 'found (mapc (lambda (handler) diff --git a/lisp/term.el b/lisp/term.el index d3d0218857..af93089104 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -340,7 +340,7 @@ (defvar term-home-marker) ; Marks the "home" position for cursor addressing. (defvar term-saved-home-marker nil "When using alternate sub-buffer, -contains saved term-home-marker from original sub-buffer.") +contains saved `term-home-marker' from original sub-buffer.") (defvar term-start-line-column 0 "(current-column) at start of screen line, or nil if unknown.") (defvar term-current-column 0 "If non-nil, is cache for (current-column).") @@ -377,7 +377,7 @@ are not allowed.") (defvar term-scroll-with-delete nil "If t, forward scrolling should be implemented by delete to top-most line(s); and if nil, scrolling should be implemented -by moving term-home-marker. It is set to t if there is a +by moving `term-home-marker'. It is set to t if there is a \(non-default) scroll-region OR the alternate buffer is used.") (defvar term-pending-delete-marker) ; New user input in line mode ; needs to be deleted, because it gets echoed by the inferior. @@ -669,7 +669,7 @@ Do not change it directly; use `term-set-escape-char' instead.") "Keymap used in Term pager mode.") (defvar term-ptyp t - "True if communications via pty; false if by pipe. Buffer local. + "Non-nil if communications via pty; false if by pipe. Buffer local. This is to work around a bug in Emacs process signaling.") (defvar term-last-input-match "" @@ -1228,8 +1228,7 @@ Entry to this mode runs the hooks on `term-mode-hook'." (process-send-string proc chars)))) (defun term-send-raw () - "Send the last character typed through the terminal-emulator -without any interpretation." + "Send last typed character to the terminal-emulator without any interpretation." (interactive) (let ((keys (this-command-keys))) (term-send-raw-string (string (aref keys (1- (length keys))))))) @@ -1401,8 +1400,8 @@ Called as a buffer-local `read-only-mode-hook' function." (force-mode-line-update)) (defun term-check-proc (buffer) - "True if there is a process associated w/buffer BUFFER, and it -is alive. BUFFER can be either a buffer or the name of one." + "Non-nil if there is a process associated w/buffer BUFFER, and it is alive. +BUFFER can be either a buffer or the name of one." (let ((proc (get-buffer-process buffer))) (and proc (memq (process-status proc) '(run stop open listen connect))))) @@ -1538,7 +1537,7 @@ Using \"emacs\" loses, because bash disables editing if $TERM == emacs.") Some other integer if Bash is new or not in use. Nil if unknown.") (defun term--bash-needs-EMACSp () - "t if Bash is old, nil if it is new or not in use." + "Return t if Bash is old, nil if it is new or not in use." (eq 43 (or term--bash-needs-EMACS-status (setf @@ -2107,17 +2106,17 @@ The values of `term-get-old-input', `term-input-filter-functions', and in the buffer. E.g., If the interpreter is the csh, - term-get-old-input is the default: take the current line, discard any - initial string matching regexp term-prompt-regexp. - term-input-filter-functions monitors input for \"cd\", \"pushd\", and + `term-get-old-input' is the default: take the current line, discard any + initial string matching regexp `term-prompt-regexp'. + `term-input-filter-functions' monitors input for \"cd\", \"pushd\", and \"popd\" commands. When it sees one, it cd's the buffer. - term-input-filter is the default: returns t if the input isn't all white + `term-input-filter' is the default: returns t if the input isn't all white space. If the term is Lucid Common Lisp, - term-get-old-input snarfs the sexp ending at point. - term-input-filter-functions does nothing. - term-input-filter returns nil if the input matches input-filter-regexp, + `term-get-old-input' snarfs the sexp ending at point. + `term-input-filter-functions' does nothing. + `term-input-filter' returns nil if the input matches input-filter-regexp, which matches (1) all whitespace (2) :a, :c, etc. Similarly for Soar, Scheme, etc." @@ -2403,8 +2402,7 @@ Useful if you accidentally suspend the top-level process." (kill-region pmark (point))))) (defun term-delchar-or-maybe-eof (arg) - "Delete ARG characters forward, or send an EOF to process if at end of -buffer." + "Delete ARG characters forward, or send an EOF to process if at end of buffer." (interactive "p") (if (eobp) (process-send-eof) @@ -3171,7 +3169,7 @@ See `term-prompt-regexp'." Set in `pre-command-hook' in char mode by `term-set-goto-process-mark'.") (defun term-set-goto-process-mark () - "Sets `term-goto-process-mark'. + "Set `term-goto-process-mark'. Always set to nil if `term-char-mode-point-at-process-mark' is nil. @@ -3430,7 +3428,7 @@ option is enabled. See `term-set-goto-process-mark'." (t))) (defun term--reset-scroll-region () - "Sets the scroll region to the full height of the terminal." + "Set the scroll region to the full height of the terminal." (term-set-scroll-region 0 (term--last-line))) (defun term-set-scroll-region (top bottom) @@ -3793,7 +3791,7 @@ all pending output has been dealt with.")) (defun term-erase-in-display (kind) "Erase (that is blank out) part of the window. -If KIND is 0, erase from (point) to (point-max); +If KIND is 0, erase from point to point-max; if KIND is 1, erase from home to point; else erase from home to point-max." (term-handle-deferred-scroll) (cond ((eq kind 0) diff --git a/lisp/textmodes/bib-mode.el b/lisp/textmodes/bib-mode.el index e2fd3ecaa4..a429aae7f7 100644 --- a/lisp/textmodes/bib-mode.el +++ b/lisp/textmodes/bib-mode.el @@ -137,7 +137,7 @@ with the cdr.") (defcustom bib-auto-capitalize t - "True to automatically capitalize appropriate fields in Bib mode." + "Non-nil to automatically capitalize appropriate fields in Bib mode." :type 'boolean) (defconst bib-capitalized-fields "%[AETCBIJR]") diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 9b3211df57..1d450b5001 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -1861,7 +1861,7 @@ is itself incorrect, but suspiciously repeated." ;;* flyspell-highlight-duplicate-region ... */ ;;*---------------------------------------------------------------------*/ (defun flyspell-highlight-duplicate-region (beg end poss) - "Set up an overlay on a duplicate misspelled word, in the buffer from BEG to END. + "Set up overlay on duplicate misspelled word, in the buffer from BEG to END. POSS is a list of possible spelling/correction lists, as returned by `ispell-parse-output'." (let ((inhibit-read-only t)) diff --git a/lisp/textmodes/makeinfo.el b/lisp/textmodes/makeinfo.el index 13367a09bc..6b9b3f3e9d 100644 --- a/lisp/textmodes/makeinfo.el +++ b/lisp/textmodes/makeinfo.el @@ -175,10 +175,9 @@ command to gain use of `next-error'." 'makeinfo-compilation-sentinel-region))))))) (defun makeinfo-next-error (_arg _reset) - "This function is used to disable `next-error' if the user has -used `makeinfo-region'. Since the compilation process is used on -a temporary file in that case, calling `next-error' would give -nonsensical results." + "This is used to disable `next-error' if the user has used `makeinfo-region'. +Since the compilation process is used on a temporary file in that +case, calling `next-error' would give nonsensical results." (error "Use `makeinfo-buffer' to gain use of the `next-error' command")) ;; Actually run makeinfo. COMMAND is the command to run. If diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el index 2590538568..936732153a 100644 --- a/lisp/textmodes/mhtml-mode.el +++ b/lisp/textmodes/mhtml-mode.el @@ -19,6 +19,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Commentary: + ;;; Code: (eval-when-compile (require 'cl-lib)) diff --git a/lisp/textmodes/refill.el b/lisp/textmodes/refill.el index 0a0e4cc444..b2ebbd5f37 100644 --- a/lisp/textmodes/refill.el +++ b/lisp/textmodes/refill.el @@ -153,7 +153,7 @@ regardless of the number of after-change calls from commands doing complex processing.") (defun refill-after-change-function (_beg end _len) - "Function for `after-change-functions' which just sets `refill-doit'." + "Set `refill-doit'. Used by `after-change-functions'." (unless undo-in-progress (setq refill-doit end))) diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el index abcf119fb8..ee26d911a5 100644 --- a/lisp/textmodes/reftex-dcr.el +++ b/lisp/textmodes/reftex-dcr.el @@ -32,14 +32,17 @@ ;;;###autoload (defun reftex-view-crossref (&optional arg auto-how fail-quietly) - "View cross reference of macro at point. Point must be on the KEY -argument. When at a `\\ref' macro, show corresponding `\\label' -definition, also in external documents (`xr'). When on a label, show -a locations where KEY is referenced. Subsequent calls find additional -locations. When on a `\\cite', show the associated `\\bibitem' macro or -the BibTeX database entry. When on a `\\bibitem', show a `\\cite' macro -which uses this KEY. When on an `\\index', show other locations marked -by the same index entry. + "View cross reference of macro at point. + +Point must be on the KEY argument. When at a `\\ref' macro, show +corresponding `\\label' definition, also in external +documents (`xr'). When on a label, show a locations where KEY is +referenced. Subsequent calls find additional locations. When on +a `\\cite', show the associated `\\bibitem' macro or the BibTeX +database entry. When on a `\\bibitem', show a `\\cite' macro +which uses this KEY. When on an `\\index', show other locations +marked by the same index entry. + To define additional cross referencing items, use the option `reftex-view-crossref-extra'. See also `reftex-view-crossref-from-bibtex'. With one or two \\[universal-argument] prefixes, enforce rescanning of the document. diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el index 3b7518e5c3..cc8b3244b9 100644 --- a/lisp/textmodes/reftex-global.el +++ b/lisp/textmodes/reftex-global.el @@ -338,17 +338,17 @@ Also checks if buffers visiting the files are in read-only mode." (while (setq file (pop files)) (unless (file-exists-p file) (ding) - (or (y-or-n-p (format "No such file %s. Continue? " file)) + (or (y-or-n-p (format "No such file %s. Continue?" file)) (error "Abort"))) (unless (file-writable-p file) (ding) - (or (y-or-n-p (format "No write access to %s. Continue? " file)) + (or (y-or-n-p (format "No write access to %s. Continue?" file)) (error "Abort"))) (when (and (setq buf (find-buffer-visiting file)) (with-current-buffer buf buffer-read-only)) (ding) - (or (y-or-n-p (format "Buffer %s is read-only. Continue? " + (or (y-or-n-p (format "Buffer %s is read-only. Continue?" (buffer-name buf))) (error "Abort")))))) diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el index 423c5398dd..9d9eab4d7b 100644 --- a/lisp/textmodes/reftex-index.el +++ b/lisp/textmodes/reftex-index.el @@ -934,8 +934,8 @@ When index is restricted, select the previous section as restriction criterion." (t nil)))) (defun reftex-index-analyze-entry (data) - ;; This splits the index context so that key, attribute and visual - ;; values are accessible individually. + "Split index context so that key, attribute and visual +values are accessible individually." (interactive) (let* ((arg (nth 5 data)) (context (nth 2 data)) diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el index 9def10cee0..c521a07f19 100644 --- a/lisp/textmodes/reftex-parse.el +++ b/lisp/textmodes/reftex-parse.el @@ -435,7 +435,8 @@ This function also makes sure the old toc markers do not point anywhere." ;;;###autoload (defun reftex-section-info (file) "Return a section entry for the current match. -Careful: This function expects the match-data to be still in place!" +Careful: This function expects the `match-data' to still be in +place!" (let* ((marker (set-marker (make-marker) (1- (match-beginning 3)))) (macro (reftex-match-string 3)) (prefix (save-match-data @@ -494,7 +495,8 @@ will rescan the entire document." ;;;###autoload (defun reftex-index-info (file) "Return an index entry for the current match. -Careful: This function expects the match-data to be still in place!" +Careful: This function expects the `match-data' to still be in +place!" (catch 'exit (let* ((macro (reftex-match-string 10)) (bom (match-beginning 10)) diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el index 23f2193501..d57a767855 100644 --- a/lisp/textmodes/reftex-vars.el +++ b/lisp/textmodes/reftex-vars.el @@ -330,7 +330,8 @@ select the nearest entry with the correct new level." "The maximum level of toc entries which will be included in the TOC. Section headings with a bigger level will be ignored. In RefTeX, chapters are level 1, sections are level 2 etc. -This variable can be changed from within the *toc* buffer with the `t' key." +This variable can be changed from within the *toc* buffer with \ +\\\\[reftex-toc-max-level]." :group 'reftex-table-of-contents-browser :type 'integer) @@ -1208,7 +1209,7 @@ path." :type '(repeat (file))) (defcustom reftex-sort-bibtex-matches 'reverse-year - "Sorting of the entries found in BibTeX databases by reftex-citation. + "Sorting of the entries found in BibTeX databases by `reftex-citation'. Possible values: nil Do not sort entries. `author' Sort entries by author name. @@ -1364,7 +1365,7 @@ should return the string to insert into the buffer." :type '(choice (const nil) function)) (defcustom reftex-select-bib-mode-hook nil - "Mode hook for reftex-select-bib-mode." + "Mode hook for `reftex-select-bib-mode'." :group 'reftex-citation-support :type 'hook) @@ -1840,7 +1841,7 @@ upon the variable `reftex-initialize-temporary-buffers'." (defcustom reftex-initialize-temporary-buffers nil "Non-nil means do initializations even when visiting file temporarily. -When nil, RefTeX may turn off find-file hooks and other stuff to briefly +When nil, RefTeX may turn off `find-file' hooks and other stuff to briefly visit a file. When t, the full default initializations are done (find-file-hook etc.). Instead of t or nil, this variable may also be a list of hook functions to diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el index 604a67df32..550994cd7b 100644 --- a/lisp/textmodes/texinfmt.el +++ b/lisp/textmodes/texinfmt.el @@ -932,9 +932,9 @@ commands." "Text of the copyright notice and copying permissions.") (defun texinfo-copying () - "Copy the copyright notice and copying permissions from the Texinfo file, -as indicated by the @copying ... @end copying command; -insert the text with the @insertcopying command." + "Copy the copyright notice and copying permissions from Texinfo file. +This is indicated by the \"@copying ... @end copying\" command; +insert the text with the \"@insertcopying\" command." (let ((beg (progn (beginning-of-line) (point))) (end (progn (re-search-forward "^@end copying[ \t]*\n") (point)))) (setq texinfo-copying-text @@ -944,8 +944,8 @@ insert the text with the @insertcopying command." (delete-region beg end))) (defun texinfo-insertcopying () - "Insert the copyright notice and copying permissions from the Texinfo file, -which are indicated by the @copying ... @end copying command." + "Insert the copyright notice and copying permissions from Texinfo file. +This is indicated by the \"@copying ... @end copying\" command." (insert (concat "\n" texinfo-copying-text))) (put 'begin 'texinfo-format 'texinfo-format-begin) @@ -2546,7 +2546,9 @@ If used within a line, follow `@bullet' with braces." "smalllisp" "\\)") "Regexp specifying end of environments in which @kbd does not put `...' -around argument. (See `texinfo-format-kbd-regexp')") +around argument. + +See `texinfo-format-kbd-regexp'.") (put 'kbd 'texinfo-format 'texinfo-format-kbd) (defun texinfo-format-kbd () diff --git a/lisp/transient.el b/lisp/transient.el index 2be82f56d8..f3d3902a77 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -1289,8 +1289,8 @@ variable instead.") (defvar transient--exitp nil "Whether to exit the transient.") (defvar transient--showp nil "Whether the transient is show in a popup buffer.") -(defvar transient--helpp nil "Whether help-mode is active.") -(defvar transient--editp nil "Whether edit-mode is active.") +(defvar transient--helpp nil "Whether `help-mode' is active.") +(defvar transient--editp nil "Whether `edit-mode' is active.") (defvar transient--active-infix nil "The active infix awaiting user input.") diff --git a/lisp/wdired.el b/lisp/wdired.el index eafb50cc18..eb5a638556 100644 --- a/lisp/wdired.el +++ b/lisp/wdired.el @@ -453,7 +453,7 @@ non-nil means return old filename." (remove-function (local 'revert-buffer-function) #'wdired-revert)) (defun wdired-abort-changes () - "Abort changes and return to dired mode." + "Abort changes and return to `dired-mode'." (interactive) (remove-hook 'before-change-functions #'wdired--before-change-fn t) (let ((inhibit-read-only t)) @@ -689,7 +689,7 @@ Optional arguments are ignored." ;; FIXME: Can't we use the normal mechanism for that? --Stef (if (and (buffer-modified-p) - (not (y-or-n-p "Buffer changed. Discard changes and kill buffer?"))) + (not (y-or-n-p "Buffer changed. Discard changes and kill buffer?"))) (error "Error"))) ;; Added to after-change-functions in wdired-change-to-wdired-mode to diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 59d3249c5d..e193be6cdd 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -565,8 +565,8 @@ Used when `whitespace-style' includes the value `space-before-tab'.") (defvar whitespace-indentation 'whitespace-indentation - "Symbol face used to visualize `tab-width' or more SPACEs at beginning of -line. Used when `whitespace-style' includes the value `indentation'.") + "Symbol face used to visualize `tab-width' or more SPACEs at beginning of line. +Used when `whitespace-style' includes the value `indentation'.") (make-obsolete-variable 'whitespace-indentation "use the face instead." "24.4") (defface whitespace-indentation @@ -2353,7 +2353,7 @@ Also refontify when necessary." (defun whitespace-display-vector-p (vec) - "Return true if every character in vector VEC can be displayed." + "Return non-nil if every character in vector VEC can be displayed." (let ((i (length vec))) (when (> i 0) (while (and (>= (setq i (1- i)) 0) diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 9a34dc8d43..ab358da7e3 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -190,7 +190,7 @@ the contents of strings." (buffer-enable-undo)) (defcustom widget-menu-max-size 40 - "Largest number of items allowed in a popup-menu. + "Largest number of items allowed in a popup menu. Larger menus are read through the minibuffer." :group 'widgets :type 'integer) @@ -202,9 +202,8 @@ For a larger number of items, the minibuffer is used." :type 'integer) (defcustom widget-menu-minibuffer-flag nil - "Control how to ask for a choice from the keyboard. -Non-nil means use the minibuffer; -nil means read a single character." + "Non-nil means use the minibuffer; to ask for a choice from the keyboard. +If nil, read a single character." :group 'widgets :type 'boolean) diff --git a/lisp/woman.el b/lisp/woman.el index fe9f8969c3..1ca4d5e871 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -1790,7 +1790,7 @@ Argument EVENT is the invoking mouse event." ;; That comment was moved after the symbol `woman-menu' to make ;; find-function-search-for-symbol work. -- rost woman-mode-map - "WoMan Menu" + "WoMan Menu." `("WoMan" ["WoMan..." woman t] ; [NAME CALLBACK ENABLE] "--" @@ -2182,7 +2182,7 @@ To be called on original buffer and any .so insertions." ;; variable. zsoelim is always run as the very first preprocessor. (defvar woman-emulate-tbl nil - "True if WoMan should emulate the tbl preprocessor. + "Non-nil if WoMan should emulate the tbl preprocessor. This applies to text between .TE and .TS directives. Currently set only from \\='\\\" t in the first line of the source file.") commit 7f06fe894cabf8f33e10386d6adb5d2ce9481a25 Author: Dmitry Gutov Date: Wed Sep 22 21:07:49 2021 +0300 Put './' in the project directory completions * lisp/progmodes/project.el (project--read-file-cpd-relative): Put './' in the completions set when cpd was in the original (bug#50732). diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index ebd21d4b60..2eead0d069 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -887,7 +887,13 @@ by the user at will." (prompt (if (zerop cpd-length) prompt (concat prompt (format " in %s" common-parent-directory)))) + (included-cpd (when (member common-parent-directory all-files) + (setq all-files + (delete common-parent-directory all-files)) + t)) (substrings (mapcar (lambda (s) (substring s cpd-length)) all-files)) + (_ (when included-cpd + (setq substrings (cons "./" substrings)))) (new-collection (project--file-completion-table substrings)) (res (project--completing-read-strict prompt new-collection commit 8816d67c6102876aa09ea7dcb1d0c0541a4315a8 Author: Eli Zaretskii Date: Wed Sep 22 20:45:47 2021 +0300 ; Fix recently added documentation * lisp/thingatpt.el (bounds-of-thing-at-mouse, thing-at-mouse): Improve and clarify the doc strings. diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 6670857df1..58ef2cfd91 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -189,8 +189,8 @@ a symbol as a valid THING." ;;;###autoload (defun bounds-of-thing-at-mouse (event thing) - "Determine the start and end locations for the THING at mouse click. -Like `bounds-of-thing-at-point', but tries to use the EVENT + "Determine start and end locations for THING at mouse click given by EVENT. +Like `bounds-of-thing-at-point', but tries to use the position in EVENT where the mouse button is clicked to find the thing nearby." (save-excursion (mouse-set-point event) @@ -198,8 +198,8 @@ where the mouse button is clicked to find the thing nearby." ;;;###autoload (defun thing-at-mouse (event thing &optional no-properties) - "Return the THING at mouse click. -Like `thing-at-point', but tries to use the EVENT + "Return the THING at mouse click specified by EVENT. +Like `thing-at-point', but tries to use the position in EVENT where the mouse button is clicked to find the thing nearby." (save-excursion (mouse-set-point event) commit ac6afe9c3386c126b819ff8447b04329ec4b4204 Author: Juri Linkov Date: Wed Sep 22 20:08:45 2021 +0300 Many improvements for Context Menus (bug#9054) * lisp/menu-bar.el (menu-bar-showhide-menu): Add "Context Menus". * lisp/mouse.el (context-menu-undo): Add "in Region" to the titles when the region is active. (context-menu-region): Use 'mouse-yank-from-menu' in menu items created from 'yank-menu' for submenu "Paste from Kill Menu". (context-menu-region): Add submenu "Select" with things to mark. (mark-thing-at-mouse, mouse-yank-from-menu): New functions. * lisp/thingatpt.el (bounds-of-thing-at-mouse): New function. * lisp/progmodes/elisp-mode.el (elisp-context-menu): * lisp/progmodes/prog-mode.el (prog-context-menu): Use full symbol/identifier names in :help strings. Suggested by Martin Rudalics diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index d863f34df1..07f7beb92c 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1315,6 +1315,11 @@ mail status in mode line")) :visible (and (display-graphic-p) (fboundp 'x-show-tip)) :button (:toggle . tooltip-mode))) + (bindings--define-key menu [showhide-context-menu] + '(menu-item "Context Menus" context-menu-mode + :help "Turn mouse-3 context menus on/off" + :button (:toggle . context-menu-mode))) + (bindings--define-key menu [menu-bar-mode] '(menu-item "Menu Bar" toggle-menu-bar-mode-from-frame :help "Turn menu bar on/off" diff --git a/lisp/mouse.el b/lisp/mouse.el index f33a73f03f..edac5085ff 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -418,16 +418,16 @@ Some context functions add menu items below the separator." (listp pending-undo-list) (consp buffer-undo-list))) (define-key-after menu [undo] - '(menu-item "Undo" undo + `(menu-item ,(if (region-active-p) "Undo in Region" "Undo") undo :help "Undo last edits"))) (when (and (not buffer-read-only) (undo--last-change-was-undo-p buffer-undo-list)) (define-key-after menu [undo-redo] - '(menu-item "Redo" undo-redo + `(menu-item (if undo-in-region "Redo in Region" "Redo") undo-redo :help "Redo last undone edits"))) menu) -(defun context-menu-region (menu _click) +(defun context-menu-region (menu click) "Populate MENU with region commands." (define-key-after menu [separator-region] menu-bar-separator) (when (and mark-active (not buffer-read-only)) @@ -455,21 +455,52 @@ Some context functions add menu items below the separator." `(menu-item "Paste" mouse-yank-at-click :help "Paste (yank) text most recently cut/copied"))) (when (and (cdr yank-menu) (not buffer-read-only)) - (define-key-after menu (if (featurep 'ns) [select-paste] - [paste-from-menu]) - ;; ns-win.el said: Change text to be more consistent with - ;; surrounding menu items `paste', etc." - `(menu-item ,(if (featurep 'ns) "Select and Paste" "Paste from Kill Menu") - yank-menu - :help "Choose a string from the kill ring and paste it"))) + (let ((submenu (make-sparse-keymap (propertize "Paste from Kill Menu")))) + (dolist (item yank-menu) + (when (consp item) + (define-key-after submenu (vector (car item)) + `(menu-item ,(cadr item) + ,(lambda () (interactive) + (mouse-yank-from-menu click (car item))))))) + (define-key-after menu (if (featurep 'ns) [select-paste] [paste-from-menu]) + `(menu-item ,(if (featurep 'ns) "Select and Paste" "Paste from Kill Menu") + ,submenu + :help "Choose a string from the kill ring and paste it")))) (when (and mark-active (not buffer-read-only)) (define-key-after menu [clear] '(menu-item "Clear" delete-active-region :help "Delete text in region between mark and current position"))) - (define-key-after menu [mark-whole-buffer] - '(menu-item "Select All" mark-whole-buffer - :help "Mark the whole buffer for a subsequent cut/copy")) + + (let ((submenu (make-sparse-keymap (propertize "Select")))) + (define-key-after submenu [mark-whole-buffer] + `(menu-item "All" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'buffer)) + :help "Mark the whole buffer for a subsequent cut/copy")) + (define-key-after submenu [mark-line] + `(menu-item "Line" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'line)) + :help "Mark the line at click for a subsequent cut/copy")) + (define-key-after submenu [mark-defun] + `(menu-item "Defun" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'defun)) + :help "Mark the defun at click for a subsequent cut/copy")) + (define-key-after submenu [mark-list] + `(menu-item "List" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'list)) + :help "Mark the list at click for a subsequent cut/copy")) + (define-key-after submenu [mark-symbol] + `(menu-item "Symbol" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'symbol)) + :help "Mark the symbol at click for a subsequent cut/copy")) + (when (region-active-p) + (define-key-after submenu [mark-none] + `(menu-item "None" + ,(lambda (_e) (interactive "e") (deactivate-mark)) + :help "Deactivate the region"))) + + (define-key-after menu [select-region] + `(menu-item "Select" ,submenu))) menu) (defun context-menu-ffap (menu click) @@ -517,6 +548,26 @@ This is the keyboard interface to \\[context-menu-map]." (global-set-key [S-f10] 'context-menu-open) +(defun mark-thing-at-mouse (click thing) + "Activate the region around THING found near the mouse CLICK." + (let ((bounds (bounds-of-thing-at-mouse click thing))) + (when bounds + (goto-char (if mouse-select-region-move-to-beginning + (car bounds) (cdr bounds))) + (push-mark (if mouse-select-region-move-to-beginning + (cdr bounds) (car bounds)) + t 'activate)))) + +(defun mouse-yank-from-menu (click string) + "Insert STRING at mouse CLICK." + ;; Give temporary modes such as isearch a chance to turn off. + (run-hooks 'mouse-leave-buffer-hook) + (when select-active-regions + (deactivate-mark)) + (or mouse-yank-at-point (mouse-set-point click)) + (push-mark) + (insert string)) + ;; Commands that operate on windows. diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index ce45de7f6c..0b2395d976 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -158,22 +158,13 @@ All commands in `lisp-mode-shared-map' are inherited by this map.") (when (thing-at-mouse click 'symbol) (define-key-after menu [elisp-separator] menu-bar-separator 'middle-separator) - (define-key-after menu [info-lookup-symbol] - '(menu-item "Look up in Manual" - (lambda (click) (interactive "e") - (info-lookup-symbol - (intern (thing-at-mouse click 'symbol t)))) - :help "Display definition in relevant manual") - 'elisp-separator) + (let* ((string (thing-at-mouse click 'symbol t)) (symbol (when (stringp string) (intern string))) (title (cond ((not (symbolp symbol)) nil) ((and (facep symbol) (not (fboundp symbol))) "Face") - ((and (fboundp symbol) (boundp symbol) - (memq symbol minor-mode-list)) - "Mode") ((and (fboundp symbol) (not (or (boundp symbol) (facep symbol)))) "Function") @@ -183,11 +174,17 @@ All commands in `lisp-mode-shared-map' are inherited by this map.") ((or (fboundp symbol) (boundp symbol) (facep symbol)) "Symbol")))) (when title + (define-key-after menu [info-lookup-symbol] + `(menu-item "Look up in Manual" + (lambda (_click) (interactive "e") + (info-lookup-symbol ',symbol)) + :help ,(format "Find `%s' in relevant manual" symbol)) + 'elisp-separator) (define-key-after menu [describe-symbol] `(menu-item (format "Describe %s" ,title) (lambda (_click) (interactive "e") (describe-symbol ',symbol)) - :help "Display the full documentation of symbol") + :help ,(format "Display the documentation of `%s'" symbol)) 'elisp-separator)))) menu) diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 88d55a647c..7f70e02b72 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -48,27 +48,26 @@ (require 'xref) (define-key-after menu [prog-separator] menu-bar-separator 'middle-separator) - (when (not (xref-marker-stack-empty-p)) + + (unless (xref-marker-stack-empty-p) (define-key-after menu [xref-pop] '(menu-item "Back Definition" xref-pop-marker-stack :help "Back to the position of the last search") 'prog-separator)) - (when (save-excursion - (mouse-set-point click) - (xref-backend-identifier-at-point - (xref-find-backend))) - (define-key-after menu [xref-find-ref] - '(menu-item "Find References" xref-find-references-at-mouse - :help "Find references to identifier") - 'prog-separator)) - (when (save-excursion - (mouse-set-point click) - (xref-backend-identifier-at-point - (xref-find-backend))) - (define-key-after menu [xref-find-def] - '(menu-item "Find Definition" xref-find-definitions-at-mouse - :help "Find definition of identifier") - 'prog-separator)) + + (let ((identifier (save-excursion + (mouse-set-point click) + (xref-backend-identifier-at-point + (xref-find-backend))))) + (when identifier + (define-key-after menu [xref-find-ref] + `(menu-item "Find References" xref-find-references-at-mouse + :help ,(format "Find references to `%s'" identifier)) + 'prog-separator) + (define-key-after menu [xref-find-def] + `(menu-item "Find Definition" xref-find-definitions-at-mouse + :help ,(format "Find definition of `%s'" identifier)) + 'prog-separator))) menu) (defvar prog-mode-map diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 0af6d56ccc..6670857df1 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -151,15 +151,6 @@ positions of the thing found." (if (and (<= real-beg orig) (<= orig end) (< real-beg end)) (cons real-beg end)))))))))) -;;;###autoload -(defun thing-at-mouse (event thing &optional no-properties) - "Return the THING at mouse click. -Like `thing-at-point', but tries to use the event -where the mouse button is clicked to find a thing nearby." - (save-excursion - (mouse-set-point event) - (thing-at-point thing no-properties))) - ;;;###autoload (defun thing-at-point (thing &optional no-properties) "Return the THING at point. @@ -196,6 +187,24 @@ a symbol as a valid THING." (set-text-properties 0 (length text) nil text)) text))) +;;;###autoload +(defun bounds-of-thing-at-mouse (event thing) + "Determine the start and end locations for the THING at mouse click. +Like `bounds-of-thing-at-point', but tries to use the EVENT +where the mouse button is clicked to find the thing nearby." + (save-excursion + (mouse-set-point event) + (bounds-of-thing-at-point thing))) + +;;;###autoload +(defun thing-at-mouse (event thing &optional no-properties) + "Return the THING at mouse click. +Like `thing-at-point', but tries to use the EVENT +where the mouse button is clicked to find the thing nearby." + (save-excursion + (mouse-set-point event) + (thing-at-point thing no-properties))) + ;; Go to beginning/end (defun beginning-of-thing (thing) commit 2386b085268af9c06aebc5c4aced1aa6a0d3f702 Author: Eli Zaretskii Date: Wed Sep 22 19:13:49 2021 +0300 Fix build with native compilation but without zlib * src/comp.c (comp_hash_source_file): Condition code that requires zlib with HAVE_ZLIB. * etc/NEWS: Explain that '--without-compress-install' is necessary when configuring with native compilation but without zlib. diff --git a/etc/NEWS b/etc/NEWS index c18952d238..f273b8e82a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -31,6 +31,11 @@ and also requires GCC and Binutils to be available when Lisp code is natively compiled. See the Info node "(elisp) Native Compilation" for more details. +If you build Emacs with native compilation, but without zlib, be sure +to configure with the '--without-compress-install' option, so that the +installed *.el files are not compressed; otherwise, you will not be +able to use JIT native compilation of the installed *.el files. + ** The Cairo graphics library is now used by default if present. '--with-cairo' is now the default, if the appropriate development files are found by 'configure'. Note that building with Cairo means using diff --git a/src/comp.c b/src/comp.c index e9635f219f..bc1adcf4e2 100644 --- a/src/comp.c +++ b/src/comp.c @@ -705,6 +705,12 @@ comp_hash_source_file (Lisp_Object filename) /* Can't use Finsert_file_contents + Fbuffer_hash as this is called by Fcomp_el_to_eln_filename too early during bootstrap. */ bool is_gz = suffix_p (filename, ".gz"); +#ifndef HAVE_ZLIB + if (is_gz) + xsignal2 (Qfile_notify_error, + build_string ("Cannot natively compile compressed *.el files without zlib support"), + filename); +#endif Lisp_Object encoded_filename = ENCODE_FILE (filename); FILE *f = emacs_fopen (SSDATA (encoded_filename), is_gz ? "rb" : "r"); @@ -713,9 +719,13 @@ comp_hash_source_file (Lisp_Object filename) Lisp_Object digest = make_uninit_string (MD5_DIGEST_SIZE * 2); +#ifdef HAVE_ZLIB int res = is_gz ? md5_gz_stream (f, SSDATA (digest)) : md5_stream (f, SSDATA (digest)); +#else + int res = md5_stream (f, SSDATA (digest)); +#endif fclose (f); if (res) commit eb42c4b099c171e46baf4b579fb921d49d032f2d Author: Wilson Snyder Date: Wed Sep 22 10:19:57 2021 -0400 verilog-mode.el: Enable lexical binding, and merge from upstream. * lisp/progmodes/verilog-mode.el: Enable lexical binding. Templates that used the never-documented `inst' or `submod' variables may need to change to use vl-... variables. (verilog-at-constraint-p): Fix indentation on double curly brackets (#1719) (#1744). Reported by Nikolay Puzanov. diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index 75d2ea649d..d47bb8bcb9 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -1,4 +1,4 @@ -;;; verilog-mode.el --- major mode for editing verilog source in Emacs +;;; verilog-mode.el --- major mode for editing verilog source in Emacs -*- lexical-binding: t; -*- ;; Copyright (C) 1996-2021 Free Software Foundation, Inc. @@ -9,7 +9,7 @@ ;; Keywords: languages ;; The "Version" is the date followed by the decimal rendition of the Git ;; commit hex. -;; Version: 2021.09.16.045775504 +;; Version: 2021.09.22.045357537 ;; Yoni Rabkin contacted the maintainer of this ;; file on 19/3/2008, and the maintainer agreed that when a bug is @@ -124,7 +124,7 @@ ;; ;; This variable will always hold the version number of the mode -(defconst verilog-mode-version "2021-09-16-2ba7a90-vpo-GNU" +(defconst verilog-mode-version "2021-09-22-2b419e1-vpo-GNU" "Version of this Verilog mode.") (defconst verilog-mode-release-emacs t "If non-nil, this version of Verilog mode was released with Emacs itself.") @@ -4759,7 +4759,7 @@ More specifically, after a generate and before an endgenerate." (while (and (/= nest 0) (verilog-re-search-backward - "\\<\\(module\\)\\|\\(connectmodule\\)\\|\\(generate\\)\\|\\(endgenerate\\)\\>" nil 'move) + "\\<\\(module\\)\\|\\(connectmodule\\)\\|\\(generate\\)\\|\\(endgenerate\\)\\|\\(if\\)\\|\\(case\\)\\|\\(for\\)\\>" nil 'move) (cond ((match-end 1) ; module - we have crawled out (throw 'done 1)) @@ -4768,7 +4768,13 @@ More specifically, after a generate and before an endgenerate." ((match-end 3) ; generate (setq nest (1- nest))) ((match-end 4) ; endgenerate - (setq nest (1+ nest)))))))) + (setq nest (1+ nest))) + ((match-end 5) ; if + (setq nest (1- nest))) + ((match-end 6) ; case + (setq nest (1- nest))) + ((match-end 7) ; for + (setq nest (1- nest)))))))) (= nest 0) )) ; return nest (defun verilog-in-fork-region-p () @@ -6588,7 +6594,7 @@ Return >0 for nested struct." (equal (char-before) ?\;) (equal (char-before) ?\})) ;; skip what looks like bus repetition operator {#{ - (not (string-match "^{\\s-*[0-9a-zA-Z_]+\\s-*{" (buffer-substring p (point))))))))) + (not (string-match "^{\\s-*[\\(\\)0-9a-zA-Z_]*\\s-*{" (buffer-substring p (point))))))))) (progn (let ( (pt (point)) (pass 0)) (verilog-backward-ws&directives) @@ -11575,6 +11581,7 @@ See the example in `verilog-auto-inout-modport'." (defun verilog-auto-inst-port-map (_port-st) nil) +;; These are used by user's AUTO_TEMPLATE Lisp expressions (defvar vl-cell-type nil "See `verilog-auto-inst'.") ; Prevent compile warning (defvar vl-cell-name nil "See `verilog-auto-inst'.") ; Prevent compile warning (defvar vl-memory nil "See `verilog-auto-inst'.") ; Prevent compile warning commit 6ad77d36fd3f1a0080157c2064932e100ba6ad88 Author: Mattias Engdegård Date: Wed Sep 22 15:40:29 2021 +0200 Don't rely on lexical-binding being nil in tests * test/lisp/button-tests.el (button--help-echo-form): * test/lisp/files-tests.el (files-tests-permanent-local-variables): Remove assumption that `with-temp-buffer` creates a buffer where `lexical-binding` is nil. diff --git a/test/lisp/button-tests.el b/test/lisp/button-tests.el index e0944afa34..2f5ad795df 100644 --- a/test/lisp/button-tests.el +++ b/test/lisp/button-tests.el @@ -59,6 +59,7 @@ "Test `button--help-echo' with forms." (with-temp-buffer ;; Test text property buttons with dynamic scoping. + (setq lexical-binding nil) (let* ((help (make-symbol "help")) (form `(funcall (let ((,help "lexical form")) (lambda () ,help)))) diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index aa5150b4b7..b283a512a4 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -154,12 +154,14 @@ form.") (ert-deftest files-tests-permanent-local-variables () (let ((enable-local-variables nil)) (with-temp-buffer + (setq lexical-binding nil) (insert ";;; test-test.el --- tests -*- lexical-binding: t; -*-\n\n") (hack-local-variables) (should (eq lexical-binding t)))) (let ((enable-local-variables nil) (permanently-enabled-local-variables nil)) (with-temp-buffer + (setq lexical-binding nil) (insert ";;; test-test.el --- tests -*- lexical-binding: t; -*-\n\n") (hack-local-variables) (should (eq lexical-binding nil))))) commit 8213729c9353530a917ed10356b5f8c0802f6720 Author: Eli Zaretskii Date: Wed Sep 22 16:03:39 2021 +0300 ; * .gitignore: Add native-lisp/. diff --git a/.gitignore b/.gitignore index 7e0cbb0bd3..e49e970d09 100644 --- a/.gitignore +++ b/.gitignore @@ -143,6 +143,7 @@ src/gl-stamp core core.*[0-9] gmon.out +native-lisp/ oo/ oo-spd/ src/*.map commit 959d647568427219102cff17613cfbd4d516f9ef Author: Eli Zaretskii Date: Wed Sep 22 16:01:30 2021 +0300 Doc string fixes in comp.e * src/comp.c (Fcomp_el_to_eln_filename) (Fcomp_el_to_eln_rel_filename): Doc fix. diff --git a/src/comp.c b/src/comp.c index fbf6a3c670..e9635f219f 100644 --- a/src/comp.c +++ b/src/comp.c @@ -4041,7 +4041,13 @@ make_directory_wrapper_1 (Lisp_Object ignore) DEFUN ("comp-el-to-eln-rel-filename", Fcomp_el_to_eln_rel_filename, Scomp_el_to_eln_rel_filename, 1, 1, 0, - doc: /* Return the corresponding .eln relative filename. */) + doc: /* Return the relative name of the .eln file for FILENAME. +FILENAME must exist, and if it's a symlink, the target must exist. +If FILENAME is compressed, it must have the \".gz\" extension, +and Emacs must have been compiled with zlib; the file will be +uncompressed on the fly to hash its contents. +Value includes the original base name, followed by 2 hash values, +one for the file name and another for its contents, followed by .eln. */) (Lisp_Object filename) { CHECK_STRING (filename); @@ -4126,10 +4132,22 @@ DEFUN ("comp-el-to-eln-rel-filename", Fcomp_el_to_eln_rel_filename, DEFUN ("comp-el-to-eln-filename", Fcomp_el_to_eln_filename, Scomp_el_to_eln_filename, 1, 2, 0, - doc: /* Return the .eln filename for source FILENAME to used -for new compilations. -If BASE-DIR is non-nil use it as a base directory, look for a suitable -directory in `comp-eln-load-path' otherwise. */) + doc: /* Return the absolute .eln file name for source FILENAME. +The resulting .eln file name is intended to be used for natively +compiling FILENAME. FILENAME must exist and be readable, but other +than that, its leading directories are ignored when constructing +the name of the .eln file. +If BASE-DIR is non-nil, use it as the directory for the .eln file; +non-absolute BASE-DIR is interpreted as relative to `invocation-directory'. +If BASE-DIR is omitted or nil, look for the first writable directory +in `native-comp-eln-load-path', and use as BASE-DIR its subdirectory +whose name is given by `comp-native-version-dir'. +If FILENAME specifies a preloaded file, the directory for the .eln +file is the \"preloaded/\" subdirectory of the directory determined +as described above. FILENAME is considered to be a preloaded file if +the value of `comp-file-preloaded-p' is non-nil, or if FILENAME +appears in the value of the environment variable LISP_PRELOADED; +the latter is supposed to be used by the Emacs build procedure. */) (Lisp_Object filename, Lisp_Object base_dir) { Lisp_Object source_filename = filename; @@ -4707,7 +4725,7 @@ helper_PSEUDOVECTOR_TYPEP_XUNTAG (Lisp_Object a, enum pvec_type code) } -/* `comp-eln-load-path' clean-up support code. */ +/* `native-comp-eln-load-path' clean-up support code. */ static Lisp_Object all_loaded_comp_units_h; @@ -4722,7 +4740,7 @@ return_nil (Lisp_Object arg) /* Windows does not let us delete a .eln file that is currently loaded by a process. The strategy is to rename .eln files into .old.eln instead of removing them when this is not possible and clean-up - `comp-eln-load-path' when exiting. + `native-comp-eln-load-path' when exiting. Any error is ignored because it may be due to the file being loaded in another Emacs instance. */ @@ -4850,7 +4868,7 @@ maybe_defer_native_compilation (Lisp_Object function_name, /**************************************/ /* Fixup the system eln-cache directory, which is the last entry in - `comp-eln-load-path'. Argument is a .eln file in that directory. */ + `native-comp-eln-load-path'. Argument is a .eln file in that directory. */ void fixup_eln_load_path (Lisp_Object eln_filename) { commit 7973227f67cd8ea4a1ed590ebc279b34ece86c12 Author: Eli Zaretskii Date: Wed Sep 22 10:07:25 2021 +0300 Update comments warning about GC-resistant C programming * src/eval.c: Remove an outdated comment about protection from GC. * src/buffer.h: * src/lisp.h: Add warnings about using 'char *' pointers to text of Lisp strings and buffer text in code that could GC. Reported by Po Lu diff --git a/src/buffer.h b/src/buffer.h index 24e9c3fcbc..8623bed08e 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -60,6 +60,14 @@ enum { BEG = 1, BEG_BYTE = BEG }; /* Macros for the addresses of places in the buffer. */ +/* WARNING: Use the 'char *' pointers to buffer text with care in code + that could GC: GC can relocate buffer text, invalidating such + pointers. It is best to use character or byte position instead, + delaying the access through BYTE_POS_ADDR etc. pointers to the + latest possible moment. If you must use the 'char *' pointers + (e.g., for speed), be sure to adjust them after any call that could + potentially GC. */ + /* Address of beginning of buffer. */ #define BEG_ADDR (current_buffer->text->beg) @@ -1002,6 +1010,9 @@ SET_BUF_PT_BOTH (struct buffer *buf, ptrdiff_t charpos, ptrdiff_t byte) or convert between a byte position and an address. These functions do not check that the position is in range. */ +/* See the important WARNING above about using the 'char *' pointers + returned by these functions. */ + /* Return the address of byte position N in current buffer. */ INLINE unsigned char * diff --git a/src/eval.c b/src/eval.c index 76fe671b6d..2bb7cfe600 100644 --- a/src/eval.c +++ b/src/eval.c @@ -364,9 +364,6 @@ do_debug_on_call (Lisp_Object code, ptrdiff_t count) call_debugger (list1 (code)); } -/* NOTE!!! Every function that can call EVAL must protect its args - and temporaries from garbage collection while it needs them. - The definition of `For' shows what you have to do. */ DEFUN ("or", For, Sor, 0, UNEVALLED, 0, doc: /* Eval args until one of them yields non-nil, then return that value. diff --git a/src/lisp.h b/src/lisp.h index 720e621d19..09e0b8e9bd 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1555,6 +1555,14 @@ STRING_MULTIBYTE (Lisp_Object str) /* Convenience functions for dealing with Lisp strings. */ +/* WARNING: Use the 'char *' pointers to string data with care in code + that could GC: GC can relocate string data, invalidating such + pointers. It is best to use string character or byte index + instead, delaying the access through SDATA/SSDATA pointers to the + latest possible moment. If you must use the 'char *' pointers + (e.g., for speed), be sure to adjust them after any call that could + potentially GC. */ + INLINE unsigned char * SDATA (Lisp_Object string) { commit 3d575534d43802552f59eb1b990939cb3412d4e9 Author: Daniel Fleischer Date: Sun Sep 19 00:17:49 2021 +0300 Native compilation on macOS: libgccjit not found * etc/PROBLEMS: Describe the problem with libgccjit setup on macOS. (Bug#50411) diff --git a/etc/PROBLEMS b/etc/PROBLEMS index f90418798d..42d714bf1e 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -2671,6 +2671,24 @@ something like the following in your init file: (push "\\`-[^-]*-monaco-bold-" face-ignored-fonts) +** Native Compilation on macOS + +Native complitation requires the libgccjit library to be installed and +its path available to Emacs. Errors such as: + + libgccjit.so: error: error invoking gcc driver + Error: Internal native compiler error failed to compile + +indicate Emacs can't find the library in running time. One can set +the "LIBRARY_PATH" environment variable in the early initalization +file; for example: + +(setenv "LIBRARY_PATH" + (string-join + '("/usr/local/opt/gcc/lib/gcc/11" + "/usr/local/opt/libgccjit/lib/gcc/11" + "/usr/local/opt/gcc/lib/gcc/11/gcc/x86_64-apple-darwin20/11.2.0") ":")) + * Build-time problems ** Configuration commit e402a21704ad8cc85209285338d3a28238c4cefd Author: Stephen Gildea Date: Tue Sep 21 22:28:29 2021 -0700 ; * doc/misc/mh-e.texi (Scan Line Formats): Fix typo, an extra "the". diff --git a/doc/misc/mh-e.texi b/doc/misc/mh-e.texi index d2b81a634d..bc788ebae0 100644 --- a/doc/misc/mh-e.texi +++ b/doc/misc/mh-e.texi @@ -8114,7 +8114,7 @@ width is 4, so you would use @samp{(mh-set-cmd-note 4)}. @vindex mh-scan-format-nmh The default setting for @code{mh-scan-format-file} is @samp{Use MH-E -scan Format}. This means that the format string will be taken from the +scan Format}. This means that the format string will be taken from either @code{mh-scan-format-mh} or @code{mh-scan-format-nmh} depending on whether MH or nmh (or GNU mailutils MH) is in use. This setting also enables you to turn on the option commit f2bd2386a79fed311361fd9ca809ab1b2a0362a6 Author: Lars Ingebrigtsen Date: Wed Sep 22 07:22:17 2021 +0200 Speed up `replace-match' slightly * src/search.c (Freplace_match): Speed up non-literal (but actually literal) common case. This makes (benchmark-run 1000000 (replace-regexp-in-string "a+" "foo" "ogihdipofdhookfdohkfdpokhpokhfdpokfdhpokfdhkdfkhgoadfphokfkhpofdkhkdpokf")) about 10% faster. diff --git a/src/search.c b/src/search.c index 14adeb58e9..08f1e9474f 100644 --- a/src/search.c +++ b/src/search.c @@ -2387,6 +2387,13 @@ since only regular expressions have distinguished subexpressions. */) if (! NILP (string)) CHECK_STRING (string); + /* Most replacement texts don't contain any backslash directives in + the replacements. Check whether that's the case, which will + enable us to take the fast path later. */ + if (NILP (literal) + && !memchr (SSDATA (newtext), '\\', SBYTES (newtext))) + literal = Qt; + case_action = nochange; /* We tried an initialization */ /* but some C compilers blew it */ commit 7ce721bdacd65d47031060ee8e81d6117e94cc75 Author: Stephen Gildea Date: Tue Sep 21 22:01:03 2021 -0700 Migrate MH-E functional tests from SourceForge * test/lisp/mh-e/mh-limit-tests.el: * test/lisp/mh-e/mh-utils-tests.el: * test/lisp/mh-e/mh-xface-tests.el: Import the functional tests from src/mh-unit.el. mh-unit.el is from the old SourceForge mh-e repository, last changed in 2017. To this are applied unmerged patches Mike Kupfer wrote in 2018 ("Refactor mh-unit into functional and release tests" and "Fix the functional tests"). All tests have been converted to run under Emacs's ERT framework. Some tests for mh-utils use MH programs to examine mail folders. These tests require an MH variant to be installed on the system; for these, added both a mock harness that pretends the needed files and MH programs do exist, and a wrapper that creates the necessary mail files. New function 'mh-test-utils-setup-with-variant' bears some resemblance to 'mh-test-folders-set-up' from the original tests. New function 'mh-test-utils-setup-with-mocks' is new functionality for these tests. diff --git a/test/lisp/mh-e/mh-limit-tests.el b/test/lisp/mh-e/mh-limit-tests.el new file mode 100644 index 0000000000..982573d9b4 --- /dev/null +++ b/test/lisp/mh-e/mh-limit-tests.el @@ -0,0 +1,35 @@ +;;; mh-limit-tests.el --- tests for mh-limit.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 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(require 'mh-limit) + +(ert-deftest mh-pick-args-list () + "Test `mh-pick-args-list'." + (should (equal '() (mh-pick-args-list ""))) + (should (equal '("-subject" "a") (mh-pick-args-list "-subject a"))) + (should (equal '("-subject" "a") (mh-pick-args-list " -subject a "))) + (should (equal '("-subject" "a" "-from" "b") + (mh-pick-args-list "-subject a -from b"))) + (should (equal '("-subject" "a b" "-from" "c d") + (mh-pick-args-list "-subject a b -from c d")))) + +;;; mh-limit-tests.el ends here diff --git a/test/lisp/mh-e/mh-utils-tests.el b/test/lisp/mh-e/mh-utils-tests.el new file mode 100644 index 0000000000..68152ce3b6 --- /dev/null +++ b/test/lisp/mh-e/mh-utils-tests.el @@ -0,0 +1,408 @@ +;;; mh-utils-tests.el --- tests for mh-utils.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 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(eval-when-compile (require 'cl-lib)) +(require 'mh-utils) + +(ert-deftest mh-quote-pick-expr () + "Test `mh-quote-pick-expr'." + (should (equal nil (mh-quote-pick-expr nil))) + (should (equal '() (mh-quote-pick-expr '()))) + (should (equal '("foo") (mh-quote-pick-expr '("foo")))) + (should (equal '("^\\[foo]?\\*+\\.\\$") + (mh-quote-pick-expr '("^[foo]?*+.$")))) + (should (equal '("^\\[foo]?\\*+\\.\\$" "bar" "baz\\$") + (mh-quote-pick-expr '("^[foo]?*+.$" "bar" "baz$"))))) + +(ert-deftest mh-normalize-folder-name () + "Test `mh-normalize-folder-name'." + (should (equal nil (mh-normalize-folder-name nil))) + (should (equal "+" (mh-normalize-folder-name ""))) + (should (equal "" (mh-normalize-folder-name "" t))) + (should (equal nil (mh-normalize-folder-name "" nil nil t))) + (should (equal nil (mh-normalize-folder-name "+" nil nil t))) + (should (equal nil (mh-normalize-folder-name "+" t t t))) + (should (equal "+inbox" (mh-normalize-folder-name "inbox"))) + (should (equal "+inbox" (mh-normalize-folder-name "+inbox"))) + (should (equal "+inbox" (mh-normalize-folder-name "+inbox/"))) + (should (equal "+inbox/" (mh-normalize-folder-name "+inbox/" t t t))) + (should (equal "+inbox/" (mh-normalize-folder-name "+inbox/" nil t))) + (should (equal "+news" (mh-normalize-folder-name "+inbox////../news"))) + (should (equal "+news" (mh-normalize-folder-name "+inbox////../news/"))) + (should (equal "+news/" + (mh-normalize-folder-name "+inbox////../news/" nil t))) + (should (equal "+inbox/news" (mh-normalize-folder-name "+inbox////./news")))) + + +;; Folder names that are used by the following tests. +(defvar mh-test-rel-folder "rela-folder") +(defvar mh-test-abs-folder "/abso-folder") +(defvar mh-test-no-such-folder "/testdir/none" + "Name of a folder that the user does not have.") + +(defvar mh-test-variant-logged-already nil + "Whether `with-mh-test-env' has written the MH variant to the log.") +(setq mh-test-variant-logged-already nil) ;reset if buffer is re-evaluated + +(defvar mh-test-utils-debug-mocks nil + "Whether to log detailed behavior of mock functions.") + +(defvar mh-test-call-process-real (symbol-function 'call-process)) +(defvar mh-test-file-directory-p-real (symbol-function 'file-directory-p)) + + +;;; This macro wraps tests that touch the file system and/or run programs. +;;; When running such tests, MH-E can use a particular MH variant +;;; installed on the system, or it can use the mocks provided below. + +;;; By setting PATH and mh-sys-path, you can select which of the +;;; installed MH variants to use or ignore them all and use mocks. + +(defmacro with-mh-test-env (&rest body) + "Evaluate BODY with a test mail environment. +Functions that touch the file system or run MH programs are either +mocked out or pointed at a test tree. When called from Emacs's batch +testing infrastructure, this will use mocks and thus run on systems +that do not have any MH variant installed. MH-E developers can +install an MH variant and test it interactively." + (declare (indent defun)) + `(cl-letf ((temp-home-dir nil) + ;; make local bindings for things we will modify for test env + (mh-user-path) + (mh-test-abs-folder) + ((symbol-function 'call-process)) + ((symbol-function 'file-directory-p)) + ;; the test always gets its own sub-folders cache + (mh-sub-folders-cache (make-hash-table :test #'equal)) + ;; remember the original value + (original-mh-envvar (getenv "MH"))) + (unless mh-test-variant-logged-already + (mh-variant-set mh-variant) + (setq mh-test-variant-logged-already t)) + (unwind-protect + (progn + (if mh-variant-in-use + (setq temp-home-dir (mh-test-utils-setup-with-variant)) + (mh-test-utils-setup-with-mocks)) + ,@body) + (if temp-home-dir (delete-directory temp-home-dir t)) + (setenv "MH" original-mh-envvar)))) + +(defun mh-test-utils-setup-with-mocks () + "Set dynamically bound variables so that MH programs are mocked out. +The tests use this method if no configured MH variant is found." + (setq mh-user-path "/testdir/Mail/") + (mh-populate-sub-folders-cache "+") + (mh-populate-sub-folders-cache "+rela-folder") + (mh-populate-sub-folders-cache "+rela-folder/bar") + (mh-populate-sub-folders-cache "+rela-folder/foo") + (mh-populate-sub-folders-cache "+rela-folder/food") + (fset 'call-process #'mh-test-utils-mock-call-process) + (fset 'file-directory-p #'mh-test-utils-mock-file-directory-p)) + +(defun mh-test-utils-mock-call-process (program + &optional _infile _destination _display + &rest args) + "A mocked version of `call-process' that calls no processes." + (let ((argument-responses + ;; assoc list of program arguments and lines to output. + '((("folder" "-fast") . ("rela-folder")) + (("folders" "-noheader" "-norecurse" "-nototal") . + ("rela-folder has no messages.")) + (("folders" "-noheader" "-norecurse" "-nototal" "+rela-folder") . + ("rela-folder+ has no messages." + "rela-folder/bar has no messages." + "rela-folder/foo has no messages." + "rela-folder/food has no messages.")) + (("folders" "-noheader" "-norecurse" "-nototal" "+rela-folder/foo") . + ("rela-folder/foo+ has no messages.")) + (("folders" "-noheader" "-norecurse" "-nototal" "+") . + ("+ has no messages.")) + (("folders" "-noheader" "-norecurse" "-nototal" "+/abso-folder") . + ("/abso-folder+ has no messages." + "/abso-folder/bar has no messages." + "/abso-folder/foo has no messages." + "/abso-folder/food has no messages.")) + )) + (arglist (cons (file-name-base program) args))) + (let ((response-list-cons (assoc arglist argument-responses))) + (cond (response-list-cons + (let ((response-list (cdr response-list-cons))) + (when mh-test-utils-debug-mocks + (message "call-process mock arglist %s" arglist) + (message " -> response %S" response-list)) + (while response-list + (insert (car response-list) "\n") + (setq response-list (cdr response-list)))) + 0) + (t + (message "call-process mock unexpected arglist %s" arglist) + 1))))) + +(defun mh-test-utils-mock-file-directory-p (filename) + "A mocked version of `file-directory-p' that does not access the file system." + (let ((directories '("" "/" "/tmp" "/abso-folder" "/abso-folder/foo" + "/testdir/Mail" "/testdir/Mail/rela-folder" + "/testdir/Mail/rela-folder/foo" + "rela-folder" "rela-folder/foo")) + (non-directories '("/abso-folder/fo" "rela-folder/fo" + "/testdir/Mail/rela-folder/fo" + "/testdir/Mail/nosuchfolder" + "/nosuchfolder" "nosuchfolder"))) + (cond ((member (directory-file-name filename) directories) + (when mh-test-utils-debug-mocks + (message "file-directory-p mock: %S -> t" filename)) + t) + ((member (directory-file-name filename) non-directories) + (when mh-test-utils-debug-mocks + (message "file-directory-p mock: %S -> nil" filename)) + nil) + (t + (message "file-directory-p mock unexpected filename: %S" filename) + nil)))) + +(defun mh-test-utils-setup-with-variant () + "Create a temporary directory structure for actual MH programs to read. +Return the name of the root of the created directory tree. +Set dynamically bound variables so that MH programs may log. +The tests use this method if a configured MH variant is found." + (let* ((temp-home-dir + (make-temp-file "emacs-mh-e-unit-test" t)) + (profile (expand-file-name + ".mh_profile" temp-home-dir)) + (mail-dir (expand-file-name "Mail" temp-home-dir)) + (rela-folder (expand-file-name + "rela-folder" mail-dir)) + (abso-folder (expand-file-name + "abso-folder" temp-home-dir))) + (with-temp-file profile + (insert "Path: " mail-dir "\n" "Welcome: disable\n")) + (setenv "MH" profile) + (make-directory (expand-file-name "bar" rela-folder) t) + (make-directory (expand-file-name "foo" rela-folder) t) + (make-directory (expand-file-name "food" rela-folder) t) + (setq mh-user-path (file-name-as-directory mail-dir)) + (make-directory (expand-file-name "bar" abso-folder) t) + (make-directory (expand-file-name "foo" abso-folder) t) + (make-directory (expand-file-name "food" abso-folder) t) + (setq mh-test-abs-folder abso-folder) + (fset 'call-process #'mh-test-utils-log-call-process) + (fset 'file-directory-p #'mh-test-utils-log-file-directory-p) + temp-home-dir)) + +(defun mh-test-utils-log-call-process (program + &optional infile destination display + &rest args) + "A wrapper around `call-process' that can log the program args and output. +Both args and output are written with `message' if `mh-test-utils-debug-mocks' +is non-nil." + (let (process-output) + (when mh-test-utils-debug-mocks + (message "call-process arglist %s" (cons program args))) + (with-temp-buffer + (apply mh-test-call-process-real program infile destination display args) + (setq process-output (buffer-string))) + (when mh-test-utils-debug-mocks + (message " -> response:\n%s" process-output)) + (insert process-output))) + +(defun mh-test-utils-log-file-directory-p (filename) + "A wrapper around `file-directory-p' that can log calls. +Both FILENAME and the return value are written with `message' +if `mh-test-utils-debug-mocks' is non-nil." + (let ((result (funcall mh-test-file-directory-p-real filename))) + (when mh-test-utils-debug-mocks + (message "file-directory-p: %S -> %s" filename result)) + result)) + + +(ert-deftest mh-sub-folders-actual () + "Test `mh-sub-folders-actual'." + ;; Note that mh-sub-folders-actual expects the folder to have + ;; already been normalized with + ;; (mh-normalize-folder-name folder nil nil t) + (with-mh-test-env + (should (equal + mh-test-rel-folder + (car (assoc mh-test-rel-folder (mh-sub-folders-actual nil))))) + ;; Empty string and "+" not tested since mh-normalize-folder-name + ;; would change them to nil. + (should (equal "foo" + (car (assoc "foo" (mh-sub-folders-actual + (format "+%s" mh-test-rel-folder)))))) + ;; Folder with trailing slash not tested since + ;; mh-normalize-folder-name would strip it. + (should (equal + nil + (mh-sub-folders-actual (format "+%s/foo" mh-test-rel-folder)))) + + (should (equal + (list (list "bar") (list "foo") (list "food")) + (mh-sub-folders-actual (format "+%s" mh-test-abs-folder)))) + + ;; FIXME: mh-sub-folders-actual doesn't (yet) expect to be given a + ;; nonexistent folder. + ;; (should (equal nil + ;; (mh-sub-folders-actual "+nosuchfolder"))) + ;; (should (equal nil + ;; (mh-sub-folders-actual "+/nosuchfolder"))) + )) + +(ert-deftest mh-sub-folders () + "Test `mh-sub-folders'." + (with-mh-test-env + (should (equal mh-test-rel-folder + (car (assoc mh-test-rel-folder (mh-sub-folders nil))))) + (should (equal mh-test-rel-folder + (car (assoc mh-test-rel-folder (mh-sub-folders ""))))) + (should (equal nil + (car (assoc mh-test-no-such-folder (mh-sub-folders + "+"))))) + (should (equal (list (list "bar") (list "foo") (list "food")) + (mh-sub-folders (format "+%s" mh-test-rel-folder)))) + (should (equal (list (list "bar") (list "foo") (list "food")) + (mh-sub-folders (format "+%s/" mh-test-rel-folder)))) + (should (equal nil + (mh-sub-folders (format "+%s/foo/" mh-test-rel-folder)))) + (should (equal nil + (mh-sub-folders (format "+%s/foo" mh-test-rel-folder)))) + (should (equal (list (list "bar") (list "foo") (list "food")) + (mh-sub-folders (format "+%s" mh-test-abs-folder)))) + + ;; FIXME: mh-sub-folders doesn't (yet) expect to be given a + ;; nonexistent folder. + ;; (should (equal nil + ;; (mh-sub-folders "+nosuchfolder"))) + ;; (should (equal nil + ;; (mh-sub-folders "+/nosuchfolder"))) + )) + + +(defmacro mh-test-folder-completion-1 (name + nil-expected t-expected lambda-expected) + "Helper for testing `mh-folder-completion-function'. +Ask for completion on NAME three times, with three different +values for the FLAG argument of `mh-folder-completion-function'. +NIL-EXPECTED is the expected value with FLAG nil. +T-EXPECTED is the expected value with FLAG t. +LAMBDA-EXPECTED is the expected value with FLAG lambda." + `(with-mh-test-env + (mh-test-folder-completion-2 ,nil-expected ;case "a" + (mh-folder-completion-function ,name nil nil)) + (mh-test-folder-completion-2 ,t-expected ;case "b" + (mh-folder-completion-function ,name nil t)) + (mh-test-folder-completion-2 ,lambda-expected ;case "c" + (mh-folder-completion-function ,name nil + 'lambda)))) + +(defmacro mh-test-folder-completion-2 (expected actual) + "Inner helper for testing `mh-folder-completion-function'. +ACTUAL should evaluate to either EXPECTED or to a list containing EXPECTED. +ACTUAL may be evaluated twice, but this gives a clearer error on failure, +and the `should' macro requires idempotent evaluation anyway." + `(if (and (not (consp ,expected)) (consp ,actual)) + (should (member ,expected ,actual)) + (should (equal ,expected ,actual)))) + + +(ert-deftest mh-folder-completion-function-02-empty () + "Test `mh-folder-completion-function' with empty name." + (mh-test-folder-completion-1 "" "+" (format "%s/" mh-test-rel-folder) nil)) + +(ert-deftest mh-folder-completion-function-03-plus () + "Test `mh-folder-completion-function' with `+'." + (mh-test-folder-completion-1 "+" "+" (format "%s/" mh-test-rel-folder) nil)) + +(ert-deftest mh-folder-completion-function-04-rel-folder () + "Test `mh-folder-completion-function' with `+rela-folder'." + (mh-test-folder-completion-1 (format "+%s" mh-test-rel-folder) + (format "+%s/" mh-test-rel-folder) + (list (format "%s/" mh-test-rel-folder)) + t)) + +(ert-deftest mh-folder-completion-function-05-rel-folder-slash () + "Test `mh-folder-completion-function' with `+rela-folder/'." + (mh-test-folder-completion-1 (format "+%s/" mh-test-rel-folder) + (format "+%s/" mh-test-rel-folder) + (list "bar" "foo" "food") + t)) + +(ert-deftest mh-folder-completion-function-06-rel-folder-slash-foo () + "Test `mh-folder-completion-function' with `+rela-folder/foo'." + (mh-test-folder-completion-1 (format "+%s/foo" mh-test-rel-folder) + (format "+%s/foo" mh-test-rel-folder) + (list "foo" "food") + t) + (with-mh-test-env + (should (equal nil + (mh-folder-completion-function + (format "+%s/fo" mh-test-rel-folder) nil 'lambda))))) + +(ert-deftest mh-folder-completion-function-07-rel-folder-slash-foo-slash () + "Test `mh-folder-completion-function' with `+rela-folder/foo/'." + (mh-test-folder-completion-1 (format "+%s/foo/" mh-test-rel-folder) + nil + nil + t)) + +(ert-deftest mh-folder-completion-function-08-plus-slash () + "Test `mh-folder-completion-function' with `+/'." + :expected-result :failed ;to be fixed in a patch by mkupfer + (mh-test-folder-completion-1 "+/" "+/" "tmp/" nil) + ;; case "bb" + (with-mh-test-env + (should (equal nil + (member (format "+%s/" mh-test-rel-folder) + (mh-folder-completion-function "+/" nil t)))))) + +(ert-deftest mh-folder-completion-function-09-plus-slash-tmp () + "Test `mh-folder-completion-function' with `+/tmp'." + :expected-result :failed ;to be fixed in a patch by mkupfer + (mh-test-folder-completion-1 "+/tmp" "+/tmp" "tmp/" t)) + +(ert-deftest mh-folder-completion-function-10-plus-slash-abs-folder () + "Test `mh-folder-completion-function' with `+/abso-folder'." + (mh-test-folder-completion-1 (format "+%s/" mh-test-abs-folder) + (format "+%s/" mh-test-abs-folder) + (list "bar" "foo" "food") + t)) + +(ert-deftest mh-folder-completion-function-11-plus-slash-abs-folder-slash-foo () + "Test `mh-folder-completion-function' with `+/abso-folder/foo'." + (mh-test-folder-completion-1 (format "+%s/foo" mh-test-abs-folder) + (format "+%s/foo" mh-test-abs-folder) + (list "foo" "food") + t) + (with-mh-test-env + (should (equal nil + (mh-folder-completion-function + (format "+%s/fo" mh-test-abs-folder) nil 'lambda))))) + +(ert-deftest mh-folder-completion-function-12-plus-nosuchfolder () + "Test `mh-folder-completion-function' with `+nosuchfolder'." + (mh-test-folder-completion-1 "+nosuchfolder" nil nil nil)) + +(ert-deftest mh-folder-completion-function-13-plus-slash-nosuchfolder () + "Test `mh-folder-completion-function' with `+/nosuchfolder'." + (mh-test-folder-completion-1 "+/nosuchfolder" nil nil nil)) + +;;; mh-utils-tests.el ends here diff --git a/test/lisp/mh-e/mh-xface-tests.el b/test/lisp/mh-e/mh-xface-tests.el index 65e3c82ec0..43355810ab 100644 --- a/test/lisp/mh-e/mh-xface-tests.el +++ b/test/lisp/mh-e/mh-xface-tests.el @@ -33,3 +33,18 @@ (should (equal (mh-x-image-url-sane-p "https:") t)) (should (equal (mh-x-image-url-sane-p "https://www.example.com/me.png") t)) (should (equal (mh-x-image-url-sane-p "abcde:") nil))) + +(ert-deftest mh-x-image-url-cache-canonicalize () + "Test `mh-x-image-url-cache-canonicalize'." + (should (equal (format "%s/%s" mh-x-image-cache-directory "%21foo%21bar.png") + (mh-x-image-url-cache-canonicalize "/foo/bar"))) + (should (equal (format "%s/%s" mh-x-image-cache-directory + "http%3A%21%21domain.com%21foo%21bar.png") + (mh-x-image-url-cache-canonicalize + "http://domain.com/foo/bar"))) + ;; All Windows invalid characters. + (should (equal (format "%s/%s" mh-x-image-cache-directory + "%21%3C%3E%3A%2A%3F%22%5C%7C%21bar.png") + (mh-x-image-url-cache-canonicalize "/<>:*?\"\\|/bar")))) + +;;; mh-xface-tests.el ends here commit 2a736738095c313ccef07d074aac4c5467b750e0 Author: Lars Ingebrigtsen Date: Wed Sep 22 05:57:48 2021 +0200 Change how thread-first/thread-last indent the first argument * lisp/doc-view.el (doc-view--current-cache-dir): Reindent. * lisp/emacs-lisp/subr-x.el (thread-first): (thread-last): Change indentation to match examples. (internal--build-binding): Reindent. * test/lisp/emacs-lisp/subr-x-tests.el (subr-x-test-thread-first-function-names-are-threaded): (subr-x-test-thread-first-examples): (subr-x-test-thread-last-function-names-are-threaded): (subr-x-test-thread-last-examples): Reindent. diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 0896bd13eb..088ca5bfea 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -727,7 +727,7 @@ It's a subdirectory of `doc-view-cache-directory'." (file-name-as-directory (expand-file-name (concat (thread-last - (file-name-nondirectory doc-view--buffer-file-name) + (file-name-nondirectory doc-view--buffer-file-name) ;; bug#13679 (subst-char-in-string ?% ?_) ;; arc-mode concatenates archive name and file name diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 4204d20249..3de666682f 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -62,7 +62,7 @@ Is equivalent to: (+ (- (/ (+ 5 20) 25)) 40) Note how the single `-' got converted into a list before threading." - (declare (indent 1) + (declare (indent 0) (debug (form &rest [&or symbolp (sexp &rest form)]))) `(internal--thread-argument t ,@forms)) @@ -79,7 +79,7 @@ Is equivalent to: (+ 40 (- (/ 25 (+ 20 5)))) Note how the single `-' got converted into a list before threading." - (declare (indent 1) (debug thread-first)) + (declare (indent 0) (debug thread-first)) `(internal--thread-argument nil ,@forms)) (defsubst internal--listify (elt) @@ -107,7 +107,7 @@ If ELT is of the form ((EXPR)), listify (EXPR) with a dummy symbol." (defun internal--build-binding (binding prev-var) "Check and build a single BINDING with PREV-VAR." (thread-first - binding + binding internal--listify internal--check-binding (internal--build-binding-value-form prev-var))) diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el index ef04cde386..1d19496ba4 100644 --- a/test/lisp/emacs-lisp/subr-x-tests.el +++ b/test/lisp/emacs-lisp/subr-x-tests.el @@ -455,18 +455,18 @@ "Test `thread-first' wraps single function names." (should (equal (macroexpand '(thread-first 5 - -)) + -)) '(- 5))) (should (equal (macroexpand '(thread-first (+ 1 2) - -)) + -)) '(- (+ 1 2))))) (ert-deftest subr-x-test-thread-first-expansion () "Test `thread-first' expands correctly." (should (equal (macroexpand '(thread-first - 5 + 5 (+ 20) (/ 25) - @@ -477,13 +477,13 @@ "Test several `thread-first' examples." (should (equal (thread-first (+ 40 2)) 42)) (should (equal (thread-first - 5 + 5 (+ 20) (/ 25) - (+ 40)) 39)) (should (equal (thread-first - "this-is-a-string" + "this-is-a-string" (split-string "-") (nbutlast 2) (append (list "good"))) @@ -500,18 +500,18 @@ "Test `thread-last' wraps single function names." (should (equal (macroexpand '(thread-last 5 - -)) + -)) '(- 5))) (should (equal (macroexpand '(thread-last (+ 1 2) - -)) + -)) '(- (+ 1 2))))) (ert-deftest subr-x-test-thread-last-expansion () "Test `thread-last' expands correctly." (should (equal (macroexpand '(thread-last - 5 + 5 (+ 20) (/ 25) - @@ -522,13 +522,13 @@ "Test several `thread-last' examples." (should (equal (thread-last (+ 40 2)) 42)) (should (equal (thread-last - 5 + 5 (+ 20) (/ 25) - (+ 40)) 39)) (should (equal (thread-last - (list 1 -2 3 -4 5) + (list 1 -2 3 -4 5) (mapcar #'abs) (cl-reduce #'+) (format "abs sum is: %s")) commit 8a8319140c5f5e981e61f20854f836874aa9dd5e Author: Lars Ingebrigtsen Date: Tue Sep 21 23:09:34 2021 +0200 Make global-auto-revert-non-file-buffers work better * lisp/autorevert.el (global-auto-revert-mode): Always switch on the non-file tracking. (auto-revert--global-possibly-adopt-current-buffer): New function to respect dynamically changing `global-auto-revert-non-file-buffers'. diff --git a/lisp/autorevert.el b/lisp/autorevert.el index c8fe205946..5b1cd32247 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -521,13 +521,12 @@ specifies in the mode line." ;; To track non-file buffers, we need to listen in to buffer ;; creation in general. Listening to major-mode changes is ;; suitable, since we then know whether it's a mode that is tracked. - (when global-auto-revert-non-file-buffers - (add-hook 'after-change-major-mode-hook - #'auto-revert--global-adopt-current-buffer)) + (add-hook 'after-change-major-mode-hook + #'auto-revert--global-possibly-adopt-current-buffer) (auto-revert-buffers)) ;; Turn global-auto-revert-mode OFF. (remove-hook 'after-change-major-mode-hook - #'auto-revert--global-adopt-current-buffer) + #'auto-revert--global-possibly-adopt-current-buffer) (remove-hook 'find-file-hook #'auto-revert--global-adopt-current-buffer) (dolist (buf (buffer-list)) (with-current-buffer buf @@ -556,6 +555,12 @@ specifies in the mode line." nil))) (setq auto-revert--global-mode t))) +(defun auto-revert--global-possibly-adopt-current-buffer () + "Consider tracking current buffer in a running Global Auto-Revert mode. +This tracks buffers if `global-auto-revert-non-file-buffers' is non-nil." + (when global-auto-revert-non-file-buffers + (auto-revert--global-adopt-current-buffer))) + (defun auto-revert--global-adopt-current-buffer () "Consider tracking current buffer in a running Global Auto-Revert mode." (auto-revert--global-add-current-buffer) commit e000a7ab1007cdbf4741a649c275b9c5d3faedc8 Author: Stefan Monnier Date: Tue Sep 21 16:53:25 2021 -0400 (etc-authors-mode--hide-local-variables): Obfuscate more efficiently diff --git a/lisp/textmodes/etc-authors-mode.el b/lisp/textmodes/etc-authors-mode.el index e416d1395a..a591b2db97 100644 --- a/lisp/textmodes/etc-authors-mode.el +++ b/lisp/textmodes/etc-authors-mode.el @@ -87,11 +87,9 @@ See also `etc-authors-mode'." (narrow-to-region (point-min) (save-excursion (goto-char (point-min)) - (if (re-search-forward - ;; Obfuscate to avoid this being interpreted - ;; as a local variable section itself. - (concat "^Local " "Variables:$") - nil t) + ;; Obfuscate to avoid this being interpreted + ;; as a local variable section itself. + (if (re-search-forward "^Local\sVariables:$" nil t) (progn (forward-line -1) (point)) (point-max))))) commit 7f5ac1468dc656592257283d9bee7a47e39cb85b Author: Stefan Kangas Date: Tue Sep 21 22:17:14 2021 +0200 ; * etc/NEWS: Improve wording of an item. * lisp/emacs-lisp/hierarchy.el: Improve wording of package description. diff --git a/etc/NEWS b/etc/NEWS index 4bdbdeae0b..c18952d238 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3080,7 +3080,7 @@ complex menus take advantage of infix arguments, which are somewhat similar to prefix arguments, but are more flexible and discoverable. ** hierarchy.el -It's a library to create, query, navigate and display hierarchical +This library can create, query, navigate and display hierarchical structures. --- diff --git a/lisp/emacs-lisp/hierarchy.el b/lisp/emacs-lisp/hierarchy.el index 7466fc85df..58234852a0 100644 --- a/lisp/emacs-lisp/hierarchy.el +++ b/lisp/emacs-lisp/hierarchy.el @@ -1,4 +1,4 @@ -;;; hierarchy.el --- Library to create and display hierarchy structures -*- lexical-binding: t; -*- +;;; hierarchy.el --- Library to create and display hierarchical structures -*- lexical-binding: t; -*- ;; Copyright (C) 2020-2021 Free Software Foundation, Inc. @@ -22,7 +22,8 @@ ;;; Commentary: -;; Library to create, query, navigate and display hierarchy structures. +;; Library to create, query, navigate and display hierarchical +;; structures. ;; Creation: After having created a hierarchy with `hierarchy-new', ;; populate it by calling `hierarchy-add-tree' or commit b58228903f08404e9e1c6d7f956a1033b5f8dd51 Author: Stefan Kangas Date: Tue Sep 21 22:09:09 2021 +0200 Fix warning in etc-authors-mode.el * lisp/textmodes/etc-authors-mode.el (etc-authors-mode--hide-local-variables): Avoid warning. diff --git a/lisp/textmodes/etc-authors-mode.el b/lisp/textmodes/etc-authors-mode.el index 09ad198346..e416d1395a 100644 --- a/lisp/textmodes/etc-authors-mode.el +++ b/lisp/textmodes/etc-authors-mode.el @@ -87,7 +87,11 @@ See also `etc-authors-mode'." (narrow-to-region (point-min) (save-excursion (goto-char (point-min)) - (if (re-search-forward "^Local Variables:$" nil t) + (if (re-search-forward + ;; Obfuscate to avoid this being interpreted + ;; as a local variable section itself. + (concat "^Local " "Variables:$") + nil t) (progn (forward-line -1) (point)) (point-max))))) commit 85e9e5f616fb0fd0819a04006d6d2a0fb6d93ad7 Author: Lars Ingebrigtsen Date: Tue Sep 21 22:11:43 2021 +0200 Don't quote nil and t in doc strings and comments * test/src/minibuf-tests.el (test-try-completion-ignore-case): * test/lisp/url/url-auth-tests.el (url-auth-test-digest-auth-retrieve-cache): * test/lisp/subr-tests.el (subr-tests-add-hook-depth): * test/lisp/so-long-tests/so-long-tests.el (so-long-tests-invisible-buffer-function): * test/lisp/emacs-lisp/tabulated-list-test.el (tabulated-list-sort): * src/xfaces.c: * src/process.c (Finterrupt_process): (syms_of_process): * src/minibuf.c (Fread_from_minibuffer): (Fcompleting_read): (syms_of_minibuf): * src/dispnew.c (syms_of_display): * src/data.c: * lisp/so-long.el (so-long--hack-local-variables): * lisp/progmodes/elisp-mode.el (elisp--xref-find-definitions): (elisp--xref-find-definitions): * lisp/org/ox-html.el (org-html-htmlize-output-type): * lisp/org/org-agenda.el (org-agenda-do-in-region): * lisp/net/tramp.el: * lisp/minibuffer.el (set-minibuffer-message): * lisp/isearch.el (isearch-wrap-pause): (isearch-repeat-on-direction-change): * lisp/emacs-lisp/timer.el (timer): * lisp/emacs-lisp/package.el (package-read-archive-contents): * lisp/emacs-lisp/faceup.el (faceup-next-property-change): * lisp/emacs-lisp/comp.el (comp-func): * lisp/emacs-lisp/comp-cstr.el (comp-cstr-empty-p): * lisp/emacs-lisp/cl-macs.el (cl-do): (cl-do*): (cl--self-tco): * lisp/emacs-lisp/bytecomp.el (byte-compile-unresolved-functions): (byte-compile-cond-jump-table): Don't quote t and nil. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 614aa856f6..be74195778 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -551,7 +551,7 @@ has the form (autoload . FILENAME).") "Alist of undefined functions to which calls have been compiled. Each element in the list has the form (FUNCTION POSITION . CALLS) where CALLS is a list whose elements are integers (indicating the -number of arguments passed in the function call) or the constant `t' +number of arguments passed in the function call) or the constant t if the function is called indirectly. This variable is only significant whilst compiling an entire buffer. Used for warnings when a function is not known to be defined or is later @@ -4417,7 +4417,7 @@ Return (TAIL VAR TEST CASES), where: (cases (nth 2 switch)) jump-table test-objects body tag default-tag) ;; TODO: Once :linear-search is implemented for `make-hash-table' - ;; set it to `t' for cond forms with a small number of cases. + ;; set it to t for cond forms with a small number of cases. (let ((nvalues (apply #'+ (mapcar (lambda (case) (length (car case))) cases)))) (setq jump-table (make-hash-table @@ -4446,7 +4446,7 @@ Return (TAIL VAR TEST CASES), where: (byte-compile-out 'byte-switch) ;; When the opcode argument is `byte-goto', `byte-compile-goto' sets - ;; `byte-compile-depth' to `nil'. However, we need `byte-compile-depth' + ;; `byte-compile-depth' to nil. However, we need `byte-compile-depth' ;; to be non-nil for generating tags for all cases. Since ;; `byte-compile-depth' will increase by at most 1 after compiling ;; all of the clause (which is further enforced by cl-assert below) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 16308b3a59..6d6482c349 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -1762,7 +1762,7 @@ Once the END-TEST becomes true, the RESULT forms are evaluated (with the VARs still bound to their values) to produce the result returned by `cl-do'. -Note that the entire loop is enclosed in an implicit `nil' block, so +Note that the entire loop is enclosed in an implicit nil block, so that you can use `cl-return' to exit at any time. Also note that END-TEST is checked before evaluating BODY. If END-TEST @@ -1791,7 +1791,7 @@ Once the END-TEST becomes true, the RESULT forms are evaluated (with the VARs still bound to their values) to produce the result returned by `cl-do*'. -Note that the entire loop is enclosed in an implicit `nil' block, so +Note that the entire loop is enclosed in an implicit nil block, so that you can use `cl-return' to exit at any time. Also note that END-TEST is checked before evaluating BODY. If END-TEST @@ -2071,7 +2071,7 @@ Like `cl-flet' but the definitions can refer to previous ones. ;; even handle mutually recursive functions. (letrec ((done nil) ;; Non-nil if some TCO happened. - ;; This var always holds the value `nil' until (just before) we + ;; This var always holds the value nil until (just before) we ;; exit the loop. (retvar (make-symbol "retval")) (ofargs (mapcar (lambda (s) (if (memq s cl--lambda-list-keywords) s diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el index 6a3f6046d1..5518cdb4c9 100644 --- a/lisp/emacs-lisp/comp-cstr.el +++ b/lisp/emacs-lisp/comp-cstr.el @@ -134,7 +134,7 @@ Integer values are handled in the `range' slot.") :neg (neg cstr)))) (defsubst comp-cstr-empty-p (cstr) - "Return t if CSTR is equivalent to the `nil' type specifier or nil otherwise." + "Return t if CSTR is equivalent to the nil type specifier or nil otherwise." (with-comp-cstr-accessors (and (null (typeset cstr)) (null (valset cstr)) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 31cae734cc..4060fc97d0 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -901,8 +901,8 @@ non local exit (ends with an `unreachable' insn).")) (lap () :type list :documentation "LAP assembly representation.") (ssa-status nil :type symbol - :documentation "SSA status either: 'nil', 'dirty' or 't'. -Once in SSA form this *must* be set to 'dirty' every time the topology of the + :documentation "SSA status either: nil, `dirty' or t. +Once in SSA form this *must* be set to `dirty' every time the topology of the CFG is mutated by a pass.") (frame-size nil :type integer) (vframe-size 0 :type integer) diff --git a/lisp/emacs-lisp/faceup.el b/lisp/emacs-lisp/faceup.el index 162c39634e..629029aabc 100644 --- a/lisp/emacs-lisp/faceup.el +++ b/lisp/emacs-lisp/faceup.el @@ -795,7 +795,7 @@ See `faceup-properties' for a list of tracked properties." nil (if (and (null pos) (faceup-has-any-text-property (point-min))) - ;; `pos' is `nil' and the character at `point-min' contains a + ;; `pos' is nil and the character at `point-min' contains a ;; tracked property, return `point-min'. (point-min) (unless pos diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index a0829f118d..a204966644 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1586,7 +1586,7 @@ If the archive version is too new, signal an error." (if package (package--add-to-archive-contents package archive) (lwarn '(package refresh) :warning - "Ignoring `nil' package on `%s' package archive" archive)))))) + "Ignoring nil package on `%s' package archive" archive)))))) (defvar package--old-archive-priorities nil "Store currently used `package-archive-priorities'. diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index 44d70cde6b..382f6bb1fa 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -49,7 +49,7 @@ function args ;What to do when triggered. idle-delay ;If non-nil, this is an idle-timer. psecs - ;; A timer may be created with `t' as the TIME, which means that we + ;; A timer may be created with t as the TIME, which means that we ;; want to run at specific integral multiples of `repeat-delay'. We ;; then have to recompute this (because the machine may have gone to ;; sleep, etc). diff --git a/lisp/isearch.el b/lisp/isearch.el index af6217b7ca..952caa7ac2 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -176,11 +176,11 @@ command history." (defcustom isearch-wrap-pause t "Define the behavior of wrapping when there are no more matches. -When `t' (by default), signal an error when no more matches are found. +When t (by default), signal an error when no more matches are found. Then after repeating the search, wrap with `isearch-wrap-function'. When `no', wrap immediately after reaching the last match. When `no-ding', wrap immediately without flashing the screen. -When `nil', never wrap, just stop at the last match." +When nil, never wrap, just stop at the last match." :type '(choice (const :tag "Pause before wrapping" t) (const :tag "No pause before wrapping" no) (const :tag "No pause and no flashing" no-ding) @@ -189,9 +189,9 @@ When `nil', never wrap, just stop at the last match." (defcustom isearch-repeat-on-direction-change nil "Whether a direction change should move to another match. -When `nil', the default, a direction change moves point to the other +When nil, the default, a direction change moves point to the other end of the current search match. -When `t', a direction change moves to another search match, if there +When t, a direction change moves to another search match, if there is one." :type '(choice (const :tag "Remain on the same match" nil) (const :tag "Move to another match" t)) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 7b82e120f1..1e1a6f852e 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -848,7 +848,7 @@ via `set-message-function'." (run-with-timer minibuffer-message-clear-timeout nil #'clear-minibuffer-message))) - ;; Return `t' telling the caller that the message + ;; Return t telling the caller that the message ;; was handled specially by this function. t)))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 22ddfdb8e8..2804b4d37d 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -183,7 +183,7 @@ See the variable `tramp-encoding-shell' for more information." :version "24.1" :type '(choice (const nil) string)) -;; Since Emacs 26.1, `system-name' can return `nil' at build time if +;; Since Emacs 26.1, `system-name' can return nil at build time if ;; Emacs is compiled with "--no-build-details". We do expect it to be ;; a string. (Bug#44481) (defconst tramp-system-name (or (system-name) "") diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 489e6c7f3e..23c62809a2 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -8842,7 +8842,7 @@ Point is in the buffer where the item originated.") (defun org-agenda-do-in-region (beg end cmd &optional arg force-arg delete) "Between region BEG and END, call agenda command CMD. -When optional argument ARG is non-nil or FORCE-ARG is `t', pass +When optional argument ARG is non-nil or FORCE-ARG is t, pass ARG to CMD. When optional argument DELETE is non-nil, assume CMD deletes the agenda entry and don't move to the next entry." (save-excursion diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el index 03145e35c5..d8932996eb 100644 --- a/lisp/org/ox-html.el +++ b/lisp/org/ox-html.el @@ -874,7 +874,7 @@ link's path." (defcustom org-html-htmlize-output-type 'inline-css "Output type to be used by htmlize when formatting code snippets. Choices are `css' to export the CSS selectors only,`inline-css' -to export the CSS attribute values inline in the HTML or `nil' to +to export the CSS attribute values inline in the HTML or nil to export plain text. We use as default `inline-css', in order to make the resulting HTML self-containing. diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index d082db5f02..ce45de7f6c 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -990,7 +990,7 @@ namespace but with lower confidence." ;; First call to find-lisp-object-file-name for an object ;; defined in C; the doc strings from the C source have ;; not been loaded yet. Second call will return "src/*.c" - ;; in file; handled by 't' case below. + ;; in file; handled by t case below. (push (elisp--xref-make-xref nil symbol (help-C-file-name (symbol-function symbol) 'subr)) xrefs)) ((and (setq doc (documentation symbol t)) @@ -1034,7 +1034,7 @@ namespace but with lower confidence." specializers)) (file (find-lisp-object-file-name met-name 'cl-defmethod))) (dolist (item specializers) - ;; default method has all 't' in specializers + ;; Default method has all t in specializers. (setq non-default (or non-default (not (equal t item))))) (when (and file diff --git a/lisp/so-long.el b/lisp/so-long.el index e271ff6be3..65570bf253 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -1686,7 +1686,7 @@ File-local header comments are currently an exception, and are processed by `so-long--check-header-modes' (see which for details)." ;; The first arg to `hack-local-variables' is HANDLE-MODE since Emacs 26.1, ;; and MODE-ONLY in earlier versions. In either case we are interested in - ;; whether it has the value `t'. + ;; whether it has the value t. (let ((retval (apply orig-fun handle-mode args))) (and (eq handle-mode t) retval ; A file-local mode was set. diff --git a/src/data.c b/src/data.c index 27b642df28..0d3376f090 100644 --- a/src/data.c +++ b/src/data.c @@ -681,7 +681,7 @@ global value outside of any lexical scope. */) /* It has been previously suggested to make this function an alias for symbol-function, but upon discussion at Bug#23957, there is a risk breaking backward compatibility, as some users of fboundp may - expect `t' in particular, rather than any true value. */ + expect t in particular, rather than any true value. */ DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, doc: /* Return t if SYMBOL's function definition is not void. */) (Lisp_Object symbol) diff --git a/src/dispnew.c b/src/dispnew.c index 0c31319917..69c2023fdf 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -6704,7 +6704,7 @@ See `buffer-display-table' for more information. */); DEFVAR_LISP ("tab-bar-position", Vtab_bar_position, doc: /* Specify on which side from the tool bar the tab bar shall be. -Possible values are `t' (below the tool bar), `nil' (above the tool bar). +Possible values are t (below the tool bar), nil (above the tool bar). This option affects only builds where the tool bar is not external. */); pdumper_do_now_and_after_load (syms_of_display_for_pdumper); diff --git a/src/minibuf.c b/src/minibuf.c index a4219d2a63..4b72d3e896 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1292,8 +1292,8 @@ Fifth arg HIST, if non-nil, specifies a history list and optionally HISTPOS is the initial position for use by the minibuffer history commands. For consistency, you should also specify that element of the history as the value of INITIAL-CONTENTS. Positions are counted - starting from 1 at the beginning of the list. If HIST is the symbol - `t', history is not recorded. + starting from 1 at the beginning of the list. If HIST is t, history + is not recorded. If `history-add-new-input' is non-nil (the default), the result will be added to the history list using `add-to-history'. @@ -2037,8 +2037,7 @@ HIST, if non-nil, specifies a history list and optionally the initial (This is the only case in which you should use INITIAL-INPUT instead of DEF.) Positions are counted starting from 1 at the beginning of the list. The variable `history-length' controls the maximum length - of a history list. If HIST is the symbol `t', history is not - recorded. + of a history list. If HIST is t, history is not recorded. DEF, if non-nil, is the default value or the list of default values. @@ -2486,7 +2485,7 @@ is added with (set minibuffer-history-variable (cons STRING (symbol-value minibuffer-history-variable))) - If the variable is the symbol `t', no history is recorded. */); + If the variable is t, no history is recorded. */); XSETFASTINT (Vminibuffer_history_variable, 0); DEFVAR_LISP ("minibuffer-history-position", Vminibuffer_history_position, diff --git a/src/process.c b/src/process.c index bfca165fca..58347a154a 100644 --- a/src/process.c +++ b/src/process.c @@ -6887,7 +6887,7 @@ If CURRENT-GROUP is `lambda', and if the shell owns the terminal, don't send the signal. This function calls the functions of `interrupt-process-functions' in -the order of the list, until one of them returns non-`nil'. */) +the order of the list, until one of them returns non-nil. */) (Lisp_Object process, Lisp_Object current_group) { return CALLN (Frun_hook_with_args_until_success, Qinterrupt_process_functions, @@ -8514,7 +8514,7 @@ thus favoring processes with lower descriptors. */); doc: /* List of functions to be called for `interrupt-process'. The arguments of the functions are the same as for `interrupt-process'. These functions are called in the order of the list, until one of them -returns non-`nil'. */); +returns non-nil. */); Vinterrupt_process_functions = list1 (Qinternal_default_interrupt_process); DEFVAR_LISP ("internal--daemon-sockname", Vinternal__daemon_sockname, diff --git a/src/xfaces.c b/src/xfaces.c index c5b7a568ae..5e63e87d75 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -2420,11 +2420,11 @@ evaluate_face_filter (Lisp_Object filter, struct window *w, /* Determine whether FACE_REF is a "filter" face specification (case #4 in merge_face_ref). If it is, evaluate the filter, and if the filter matches, return the filtered face spec. If the filter does - not match, return `nil'. If FACE_REF is not a filtered face + not match, return nil. If FACE_REF is not a filtered face specification, return FACE_REF. On error, set *OK to false, having logged an error message if - ERR_MSGS is true, and return `nil'. Otherwise, *OK is not touched. + ERR_MSGS is true, and return nil. Otherwise, *OK is not touched. W is either NULL or a window used to evaluate filters. If W is NULL, no window-based face specification filter matches. diff --git a/test/lisp/emacs-lisp/tabulated-list-test.el b/test/lisp/emacs-lisp/tabulated-list-test.el index db1ce31258..679afda394 100644 --- a/test/lisp/emacs-lisp/tabulated-list-test.el +++ b/test/lisp/emacs-lisp/tabulated-list-test.el @@ -96,7 +96,7 @@ (should (equal (get-text-property (point) 'tabulated-list-column-name) "name-2")) (tabulated-list-sort) - ;; Check a `t' as the sorting predicate. + ;; Check a t as the sorting predicate. (should (string= text (buffer-substring-no-properties (point-min) (point-max)))) ;; Invert. (tabulated-list-sort 1) diff --git a/test/lisp/so-long-tests/so-long-tests.el b/test/lisp/so-long-tests/so-long-tests.el index 8e4597c946..7eee345aad 100644 --- a/test/lisp/so-long-tests/so-long-tests.el +++ b/test/lisp/so-long-tests/so-long-tests.el @@ -229,7 +229,7 @@ ((obsolete run-window-configuration-change-hook)) (run-window-configuration-change-hook))))) (so-long-tests-assert-and-revert 'so-long-mode)) - ;; `so-long-invisible-buffer-function' is `nil'. + ;; `so-long-invisible-buffer-function' is nil. (with-temp-buffer (insert "#!emacs\n") (normal-mode) diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 0c3661a296..695da10408 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -492,11 +492,11 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350." (should (equal subr-tests--hook '(f5 f2 f1 f4 f3))) (add-hook 'subr-tests--hook 'f6) (should (equal subr-tests--hook '(f5 f6 f2 f1 f4 f3))) - ;; Make sure `t' is equivalent to 90. + ;; Make sure t is equivalent to 90. (add-hook 'subr-tests--hook 'f7 90) (add-hook 'subr-tests--hook 'f8 t) (should (equal subr-tests--hook '(f5 f6 f2 f1 f4 f3 f7 f8))) - ;; Make sure `nil' is equivalent to 0. + ;; Make sure nil is equivalent to 0. (add-hook 'subr-tests--hook 'f9 0) (add-hook 'subr-tests--hook 'f10) (should (equal subr-tests--hook '(f5 f10 f9 f6 f2 f1 f4 f3 f7 f8))) diff --git a/test/lisp/url/url-auth-tests.el b/test/lisp/url/url-auth-tests.el index ff30f10025..05ccfc0d12 100644 --- a/test/lisp/url/url-auth-tests.el +++ b/test/lisp/url/url-auth-tests.el @@ -154,7 +154,7 @@ Essential is how realms and paths are matched." auth) (dolist (row (list - ;; If :expected-user is `nil' it indicates + ;; If :expected-user is nil it indicates ;; authentication information shouldn't be found. ;; non-existent server diff --git a/test/src/minibuf-tests.el b/test/src/minibuf-tests.el index c55611eb84..feea1c112b 100644 --- a/test/src/minibuf-tests.el +++ b/test/src/minibuf-tests.el @@ -406,7 +406,7 @@ (should (equal (try-completion "bar" '("bArfoo" "barbaz")) (try-completion "bar" '("barbaz" "bArfoo")))) ;; bug#11339 - (should (equal (try-completion "baz" '("baz" "bAz")) "baz")) ;And not `t'! + (should (equal (try-completion "baz" '("baz" "bAz")) "baz")) ;And not t! (should (equal (try-completion "baz" '("bAz" "baz")) (try-completion "baz" '("baz" "bAz")))))) commit 636e082e451aacb881a94b6c5b3dafb15d7eaa3d Author: Lars Ingebrigtsen Date: Tue Sep 21 22:01:28 2021 +0200 Document isearch-wrap-pause * doc/emacs/search.texi (Repeat Isearch): Document `isearch-wrap-pause'. diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index e4322e361f..8a101f1150 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -222,6 +222,15 @@ going past the original starting point of the search, it changes to @samp{Overwrapped}, which means that you are revisiting matches that you have already seen. +@vindex isearch-wrap-pause + You can control what happens when there are no more matches by +customizing the @code{isearch-wrap-pause} user option. If it is +@code{t} (the default), signal an error. (Repeating the search will +wrap around.) If @code{no}, issue a @code{ding} and wrap immediately +after reaching the last match. If @code{no-ding}, wrap immediately, +but don't @code{ding}. Finally, if @code{nil}, never wrap, but just +stop at the last match. + @cindex search ring @findex isearch-ring-advance @findex isearch-ring-retreat diff --git a/etc/NEWS b/etc/NEWS index 7765f5a679..4bdbdeae0b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1044,10 +1044,12 @@ achieve that. +++ ** New command 'C-x C-k Q' to force redisplay in keyboard macros. +--- ** 'blink-cursor-mode' is now enabled by default regardless of the UI. It used to be enabled when Emacs is started in GUI mode but not when started in text mode. The cursor still only actually blinks in GUI frames. ++++ ** New minor mode 'show-paren-local-mode'. It serves as a local counterpart for 'show-paren-mode', allowing you to toggle it separately in different buffers. @@ -1074,6 +1076,7 @@ distinguish between sub-expression highlighting. Like 'search-highlight-submatches', this is controlled by the new user option 'query-replace-highlight-submatches'. ++++ *** New user option 'isearch-wrap-pause' defines how to wrap the search. There are choices to disable wrapping completely and to wrap immediately. When wrapping immediately, it consistently handles the numeric arguments commit 7b62ea95c9616b6897b8a727a219925c62c38557 Author: Stefan Kangas Date: Sun Sep 19 15:46:44 2021 +0200 New major mode with font-locking for etc/AUTHORS * lisp/textmodes/etc-authors-mode.el: New file. (Bug#50674) * etc/AUTHORS (mode): Add "mode: etc-authors" to local variables. * admin/authors.el (authors): Add "mode: etc-authors" to local variables of the generated AUTHORS file. diff --git a/admin/authors.el b/admin/authors.el index b4e6c934b6..3dec23c191 100644 --- a/admin/authors.el +++ b/admin/authors.el @@ -1676,7 +1676,7 @@ list of their contributions.\n") (insert "\n ")) (insert " " file)) (insert "\n"))))) - (insert "\nLocal" " Variables:\ncoding: " + (insert "\nLocal" " Variables:\nmode: etc-authors\ncoding: " (symbol-name authors-coding-system) "\nEnd:\n") (message "Generating buffer %s... done" buffer-name) (unless noninteractive diff --git a/etc/AUTHORS b/etc/AUTHORS index 3e91efb570..b599809e3e 100644 --- a/etc/AUTHORS +++ b/etc/AUTHORS @@ -5521,5 +5521,6 @@ Zoran Milojevic: changed avoid.el উৎসব রায়: changed quail/indian.el Local Variables: +mode: etc-authors coding: utf-8 End: diff --git a/etc/NEWS b/etc/NEWS index eeb753a9af..7765f5a679 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3080,6 +3080,11 @@ similar to prefix arguments, but are more flexible and discoverable. It's a library to create, query, navigate and display hierarchical structures. +--- +** New major mode for displaying the "etc/AUTHORS" file. +This new 'etc-authors-mode' provides font-locking for displaying the +"etc/AUTHORS" file from the Emacs distribution, and not much else. + * Incompatible Editing Changes in Emacs 28.1 diff --git a/lisp/textmodes/etc-authors-mode.el b/lisp/textmodes/etc-authors-mode.el new file mode 100644 index 0000000000..09ad198346 --- /dev/null +++ b/lisp/textmodes/etc-authors-mode.el @@ -0,0 +1,131 @@ +;;; etc-authors-mode.el --- font-locking for etc/AUTHORS -*- lexical-binding: t -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; Author: Stefan Kangas +;; Keywords: internal + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Major mode to display the etc/AUTHORS file from the Emacs +;; distribution. Provides some basic font locking and not much else. + +;;; Code: + +(defgroup etc-authors-mode nil + "Display the \"etc/AUTHORS\" file from the Emacs distribution." + :version "28.1" + :group 'internal) + +(defface etc-authors-default '((t :inherit variable-pitch)) + "Default face used to display the \"etc/AUTHORS\" file. +See also `etc-authors-mode'." + :version "28.1") + +(defface etc-authors-author '((((class color) (min-colors 88) (background light)) + :foreground "midnight blue" + :weight bold :height 1.05 + :inherit variable-pitch) + (((class color) (min-colors 88) (background dark)) + :foreground "cyan" + :weight bold :height 1.05 + :inherit variable-pitch) + (((supports :weight bold) (supports :height 1.05)) + :weight bold :height 1.05 + :inherit variable-pitch) + (((supports :weight bold)) + :weight bold :inherit variable-pitch) + (t :inherit variable-pitch)) + "Face used for the author in the \"etc/AUTHORS\" file. +See also `etc-authors-mode'." + :version "28.1") + +(defface etc-authors-descriptor '((((class color) (min-colors 88) (background light)) + :foreground "sienna" :inherit variable-pitch) + (((class color) (min-colors 88) (background dark)) + :foreground "peru" :inherit variable-pitch) + (t :inherit variable-pitch)) + "Face used for the description text in the \"etc/AUTHORS\" file. +See also `etc-authors-mode'." + :version "28.1") + +(defface etc-authors-other-files '((t :inherit etc-authors-descriptor)) + "Face used for the \"other files\" text in the \"etc/AUTHORS\" file. +See also `etc-authors-mode'." + :version "28.1") + +(defconst etc-authors--author-re + (rx bol (group (not (any blank "\n")) (+? (not (any ":" "\n")))) ":") + "Regexp matching an author in \"etc/AUTHORS\".") + +(defvar etc-authors-mode-font-lock-keywords + `((,etc-authors--author-re + 1 'etc-authors-author) + (,(rx (or "wrote" + (seq (? "and ") (or "co-wrote" "changed")))) + 0 'etc-authors-descriptor) + (,(rx "and " (+ digit) " other files") + 0 'etc-authors-other-files) + (,(rx bol (not space) (+ not-newline) eol) + 0 'etc-authors-default))) + +(defun etc-authors-mode--hide-local-variables () + "Hide local variables in \"etc/AUTHORS\". Used by `etc-authors-mode'." + (narrow-to-region (point-min) + (save-excursion + (goto-char (point-min)) + (if (re-search-forward "^Local Variables:$" nil t) + (progn (forward-line -1) (point)) + (point-max))))) + +(defun etc-authors-next-author (&optional arg) + "Move point to the next author in \"etc/AUTHORS\". +With a prefix arg ARG, move point that many authors forward." + (interactive "p" etc-authors-mode) + (if (< 0 arg) + (progn + (when (looking-at etc-authors--author-re) + (forward-line 1)) + (re-search-forward etc-authors--author-re nil t arg)) + (when (looking-at etc-authors--author-re) + (forward-line -1)) + (re-search-backward etc-authors--author-re nil t (abs arg))) + (goto-char (line-beginning-position))) + +(defun etc-authors-prev-author (&optional arg) + "Move point to the previous author in \"etc/AUTHORS\". +With a prefix arg ARG, move point that many authors backward." + (interactive "p" etc-authors-mode) + (etc-authors-next-author (- arg))) + +(defvar etc-authors-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "n" #'etc-authors-next-author) + (define-key map "p" #'etc-authors-prev-author) + map) + "Keymap for `etc-authors-mode'.") + +;;;###autoload +(define-derived-mode etc-authors-mode special-mode "Authors View" + "Major mode for viewing \"etc/AUTHORS\" from the Emacs distribution. +Provides some basic font locking and not much else." + (setq-local font-lock-defaults + '(etc-authors-mode-font-lock-keywords nil nil ((?_ . "w")))) + (setq font-lock-multiline nil) + (etc-authors-mode--hide-local-variables)) + +(provide 'etc-authors-mode) +;;; etc-authors-mode.el ends here commit e4a9aa940beb032e97de6d4e4a23c2c9d94fdeb6 Author: Stefan Kangas Date: Tue Sep 21 21:07:37 2021 +0200 ; * doc/lispref/windows.texi (Cyclic Window Ordering): Fix typo. diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 44cd89d98c..679744884a 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -2082,7 +2082,7 @@ windows to search, and have the same meanings as in @end defun @defun window-bump-use-time window -This function marks @var{window} has having been recently used. This +This function marks @var{window} as having been recently used. This can be useful when creating certain @code{pop-to-buffer} scenarios. @end defun commit fd77065fc66e340e3d6a246859868d459076f509 Author: Eli Zaretskii Date: Tue Sep 21 21:51:38 2021 +0300 Improve recently added documentation * doc/lispref/lists.texi (Building Lists): * lisp/subr.el (ensure-list): Avoid passive tense in documenting 'ensure-list'. diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index 6bb11460ef..75641256b6 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -680,9 +680,9 @@ list are in the same order as in @var{tree}. @end example @defun ensure-list object -Ensure that we have a list. If @var{object} is already a list, it is -returned. If @var{object} isn't a list, a one-element list containing -@var{object} is returned. +This function returns @var{object} as a list. If @var{object} is +already a list, the function returns it; otherwise, the function +returns a one-element list containing @var{object}. This is usually useful if you have a variable that may or may not be a list, and you can then say, for instance: diff --git a/lisp/subr.el b/lisp/subr.el index 232e684cd4..0793cbca5e 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6427,9 +6427,9 @@ This is intended for internal use only." (json-unavailable nil)))) (defun ensure-list (object) - "Ensure that we have a list. -If OBJECT is already a list, OBJECT is returned. If it's -not a list, a one-element list containing OBJECT is returned." + "Return OBJECT as a list. +If OBJECT is already a list, return OBJECT itself. If it's +not a list, return a one-element list containing OBJECT." (if (listp object) object (list object))) commit be4f8584983e63905aa409efad11fb7d8d418ccb Author: Lars Ingebrigtsen Date: Tue Sep 21 20:30:57 2021 +0200 Add new function `ensure-list' * doc/lispref/lists.texi (Building Lists): Document it. * lisp/subr.el (ensure-list): New function. * lisp/emacs-lisp/shortdoc.el (list): Mention it. diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index bbe1dce42d..6bb11460ef 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -679,6 +679,20 @@ list are in the same order as in @var{tree}. @result{}(1 2 3 4 5 6 7) @end example +@defun ensure-list object +Ensure that we have a list. If @var{object} is already a list, it is +returned. If @var{object} isn't a list, a one-element list containing +@var{object} is returned. + +This is usually useful if you have a variable that may or may not be a +list, and you can then say, for instance: + +@lisp +(dolist (elem (ensure-list foo)) + (princ elem)) +@end lisp +@end defun + @defun number-sequence from &optional to separation This function returns a list of numbers starting with @var{from} and incrementing by @var{separation}, and ending at or just before diff --git a/etc/NEWS b/etc/NEWS index d5b6919d6d..eeb753a9af 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3825,6 +3825,11 @@ This function works along the line of 'replace-regexp-in-string', but it matches on fixed strings instead of regexps, and does not change the global match state. ++++ +** New function 'ensure-list'. +This function makes a list of its object if it's not a list already. +If it's already a list, the list is returned as is. + +++ ** New function 'split-string-shell-command'. This splits a shell command string into separate components, diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index 3e0d5aef02..d4838ff0f8 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -495,6 +495,9 @@ There can be any number of :example/:result elements." :eval (list 1 2 3)) (number-sequence :eval (number-sequence 5 8)) + (ensure-list + :eval (ensure-list "foo") + :eval (ensure-list '(1 2 3))) "Operations on Lists" (append :eval (append '("foo" "bar") '("zot"))) diff --git a/lisp/subr.el b/lisp/subr.el index 6bd9a018eb..232e684cd4 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6426,4 +6426,12 @@ This is intended for internal use only." (:success t) (json-unavailable nil)))) +(defun ensure-list (object) + "Ensure that we have a list. +If OBJECT is already a list, OBJECT is returned. If it's +not a list, a one-element list containing OBJECT is returned." + (if (listp object) + object + (list object))) + ;;; subr.el ends here diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 54bee7bc75..0c3661a296 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -767,5 +767,10 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350." (should-not (equal dir default-directory)) (should (file-exists-p default-directory))))) +(ert-deftest test-ensure-list () + (should (equal (ensure-list nil) nil)) + (should (equal (ensure-list :foo) '(:foo))) + (should (equal (ensure-list '(1 2 3)) '(1 2 3)))) + (provide 'subr-tests) ;;; subr-tests.el ends here commit a08bb1f6828bd6a7fb93319652e13beab5a25302 Merge: 2e5752cf98 f41a4ec8e1 Author: Michael Albinus Date: Tue Sep 21 20:27:48 2021 +0200 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit 2e5752cf981bd9672630db2d66a032c6607fe1a7 Author: Michael Albinus Date: Tue Sep 21 20:26:59 2021 +0200 Fix tramp-compat-temporary-file-directory implementation * lisp/net/tramp-archive.el (tramp-archive-handle-temporary-file-directory): Use `tramp-compat-temporary-file-directory-function'. * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): Make it a defconst. * lisp/net/tramp.el (tramp-get-debug-buffer, tramp-get-debug-file-name) (tramp-debug-message, tramp-file-name-handler, tramp-parse-file) (tramp-parse-shostkeys-sknownhosts) (tramp-handle-expand-file-name, tramp-handle-make-process) (tramp-local-host-p, tramp-call-process) (tramp-call-process-region, tramp-process-lines) (tramp-read-passwd): * lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection): * lisp/net/tramp-compat.el (tramp-compat-make-temp-name) (tramp-compat-make-temp-file); * lisp/net/tramp-crypt.el (tramp-crypt-file-name-for-operation) (tramp-crypt-maybe-open-connection, tramp-crypt-send-command) (tramp-crypt-do-encrypt-or-decrypt-file-name): * lisp/net/tramp-fuse.el (tramp-fuse-mount-point, tramp-fuse-mounted-p) (tramp-fuse-unmount): * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band) (tramp-sh-handle-expand-file-name) (tramp-sh-handle-file-local-copy, ) (tramp-sh-handle-write-region, tramp-maybe-open-connection): * lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Use it. diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 46064a8574..d68d4c7b76 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -1273,7 +1273,7 @@ connection if a previous connection has died for some reason." (list "-s" device "shell") (list "shell"))) (p (let ((default-directory - (tramp-compat-temporary-file-directory))) + tramp-compat-temporary-file-directory)) (apply #'start-process (tramp-get-connection-name vec) buf tramp-adb-program args))) (prompt (md5 (concat (prin1-to-string process-environment) diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index 5e2e1f0602..b28235924d 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el @@ -658,7 +658,7 @@ offered." ;; mounted directory, it is returned as it. Not what we want. (with-parsed-tramp-archive-file-name default-directory nil (let ((default-directory (file-name-directory archive))) - (tramp-compat-temporary-file-directory)))) + (tramp-compat-temporary-file-directory-function)))) (defun tramp-archive-handle-not-implemented (operation &rest args) "Generic handler for operations not implemented for file archives." diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index e6f1d9df70..213ab5857c 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -63,25 +63,24 @@ `(when (functionp ,function) (with-no-warnings (funcall ,function ,@arguments)))) -(defsubst tramp-compat-temporary-file-directory () - "Return name of directory for temporary files. -It is the default value of `temporary-file-directory'." - ;; We must return a local directory. If it is remote, we could run - ;; into an infloop. - (eval (car (get 'temporary-file-directory 'standard-value)) t)) +;; We must use a local directory. If it is remote, we could run into +;; an infloop. +(defconst tramp-compat-temporary-file-directory + (eval (car (get 'temporary-file-directory 'standard-value)) t) + "The default value of `temporary-file-directory'.") (defsubst tramp-compat-make-temp-name () "Generate a local temporary file name (compat function)." (make-temp-name (expand-file-name - tramp-temp-name-prefix (tramp-compat-temporary-file-directory)))) + tramp-temp-name-prefix tramp-compat-temporary-file-directory))) (defsubst tramp-compat-make-temp-file (f &optional dir-flag) "Create a local temporary file (compat function). Add the extension of F, if existing." (make-temp-file (expand-file-name - tramp-temp-name-prefix (tramp-compat-temporary-file-directory)) + tramp-temp-name-prefix tramp-compat-temporary-file-directory) dir-flag (file-name-extension f t))) ;; `temporary-file-directory' as function is introduced with Emacs 26.1. diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el index 5f86767ef9..5def3a4137 100644 --- a/lisp/net/tramp-crypt.el +++ b/lisp/net/tramp-crypt.el @@ -247,7 +247,7 @@ Operations not mentioned here will be handled by the default Emacs primitives.") (unless (tramp-crypt-file-name-p tfnfo) (setq tfnfo (apply #'tramp-file-name-for-operation operation - (cons (tramp-compat-temporary-file-directory) (cdr args))))) + (cons tramp-compat-temporary-file-directory (cdr args))))) tfnfo)) (defun tramp-crypt-run-real-handler (operation args) @@ -329,7 +329,7 @@ connection if a previous connection has died for some reason." (copy-file remote-config local-config 'ok 'keep) ;; Create local encfs6 config file otherwise. - (let* ((default-directory (tramp-compat-temporary-file-directory)) + (let* ((default-directory tramp-compat-temporary-file-directory) (tmpdir1 (file-name-as-directory (tramp-compat-make-temp-file " .crypt" 'dir-flag))) (tmpdir2 (file-name-as-directory @@ -383,7 +383,7 @@ ARGS are the arguments. It returns t if ran successful, and nil otherwise." (with-temp-buffer (let* (;; Don't check for a proper method. (non-essential t) - (default-directory (tramp-compat-temporary-file-directory)) + (default-directory tramp-compat-temporary-file-directory) ;; We cannot add it to `process-environment', because ;; `tramp-call-process-region' doesn't use it. (encfs-config @@ -427,7 +427,7 @@ Otherwise, return NAME." crypt-vec localname (concat (symbol-name op) "-file-name") (unless (tramp-crypt-send-command crypt-vec (if (eq op 'encrypt) "encode" "decode") - (tramp-compat-temporary-file-directory) localname) + tramp-compat-temporary-file-directory localname) (tramp-error crypt-vec 'file-error "%s of file name %s failed." (if (eq op 'encrypt) "Encoding" "Decoding") name)) diff --git a/lisp/net/tramp-fuse.el b/lisp/net/tramp-fuse.el index 93b184a36c..8c5afa7cf9 100644 --- a/lisp/net/tramp-fuse.el +++ b/lisp/net/tramp-fuse.el @@ -154,7 +154,7 @@ (when (tramp-file-name-user vec) (concat (tramp-file-name-user-domain vec) "@")) (tramp-file-name-host-port vec)) - (tramp-compat-temporary-file-directory)))) + tramp-compat-temporary-file-directory))) (defun tramp-fuse-mounted-p (vec) "Check, whether fuse volume determined by VEC is mounted." @@ -163,7 +163,7 @@ ;; to cache a nil result. (or (tramp-get-connection-property (tramp-get-connection-process vec) "mounted" nil) - (let* ((default-directory (tramp-compat-temporary-file-directory)) + (let* ((default-directory tramp-compat-temporary-file-directory) (command (format "mount -t fuse.%s" (tramp-file-name-method vec))) (mount (shell-command-to-string command))) (tramp-message vec 6 "%s\n%s" command mount) @@ -177,7 +177,7 @@ (defun tramp-fuse-unmount (vec) "Unmount fuse volume determined by VEC." - (let ((default-directory (tramp-compat-temporary-file-directory)) + (let ((default-directory tramp-compat-temporary-file-directory) (command (format "fusermount3 -u %s" (tramp-fuse-mount-point vec)))) (tramp-message vec 6 "%s\n%s" command (shell-command-to-string command)) (tramp-flush-connection-property diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index fbb122e721..18599f7c39 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2391,7 +2391,7 @@ The method used must be an out-of-band method." ;; can be handled. We don't set a timeout, because ;; the copying of large files can last longer than 60 ;; secs. - p (let ((default-directory (tramp-compat-temporary-file-directory))) + p (let ((default-directory tramp-compat-temporary-file-directory)) (apply #'start-process (tramp-get-connection-name v) @@ -2740,7 +2740,7 @@ the result will be a local, non-Tramp, file name." ;; `expand-file-name' (this does "/./" and "/../"). ;; `default-directory' is bound, because on Windows there ;; would be problems with UNC shares or Cygwin mounts. - (let ((default-directory (tramp-compat-temporary-file-directory))) + (let ((default-directory tramp-compat-temporary-file-directory)) (tramp-make-tramp-file-name v (tramp-drop-volume-letter (tramp-run-real-handler @@ -3221,7 +3221,7 @@ implementation will be used." (let (file-name-handler-alist (coding-system-for-write 'binary) (default-directory - (tramp-compat-temporary-file-directory))) + tramp-compat-temporary-file-directory)) (with-temp-file tmpfile (set-buffer-multibyte nil) (insert-buffer-substring (tramp-get-buffer v)) @@ -3314,8 +3314,7 @@ implementation will be used." ;; we use it always because this makes the logic ;; simpler. We must also set `temporary-file-directory', ;; because it could point to a remote directory. - (temporary-file-directory - (tramp-compat-temporary-file-directory)) + (temporary-file-directory tramp-compat-temporary-file-directory) (tmpfile (or tramp-temp-buffer-file-name (tramp-compat-make-temp-file filename)))) @@ -3408,7 +3407,7 @@ implementation will be used." ;; question is a tmp file anyway. (let ((coding-system-for-read 'binary) (default-directory - (tramp-compat-temporary-file-directory))) + tramp-compat-temporary-file-directory)) (insert-file-contents-literally tmpfile) (funcall loc-enc (point-min) (point-max))) @@ -4919,7 +4918,7 @@ connection if a previous connection has died for some reason." ;; This must be done in order to avoid our file ;; name handler. (p (let ((default-directory - (tramp-compat-temporary-file-directory))) + tramp-compat-temporary-file-directory)) (apply #'start-process (tramp-get-connection-name vec) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 5c2d7d008a..87f3665d91 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -1962,7 +1962,7 @@ If ARGUMENT is non-nil, use it as argument for ;; Otherwise, we must delete the connection cache, because ;; capabilities might have changed. (unless (or argument (processp p)) - (let ((default-directory (tramp-compat-temporary-file-directory)) + (let ((default-directory tramp-compat-temporary-file-directory) (command (concat tramp-smb-program " -V"))) (unless tramp-smb-version @@ -2049,7 +2049,7 @@ If ARGUMENT is non-nil, use it as argument for (let* ((coding-system-for-read nil) (process-connection-type tramp-process-connection-type) (p (let ((default-directory - (tramp-compat-temporary-file-directory)) + tramp-compat-temporary-file-directory) (process-environment (cons (concat "TERM=" tramp-terminal-type) process-environment))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 8c9200093d..22ddfdb8e8 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1899,7 +1899,7 @@ The outline level is equal to the verbosity of the Tramp message." ;; `(custom-declare-variable outline-minor-mode-prefix ...)' ;; raises on error in `(outline-mode)', we don't want to see it ;; in the traces. - (let ((default-directory (tramp-compat-temporary-file-directory))) + (let ((default-directory tramp-compat-temporary-file-directory)) (outline-mode)) (setq-local outline-level 'tramp-debug-outline-level) (setq-local font-lock-keywords @@ -1918,7 +1918,7 @@ The outline level is equal to the verbosity of the Tramp message." "Get the debug file name for VEC." (expand-file-name (tramp-compat-string-replace "/" " " (tramp-debug-buffer-name vec)) - (tramp-compat-temporary-file-directory))) + tramp-compat-temporary-file-directory)) (put #'tramp-get-debug-file-name 'tramp-suppress-trace t) @@ -1960,7 +1960,8 @@ ARGUMENTS to actually emit the message (if applicable)." (dolist (elt (append - (mapcar #'intern (all-completions "tramp-" obarray 'functionp)) + (mapcar + #'intern (all-completions "tramp-" obarray #'functionp)) tramp-trace-functions)) (unless (get elt 'tramp-suppress-trace) (trace-function-background elt)))) @@ -2586,7 +2587,7 @@ Fall back to normal file name handler if no Tramp file name handler exists." ;; the bug#9114 for which it was added doesn't ;; clarify the core of the problem. (let ((default-directory - (tramp-compat-temporary-file-directory)) + tramp-compat-temporary-file-directory) file-name-handler-alist) (autoload-do-load sf foreign))) ;; (tramp-message @@ -3090,7 +3091,7 @@ User is always nil." User is always nil." ;; On Windows, there are problems in completion when ;; `default-directory' is remote. - (let ((default-directory (tramp-compat-temporary-file-directory))) + (let ((default-directory tramp-compat-temporary-file-directory)) (when (file-readable-p filename) (with-temp-buffer (insert-file-contents-literally filename) @@ -3144,7 +3145,7 @@ User is always nil." User is always nil." ;; On Windows, there are problems in completion when ;; `default-directory' is remote. - (let* ((default-directory (tramp-compat-temporary-file-directory)) + (let* ((default-directory tramp-compat-temporary-file-directory) (files (and (file-directory-p dirname) (directory-files dirname)))) (cl-loop for f in files @@ -3378,7 +3379,7 @@ User is always nil." ;; Do normal `expand-file-name' (this does "/./" and "/../"). ;; `default-directory' is bound, because on Windows there would ;; be problems with UNC shares or Cygwin mounts. - (let ((default-directory (tramp-compat-temporary-file-directory))) + (let ((default-directory tramp-compat-temporary-file-directory)) (tramp-make-tramp-file-name v (tramp-drop-volume-letter (tramp-run-real-handler #'expand-file-name (list localname)))))))) @@ -4103,7 +4104,7 @@ substitution. SPEC-LIST is a list of char/value pairs used for "An alternative `make-process' implementation for Tramp files." (when args (with-parsed-tramp-file-name (expand-file-name default-directory) nil - (let ((default-directory (tramp-compat-temporary-file-directory)) + (let ((default-directory tramp-compat-temporary-file-directory) (name (plist-get args :name)) (buffer (plist-get args :buffer)) (command (plist-get args :command)) @@ -5366,7 +5367,7 @@ This handles also chrooted environments, which are not regarded as local." ;; The local temp directory must be writable for the other user. (file-writable-p (tramp-make-tramp-file-name - vec (tramp-compat-temporary-file-directory) 'nohop)) + vec tramp-compat-temporary-file-directory 'nohop)) ;; On some systems, chown runs only for root. (or (zerop (user-uid)) (zerop (tramp-get-remote-uid vec 'integer)))))) @@ -5508,7 +5509,7 @@ ALIST is of the form ((FROM . TO) ...)." It always returns a return code. The Lisp error raised when PROGRAM is nil is trapped also, returning 1. Furthermore, traces are written with verbosity of 6." - (let ((default-directory (tramp-compat-temporary-file-directory)) + (let ((default-directory tramp-compat-temporary-file-directory) (process-environment (default-toplevel-value 'process-environment)) (destination (if (eq destination t) (current-buffer) destination)) (vec (or vec (car tramp-current-connection))) @@ -5542,7 +5543,7 @@ are written with verbosity of 6." It always returns a return code. The Lisp error raised when PROGRAM is nil is trapped also, returning 1. Furthermore, traces are written with verbosity of 6." - (let ((default-directory (tramp-compat-temporary-file-directory)) + (let ((default-directory tramp-compat-temporary-file-directory) (process-environment (default-toplevel-value 'process-environment)) (buffer (if (eq buffer t) (current-buffer) buffer)) result) @@ -5572,7 +5573,7 @@ are written with verbosity of 6." "Call `process-lines' on the local host. If an error occurs, it returns nil. Traces are written with verbosity of 6." - (let ((default-directory (tramp-compat-temporary-file-directory)) + (let ((default-directory tramp-compat-temporary-file-directory) (process-environment (default-toplevel-value 'process-environment)) (vec (or vec (car tramp-current-connection))) result) @@ -5611,7 +5612,7 @@ Invokes `password-read' if available, `read-passwd' else." ;; `exec-path' contains a relative file name like ".", it ;; could happen that the "gpg" command is not found. So we ;; adapt `default-directory'. (Bug#39389, Bug#39489) - (default-directory (tramp-compat-temporary-file-directory)) + (default-directory tramp-compat-temporary-file-directory) (case-fold-search t) (key (tramp-make-tramp-file-name ;; In tramp-sh.el, we must use "password-vector" due to commit f41a4ec8e171db19690e3bf2198d8045f153e81f Author: Stefan Kangas Date: Tue Sep 21 20:17:46 2021 +0200 ; * lisp/emacs-lisp/checkdoc.el: Fix warnings. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 9d7d35eb73..5224a943ac 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -164,6 +164,7 @@ (require 'cl-lib) (require 'help-mode) ;; for help-xref-info-regexp (require 'thingatpt) ;; for handy thing-at-point-looking-at +(require 'dired) ;; for dired-get-filename and dired-map-over-marks (require 'lisp-mnt) (defvar compilation-error-regexp-alist) @@ -278,6 +279,8 @@ Currently, all recognized keywords must be on `finder-known-keywords'." :version "25.1" :type 'boolean) +(define-obsolete-variable-alias 'checkdoc-style-hooks + 'checkdoc-style-functions "24.3") (defvar checkdoc-style-functions nil "Hook run after the standard style check is completed. All functions must return nil or a string representing the error found. @@ -287,6 +290,8 @@ Each hook is called with two parameters, (DEFUNINFO ENDPOINT). DEFUNINFO is the return value of `checkdoc-defun-info'. ENDPOINT is the location of end of the documentation string.") +(define-obsolete-variable-alias 'checkdoc-comment-style-hooks + 'checkdoc-comment-style-functions "24.3") (defvar checkdoc-comment-style-functions nil "Hook run after the standard comment style check is completed. Must return nil if no errors are found, or a string describing the @@ -2806,10 +2811,6 @@ function called to create the messages." ;; Obsolete -(define-obsolete-variable-alias 'checkdoc-style-hooks - 'checkdoc-style-functions "24.3") -(define-obsolete-variable-alias 'checkdoc-comment-style-hooks - 'checkdoc-comment-style-functions "24.3") (define-obsolete-function-alias 'checkdoc-run-hooks #'run-hook-with-args-until-success "28.1") (defvar checkdoc-version "0.6.2" commit b2bb717d4b539b80841096609321d0c0b43576d0 Author: Stefan Kangas Date: Tue Sep 21 19:23:17 2021 +0200 Minor clean-up and fixes in checkdoc * lisp/emacs-lisp/checkdoc.el: Minor doc fixes. Remove unnecessary space at the end of 'y-or-n-p' prompts. Move obsolete definitions to the end of the file. (checkdoc-symbol-words, checkdoc-common-verbs-wrong-voice): Add some more common words. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 7418663175..9d7d35eb73 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -118,8 +118,7 @@ ;; The text that follows the `error' and `y-or-n-p' commands is ;; also checked. The documentation for `error' clearly states some ;; simple style rules to follow which checkdoc will auto-fix for you. -;; `y-or-n-p' also states that it should end in a space. I added that -;; it should end in "? " since that is almost always used. +;; `y-or-n-p' and `yes-or-no-p' should also end in "?". ;; ;; Adding your own checks: ;; @@ -279,8 +278,6 @@ Currently, all recognized keywords must be on `finder-known-keywords'." :version "25.1" :type 'boolean) -(define-obsolete-variable-alias 'checkdoc-style-hooks - 'checkdoc-style-functions "24.3") (defvar checkdoc-style-functions nil "Hook run after the standard style check is completed. All functions must return nil or a string representing the error found. @@ -290,8 +287,6 @@ Each hook is called with two parameters, (DEFUNINFO ENDPOINT). DEFUNINFO is the return value of `checkdoc-defun-info'. ENDPOINT is the location of end of the documentation string.") -(define-obsolete-variable-alias 'checkdoc-comment-style-hooks - 'checkdoc-comment-style-functions "24.3") (defvar checkdoc-comment-style-functions nil "Hook run after the standard comment style check is completed. Must return nil if no errors are found, or a string describing the @@ -313,9 +308,10 @@ Do not set this by hand, use a function like `checkdoc-current-buffer' with a universal argument.") (defcustom checkdoc-symbol-words - '("beginning-of-line" "byte-code" "command-line" "end-of-line" - "major-mode" "syntax-table" "top-level" "user-error" - "version-control" "window-system") + '("beginning-of-buffer" "beginning-of-line" "byte-code" + "byte-compile" "command-line" "end-of-buffer" "end-of-line" + "major-mode" "point-max" "point-min" "syntax-table" + "top-level" "user-error" "version-control" "window-system") "A list of symbol names (strings) which also happen to make good words. These words are ignored when unquoted symbols are searched for. This should be set in an Emacs Lisp file's local variables." @@ -400,6 +396,7 @@ this to anything but t is likely to be counter-productive.") ("contains" . "contain") ("converts" . "convert") ("creates" . "create") + ("defines" . "define") ("destroys" . "destroy") ("determines" . "determine") ("disables" . "disable") @@ -438,6 +435,7 @@ this to anything but t is likely to be counter-productive.") ("performs" . "perform") ("prepares" . "prepare") ("prepends" . "prepend") + ("prompts" . "prompt") ("reads" . "read") ("raises" . "raise") ("removes" . "remove") @@ -1294,8 +1292,8 @@ TEXT, START, END and UNFIXABLE conform to ;; Add in a menubar with easy-menu -(easy-menu-define - nil checkdoc-minor-mode-map "Checkdoc Minor Mode Menu" +(easy-menu-define nil checkdoc-minor-mode-map + "Checkdoc Minor Mode Menu." '("CheckDoc" ["Interactive Buffer Style Check" checkdoc t] ["Interactive Buffer Style and Spelling Check" checkdoc-ispell t] @@ -1337,8 +1335,6 @@ checking of documentation strings. ;;; Subst utils ;; -(define-obsolete-function-alias 'checkdoc-run-hooks - #'run-hook-with-args-until-success "28.1") (defsubst checkdoc-create-common-verbs-regexp () "Rebuild the contents of `checkdoc-common-verbs-regexp'." @@ -1415,7 +1411,7 @@ buffer, otherwise stop after the first error." (if (or (eq checkdoc-autofix-flag 'automatic-then-never) (checkdoc-y-or-n-p - "Convert comment to documentation? ")) + "Convert comment to documentation?")) (save-excursion ;; Our point is at the beginning of the comment! ;; Insert a quote, then remove the comment chars. @@ -1485,7 +1481,7 @@ buffer, otherwise stop after the first error." (looking-at "\\([ \t]+\\)[^ \t\n]")) (if (checkdoc-autofix-ask-replace (match-beginning 1) (match-end 1) - "Remove this whitespace? " + "Remove this whitespace?" "") nil (checkdoc-create-error @@ -1498,7 +1494,7 @@ buffer, otherwise stop after the first error." (when (re-search-forward "^(" e t) (if (checkdoc-autofix-ask-replace (match-beginning 0) (match-end 0) - (format-message "Escape this `('? ") + (format-message "Escape this `('?") "\\(") nil (checkdoc-create-error @@ -1516,7 +1512,7 @@ buffer, otherwise stop after the first error." (setq start (point) end (1- e))))) (if (checkdoc-autofix-ask-replace - start end "Remove this whitespace? " "") + start end "Remove this whitespace?" "") nil (checkdoc-create-error "Documentation strings should not start or end with whitespace" @@ -1541,7 +1537,7 @@ buffer, otherwise stop after the first error." nil (forward-char 1) (if (checkdoc-autofix-ask-replace - (point) (1+ (point)) "Add period to sentence? " + (point) (1+ (point)) "Add period to sentence?" ".\"" t) nil (checkdoc-create-error @@ -1562,7 +1558,7 @@ buffer, otherwise stop after the first error." ;; Here we have found a complete sentence, but no break. (if (checkdoc-autofix-ask-replace (1+ (match-beginning 0)) (match-end 0) - "First line not a complete sentence. Add RET here? " + "First line not a complete sentence. Add RET here?" "\n" t) (let (l1 l2) (end-of-line 2) @@ -1589,7 +1585,7 @@ may require more formatting") (< (current-column) numc)) (when (checkdoc-autofix-ask-replace p (1+ p) - "1st line not a complete sentence. Join these lines? " + "First line not a complete sentence. Join these lines?" " " t) (setq msg nil))))) (if msg @@ -1602,7 +1598,7 @@ may require more formatting") (if (looking-at "[a-z]") (if (checkdoc-autofix-ask-replace (match-beginning 0) (match-end 0) - "Capitalize your sentence? " (upcase (match-string 0)) + "Capitalize your sentence?" (upcase (match-string 0)) t) nil (checkdoc-create-error @@ -1658,7 +1654,7 @@ mouse-[0-3]\\)\\)\\>")) (not (looking-at "variable\\|option\\|function\\|command\\|symbol")))) (if (checkdoc-autofix-ask-replace - mb me "Prefix this ambiguous symbol? " ms1 t) + mb me "Prefix this ambiguous symbol?" ms1 t) ;; We didn't actually replace anything. Here we find ;; out what special word form they wish to use as ;; a prefix. @@ -1717,7 +1713,7 @@ function,command,variable,option or symbol." ms1)))))) (when (looking-at "\"\\*?\\(True\\)\\b") (if (checkdoc-autofix-ask-replace (match-beginning 1) (match-end 1) - "Say \"Non-nil\" instead of \"True\"? " + "Say \"Non-nil\" instead of \"True\"?" "Non-nil") nil (checkdoc-create-error @@ -1742,7 +1738,7 @@ function,command,variable,option or symbol." ms1)))))) ;; (concat (car fp) "-flag")))) ;; (if (checkdoc-y-or-n-p ;; (format - ;; "Rename to %s and Query-Replace all occurrences? " + ;; "Rename to %s and Query-Replace all occurrences?" ;; newname)) ;; (progn ;; (beginning-of-defun) @@ -1805,7 +1801,7 @@ function,command,variable,option or symbol." ms1)))))) (if (checkdoc-autofix-ask-replace (match-beginning 1) (match-end 1) (format-message - "If this is the argument `%s', it should appear as %s. Fix? " + "If this is the argument `%s', it should appear as %s. Fix?" (car args) (upcase (car args))) (upcase (car args)) t) (setq found (match-beginning 1)))))) @@ -1815,7 +1811,7 @@ function,command,variable,option or symbol." ms1)))))) ;; to the end of the documentation string. (if (checkdoc-y-or-n-p (format - "Add %s documentation to end of doc string? " + "Add %s documentation to end of doc string?" (upcase (car args)))) ;; Now do some magic and invent a doc string. (save-excursion @@ -1878,7 +1874,7 @@ function,command,variable,option or symbol." ms1)))))) (if (checkdoc-autofix-ask-replace (match-beginning 1) (match-end 1) (format "Use the imperative for \"%s\". \ -Replace with \"%s\"? " original replace) +Replace with \"%s\"?" original replace) replace t) (setq rs nil))) (if rs @@ -1892,7 +1888,7 @@ Replace with \"%s\"? " original replace) (when (looking-at "\"Return \\(true\\)\\b") (if (checkdoc-autofix-ask-replace (match-beginning 1) (match-end 1) - "Say \"non-nil\" instead of \"true\"? " + "Say \"non-nil\" instead of \"true\"?" "non-nil") nil (checkdoc-create-error @@ -1926,7 +1922,7 @@ Replace with \"%s\"? " original replace) (or (boundp found) (fboundp found))) (progn (setq msg (format-message - "Add quotes around Lisp symbol `%s'? " ms)) + "Add quotes around Lisp symbol `%s'?" ms)) (if (checkdoc-autofix-ask-replace (match-beginning 1) (+ (match-beginning 1) (length ms)) @@ -1945,7 +1941,7 @@ Replace with \"%s\"? " original replace) (if (re-search-forward "\\([`‘]\\(t\\|nil\\)['’]\\)" e t) (if (checkdoc-autofix-ask-replace (match-beginning 1) (match-end 1) - (format "%s should not appear in quotes. Remove? " + (format "%s should not appear in quotes. Remove?" (match-string 2)) (match-string 2) t) nil @@ -1961,9 +1957,7 @@ Replace with \"%s\"? " original replace) ;; and reliance on the Ispell program. (checkdoc-ispell-docstring-engine e take-notes) ;; User supplied checks - (save-excursion (run-hook-with-args-until-success 'checkdoc-style-functions fp e)) - ;; Done! - ))) + (save-excursion (run-hook-with-args-until-success 'checkdoc-style-functions fp e))))) (defun checkdoc-defun-info nil "Return a list of details about the current sexp. @@ -2186,7 +2180,7 @@ If the offending word is in a piece of quoted text, then it is skipped." (checkdoc-in-abbreviation-p b)) (if (checkdoc-autofix-ask-replace b e - "There should be two spaces after a period. Fix? " + "There should be two spaces after a period. Fix?" ". ") nil (if errtxt @@ -2303,7 +2297,7 @@ Optional argument INTERACT may permit the user to fix problems on the fly." News agents may remove it" s (match-beginning 0) e (match-end 0) f t) ;; If interactive is passed down, give them a chance to fix things. - (if (and interact (y-or-n-p (concat msg ". Fix? "))) + (if (and interact (y-or-n-p (concat msg ". Fix?"))) (progn (checkdoc-recursive-edit msg) (setq msg nil) @@ -2319,7 +2313,7 @@ News agents may remove it" ;; This is not a complex activity (if (checkdoc-autofix-ask-replace (match-beginning 1) (match-end 1) - "White space at end of line. Remove? " "") + "White space at end of line. Remove?" "") nil (setq msg "White space found at end of line" s (match-beginning 1) e (match-end 1)))))) @@ -2356,7 +2350,7 @@ Code:, and others referenced in the style guide." (if (not (lm-summary)) ;; This certifies as very complex so always ask unless ;; it's set to never - (if (checkdoc-y-or-n-p "There is no first line summary! Add one? ") + (if (checkdoc-y-or-n-p "There is no first line summary! Add one?") (progn (goto-char (point-min)) (insert ";;; " fn fe " --- " (read-string "Summary: ") "\n")) @@ -2387,7 +2381,7 @@ Code:, and others referenced in the style guide." "You should have a summary line (\";;; .* --- .*\")" nil nil t))) (if (checkdoc-y-or-n-p - "You should have a \";;; Commentary:\", add one? ") + "You should have a \";;; Commentary:\", add one?") (insert "\n;;; Commentary:\n;; \n\n") (checkdoc-create-error "You should have a section marked \";;; Commentary:\"" @@ -2415,7 +2409,7 @@ Code:, and others referenced in the style guide." (re-search-forward "^(" nil t)) (beginning-of-line))) (if (checkdoc-y-or-n-p - "You should have a \";;; History:\", add one? ") + "You should have a \";;; History:\", add one?") (insert "\n;;; History:\n;; \n\n") (checkdoc-create-error "You should have a section marked \";;; History:\" or use a ChangeLog" @@ -2441,7 +2435,7 @@ Code:, and others referenced in the style guide." cont (looking-at "require\\s-+"))) (if (and (not cont) (checkdoc-y-or-n-p - "There is no ;;; Code: marker. Insert one? ")) + "There is no ;;; Code: marker. Insert one?")) (progn (goto-char pos) (insert ";;; Code:\n\n") nil) @@ -2463,7 +2457,7 @@ Code:, and others referenced in the style guide." "\\|^;;;[ \t]+ End of file[ \t]+" (regexp-quote fn) "\\(" (regexp-quote fe) "\\)?") nil t)) - (if (checkdoc-y-or-n-p "No identifiable footer! Add one? ") + (if (checkdoc-y-or-n-p "No identifiable footer! Add one?") (progn (goto-char (point-max)) (insert "\n(provide '" fn ")\n\n;;; " fn fe " ends here\n")) @@ -2606,7 +2600,7 @@ Argument TYPE specifies the type of question, such as `error' or `y-or-n-p'." (looking-at "[a-z]\\w+")) (not (checkdoc-autofix-ask-replace (match-beginning 0) (match-end 0) - "Capitalize your message text? " + "Capitalize your message text?" (capitalize (match-string 0)) t))) (checkdoc-create-error @@ -2628,7 +2622,7 @@ Argument TYPE specifies the type of question, such as `error' or `y-or-n-p'." (looking-at "\\.")) (not (checkdoc-autofix-ask-replace (match-beginning 0) (match-end 0) - "Remove period from error? " + "Remove period from error?" "" t))) (checkdoc-create-error @@ -2648,7 +2642,7 @@ Argument TYPE specifies the type of question, such as `error' or `y-or-n-p'." ;; (defun checkdoc-y-or-n-p (question) "Like `y-or-n-p', but pays attention to `checkdoc-autofix-flag'. - Argument QUESTION is the prompt passed to `y-or-n-p'." +Argument QUESTION is the prompt passed to `y-or-n-p'." (prog1 (if (or (not checkdoc-autofix-flag) (eq checkdoc-autofix-flag 'never)) @@ -2812,6 +2806,12 @@ function called to create the messages." ;; Obsolete +(define-obsolete-variable-alias 'checkdoc-style-hooks + 'checkdoc-style-functions "24.3") +(define-obsolete-variable-alias 'checkdoc-comment-style-hooks + 'checkdoc-comment-style-functions "24.3") +(define-obsolete-function-alias 'checkdoc-run-hooks + #'run-hook-with-args-until-success "28.1") (defvar checkdoc-version "0.6.2" "Release version of checkdoc you are currently running.") (make-obsolete-variable 'checkdoc-version 'emacs-version "28.1") commit 8f0806da1afa8ba1ca7a65c344b484ac449a82f4 Author: Stefan Kangas Date: Tue Sep 21 19:20:48 2021 +0200 checkdoc: New defvars to disable some warnings * lisp/emacs-lisp/checkdoc.el (checkdoc--argument-missing-flag) (checkdoc--disambiguate-symbol-flag) (checkdoc--interactive-docstring-flag): New defvars to disable some warnings. These are intended for use with Emacs itself rather than with third-party libraries. (checkdoc-this-string-valid, checkdoc-this-string-valid-engine): Respect above new variables. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index d797508687..7418663175 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -331,6 +331,35 @@ See Info node `(elisp) Documentation Tips' for background." :type 'boolean :version "28.1") +;; This is how you can use checkdoc to make mass fixes on the Emacs +;; source tree: +;; +;; (setq checkdoc--argument-missing-flag nil) ; optional +;; (setq checkdoc--disambiguate-symbol-flag nil) ; optional +;; (setq checkdoc--interactive-docstring-flag nil) ; optional +;; Then use `M-x find-dired' ("-name '*.el'") and `M-x checkdoc-dired' + +(defvar checkdoc--argument-missing-flag t + "Non-nil means warn if arguments are missing from docstring. +This variable is intended for use on Emacs itself, where the +large number of libraries means it is impractical to fix all +of these warnings en masse. In almost any other case, setting +this to anything but t is likely to be counter-productive.") + +(defvar checkdoc--disambiguate-symbol-flag t + "Non-nil means ask to disambiguate Lisp symbol. +This variable is intended for use on Emacs itself, where the +large number of libraries means it is impractical to fix all +of these warnings masse. In almost any other case, setting +this to anything but t is likely to be counter-productive.") + +(defvar checkdoc--interactive-docstring-flag t + "Non-nil means warn if interactive function has no docstring. +This variable is intended for use on Emacs itself, where the +large number of libraries means it is impractical to fix all +of these warnings masse. In almost any other case, setting +this to anything but t is likely to be counter-productive.") + ;;;###autoload (defun checkdoc-list-of-strings-p (obj) "Return t when OBJ is a list of strings." @@ -1416,12 +1445,13 @@ buffer, otherwise stop after the first error." (checkdoc-create-error "You should convert this comment to documentation" (point) (line-end-position))) - (checkdoc-create-error - (if (nth 2 fp) - "All interactive functions should have documentation" - "All variables and subroutines might as well have a \ + (when checkdoc--interactive-docstring-flag + (checkdoc-create-error + (if (nth 2 fp) + "All interactive functions should have documentation" + "All variables and subroutines might as well have a \ documentation string") - (point) (+ (point) 1) t))))) + (point) (+ (point) 1) t)))))) (if (and (not err) (= (following-char) ?\")) (with-syntax-table checkdoc-syntax-table (checkdoc-this-string-valid-engine fp take-notes)) @@ -1621,6 +1651,7 @@ mouse-[0-3]\\)\\)\\>")) (setq mb (match-beginning 1) me (match-end 1)) (if (and sym (boundp sym) (fboundp sym) + checkdoc--disambiguate-symbol-flag (save-excursion (goto-char mb) (forward-word-strictly -1) @@ -1798,11 +1829,12 @@ function,command,variable,option or symbol." ms1)))))) (looking-at "[.?!]"))) (insert ".")) nil) - (checkdoc-create-error - (format-message - "Argument `%s' should appear (as %s) in the doc string" - (car args) (upcase (car args))) - s (marker-position e))) + (when checkdoc--argument-missing-flag + (checkdoc-create-error + (format-message + "Argument `%s' should appear (as %s) in the doc string" + (car args) (upcase (car args))) + s (marker-position e)))) (if (or (and order (eq order 'yes)) (and (not order) checkdoc-arguments-in-order-flag)) (if (< found last-pos) commit 1c73c0b33a9b10cdae1316ad9e0ba861af454b66 Author: Stefan Kangas Date: Tue Sep 21 19:18:50 2021 +0200 Add new command 'checkdoc-dired' * lisp/emacs-lisp/checkdoc.el (checkdoc-dired): New command. (checkdoc--dired-skip-lines-re): New constant. diff --git a/etc/NEWS b/etc/NEWS index 00f46b3592..d5b6919d6d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2811,6 +2811,10 @@ your code to be edited with an Emacs older than version 27.1. In addition to verifying the format of the prompt for 'y-or-n-p', checkdoc will now check the format of 'yes-or-no-p'. +--- +*** New command 'checkdoc-dired'. +This can be used to run checkdoc on files from a Dired buffer. + --- *** No longer checks for "A-" modifiers. Checkdoc recommends usage of command substitutions ("\\[foo-command]") diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 07ae855191..d797508687 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -1070,6 +1070,39 @@ space at the end of each line." (if (called-interactively-p 'interactive) (message "Checkdoc: done.")))))) +(defconst checkdoc--dired-skip-lines-re + (rx (or (seq bol + (or ";; Generated from Unicode data files by unidat" + ";; This file is automatically generated from" + ";; Generated by the command ")) + ".el --- automatically extracted autoloads -*- lexical-binding: t -*-" + ";;; lisp/trampver.el. Generated from trampver.el.in by configure.")) + "Regexp that when it matches tells `checkdoc-dired' to skip a file.") + +(defun checkdoc-dired (files) + "In Dired, run `checkdoc' on marked files. +Skip anything that doesn't have the Emacs Lisp library file +extension (\".el\"). +When called from Lisp, FILES is a list of filenames." + (interactive + (list + (delq nil + (mapcar + ;; skip anything that doesn't look like an Emacs Lisp library + (lambda (f) (if (equal (file-name-extension f) "el") f nil)) + (nreverse (dired-map-over-marks (dired-get-filename) nil))))) + dired-mode) + (if (null files) + (error "No files to run checkdoc on") + (save-window-excursion + (dolist (fil files) + (find-file fil) + (unless (and + (goto-char (point-min)) + (re-search-forward checkdoc--dired-skip-lines-re nil t)) + (checkdoc))))) + (message "checkdoc-dired: Successfully checked %d files" (length files))) + ;;; Ispell interface for forcing a spell check ;; commit f29aee1d9ad25d55f17372b14969e1645e65aa8c Author: Lars Ingebrigtsen Date: Tue Sep 21 19:55:11 2021 +0200 More NEWS tagging diff --git a/etc/NEWS b/etc/NEWS index 406b989e02..00f46b3592 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -584,6 +584,7 @@ commands and is globally bound to 'C-h x'. +++ *** New command 'describe-keymap' describes keybindings in a keymap. +--- *** New command 'apropos-function'. This works like 'C-u M-x apropos-command' but is more discoverable. @@ -627,6 +628,7 @@ can provide a better overview in a long list of available bindings. It allows users to change the maximum number of keystrokes and commands recorded for the purpose of 'view-lossage'. ++++ *** New commands to describe buttons and widgets. 'widget-describe' (on a widget) will pop up a help buffer and give a description of the properties. Likewise 'button-describe' does the @@ -638,6 +640,7 @@ Now clicking on the link to find the definition of functions generated by 'cl-defstruct', or variables generated by 'define-derived-mode', for example, will go to the exact place where they are defined. +--- *** New commands 'apropos-next-symbol' and 'apropos-previous-symbol'. These new navigation commands are bound to 'n' and 'p' in 'apropos-mode'. @@ -711,6 +714,7 @@ summary of where Emacs is using memory currently. This works like 'report-emacs-bug', but is more geared towards sending patches to the Emacs issue tracker. +--- *** New face 'apropos-button'. Applies to buttons that indicate a face. commit 3678f916d828ca70b8d872099a0020faebfcbc5e Author: Lars Ingebrigtsen Date: Tue Sep 21 19:52:23 2021 +0200 Do some NEWS tagging diff --git a/etc/NEWS b/etc/NEWS index e5a3dedda7..406b989e02 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -388,6 +388,7 @@ This updates the use time of a window. ** Minibuffer ++++ *** Minibuffer scrolling is now conservative by default. This is controlled by the new variable 'scroll-minibuffer-conservatively'. It is t by default; setting it to nil will cause scrolling in the @@ -439,6 +440,7 @@ both modes are on). ** Tab Bars and Tab Lines ++++ *** The prefix key 'C-x t t' can be used to display a buffer in a new tab. Typing 'C-x t t' before a command will cause the buffer shown by that command to be displayed in a new tab. 'C-x t t" is bound to the @@ -552,6 +554,7 @@ The value is saved in the user option 'mouse-wheel-scroll-amount-horizontal'. --- *** Customize buffers can now be reverted with 'C-x x g'. +--- *** Most customize commands now hide obsolete user options. Obsolete user options are no longer shown in the listings produced by the commands 'customize', 'customize-group', 'customize-apropos' and @@ -560,6 +563,7 @@ the commands 'customize', 'customize-group', 'customize-apropos' and To customize obsolete user options, use 'customize-option' or 'customize-saved'. +--- *** New SVG icons for checkboxes and arrows. They will be used automatically instead of the old icons. If Emacs is built without SVG support, the old icons will be used instead. commit 314f27014e508eae46dea961e5c45683dfc99366 Author: Lars Ingebrigtsen Date: Tue Sep 21 19:47:57 2021 +0200 Document `window-bump-use-time' * doc/lispref/windows.texi (Cyclic Window Ordering): Mention window-bump-use-time. diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 26f85df160..44cd89d98c 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -2081,6 +2081,11 @@ windows to search, and have the same meanings as in @code{next-window}. @end defun +@defun window-bump-use-time window +This function marks @var{window} has having been recently used. This +can be useful when creating certain @code{pop-to-buffer} scenarios. +@end defun + @node Buffers and Windows @section Buffers and Windows diff --git a/etc/NEWS b/etc/NEWS index 775d35fe97..e5a3dedda7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -382,6 +382,7 @@ 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. commit b5395127626c1caaca8f80edcee77647e6eb9bb0 Author: Juri Linkov Date: Tue Sep 21 20:45:38 2021 +0300 * lisp/tab-bar.el: Preserve all existing tab parameters when switching tabs. * lisp/tab-bar.el (tab-bar--tab, tab-bar--current-tab-make): Copy other possible tab parameters. https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg01544.html diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 4e59508f6d..d0a1b3b70b 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -902,7 +902,8 @@ on the tab bar instead." (if (consp current) (seq-reduce (lambda (current param) (assq-delete-all param current)) - '(wc wc-point wc-bl wc-bbl wc-history-back wc-history-forward) + '(wc wc-point wc-bl wc-bbl + wc-history-back wc-history-forward) (copy-sequence current)) current)) current) @@ -914,8 +915,10 @@ on the tab bar instead." (let* ((tab (tab-bar--current-tab-find nil frame)) (tab-explicit-name (alist-get 'explicit-name tab)) (tab-group (alist-get 'group tab)) - (bl (seq-filter #'buffer-live-p (frame-parameter frame 'buffer-list))) - (bbl (seq-filter #'buffer-live-p (frame-parameter frame 'buried-buffer-list)))) + (bl (seq-filter #'buffer-live-p (frame-parameter + frame 'buffer-list))) + (bbl (seq-filter #'buffer-live-p (frame-parameter + frame 'buried-buffer-list)))) `(tab (name . ,(if tab-explicit-name (alist-get 'name tab) @@ -929,8 +932,18 @@ on the tab bar instead." (wc-point . ,(point-marker)) (wc-bl . ,bl) (wc-bbl . ,bbl) - (wc-history-back . ,(gethash (or frame (selected-frame)) tab-bar-history-back)) - (wc-history-forward . ,(gethash (or frame (selected-frame)) tab-bar-history-forward))))) + (wc-history-back . ,(gethash (or frame (selected-frame)) + tab-bar-history-back)) + (wc-history-forward . ,(gethash (or frame (selected-frame)) + tab-bar-history-forward)) + ;; Copy other possible parameters + ,@(mapcan (lambda (param) + (unless (memq (car param) + '(name explicit-name group time + ws wc wc-point wc-bl wc-bbl + wc-history-back wc-history-forward)) + (list param))) + (cdr tab))))) (defun tab-bar--current-tab (&optional tab frame) (tab-bar--current-tab-make (or tab (tab-bar--current-tab-find nil frame)))) @@ -950,7 +963,15 @@ on the tab bar instead." (alist-get 'name tab) (funcall tab-bar-tab-name-function))) (explicit-name . ,tab-explicit-name) - ,@(if tab-group `((group . ,tab-group)))))) + ,@(if tab-group `((group . ,tab-group))) + ;; Copy other possible parameters + ,@(mapcan (lambda (param) + (unless (memq (car param) + '(name explicit-name group time + ws wc wc-point wc-bl wc-bbl + wc-history-back wc-history-forward)) + (list param))) + (cdr tab))))) (defun tab-bar--current-tab-find (&optional tabs frame) (assq 'current-tab (or tabs (funcall tab-bar-tabs-function frame)))) commit a7d51676f140c88b534af98be68fbeafcec2fa15 Author: Lars Ingebrigtsen Date: Tue Sep 21 19:43:03 2021 +0200 Document completions-detailed * doc/emacs/help.texi (Name Help): Document completions-detailed. * lisp/minibuffer.el (completions-detailed): Give an example in the doc string. diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi index 9f6009b321..4ee302fbf7 100644 --- a/doc/emacs/help.texi +++ b/doc/emacs/help.texi @@ -319,6 +319,14 @@ variable, or a face. If the symbol has more than one definition, like it has both definition as a function and as a variable, this command will show the documentation of all of them, one after the other. +@vindex completions-detailed + If the @code{completions-detailed} user option is non-@code{nil}, +some commands provide details about the possible values when +displaying completions. For instance, @kbd{C-h o TAB} will then +include the first line of the doc string, and will also say whether +each symbol is a function or a variable (and so on). Which details +are included varies depending on the command used. + @node Apropos @section Apropos @cindex apropos diff --git a/etc/NEWS b/etc/NEWS index 89e9d9add7..775d35fe97 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -174,6 +174,7 @@ completion list popped up by 'M-x' shows the key bindings for all the commands shown in the list of candidate completions that have a key binding. ++++ ** New user option 'completions-detailed'. When non-nil, some commands like 'describe-symbol' show more detailed completions with more information in completion prefix and suffix. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index b5c0054a3c..7b82e120f1 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1824,8 +1824,9 @@ in one column." (defcustom completions-detailed nil "When non-nil, display completions with details added as prefix/suffix. -Some commands might provide a detailed view with more information prepended -or appended to completions." +This makes some commands (for instance, \\[describe-symbol]) provide a +detailed view with more information prepended or appended to +completions." :type 'boolean :version "28.1") commit 90d491ee577399a76754ad2c873c03bc5c466eda Author: Basil L. Contovounesios Date: Tue Sep 21 18:14:11 2021 +0100 ; * etc/NEWS: Refile recent addition (bug#50690). diff --git a/etc/NEWS b/etc/NEWS index 558656bf01..89e9d9add7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1746,9 +1746,6 @@ tags to be considered as well. *** New user option 'vc-git-log-switches'. String or list of strings specifying switches for Git log under VC. ---- -*** The macro 'vc-call' no longer evaluates its second argument twice. - ** Gnus +++ @@ -3546,6 +3543,9 @@ still being used by 'find-library' and related commands, so the variable has been renamed to 'find-library-source-path', and 'find-function-source-path' is now an obsolete variable alias. +--- +** The macro 'vc-call' no longer evaluates its second argument twice. + * Lisp Changes in Emacs 28.1 commit 0e2792e8b498c95041d459afb7986e65de837f63 Author: Michalis V Date: Tue Sep 21 19:13:35 2021 +0200 Make dired-do-compress-to work in inserted subdirectories * lisp/dired-aux.el (dired-do-compress-to): Make this work in file in inserted subdirectories (bug#46913). diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 53fbcfb6d0..4549f45ef6 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1245,7 +1245,7 @@ and `dired-compress-files-alist'." (?i . ,(mapconcat (lambda (in-file) (shell-quote-argument - (file-name-nondirectory in-file))) + (file-relative-name in-file))) in-files " ")))))) (message (ngettext "Compressed %d file to %s" "Compressed %d files to %s" commit bd6fe44a57f4486767855332eee8fc1a5c5b95ba Author: Lars Ingebrigtsen Date: Tue Sep 21 19:05:15 2021 +0200 Revert "Make dired-compress-file query for a directory to uncompress to" This reverts commit 7e395a59b025c7f4be49294ad806addf5b1a25c9. The behaviour change isn't good for the majority of tar files. diff --git a/etc/NEWS b/etc/NEWS index e8196d277d..558656bf01 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1191,9 +1191,6 @@ keys, add the following to your init file: Using it instead of 'read-char-choice' allows using 'C-x o' to switch to the help window displayed after typing 'C-h'. ---- -*** 'dired-compress-file' now queries for a directory to uncompress to. - +++ ** New user option 'isearch-allow-motion'. When 'isearch-allow-motion' is set, the commands 'beginning-of-buffer', diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index f2cb745ad4..53fbcfb6d0 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1134,10 +1134,9 @@ present. A FMT of \"\" will suppress the messaging." ;; "tar -zxf" isn't used because it's not available on the ;; Solaris 10 version of tar (obsolete in 2024?). ;; Same thing on AIX 7.1 (obsolete 2023?) and 7.2 (obsolete 2022?). - ("\\.tar\\.gz\\'" "" "gzip -dc %i | tar -xf - -C %c") - ("\\.tar\\.xz\\'" "" "xz -dc %i | tar -xf - -C %c") - ("\\.tgz\\'" "" "gzip -dc %i | tar -xf - -C %c") - ("\\.tar\\.bz2\\'" "" "bunzip2 -c %i | tar -xf - -C %c") + ("\\.tar\\.gz\\'" "" "gzip -dc %i | tar -xf -") + ("\\.tar\\.xz\\'" "" "xz -dc %i | tar -xf -") + ("\\.tgz\\'" "" "gzip -dc %i | tar -xf -") ("\\.gz\\'" "" "gzip -d") ("\\.lz\\'" "" "lzip -d") ("\\.Z\\'" "" "uncompress") @@ -1149,8 +1148,8 @@ present. A FMT of \"\" will suppress the messaging." ("\\.bz2\\'" "" "bunzip2") ("\\.xz\\'" "" "unxz") ("\\.zip\\'" "" "unzip -o -d %o %i") - ("\\.tar\\.zst\\'" "" "unzstd -c %i | tar -xf - -C %c") - ("\\.tzst\\'" "" "unzstd -c %i | tar -xf - -C %c") + ("\\.tar\\.zst\\'" "" "unzstd -c %i | tar -xf -") + ("\\.tzst\\'" "" "unzstd -c %i | tar -xf -") ("\\.zst\\'" "" "unzstd --rm") ("\\.7z\\'" "" "7z x -aoa -o%o %i") ;; This item controls naming for compression. @@ -1254,42 +1253,6 @@ and `dired-compress-files-alist'." (length in-files) (file-name-nondirectory out-file))))))) -;;;###autoload -(defun dired-uncompress-file (file dirname command) - "Uncompress FILE using COMMAND. -If file is a tar archive or some other format that supports -output directory in its parameters, ask user the target directory -to extract it (defaults to DIRNAME). Returns the directory or -filename produced after the uncompress operation." - (if (string-match "%[ioc]" command) - (let ((extractdir (expand-file-name - (read-file-name - (format "Extract file to (default %s): " dirname) - dirname)))) - (prog1 - (file-name-as-directory extractdir) - (unless (file-directory-p extractdir) - (dired-create-directory extractdir)) - (dired-shell-command - (replace-regexp-in-string - "%[oc]" (shell-quote-argument extractdir) - (replace-regexp-in-string - "%i" (shell-quote-argument file) - command - nil t) - nil t)))) - ;; We found an uncompression rule without output dir argument - (let ((match (string-search " " command)) - (msg (concat "Uncompressing " file))) - (unless (if match - (dired-check-process - msg - (substring command 0 match) - (substring command (1+ match)) - file) - (dired-check-process msg command file)) - dirname)))) - ;;;###autoload (defun dired-compress-file (file) "Compress or uncompress FILE. @@ -1314,7 +1277,28 @@ Return nil if no change in files." ((file-symlink-p file) nil) ((and suffix (setq command (nth 2 suffix))) - (dired-uncompress-file file newname command)) + (if (string-match "%[io]" command) + (prog1 (setq newname (file-name-as-directory newname)) + (dired-shell-command + (replace-regexp-in-string + "%o" (shell-quote-argument newname) + (replace-regexp-in-string + "%i" (shell-quote-argument file) + command + nil t) + nil t))) + ;; We found an uncompression rule. + (let ((match (string-search " " command)) + (msg (concat "Uncompressing " file))) + (unless (if match + (dired-check-process msg + (substring command 0 match) + (substring command (1+ match)) + file) + (dired-check-process msg + command + file)) + newname)))) (t ;; We don't recognize the file as compressed, so compress it. ;; Try gzip; if we don't have that, use compress. diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el index 5888f4cd99..7f1743f88d 100644 --- a/test/lisp/dired-aux-tests.el +++ b/test/lisp/dired-aux-tests.el @@ -158,59 +158,5 @@ (should (string-match (regexp-quote command) (nth 0 lines))) (dired-test--check-highlighting (nth 0 lines) '(8)))) -(ert-deftest dired-test-bug47058-tar () - "test for https://debbugs.gnu.org/47058 ." - (dired-test-bug47058-fn "tar -cf - %i | gzip -c9 > %o" - "gzip -dc %i | tar -xf - -C %c" - ".tar.gz")) - -(ert-deftest dired-test-bug47058-zip () - "test for https://debbugs.gnu.org/47058 ." - (dired-test-bug47058-fn "zip %o -r --filesync %i" - "unzip -o -d %o %i" - ".zip")) - -(defun dired-test-bug47058-fn (compress-cmd uncompress-cmd extension) - "helper fn for testing https://debbugs.gnu.org/47058 ." - (let* ((base-file (make-temp-file "dired-test-47058-")) - (archive-file (concat base-file extension)) - (file1 (make-temp-file "a")) - (file2 (make-temp-file "b")) - (file3 (make-temp-file "c")) - (filelist (list file1 file2 file3)) - (comprcmd (replace-regexp-in-string - "%c" (shell-quote-argument temporary-file-directory) - (replace-regexp-in-string - "%i" (mapconcat 'identity filelist " ") - (replace-regexp-in-string - "%o" (shell-quote-argument archive-file) - compress-cmd))))) - (cl-letf (((symbol-function 'read-file-name) - (lambda (&rest _) base-file))) - (dired-delete-file base-file) - (should-not (file-exists-p base-file)) - (should-not (file-exists-p archive-file)) - (dired-shell-command comprcmd) - (should (file-exists-p archive-file)) - (mapcar (lambda (f) (should (file-exists-p f))) - filelist) - (mapcar (lambda (f) (delete-file f)) - filelist) - (mapcar (lambda (f) (should-not (file-exists-p f))) - filelist) - (should (string-equal - (dired-uncompress-file archive-file - base-file - uncompress-cmd) - (file-name-as-directory base-file))) - (mapcar (lambda (f) - (should (file-exists-p - (concat (file-name-as-directory base-file) f)))) - filelist) - (dired-delete-file base-file 'always' nil) - (dired-delete-file archive-file 'always' nil) - (should-not (file-exists-p base-file)) - (should-not (file-exists-p archive-file))))) - (provide 'dired-aux-tests) ;; dired-aux-tests.el ends here commit ff714466e7415c3f1cedec6702e6c52ad6674461 Author: Lars Ingebrigtsen Date: Tue Sep 21 19:04:46 2021 +0200 Revert "Make recent dired tests check for external executables" This reverts commit 98a17f30b8314e40a1edefac3d542d3e105c7bd6. Reverting parent commit. diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el index af0d8b0936..5888f4cd99 100644 --- a/test/lisp/dired-aux-tests.el +++ b/test/lisp/dired-aux-tests.el @@ -160,16 +160,12 @@ (ert-deftest dired-test-bug47058-tar () "test for https://debbugs.gnu.org/47058 ." - (skip-unless (and (executable-find "tar") - (executable-find "gzip"))) (dired-test-bug47058-fn "tar -cf - %i | gzip -c9 > %o" "gzip -dc %i | tar -xf - -C %c" ".tar.gz")) (ert-deftest dired-test-bug47058-zip () "test for https://debbugs.gnu.org/47058 ." - (skip-unless (and (executable-find "zip") - (executable-find "unzip"))) (dired-test-bug47058-fn "zip %o -r --filesync %i" "unzip -o -d %o %i" ".zip")) commit aaf4bb1f07c4d98e6390f90636848c5d46aa6162 Author: Lars Ingebrigtsen Date: Tue Sep 21 18:54:41 2021 +0200 Restore some of the previous behaviour in whitespace-display-window * lisp/whitespace.el (whitespace-display-window): Emulate previous behaviour (bug#50716). Code from martin rudalics . diff --git a/lisp/whitespace.el b/lisp/whitespace.el index adf553938e..59d3249c5d 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -1836,12 +1836,13 @@ cleaning up these problems." (defun whitespace-display-window (buffer) - "Display BUFFER in a new window." (goto-char (point-min)) (set-buffer-modified-p nil) - (pop-to-buffer buffer) - (shrink-window-if-larger-than-buffer)) - + (let ((window (display-buffer + buffer + `((display-buffer-reuse-window + display-buffer-below-selected))))) + (shrink-window-if-larger-than-buffer window))) (defun whitespace-kill-buffer (buffer-name) "Kill buffer BUFFER-NAME and windows related with it." commit 6f360c5aad7558e0404454783b9dd902e46c034e Author: Stefan Kangas Date: Tue Sep 21 18:12:07 2021 +0200 ; Stylistic docfixes in htmlfontify.el found by checkdoc diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index e63910d857..9fe6e825f7 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -90,23 +90,30 @@ "The generator meta tag for this version of htmlfontify.") (defconst htmlfontify-manual "Htmlfontify Manual" - "Copy and convert buffers and files to HTML, adding hyperlinks between files -\(driven by etags) if requested. -\nInteractive functions: + "Copy and convert buffers and files to HTML. +Add hyperlinks between files driven by etags) if requested. + +Interactive functions: `htmlfontify-buffer' `htmlfontify-run-etags' `htmlfontify-copy-and-link-dir' `htmlfontify-load-rgb-file' - `htmlfontify-unload-rgb-file'\n -In order to:\n + `htmlfontify-unload-rgb-file' + +In order to: + fontify a file you have open: \\[htmlfontify-buffer] prepare the etags map for a directory: \\[htmlfontify-run-etags] -copy a directory, fontifying as you go: \\[htmlfontify-copy-and-link-dir]\n +copy a directory, fontifying as you go: \\[htmlfontify-copy-and-link-dir] + The following might be useful when running non-windowed or in batch mode: -\(note that they shouldn't be necessary - we have a built in map)\n +\(note that they shouldn't be necessary - we have a built in map) + load an X11 style rgb.txt file: \\[htmlfontify-load-rgb-file] -unload the current rgb.txt file: \\[htmlfontify-unload-rgb-file]\n -And here's a programmatic example:\n +unload the current rgb.txt file: \\[htmlfontify-unload-rgb-file] + +And here's a programmatic example: + \(defun rtfm-build-page-header (file style) (format \"#define TEMPLATE red+black.html #define DEBUG 1 @@ -148,7 +155,8 @@ This is called with two arguments (the filename relative to the top level source directory being etag'd and fontified), and a string containing the text to embed in the document. It should return a string that will be used as the header for the -htmlfontified version of the source file.\n +htmlfontified version of the source file. + See also `hfy-page-footer'." ;; FIXME: Why place such a :tag everywhere? Isn't it imposing your ;; own Custom preference on your users? --Stef @@ -233,8 +241,10 @@ These functions will be called with the HTML buffer as the current buffer." "Fallback `defface' specification for the face `default', used when `hfy-display-class' has been set (the normal htmlfontify way of extracting potentially non-current face information doesn't necessarily work for -`default').\n -Example: I customize this to:\n +`default'). + +Example: I customize this to: + \((t :background \"black\" :foreground \"white\" :family \"misc-fixed\"))" :tag "default-face-definition" :type '(alist)) @@ -244,8 +254,9 @@ Example: I customize this to:\n "\x01" "\\([0-9]+\\)" "," "\\([0-9]+\\)$" "\\|" ".*\x7f[0-9]+,[0-9]+$") - "Regex used to parse an etags entry: must have 3 subexps, corresponding, -in order, to:\n + "Regex used to parse an etags entry. +This must have 3 subexps, corresponding, in order, to: + 1 - The tag 2 - The line 3 - The char (point) at which the tag occurs." @@ -302,7 +313,8 @@ done;") :type '(alist :key-type (string) :value-type (string))) (defcustom hfy-etags-bin "etags" - "Location of etags binary (we begin by assuming it's in your path).\n + "Location of etags binary (we begin by assuming it's in your path). + Note that if etags is not in your path, you will need to alter the shell commands in `hfy-etags-cmd-alist'." :tag "etags-bin" @@ -346,7 +358,8 @@ commands in `hfy-etags-cmd-alist'." (cdr (assoc (hfy-which-etags) hfy-etags-cmd-alist)) "The etags equivalent command to run in a source directory to generate a tags file for the whole source tree from there on down. The command should emit -the etags output on stdout.\n +the etags output on stdout. + Two canned commands are provided - they drive Emacs's etags and exuberant-ctags' etags respectively." :tag "etags-command" @@ -356,9 +369,10 @@ exuberant-ctags' etags respectively." (cons 'choice clist))) (defcustom hfy-istext-command "file %s | sed -e 's@^[^:]*:[ \t]*@@'" - "Command to run with the name of a file, to see whether it is a text file -or not. The command should emit a string containing the word `text' if -the file is a text file, and a string not containing `text' otherwise." + "Command to run with the name of a file, to see if it is a text file or not. +The command should emit a string containing the word `text' if +the file is a text file, and a string not containing `text' +otherwise." :tag "istext-command" :type '(string)) @@ -372,8 +386,10 @@ the file is a text file, and a string not containing `text' otherwise." "Display class to use to determine which display class to use when calculating a face's attributes. This is useful when, for example, you are running Emacs on a tty or in batch mode, and want htmlfontify to have -access to the face spec you would use if you were connected to an X display.\n -Some valid class specification elements are:\n +access to the face spec you would use if you were connected to an X display. + +Some valid class specification elements are: + (class color) (class grayscale) (background dark) @@ -383,14 +399,17 @@ Some valid class specification elements are:\n (type motif) (type lucid) Multiple values for a tag may be combined, to indicate that any one or more -of these values in the specification key constitutes a match, eg:\n -\((class color grayscale) (type tty)) would match any of:\n +of these values in the specification key constitutes a match, eg: + +\((class color grayscale) (type tty)) would match any of: + ((class color)) ((class grayscale)) ((class color grayscale)) ((class color foo)) ((type tty)) - ((type tty) (class color))\n + ((type tty) (class color)) + and so on." :type '(alist :key-type (symbol) :value-type (symbol)) :tag "display-class" @@ -407,7 +426,9 @@ and so on." (define-obsolete-variable-alias 'hfy-optimisations 'hfy-optimizations "25.1") (defcustom hfy-optimizations (list 'keep-overlays) - "Optimizations to turn on: So far, the following have been implemented:\n + "Optimizations to turn on. +So far, the following have been implemented: + merge-adjacent-tags: If two (or more) span tags are adjacent, identical and separated by nothing more than whitespace, they will be merged into one span. @@ -417,16 +438,19 @@ and so on." output. keep-overlays : More of a bell (or possibly whistle) than an optimization - If on, preserve overlay highlighting - (cf ediff or goo-font-lock) as well as basic faces.\n + (cf ediff or goo-font-lock) as well as basic faces. + body-text-only : Emit only body-text. In concrete terms, 1. Suppress calls to `hfy-page-header' and `hfy-page-footer' 2. Pretend that `div-wrapper' option above is turned off 3. Don't enclose output in
 
tags - And the following are planned but not yet available:\n + And the following are planned but not yet available: + kill-context-leak : Suppress hyperlinking between files highlighted by - different modes.\n + different modes. + Note: like compiler optimizations, these optimize the _output_ of the code, not the processing of the source itself, and are therefore likely to slow htmlfontify down, at least a little. Except for skip-refontification, @@ -442,20 +466,28 @@ which can never slow you down, but may result in incomplete fontification." :tag "optimizations") (defvar hfy-tags-cache nil - "Alist of the form:\n -\((\"/src/dir/0\" . tag-hash0) (\"/src/dir/1\" tag-hash1) ...)\n -Each tag hash entry then contains entries of the form:\n -\"tag_string\" => ((\"file/name.ext\" line char) ... )\n -ie an alist mapping (relative) file paths to line and character offsets.\n + "Alist of the form: + +\((\"/src/dir/0\" . tag-hash0) (\"/src/dir/1\" tag-hash1) ...) + +Each tag hash entry then contains entries of the form: + +\"tag_string\" => ((\"file/name.ext\" line char) ... ) + +ie an alist mapping (relative) file paths to line and character offsets. + See also `hfy-load-tags-cache'.") (defvar hfy-tags-sortl nil - "Alist of the form ((\"/src/dir\" . (tag0 tag1 tag2)) ... )\n -where the tags are stored in descending order of length.\n + "Alist of the form ((\"/src/dir\" . (tag0 tag1 tag2)) ... ) + +where the tags are stored in descending order of length. + See also `hfy-load-tags-cache'.") (defvar hfy-tags-rmap nil - "Alist of the form ((\"/src/dir\" . tag-rmap-hash))\n + "Alist of the form ((\"/src/dir\" . tag-rmap-hash)) + where tag-rmap-hash has entries of the form: \"tag_string\" => ( \"file/name.ext\" line char ) Unlike `hfy-tags-cache' these are the locations of occurrences of @@ -467,8 +499,10 @@ Properties may be repeated, in which case later properties should be treated as if they were inherited from a `parent' font. \(For some properties, only the first encountered value is of any importance, for others the values might be cumulative, and for others they might be -cumulative in a complex way.)\n -Some examples:\n +cumulative in a complex way.) + +Some examples: + \(hfy-face-to-style \\='default) => ((\"background\" . \"rgb(0, 0, 0)\") (\"color\" . \"rgb(255, 255, 255)\") @@ -477,27 +511,31 @@ Some examples:\n (\"font-stretch\" . \"normal\") (\"font-family\" . \"misc-fixed\") (\"font-size\" . \"13pt\") - (\"text-decoration\" . \"none\"))\n + (\"text-decoration\" . \"none\")) + \(hfy-face-to-style \\='Info-title-3-face) => ((\"font-weight\" . \"700\") (\"font-family\" . \"helv\") (\"font-size\" . \"120%\") - (\"text-decoration\" . \"none\"))\n") + (\"text-decoration\" . \"none\"))") (defvar hfy-sheet-assoc 'please-ignore-this-line - "An assoc with elements of the form (face-name style-name . style-string):\n + "An assoc with elements of the form (face-name style-name . style-string): + \((default \"default\" . \"{background: black; color: white}\") (font-lock-string-face \"string\" . \"{color: rgb(64,224,208)}\"))" ) (defvar hfy-facemap-assoc 'please-ignore-this-line "An assoc of (point . FACE-SYMBOL) or (point . DEFFACE-LIST) and (point . \\='end) elements, in descending order of point value -\(ie from the file's end to its beginning).\n +\(ie from the file's end to its beginning). + The map is in reverse order because inserting a