commit 9d8fc3a598090da518fcdd5c0503ed0f7faa41a9 (HEAD, refs/remotes/origin/master) Author: Simen Heggestøyl Date: Sat May 9 19:58:46 2020 +0200 Use lexical-binding in help-mode.el and add tests * lisp/help-mode.el: Use lexical-binding. (help-mode-map, help-mode-menu, help-mode-setup) (help-mode-finish): Make spelling of "Help mode" consistent throughout the doc strings (also making it consistent with the spelling of "Help mode" used in the Elisp manual). (help-do-xref): Re-indent to make the else-branch easier to see. * test/lisp/help-mode-tests.el: New file with tests for help-mode.el. diff --git a/lisp/help-mode.el b/lisp/help-mode.el index bae8281147..9c2d1d7227 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -1,4 +1,4 @@ -;;; help-mode.el --- `help-mode' used by *Help* buffers +;;; help-mode.el --- `help-mode' used by *Help* buffers -*- lexical-binding: t; -*- ;; Copyright (C) 1985-1986, 1993-1994, 1998-2020 Free Software ;; Foundation, Inc. @@ -47,10 +47,10 @@ (define-key map "\C-c\C-c" 'help-follow-symbol) (define-key map "\r" 'help-follow) map) - "Keymap for help mode.") + "Keymap for Help mode.") (easy-menu-define help-mode-menu help-mode-map - "Menu for Help Mode." + "Menu for Help mode." '("Help-Mode" ["Show Help for Symbol" help-follow-symbol :help "Show the docs for the symbol at point"] @@ -327,13 +327,13 @@ Commands: ;;;###autoload (defun help-mode-setup () - "Enter Help Mode in the current buffer." + "Enter Help mode in the current buffer." (help-mode) (setq buffer-read-only nil)) ;;;###autoload (defun help-mode-finish () - "Finalize Help Mode setup in current buffer." + "Finalize Help mode setup in current buffer." (when (derived-mode-p 'help-mode) (setq buffer-read-only t) (help-make-xrefs (current-buffer)))) @@ -719,7 +719,8 @@ a proper [back] button." ;; There is a reference at point. Follow it. (let ((help-xref-following t)) (apply function (if (eq function 'info) - (append args (list (generate-new-buffer-name "*info*"))) args)))) + (append args (list (generate-new-buffer-name "*info*"))) + args)))) ;; The doc string is meant to explain what buttons do. (defun help-follow-mouse () diff --git a/test/lisp/help-mode-tests.el b/test/lisp/help-mode-tests.el new file mode 100644 index 0000000000..2b9552a8d8 --- /dev/null +++ b/test/lisp/help-mode-tests.el @@ -0,0 +1,169 @@ +;;; help-mode-tests.el --- Tests for help-mode.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2020 Free Software Foundation, Inc. + +;; Author: Simen Heggestøyl +;; 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 'ert) +(require 'help-mode) +(require 'pp) + +(ert-deftest help-mode-tests-help-buffer () + (let ((help-xref-following nil)) + (should (equal "*Help*" (help-buffer))))) + +(ert-deftest help-mode-tests-help-buffer-current-buffer () + (with-temp-buffer + (help-mode) + (let ((help-xref-following t)) + (should (equal (buffer-name (current-buffer)) + (help-buffer)))))) + +(ert-deftest help-mode-tests-help-buffer-current-buffer-error () + (with-temp-buffer + (let ((help-xref-following t)) + (should-error (help-buffer))))) + +(ert-deftest help-mode-tests-make-xrefs () + (with-temp-buffer + (insert "car is a built-in function in ‘C source code’. + +(car LIST) + + Probably introduced at or before Emacs version 1.2. + This function does not change global state, including the match data. + +Return the car of LIST. If arg is nil, return nil. +Error if arg is not nil and not a cons cell. See also ‘car-safe’. + +See Info node ‘(elisp)Cons Cells’ for a discussion of related basic +Lisp concepts such as car, cdr, cons cell and list.") + (help-mode) + (help-make-xrefs) + (let ((car-safe-button (button-at 298))) + (should (eq (button-type car-safe-button) 'help-symbol)) + (should (eq (button-get car-safe-button 'help-function) + #'describe-symbol))) + (let ((cons-cells-info-button (button-at 333))) + (should (eq (button-type cons-cells-info-button) 'help-info)) + (should (eq (button-get cons-cells-info-button 'help-function) + #'info))))) + +(ert-deftest help-mode-tests-xref-button () + (with-temp-buffer + (insert "See also the function ‘interactive’.") + (string-match help-xref-symbol-regexp (buffer-string)) + (help-xref-button 8 'help-function) + (should-not (button-at 22)) + (should-not (button-at 35)) + (let ((button (button-at 30))) + (should (eq (button-type button) 'help-function))))) + +(ert-deftest help-mode-tests-insert-xref-button () + (with-temp-buffer + (help-insert-xref-button "[back]" 'help-back) + (goto-char (point-min)) + (should (eq (button-type (button-at (point))) 'help-back)) + (help-insert-xref-button "[forward]" 'help-forward) + ;; The back button should stay unchanged. + (should (eq (button-type (button-at (point))) 'help-back)))) + +(ert-deftest help-mode-tests-xref-on-pp () + (with-temp-buffer + (insert (pp '(cons fill-column))) + (help-xref-on-pp (point-min) (point-max)) + (goto-char (point-min)) + (search-forward "co") + (should (eq (button-type (button-at (point))) 'help-function)) + (search-forward "-") + (should (eq (button-type (button-at (point))) 'help-variable)))) + +(ert-deftest help-mode-tests-xref-go-back () + (let ((help-xref-stack + `((2 ,(lambda () (erase-buffer) (insert "bar")))))) + (with-temp-buffer + (insert "foo") + (help-xref-go-back (current-buffer)) + (should (= (point) 2)) + (should (equal (buffer-string) "bar"))))) + +(ert-deftest help-mode-tests-xref-go-forward () + (let ((help-xref-forward-stack + `((2 ,(lambda () (erase-buffer) (insert "bar")))))) + (with-temp-buffer + (insert "foo") + (help-xref-go-forward (current-buffer)) + (should (= (point) 2)) + (should (equal (buffer-string) "bar"))))) + +(ert-deftest help-mode-tests-go-back () + (let ((help-xref-stack + `((2 ,(lambda () (erase-buffer) (insert "bar")))))) + (with-temp-buffer + (insert "foo") + (help-go-back) + (should (= (point) 2)) + (should (equal (buffer-string) "bar"))))) + +(ert-deftest help-mode-tests-go-back-no-stack () + (let ((help-xref-stack '())) + (should-error (help-go-back)))) + +(ert-deftest help-mode-tests-go-forward () + (let ((help-xref-forward-stack + `((2 ,(lambda () (erase-buffer) (insert "bar")))))) + (with-temp-buffer + (insert "foo") + (help-go-forward) + (should (= (point) 2)) + (should (equal (buffer-string) "bar"))))) + +(ert-deftest help-mode-tests-go-forward-no-stack () + (let ((help-xref-forward-stack '())) + (should-error (help-go-forward)))) + +(ert-deftest help-mode-tests-do-xref () + (with-temp-buffer + (help-mode) + (help-do-xref 0 #'describe-symbol '(car)) + (should (looking-at-p "car is a")) + (should (string-match-p "[back]" (buffer-string))))) + +(ert-deftest help-mode-tests-follow-symbol () + (with-temp-buffer + (insert "car") + (help-mode) + (help-follow-symbol 0) + (should (looking-at-p "car is a")) + (should (string-match-p "[back]" (buffer-string))))) + +(ert-deftest help-mode-tests-follow-symbol-no-symbol () + (with-temp-buffer + (insert "fXYEWnRHI0B9w6VJqQIw") + (help-mode) + (should-error (help-follow-symbol 0)))) + +(provide 'help-mode-tests) +;;; help-mode-tests.el ends here commit 94224c4addc999ad798cc690051498bcce199555 Author: Glenn Morris Date: Sat May 9 10:17:27 2020 -0700 * src/xdisp.c (Fwindow_text_pixel_size): Fix previous merge. diff --git a/src/xdisp.c b/src/xdisp.c index 3ff4365ea6..d65bb38869 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10511,13 +10511,13 @@ include the height of both, if present, in the return value. */) bpos = BEGV_BYTE; while (bpos < ZV_BYTE) { - FETCH_CHAR_ADVANCE (c, start, bpos); + c = fetch_char_advance (&start, &bpos); if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r')) break; } while (bpos > BEGV_BYTE) { - DEC_BOTH (start, bpos); + dec_both (&start, &bpos); c = FETCH_CHAR (bpos); if (!(c == ' ' || c == '\t')) break; @@ -10539,14 +10539,14 @@ include the height of both, if present, in the return value. */) bpos = ZV_BYTE; while (bpos > BEGV_BYTE) { - DEC_BOTH (end, bpos); + dec_both (&end, &bpos); c = FETCH_CHAR (bpos); if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r')) break; } while (bpos < ZV_BYTE) { - FETCH_CHAR_ADVANCE (c, end, bpos); + c = fetch_char_advance (&end, &bpos); if (!(c == ' ' || c == '\t')) break; } commit 5c890bfc191d0cf18dccbbf50ebdcde946a0d7fb Merge: 196bc13b7b be0d1cac83 Author: Glenn Morris Date: Sat May 9 10:03:21 2020 -0700 Merge from origin/emacs-27 be0d1cac83 (origin/emacs-27) Small fix for type of 'display-fill-colu... c5e5839776 Fix customization of 'display-fill-column-indicator-charac... d5c184aa3e Refer to fill column indicator Info node in some places. e13300ae50 Merge branch 'emacs-27' of git.sv.gnu.org:/srv/git/emacs i... 0bae57033f Fix GTK's Tool Bar menu radio buttons 4c98aa7ea5 Minor clarifications in NEWS a1cbd05f38 Improve documentation of 'with-suppressed-warnings'. 4a895c1b26 Fix a typo in a comment 2caf3e997e Improve documentation of Hi Lock mode 7081c1d66f Fix typos in the Emacs user manual 0385771e2f Fix references to Speedbar in VHDL mode a76cafea0d Fix handling of FROM = t and TO = t by 'window-text-pixel-... # Conflicts: # etc/NEWS # src/xdisp.c commit 196bc13b7bc5a29fa4d27e83d7cf0db4d99aa8b7 Author: Pieter van Oostrum Date: Thu Mar 5 20:20:04 2020 +0100 Add new filter command to Package Menu (Bug#39903) * lisp/emacs-lisp/package.el (package-menu-filter-marked): New filter command. * test/lisp/emacs-lisp/package-tests.el (package-test-list-filter-marked): New test. (package-menu-mode-menu): (package-menu-mode-map): Update menu to include new filter command. * doc/emacs/package.texi (Package Menu): Document the new command. * etc/NEWS: Announce the new command. diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index db3cf317ff..91e44b8eba 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -202,6 +202,12 @@ This prompts first for one of the qualifiers @samp{<}, @samp{>} or @samp{=}, and then a package version, and shows packages that has a lower, equal or higher version than the one specified. +@item / m +@kindex / m @r{(Package Menu)} +@findex package-menu-filter-marked +Filter package list by non-empty mark (@code{package-menu-filter-marked}). +This shows only the packages that have been marked to be installed or deleted. + @item / / @kindex / / @r{(Package Menu)} @findex package-menu-filter-clear diff --git a/etc/NEWS b/etc/NEWS index 12406eea82..ae676a9bf8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -219,6 +219,7 @@ key binding / n package-menu-filter-by-name / s package-menu-filter-by-status / v package-menu-filter-by-version +/ m package-menu-filter-marked / / package-menu-filter-clear ** gdb-mi diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 4312ab9ca9..ecf833b547 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2692,6 +2692,7 @@ either a full name or nil, and EMAIL is a valid email address." (define-key map (kbd "/ n") 'package-menu-filter-by-name) (define-key map (kbd "/ s") 'package-menu-filter-by-status) (define-key map (kbd "/ v") 'package-menu-filter-by-version) + (define-key map (kbd "/ m") 'package-menu-filter-marked) map) "Local keymap for `package-menu-mode' buffers.") @@ -2722,6 +2723,7 @@ either a full name or nil, and EMAIL is a valid email address." ["Filter by Name" package-menu-filter-by-name :help "Filter packages by name"] ["Filter by Status" package-menu-filter-by-status :help "Filter packages by status"] ["Filter by Version" package-menu-filter-by-version :help "Filter packages by version"] + ["Filter Marked" package-menu-filter-marked :help "Filter packages marked for upgrade"] ["Clear Filter" package-menu-clear-filter :help "Clear package list filter"]) ["Hide by Regexp" package-menu-hide-package :help "Hide all packages matching a regexp"] @@ -3855,6 +3857,35 @@ If VERSION is nil or the empty string, show all packages." (funcall fun (package-desc-version pkg-desc) ver))) (format "versions:%s%s" predicate version))))) +(defun package-menu-filter-marked () + "Filter \"*Packages*\" buffer by non-empty upgrade mark. +Unlike other filters, this leaves the marks intact." + (interactive) + (package--ensure-package-menu-mode) + (widen) + (let (found-entries mark pkg-id entry marks) + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + (setq mark (char-after)) + (unless (eq mark ?\s) + (setq pkg-id (tabulated-list-get-id)) + (setq entry (package-menu--print-info-simple pkg-id)) + (push entry found-entries) + ;; remember the mark + (push (cons pkg-id mark) marks)) + (forward-line)) + (if found-entries + (progn + (setq tabulated-list-entries found-entries) + (package-menu--display t nil) + ;; redo the marks, but we must remember the marks!! + (goto-char (point-min)) + (while (not (eobp)) + (setq mark (cdr (assq (tabulated-list-get-id) marks))) + (tabulated-list-put-tag (char-to-string mark) t))) + (user-error "No packages found"))))) + (defun package-menu-clear-filter () "Clear any filter currently applied to the \"*Packages*\" buffer." (interactive) diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index c0ed82c474..732bf5e061 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -413,6 +413,21 @@ Must called from within a `tar-mode' buffer." ;; No installed packages in default environment. (should-error (package-menu-filter-by-status "installed")))) +(ert-deftest package-test-list-filter-marked () + "Ensure package list is filtered correctly by non-empty mark." + (with-package-test () + (let ((buf (package-list-packages))) + (revert-buffer) + (search-forward-regexp "^ +simple-single") + (package-menu-mark-install) + (package-menu-filter-marked) + (goto-char (point-min)) + (should (re-search-forward "^I +simple-single" nil t)) + (should (= (count-lines (point-min) (point-max)) 1)) + (package-menu-mark-unmark) + ;; No marked packages in default environment. + (should-error (package-menu-filter-marked))))) + (ert-deftest package-test-list-filter-by-version () (with-package-menu-test (should-error (package-menu-filter-by-version "1.1" 'unknown-symbol))) ) commit e59f697cd589e2b68bccb752787ad4a8c9da375d Author: Paul Eggert Date: Sat May 9 09:10:50 2020 -0700 Improve nonnull checking with GCC in emacs-module * src/emacs-module.h.in (EMACS_ATTRIBUTE_NONNULL): Also do the nonnull check with GCC. (The old code did the check with Clang but not with GCC.) diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in index cd75c0907e..6a39d507c8 100644 --- a/src/emacs-module.h.in +++ b/src/emacs-module.h.in @@ -48,10 +48,14 @@ information how to write modules and use this header file. # define EMACS_NOEXCEPT_TYPEDEF #endif -#ifdef __has_attribute -#if __has_attribute(__nonnull__) -# define EMACS_ATTRIBUTE_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__))) -#endif +#if 3 < __GNUC__ + (3 <= __GNUC_MINOR__) +# define EMACS_ATTRIBUTE_NONNULL(...) \ + __attribute__ ((__nonnull__ (__VA_ARGS__))) +#elif defined __has_attribute +# if __has_attribute (__nonnull__) +# define EMACS_ATTRIBUTE_NONNULL(...) \ + __attribute__ ((__nonnull__ (__VA_ARGS__))) +# endif #endif #ifndef EMACS_ATTRIBUTE_NONNULL # define EMACS_ATTRIBUTE_NONNULL(...) @@ -81,7 +85,7 @@ struct emacs_runtime /* Return an environment pointer. */ emacs_env *(*get_environment) (struct emacs_runtime *runtime) - EMACS_ATTRIBUTE_NONNULL(1); + EMACS_ATTRIBUTE_NONNULL (1); }; /* Type aliases for function pointer types used in the module API. @@ -166,7 +170,7 @@ struct emacs_env_28 /* Every module should define a function as follows. */ extern int emacs_module_init (struct emacs_runtime *runtime) EMACS_NOEXCEPT - EMACS_ATTRIBUTE_NONNULL(1); + EMACS_ATTRIBUTE_NONNULL (1); #ifdef __cplusplus } commit ebfb2c4d1bc8f68a75b02a76ec90eb225123c099 Author: Paul Eggert Date: Sat May 9 08:47:05 2020 -0700 Update from Gnulib This incorporates: 2020-05-09 stdio: don't redefine _GL_ATTRIBUTE_FORMAT 2020-05-09 dirent, stdlib, string: don't redefine _GL_ATTRIBUTE_PURE 2020-05-08 limits-h: define LONG_BIT correctly on Haiku/x86_64 2020-05-08 ignore-value tests: use module 'attribute' 2020-05-06 attribute: minor style fixes * build-aux/config.sub, doc/misc/texinfo.tex, lib/attribute.h: * lib/dirent.in.h, lib/limits.in.h, lib/stdio.in.h, lib/stdlib.in.h: * lib/string.in.h, m4/gnulib-common.m4: Copy from Gnulib. diff --git a/build-aux/config.sub b/build-aux/config.sub index a0d12275ac..973a2980ac 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2020 Free Software Foundation, Inc. -timestamp='2020-04-24' +timestamp='2020-05-04' # 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 @@ -1366,7 +1366,7 @@ case $os in | skyos* | haiku* | rdos* | toppers* | drops* | es* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ - | nsk* | powerunix*) + | nsk* | powerunix* | genode*) # Remember, each alternative MUST END IN *, to match a version number. ;; qnx*) diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index 427494cbbf..2b7b31b34a 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-05-02.00} +\def\texinfoversion{2020-05-07.17} % -% Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc. +% Copyright 1985, 1986, 1988, 1990-2020 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 @@ -1430,7 +1430,13 @@ % subentries, which we calculated on our first read of the .toc above. % % We use the node names as the destinations. + % + % Currently we prefix the section name with the section number + % for chapter and appendix headings only in order to avoid too much + % horizontal space being required in the PDF viewer. \def\numchapentry##1##2##3##4{% + \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}% + \def\unnchapentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% \def\numsecentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% @@ -1672,9 +1678,13 @@ % Therefore, we read toc only once. % % We use node names as destinations. + % + % Currently we prefix the section name with the section number + % for chapter and appendix headings only in order to avoid too much + % horizontal space being required in the PDF viewer. \def\partentry##1##2##3##4{}% ignore parts in the outlines \def\numchapentry##1##2##3##4{% - \dopdfoutline{##1}{1}{##3}{##4}}% + \dopdfoutline{##2 ##1}{1}{##3}{##4}}% \def\numsecentry##1##2##3##4{% \dopdfoutline{##1}{2}{##3}{##4}}% \def\numsubsecentry##1##2##3##4{% @@ -1686,7 +1696,8 @@ \let\appsecentry\numsecentry% \let\appsubsecentry\numsubsecentry% \let\appsubsubsecentry\numsubsubsecentry% - \let\unnchapentry\numchapentry% + \def\unnchapentry##1##2##3##4{% + \dopdfoutline{##1}{1}{##3}{##4}}% \let\unnsecentry\numsecentry% \let\unnsubsecentry\numsubsecentry% \let\unnsubsubsecentry\numsubsubsecentry% @@ -2499,7 +2510,7 @@ \def\it{\fam=\itfam \setfontstyle{it}} \def\sl{\fam=\slfam \setfontstyle{sl}} \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} -\def\tt{\fam=\ttfam \setfontstyle{tt}} +\def\tt{\fam=\ttfam \setfontstyle{tt}}\def\ttstylename{tt} % Texinfo sort of supports the sans serif font style, which plain TeX does not. % So we set up a \sf. @@ -3512,7 +3523,7 @@ % @pounds{} is a sterling sign, which Knuth put in the CM italic font. % -\def\pounds{{\it\$}} +\def\pounds{\ifmonospace{\ecfont\char"BF}\else{\it\$}\fi} % @euro{} comes from a separate font, depending on the current style. % We use the free feym* fonts from the eurosym package by Henrik @@ -3661,11 +3672,19 @@ \fi % Quotes. -\chardef\quotedblleft="5C -\chardef\quotedblright=`\" \chardef\quoteleft=`\` \chardef\quoteright=`\' +% only change font for tt for correct kerning and to avoid using +% \ecfont unless necessary. +\def\quotedblleft{% + \ifmonospace{\ecfont\char"10}\else{\char"5C}\fi +} + +\def\quotedblright{% + \ifmonospace{\ecfont\char"11}\else{\char`\"}\fi +} + \message{page headings,} @@ -7447,13 +7466,9 @@ \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount % % We typeset each line of the verbatim in an \hbox, so we can handle -% tabs. The \global is in case the verbatim line starts with an accent, -% or some other command that starts with a begin-group. Otherwise, the -% entire \verbbox would disappear at the corresponding end-group, before -% it is typeset. Meanwhile, we can't have nested verbatim commands -% (can we?), so the \global won't be overwriting itself. +% tabs. \newbox\verbbox -\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup} +\def\starttabbox{\setbox\verbbox=\hbox\bgroup} % \begingroup \catcode`\^^I=\active @@ -7464,7 +7479,8 @@ \divide\dimen\verbbox by\tabw \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw - \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox + \wd\verbbox=\dimen\verbbox + \leavevmode\box\verbbox \starttabbox }% } \endgroup @@ -7474,9 +7490,7 @@ \let\nonarrowing = t% \nonfillstart \tt % easiest (and conventionally used) font for verbatim - % The \leavevmode here is for blank lines. Otherwise, we would - % never \starttabbox and the \egroup would end verbatim mode. - \def\par{\leavevmode\egroup\box\verbbox\endgraf}% + \def\par{\egroup\box\verbbox\endgraf\starttabbox}% \tabexpand \setupmarkupstyle{verbatim}% % Respect line breaks, @@ -7484,7 +7498,6 @@ % make each space count. % Must do in this order: \obeylines \uncatcodespecials \sepspaces - \everypar{\starttabbox}% } % Do the @verb magic: verbatim text is quoted by unique @@ -7519,9 +7532,12 @@ % ignore everything up to the first ^^M, that's the newline at the end % of the @verbatim input line itself. Otherwise we get an extra blank % line in the output. - \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% + \xdef\doverbatim#1^^M#2@end verbatim{% + \starttabbox#2\egroup\noexpand\end\gobble verbatim}% % We really want {...\end verbatim} in the body of the macro, but % without the active space; thus we have to use \xdef and \gobble. + % The \egroup ends the \verbbox started at the end of the last line in + % the block. \endgroup % \envdef\verbatim{% diff --git a/lib/attribute.h b/lib/attribute.h index 8ef9a399ad..c5919d9700 100644 --- a/lib/attribute.h +++ b/lib/attribute.h @@ -33,26 +33,26 @@ /* Selected GCC attributes; see: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html These names begin with 'ATTRIBUTE_' to avoid name clashes. */ -#define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE(args) +#define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE (args) #define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE #define ATTRIBUTE_ARTIFICIAL _GL_ATTRIBUTE_ARTIFICIAL #define ATTRIBUTE_COLD _GL_ATTRIBUTE_COLD #define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST #define ATTRIBUTE_DEPRECATED _GL_ATTRIBUTE_DEPRECATED -#define ATTRIBUTE_ERROR(msg) _GL_ATTRIBUTE_ERROR(msg) +#define ATTRIBUTE_ERROR(msg) _GL_ATTRIBUTE_ERROR (msg) #define ATTRIBUTE_EXTERNALLY_VISIBLE _GL_ATTRIBUTE_EXTERNALLY_VISIBLE -#define ATTRIBUTE_FORMAT(spec) _GL_ATTRIBUTE_FORMAT(spec) +#define ATTRIBUTE_FORMAT(spec) _GL_ATTRIBUTE_FORMAT (spec) #define ATTRIBUTE_LEAF _GL_ATTRIBUTE_LEAF #define ATTRIBUTE_MAY_ALIAS _GL_ATTRIBUTE_MAY_ALIAS #define ATTRIBUTE_MALLOC _GL_ATTRIBUTE_MALLOC #define ATTRIBUTE_NOINLINE _GL_ATTRIBUTE_NOINLINE -#define ATTRIBUTE_NONNULL(args) _GL_ATTRIBUTE_NONNULL(args) +#define ATTRIBUTE_NONNULL(args) _GL_ATTRIBUTE_NONNULL (args) #define ATTRIBUTE_NONSTRING _GL_ATTRIBUTE_NONSTRING #define ATTRIBUTE_NOTHROW _GL_ATTRIBUTE_NOTHROW #define ATTRIBUTE_PACKED _GL_ATTRIBUTE_PACKED #define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE #define ATTRIBUTE_RETURNS_NONNULL _GL_ATTRIBUTE_RETURNS_NONNULL -#define ATTRIBUTE_SENTINEL(pos) _GL_ATTRIBUTE_SENTINEL(pos) -#define ATTRIBUTE_WARNING(msg) _GL_ATTRIBUTE_WARNING(msg) +#define ATTRIBUTE_SENTINEL(pos) _GL_ATTRIBUTE_SENTINEL (pos) +#define ATTRIBUTE_WARNING(msg) _GL_ATTRIBUTE_WARNING (msg) #endif /* _GL_ATTRIBUTE_H */ diff --git a/lib/dirent.in.h b/lib/dirent.in.h index f7c2681015..6fa44f0d28 100644 --- a/lib/dirent.in.h +++ b/lib/dirent.in.h @@ -57,10 +57,12 @@ typedef struct gl_directory DIR; /* The __attribute__ feature is available in gcc versions 2.5 and later. The attribute __pure__ was added in gcc 2.96. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ +#ifndef _GL_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE /* empty */ +# endif #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ diff --git a/lib/limits.in.h b/lib/limits.in.h index 90c273fa17..d25c523706 100644 --- a/lib/limits.in.h +++ b/lib/limits.in.h @@ -15,16 +15,32 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . */ -#ifndef _@GUARD_PREFIX@_LIMITS_H - #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ -/* The include_next requires a split double-inclusion guard. */ +#if defined _GL_ALREADY_INCLUDING_LIMITS_H +/* Special invocation convention: + On Haiku/x86_64, we have a sequence of nested includes + -> -> . + In this situation, LONG_MAX and INT_MAX are not yet defined, + therefore we should not attempt to define LONG_BIT. */ + #@INCLUDE_NEXT@ @NEXT_LIMITS_H@ +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_LIMITS_H + +# define _GL_ALREADY_INCLUDING_LIMITS_H + +/* The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_LIMITS_H@ + +# undef _GL_ALREADY_INCLUDING_LIMITS_H + #ifndef _@GUARD_PREFIX@_LIMITS_H #define _@GUARD_PREFIX@_LIMITS_H @@ -102,3 +118,4 @@ #endif /* _@GUARD_PREFIX@_LIMITS_H */ #endif /* _@GUARD_PREFIX@_LIMITS_H */ +#endif diff --git a/lib/stdio.in.h b/lib/stdio.in.h index 4a95f323a9..6c338dd6c0 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -62,10 +62,12 @@ We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because gnulib and libintl do '#define printf __printf__' when they override the 'printf' function. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) -#else -# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ +#ifndef _GL_ATTRIBUTE_FORMAT +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +# else +# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ +# endif #endif /* _GL_ATTRIBUTE_FORMAT_PRINTF diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index ec5f124a36..59f9e6c71d 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -101,10 +101,12 @@ struct random_data /* The __attribute__ feature is available in gcc versions 2.5 and later. The attribute __pure__ was added in gcc 2.96. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ +#ifndef _GL_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE /* empty */ +# endif #endif /* The definition of _Noreturn is copied here. */ diff --git a/lib/string.in.h b/lib/string.in.h index 596c99bf2e..96e132f37d 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -54,10 +54,12 @@ /* The __attribute__ feature is available in gcc versions 2.5 and later. The attribute __pure__ was added in gcc 2.96. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ +#ifndef _GL_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE /* empty */ +# endif #endif /* NetBSD 5.0 declares strsignal in , not in . */ diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index b0010d0e35..f4ba5e3a00 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 49 +# gnulib-common.m4 serial 50 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -96,7 +96,7 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) # define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) # define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) -# define _GL_ATTR_warn_unused_result_GL_GNUC_PREREQ (3, 4) +# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) #endif ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's _Alignas instead. @@ -122,7 +122,7 @@ AC_DEFUN([gl_COMMON_BODY], [ /* Avoid __attribute__ ((cold)) on MinGW; see thread starting at . */ #if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__ -# define _GL_ATTRIBUTE_COLD __attribute__ ((cold)) +# define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__)) #else # define _GL_ATTRIBUTE_COLD #endif @@ -142,8 +142,8 @@ AC_DEFUN([gl_COMMON_BODY], [ #endif #if _GL_HAS_ATTRIBUTE (error) -# define _GL_ATTRIBUTE_ERROR(msg) __attribute__((__error__ (msg))) -# define _GL_ATTRIBUTE_WARNING(msg) __attribute__((__warning__ (msg))) +# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg))) +# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg))) #else # define _GL_ATTRIBUTE_ERROR(msg) # define _GL_ATTRIBUTE_WARNING(msg) commit be0d1cac83d14596406571f9cb668031ec5675ac (refs/remotes/origin/emacs-27) Author: Philipp Stephani Date: Sat May 9 14:33:05 2020 +0200 Small fix for type of 'display-fill-column-indicator-character' * lisp/cus-start.el (standard): Don't mark t as safe file-local value for 'display-fill-column-indicator-character', as that value isn't allowed. diff --git a/lisp/cus-start.el b/lisp/cus-start.el index bd32c7c61d..6632687da4 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -780,7 +780,7 @@ since it could result in memory overflow and make Emacs crash." :value nil) character) "27.1" - :safe (lambda (value) (or (characterp value) (booleanp value)))) + :safe (lambda (value) (or (characterp value) (null value)))) ;; xfaces.c (scalable-fonts-allowed display boolean "22.1") ;; xfns.c commit ae3c510696f02f01d03052f070e5ce65b4018a45 Author: Michal Nazarewicz Date: Mon May 4 19:08:10 2020 +0100 cc-mode: extend regexp used by ‘c-or-c++-mode’ * lisp/progmodes/cc-mode (c-or-c++-mode--regexp): Expand the regexp to match some more C++-only constructs and recognise a few more standard C++ header files. Also make sure identifiers start with non-digit. (c-or-c++-mode): Add ‘(interactive)’ declaration. * test/lisp/progmodes/cc-mode-tests.el (c-or-c++-mode): Add test case for the newly recognised constructs. diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index f92d3efdeb..e3a924efb0 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -2541,13 +2541,21 @@ Key bindings: (defconst c-or-c++-mode--regexp (eval-when-compile - (let ((id "[a-zA-Z0-9_]+") (ws "[ \t\r]+") (ws-maybe "[ \t\r]*")) + (let ((id "[a-zA-Z_][a-zA-Z0-9_]*") (ws "[ \t\r]+") (ws-maybe "[ \t\r]*") + (headers '("string" "string_view" "iostream" "map" "unordered_map" + "set" "unordered_set" "vector" "tuple"))) (concat "^" ws-maybe "\\(?:" - "using" ws "\\(?:namespace" ws "std;\\|std::\\)" - "\\|" "namespace" "\\(:?" ws id "\\)?" ws-maybe "{" - "\\|" "class" ws id ws-maybe "[:{\n]" - "\\|" "template" ws-maybe "<.*>" - "\\|" "#include" ws-maybe "<\\(?:string\\|iostream\\|map\\)>" + "using" ws "\\(?:namespace" ws + "\\|" id "::" + "\\|" id ws-maybe "=\\)" + "\\|" "\\(?:inline" ws "\\)?namespace" + "\\(:?" ws "\\(?:" id "::\\)*" id "\\)?" ws-maybe "{" + "\\|" "class" ws id + "\\(?:" ws "final" "\\)?" ws-maybe "[:{;\n]" + "\\|" "struct" ws id "\\(?:" ws "final" ws-maybe "[:{\n]" + "\\|" ws-maybe ":\\)" + "\\|" "template" ws-maybe "<.*?>" + "\\|" "#include" ws-maybe "<" (regexp-opt headers) ">" "\\)"))) "A regexp applied to C header files to check if they are really C++.") @@ -2563,6 +2571,7 @@ should be used. This function attempts to use file contents to determine whether the code is C or C++ and based on that chooses whether to enable `c-mode' or `c++-mode'." + (interactive) (if (save-excursion (save-restriction (save-match-data diff --git a/test/lisp/progmodes/cc-mode-tests.el b/test/lisp/progmodes/cc-mode-tests.el index ad7a52b40d..64d52a952b 100644 --- a/test/lisp/progmodes/cc-mode-tests.el +++ b/test/lisp/progmodes/cc-mode-tests.el @@ -40,7 +40,7 @@ (insert content) (setq mode nil) (c-or-c++-mode) - (unless(eq expected mode) + (unless (eq expected mode) (ert-fail (format "expected %s but got %s when testing '%s'" expected mode content))))) @@ -53,11 +53,18 @@ (funcall do-test (concat " * " content) 'c-mode)) '("using \t namespace \t std;" "using \t std::string;" + "using Foo = Bar;" "namespace \t {" "namespace \t foo \t {" - "class \t Blah_42 \t {" + "namespace \t foo::bar \t {" + "inline namespace \t foo \t {" + "inline namespace \t foo::bar \t {" "class \t Blah_42 \t \n" + "class \t Blah_42;" + "class \t Blah_42 \t final {" + "struct \t Blah_42 \t final {" "class \t _42_Blah:public Foo {" + "struct \t _42_Blah:public Foo {" "template \t < class T >" "template< class T >" "#include " @@ -67,6 +74,7 @@ (mapc (lambda (content) (funcall do-test content 'c-mode)) '("struct \t Blah_42 \t {" "struct template {" + "struct Blah;" "#include "))))) (ert-deftest c-mode-macro-comment () commit fab23328512e47a50caced8d074e86e583cc8a9f Author: Michal Nazarewicz Date: Sun May 3 16:32:47 2020 +0100 cc-mode: add ‘c-lineup-ternary-bodies’ (bug#41061) Introduce ‘c-lineup-ternary-bodies’ function which, when used as a c lineup function, aligns question mark and colon of a ternary operator. For example: return arg % 2 == 0 ? arg / 2 : (3 * arg + 1); * lisp/progmodes/cc-align.el (c-lineup-ternary-bodies): New function. * doc/misc/cc-mode.texi (Operator Line-Up Functions): Document the new function. * test/lisp/progmodes/cc-mode-tests.el (c-lineup-ternary-bodies): New test case. diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi index f9c9f5e183..16eac4828c 100644 --- a/doc/misc/cc-mode.texi +++ b/doc/misc/cc-mode.texi @@ -6395,6 +6395,26 @@ function is the same as specifying a list @code{(c-lineup-assignments @comment ------------------------------------------------------------ +@defun c-lineup-ternary-bodies +@findex lineup-ternary-bodies @r{(c-)} +Line up true and false branches of a ternary operator +(i.e. @code{?:}). More precisely, if the line starts with a colon +which is a part of a said operator it with corresponding question +mark. For example: + +@example +@group +return arg % 2 == 0 ? arg / 2 + : (3 * arg + 1); @hereFn{c-lineup-ternary-bodies} +@end group +@end example + +@workswith @code{arglist-cont}, @code{arglist-cont-nonempty} and +@code{statement-cont}. +@end defun + +@comment ------------------------------------------------------------ + @defun c-lineup-cascaded-calls @findex lineup-cascaded-calls @r{(c-)} Line up ``cascaded calls'' under each other. If the line begins with diff --git a/etc/NEWS b/etc/NEWS index 9c71752b62..12406eea82 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -305,6 +305,23 @@ use ‘doxygen’ by default one might evaluate: 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 +)) + ** browse-url *** Added support for custom URL handlers diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el index f30477dc78..c49bdc5c51 100644 --- a/lisp/progmodes/cc-align.el +++ b/lisp/progmodes/cc-align.el @@ -790,6 +790,38 @@ arglist-cont-nonempty." (or (c-lineup-assignments langelem) c-basic-offset)) +(defun c-lineup-ternary-bodies (langelem) + "Line up true and false branches of a ternary operator (i.e. ‘?:’). +More precisely, if the line starts with a colon which is a part of +a said operator it with corresponding question mark; otherwise return +nil. For example: + + return arg % 2 == 0 ? arg / 2 + : (3 * arg + 1); <- c-lineup-ternary-bodies + +Works with: arglist-cont, arglist-cont-nonempty and statement-cont. +" + (save-excursion + (back-to-indentation) + (when (and (eq ?: (char-after)) + (not (eq ?: (char-after (1+ (point)))))) + (let ((limit (c-langelem-pos langelem)) (depth 1)) + (catch 'done + (while (c-syntactic-skip-backward "^?:" limit t) + (goto-char (1- (point))) + (cond ((eq (char-after) ??) + ;; If we’ve found a question mark, decrease depth. If we’re + ;; reached zero, we’ve found the one we were looking for. + (when (zerop (setq depth (1- depth))) + (throw 'done (vector (current-column))))) + ((or (eq ?: (char-before)) (eq ?? (char-before))) + ;; Step over ‘::’ and ‘?:’ operators. We don’t have to + ;; handle ‘?:’ here but doing so saves an iteration. + (if (eq (point) limit) + (throw 'done nil) + (goto-char (1- (point))))) + ((setq depth (1+ depth)))))))))) ; Otherwise increase depth. + (defun c-lineup-cascaded-calls (langelem) "Line up \"cascaded calls\" under each other. If the line begins with \"->\" or \".\" and the preceding line ends diff --git a/test/lisp/progmodes/cc-mode-tests.el b/test/lisp/progmodes/cc-mode-tests.el index 0729841ce6..ad7a52b40d 100644 --- a/test/lisp/progmodes/cc-mode-tests.el +++ b/test/lisp/progmodes/cc-mode-tests.el @@ -78,4 +78,25 @@ (insert macro-string) (c-mode)))) +(ert-deftest c-lineup-ternary-bodies () + "Test for c-lineup-ternary-bodies function" + (with-temp-buffer + (c-mode) + (let* ((common-prefix "int value = condition ") + (expected-column (length common-prefix))) + (dolist (test '(("? a : \n b" . nil) + ("? a \n ::b" . nil) + ("a \n : b" . nil) + ("? a \n : b" . t) + ("? ::a \n : b" . t) + ("? (p ? q : r) \n : b" . t) + ("? p ?: q \n : b" . t) + ("? p ? : q \n : b" . t) + ("? p ? q : r \n : b" . t))) + (delete-region (point-min) (point-max)) + (insert common-prefix (car test)) + (should (equal + (and (cdr test) (vector expected-column)) + (c-lineup-ternary-bodies '(statement-cont . 1)))))))) + ;;; cc-mode-tests.el ends here commit c5e583977629f55ad438ef0b0c210a9eeb94ae6d Author: Eli Zaretskii Date: Sat May 9 12:34:58 2020 +0300 Fix customization of 'display-fill-column-indicator-character' * lisp/cus-start.el (display-fill-column-indicator-character): Fix the customization form. (Bug#41145) diff --git a/lisp/cus-start.el b/lisp/cus-start.el index dff4d9a606..bd32c7c61d 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -771,9 +771,16 @@ since it could result in memory overflow and make Emacs crash." :safe (lambda (value) (or (booleanp value) (integerp value)))) (display-fill-column-indicator-character display-fill-column-indicator - character + (choice + (character :tag "Use U+2502 to indicate fill column" + :value ?│) + (character :tag "Use | to indicate fill column" + :value ?|) + (const :tag "If possible, use U+2502 to indicate fill column, otherwise use |" + :value nil) + character) "27.1" - :safe characterp) + :safe (lambda (value) (or (characterp value) (booleanp value)))) ;; xfaces.c (scalable-fonts-allowed display boolean "22.1") ;; xfns.c commit d5c184aa3e2a183144efa5f269e2c70d2681aa0a Author: Philipp Stephani Date: Sat May 9 10:20:47 2020 +0200 Refer to fill column indicator Info node in some places. * src/xdisp.c (syms_of_xdisp): Add reference to manual in documentation strings for variables related to fill column indicators. * lisp/display-fill-column-indicator.el (display-fill-column-indicator) (display-fill-column-indicator-mode): Add reference to manual. diff --git a/lisp/display-fill-column-indicator.el b/lisp/display-fill-column-indicator.el index 1b92fa69d2..3f947bdc1c 100644 --- a/lisp/display-fill-column-indicator.el +++ b/lisp/display-fill-column-indicator.el @@ -39,7 +39,8 @@ (defgroup display-fill-column-indicator nil "Display a fill column indicator in the buffer." :group 'convenience - :group 'display) + :group 'display + :link '(info-link "(emacs)Displaying Boundaries")) ;;;###autoload @@ -49,7 +50,8 @@ This uses `display-fill-column-indicator' internally. To change the position of the column displayed by default customize `display-fill-column-indicator-column'. You can change the -character for the indicator setting `display-fill-column-indicator-character'." +character for the indicator setting `display-fill-column-indicator-character'. +See Info node `Displaying Boundaries' for details." :lighter nil (if display-fill-column-indicator-mode (progn diff --git a/src/xdisp.c b/src/xdisp.c index c15dd4770a..b0fbc9936f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -34976,7 +34976,8 @@ It has no effect when set to 0, or when line numbers are not absolute. */); Fmake_variable_buffer_local (Qdisplay_line_numbers_offset); DEFVAR_BOOL ("display-fill-column-indicator", Vdisplay_fill_column_indicator, - doc: /* Non-nil means display the fill column indicator. */); + doc: /* Non-nil means display the fill column indicator. +See Info node `Displaying Boundaries' for details. */); Vdisplay_fill_column_indicator = false; DEFSYM (Qdisplay_fill_column_indicator, "display-fill-column-indicator"); Fmake_variable_buffer_local (Qdisplay_fill_column_indicator); @@ -34985,7 +34986,8 @@ It has no effect when set to 0, or when line numbers are not absolute. */); doc: /* Column for indicator when `display-fill-column-indicator' is non-nil. The default value is t which means that the indicator will use the `fill-column' variable. If it is set to an integer the -indicator will be drawn in that column. */); +indicator will be drawn in that column. +See Info node `Displaying Boundaries' for details. */); Vdisplay_fill_column_indicator_column = Qt; DEFSYM (Qdisplay_fill_column_indicator_column, "display-fill-column-indicator-column"); Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_column); @@ -34993,7 +34995,8 @@ indicator will be drawn in that column. */); DEFVAR_LISP ("display-fill-column-indicator-character", Vdisplay_fill_column_indicator_character, doc: /* Character to draw the indicator when `display-fill-column-indicator' is non-nil. The default is U+2502 but a good alternative is (ascii 124) -if the font in fill-column-indicator face does not support Unicode characters. */); +if the font in fill-column-indicator face does not support Unicode characters. +See Info node `Displaying Boundaries' for details. */); Vdisplay_fill_column_indicator_character = Qnil; DEFSYM (Qdisplay_fill_column_indicator_character, "display-fill-column-indicator-character"); Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_character); commit e13300ae50f27c16c1d829d25d1114d835b5c047 Merge: 0bae57033f 4c98aa7ea5 Author: Martin Rudalics Date: Sat May 9 09:39:40 2020 +0200 Merge branch 'emacs-27' of git.sv.gnu.org:/srv/git/emacs into emacs-27 commit 0bae57033f061271d66c76c158e73672c6a87f4d Author: Martin Rudalics Date: Sat May 9 09:38:27 2020 +0200 Fix GTK's Tool Bar menu radio buttons * lisp/menu-bar.el (menu-bar-showhide-tool-bar-menu): Fix typo that makes the radio buttons pretend that the tool bar is always shown on the left side of the frame. diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 8f825a19ad..cc12a17c79 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1085,10 +1085,10 @@ The selected font will be the default on both the existing and future frames." :visible (display-graphic-p) :button (:radio . (and tool-bar-mode - (frame-parameter + (eq (frame-parameter (menu-bar-frame-for-menubar) 'tool-bar-position) - 'left)))) + 'left))))) (bindings--define-key menu [showhide-tool-bar-right] '(menu-item "On the Right" commit 4c98aa7ea56a33740e3af1d1e32b0dc0ad400b85 Author: Eli Zaretskii Date: Sat May 9 10:23:49 2020 +0300 Minor clarifications in NEWS * etc/NEWS: Tell how to revert to previous behaviors regarding displaying messages when the minibuffer is active. (Bug#41087) diff --git a/etc/NEWS b/etc/NEWS index 42133b8bad..bb275b70e6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -881,21 +881,27 @@ list the contents of such directories when completing file names. ** Minibuffer +++ -*** A new user option, 'minibuffer-beginning-of-buffer-movement', has -been introduced to allow controlling how the 'M-<' command works in +*** New user option 'minibuffer-beginning-of-buffer-movement'. +This option allows control of how the 'M-<' command works in the minibuffer. If non-nil, point will move to the end of the prompt -(if point is after the end of the prompt). +(if point is after the end of the prompt). The default is nil, which +preserves the original behavior of 'M-<' moving to the beginning of +the prompt. +++ *** When the minibuffer is active, echo-area messages are displayed at the end of the minibuffer instead of hiding the minibuffer by the echo area display. The new user option 'minibuffer-message-clear-timeout' controls how messages displayed in this situation are removed from the -minibuffer. +minibuffer. To revert to previous behavior, where echo-area messages +temporarily overwrote the minibuffer contents until the user typed +something, set 'set-message-function' and 'clear-message-function' to +nil. --- *** Minibuffer now uses 'minibuffer-message' to display error messages -at the end of the active minibuffer. +at the end of the active minibuffer. To disable this, remove +'minibuffer-error-initialize' from 'minibuffer-setup-hook'. +++ *** 'y-or-n-p' now uses the minibuffer to read 'y' or 'n' answer. commit a1cbd05f3892fc86815f69bc50d8ab9175b7b082 Author: Philipp Stephani Date: Fri May 8 22:12:07 2020 +0200 Improve documentation of 'with-suppressed-warnings'. * lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): Refer to 'byte-compile-warnings' instead of 'byte-compile-warning-types', as only the former variable documents the available warning types. diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 6a49c60099..70fe06085d 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -513,11 +513,12 @@ wrong number of parameters, say (zot 1 2)) The warnings that can be suppressed are a subset of the warnings -in `byte-compile-warning-types'; see this variable for a fuller -explanation of the warning types. The types that can be -suppressed with this macro are `free-vars', `callargs', -`redefine', `obsolete', `interactive-only', `lexical', `mapcar', -`constants' and `suspicious'. +in `byte-compile-warning-types'; see the variable +`byte-compile-warnings' for a fuller explanation of the warning +types. The types that can be suppressed with this macro are +`free-vars', `callargs', `redefine', `obsolete', +`interactive-only', `lexical', `mapcar', `constants' and +`suspicious'. For the `mapcar' case, only the `mapcar' function can be used in the symbol list. For `suspicious', only `set-buffer' can be used." commit 4a895c1b2601150357d6523bb5121fb07a89701e Author: Eli Zaretskii Date: Fri May 8 20:27:39 2020 +0300 Fix a typo in a comment * lisp/display-fill-column-indicator.el: Fix a typo in a comment. Suggested by david s . diff --git a/lisp/display-fill-column-indicator.el b/lisp/display-fill-column-indicator.el index 25259aadf6..1b92fa69d2 100644 --- a/lisp/display-fill-column-indicator.el +++ b/lisp/display-fill-column-indicator.el @@ -31,7 +31,7 @@ ;; NOTE: Customization variables for ;; `display-fill-column-indicator-column' and -;; `display-fill-column-indicator-char' itself are defined in +;; `display-fill-column-indicator-character' itself are defined in ;; cus-start.el. ;;; Code: commit 2caf3e997e2a4013ffad10a047f24c98d02ab1d5 Author: Eli Zaretskii Date: Fri May 8 17:25:45 2020 +0300 Improve documentation of Hi Lock mode * lisp/hi-lock.el (hi-lock-mode, hi-lock-face-buffer) (hi-lock-face-phrase-buffer, hi-lock-face-symbol-at-point): Clarify when 'hi-lock-mode' will use Font Lock and when it will use overlays. (Bug#41124) diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index de258935e1..0f685464cd 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el @@ -318,7 +318,10 @@ or add (global-hi-lock-mode 1) to your init file. In buffers where Font Lock mode is enabled, patterns are highlighted using font lock. In buffers where Font Lock mode is disabled, patterns are applied using overlays; in this case, the -highlighting will not be updated as you type. +highlighting will not be updated as you type. The Font Lock mode +is considered \"enabled\" in a buffer if its `major-mode' +causes `font-lock-specified-p' to return non-nil, which means +the major mode specifies support for Font Lock. When Hi Lock mode is enabled, a \"Regexp Highlighting\" submenu is added to the \"Edit\" menu. The commands in the submenu, @@ -462,7 +465,10 @@ If SUBEXP is omitted or nil, the entire REGEXP is highlighted. Use Font lock mode, if enabled, to highlight REGEXP. Otherwise, use overlays for highlighting. If overlays are used, the -highlighting will not update as you type." +highlighting will not update as you type. The Font Lock mode +is considered \"enabled\" in a buffer if its `major-mode' +causes `font-lock-specified-p' to return non-nil, which means +the major mode specifies support for Font Lock." (interactive (list (hi-lock-regexp-okay @@ -487,7 +493,10 @@ letters case-insensitive, before highlighting with `hi-lock-set-pattern'. Use Font lock mode, if enabled, to highlight REGEXP. Otherwise, use overlays for highlighting. If overlays are used, the -highlighting will not update as you type." +highlighting will not update as you type. The Font Lock mode +is considered \"enabled\" in a buffer if its `major-mode' +causes `font-lock-specified-p' to return non-nil, which means +the major mode specifies support for Font Lock." (interactive (list (hi-lock-regexp-okay @@ -508,7 +517,10 @@ unless you use a prefix argument. Uses `find-tag-default-as-symbol-regexp' to retrieve the symbol at point. This uses Font lock mode if it is enabled; otherwise it uses overlays, -in which case the highlighting will not update as you type." +in which case the highlighting will not update as you type. The Font +Lock mode is considered \"enabled\" in a buffer if its `major-mode' +causes `font-lock-specified-p' to return non-nil, which means +the major mode specifies support for Font Lock." (interactive) (let* ((regexp (hi-lock-regexp-okay (find-tag-default-as-symbol-regexp))) commit 7081c1d66fe99964c28794420f8cf4169fb8f818 Author: Eli Zaretskii Date: Fri May 8 14:21:35 2020 +0300 Fix typos in the Emacs user manual * doc/emacs/calendar.texi (Holidays): Fix usage of non-ASCII accents. * doc/emacs/custom.texi (Init Rebinding): Fix a cross-reference. * doc/emacs/dired.texi (Operating on Files): Make the cross-reference to "VC Delete/Rename" be to a different manual in the printed version. (Bug#41100) diff --git a/doc/emacs/calendar.texi b/doc/emacs/calendar.texi index 0911185395..8dc1a0b2df 100644 --- a/doc/emacs/calendar.texi +++ b/doc/emacs/calendar.texi @@ -532,8 +532,8 @@ holidays centered around a different month, use @kbd{C-u M-x holidays}, which prompts for the month and year. The holidays known to Emacs include United States holidays and the -major Bahá'í, Chinese, Christian, Islamic, and Jewish holidays; also the -solstices and equinoxes. +major Bah@'{a}@t{'}@'{i}, Chinese, Christian, Islamic, and Jewish +holidays; also the solstices and equinoxes. @findex list-holidays The command @kbd{M-x holiday-list} displays the list of holidays for diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 406f0c96c1..d034a78501 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -1882,7 +1882,7 @@ also unset keys, when passed @code{nil} as the binding. Since a mode's keymaps are not constructed until it has been loaded, you must delay running code which modifies them, e.g., by putting it -on a @dfn{mode hook} (@pxref{(Hooks)}). For example, Texinfo mode +on a @dfn{mode hook} (@pxref{Hooks}). For example, Texinfo mode runs the hook @code{texinfo-mode-hook}. Here's how you can use the hook to add local bindings for @kbd{C-c n} and @kbd{C-c p}, and remove the one for @kbd{C-c C-x x} in Texinfo mode: diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi index d514414180..4ff1dc1bd9 100644 --- a/doc/emacs/dired.texi +++ b/doc/emacs/dired.texi @@ -723,7 +723,13 @@ with renamed files so that they refer to the new names. @vindex dired-vc-rename-file If the value of the variable @code{dired-vc-rename-file} is non-@code{nil}, files are renamed using the commands of the underlying VCS, via +@ifnottex @code{vc-rename-file} (@pxref{VC Delete/Rename}). +@end ifnottex +@iftex +@code{vc-rename-file} (@pxref{VC Delete/Rename,, Deleting and Renaming +Version-Controlled Files, emacs-xtra, Specialized Emacs Features}). +@end iftex @findex dired-do-hardlink @kindex H @r{(Dired)} commit 0385771e2feab1d8e564bbda7edc7acb88aaf0a5 Author: Björn Holby Date: Mon May 4 22:02:57 2020 +0200 Fix references to Speedbar in VHDL mode * lisp/progmodes/vhdl-mode.el (vhdl-speedbar-initialize): Update references to Speedbar variables. (Bug#41084) Copyright-paperwork-exempt: yes diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index de56f581dd..3981913101 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -14730,7 +14730,7 @@ if required." (speedbar-add-mode-functions-list '("vhdl directory" (speedbar-item-info . vhdl-speedbar-item-info) - (speedbar-line-directory . speedbar-files-line-path))) + (speedbar-line-directory . speedbar-files-line-directory))) (speedbar-add-mode-functions-list '("vhdl project" (speedbar-item-info . vhdl-speedbar-item-info) commit a76cafea0d55cc8df2a2c3556a628dac83762d9a Author: Eli Zaretskii Date: Fri May 8 13:35:34 2020 +0300 Fix handling of FROM = t and TO = t by 'window-text-pixel-size' * src/xdisp.c (Fwindow_text_pixel_size): Use byte position for accessing buffer text, not character positions. (Bug#41125) diff --git a/src/xdisp.c b/src/xdisp.c index 19f4f32618..c15dd4770a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10442,7 +10442,7 @@ include the height of both, if present, in the return value. */) struct buffer *b; struct it it; struct buffer *old_b = NULL; - ptrdiff_t start, end, pos; + ptrdiff_t start, end, bpos; struct text_pos startp; void *itdata = NULL; int c, max_x = 0, max_y = 0, x = 0, y = 0; @@ -10457,32 +10457,56 @@ include the height of both, if present, in the return value. */) } if (NILP (from)) - start = BEGV; + { + start = BEGV; + bpos = BEGV_BYTE; + } else if (EQ (from, Qt)) { - start = pos = BEGV; - while ((pos++ < ZV) && (c = FETCH_CHAR (pos)) - && (c == ' ' || c == '\t' || c == '\n' || c == '\r')) - start = pos; - while ((pos-- > BEGV) && (c = FETCH_CHAR (pos)) && (c == ' ' || c == '\t')) - start = pos; + start = BEGV; + bpos = BEGV_BYTE; + while (bpos < ZV_BYTE) + { + FETCH_CHAR_ADVANCE (c, start, bpos); + if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r')) + break; + } + while (bpos > BEGV_BYTE) + { + DEC_BOTH (start, bpos); + c = FETCH_CHAR (bpos); + if (!(c == ' ' || c == '\t')) + break; + } } else { CHECK_FIXNUM_COERCE_MARKER (from); start = min (max (XFIXNUM (from), BEGV), ZV); + bpos = CHAR_TO_BYTE (start); } + SET_TEXT_POS (startp, start, bpos); + if (NILP (to)) end = ZV; else if (EQ (to, Qt)) { - end = pos = ZV; - while ((pos-- > BEGV) && (c = FETCH_CHAR (pos)) - && (c == ' ' || c == '\t' || c == '\n' || c == '\r')) - end = pos; - while ((pos++ < ZV) && (c = FETCH_CHAR (pos)) && (c == ' ' || c == '\t')) - end = pos; + end = ZV; + bpos = ZV_BYTE; + while (bpos > BEGV_BYTE) + { + DEC_BOTH (end, bpos); + c = FETCH_CHAR (bpos); + if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r')) + break; + } + while (bpos < ZV_BYTE) + { + FETCH_CHAR_ADVANCE (c, end, bpos); + if (!(c == ' ' || c == '\t')) + break; + } } else { @@ -10499,7 +10523,6 @@ include the height of both, if present, in the return value. */) max_y = XFIXNUM (y_limit); itdata = bidi_shelve_cache (); - SET_TEXT_POS (startp, start, CHAR_TO_BYTE (start)); start_display (&it, w, startp); /* It makes no sense to measure dimensions of region of text that crosses the point where bidi reordering changes scan direction.