diff options
| author | Glenn Morris | 2020-02-16 07:50:36 -0800 |
|---|---|---|
| committer | Glenn Morris | 2020-02-16 07:50:36 -0800 |
| commit | f633e014aca727b9ccecaf8e6d69386f93c5073f (patch) | |
| tree | 8db3ca5c8726fe382033559ec6a3bdf2cf28b74a /lisp | |
| parent | 3480071dfab30eaca7f1d014600b864d2ea22f62 (diff) | |
| parent | 7ceb45f61f91d99c045966d8463c8ae30add8930 (diff) | |
| download | emacs-f633e014aca727b9ccecaf8e6d69386f93c5073f.tar.gz emacs-f633e014aca727b9ccecaf8e6d69386f93c5073f.zip | |
Merge from origin/emacs-27
7ceb45f61f (origin/emacs-27) Reformulate c-end-of-macro, handling mul...
888ffd960c Fix unexec failure on macOS 10.15.4
b392c9f365 Fix 'reverse-region' when less than one line is in region
7448834f73 Correct default regexp in 'package-menu-hide-package'
faada7ca42 Remove obsolete menu entry "Redisplay buffer"
78d76cd93c Remove redundant 'msft' compilation error rule (bug#39595)
75a9eee8b8 ; * src/editfns.c (Fbuffer_size): Tiny clarification.
4d8d25d641 * doc/lispref/variables.texi (special-variable-p): Clarify...
9f6a4bbcc9 Remove the optional KEEP-ORDER argument to regexp-opt
d1e8ce8bb6 Make after-change-functions called from call-process get t...
# Conflicts:
# etc/NEWS
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/emacs-lisp/package.el | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/regexp-opt.el | 43 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 58 | ||||
| -rw-r--r-- | lisp/progmodes/cc-langs.el | 36 | ||||
| -rw-r--r-- | lisp/progmodes/compile.el | 7 | ||||
| -rw-r--r-- | lisp/sort.el | 17 |
6 files changed, 62 insertions, 105 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index c4f751871b6..c91ee445e13 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -2701,9 +2701,8 @@ either a full name or nil, and EMAIL is a valid email address." | |||
| 2701 | ["Help" package-menu-quick-help :help "Show short key binding help for package-menu-mode"] | 2701 | ["Help" package-menu-quick-help :help "Show short key binding help for package-menu-mode"] |
| 2702 | "--" | 2702 | "--" |
| 2703 | ["Refresh Package List" revert-buffer | 2703 | ["Refresh Package List" revert-buffer |
| 2704 | :help "Redownload the ELPA archive" | 2704 | :help "Redownload the package archive(s)" |
| 2705 | :active (not package--downloads-in-progress)] | 2705 | :active (not package--downloads-in-progress)] |
| 2706 | ["Redisplay buffer" revert-buffer :help "Update the buffer with current list of packages"] | ||
| 2707 | ["Execute Marked Actions" package-menu-execute :help "Perform all the marked actions"] | 2706 | ["Execute Marked Actions" package-menu-execute :help "Perform all the marked actions"] |
| 2708 | 2707 | ||
| 2709 | "--" | 2708 | "--" |
| @@ -3197,7 +3196,8 @@ The default regexp will hide only the package whose name is at point." | |||
| 3197 | (declare (interactive-only "change `package-hidden-regexps' instead.")) | 3196 | (declare (interactive-only "change `package-hidden-regexps' instead.")) |
| 3198 | (let* ((name (when (derived-mode-p 'package-menu-mode) | 3197 | (let* ((name (when (derived-mode-p 'package-menu-mode) |
| 3199 | (concat "\\`" (regexp-quote (symbol-name (package-desc-name | 3198 | (concat "\\`" (regexp-quote (symbol-name (package-desc-name |
| 3200 | (tabulated-list-get-id))))))) | 3199 | (tabulated-list-get-id)))) |
| 3200 | "\\'"))) | ||
| 3201 | (re (read-string "Hide packages matching regexp: " name))) | 3201 | (re (read-string "Hide packages matching regexp: " name))) |
| 3202 | ;; Test if it is valid. | 3202 | ;; Test if it is valid. |
| 3203 | (string-match re "") | 3203 | (string-match re "") |
diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el index 2cce4e63539..35a5fda184f 100644 --- a/lisp/emacs-lisp/regexp-opt.el +++ b/lisp/emacs-lisp/regexp-opt.el | |||
| @@ -84,7 +84,7 @@ | |||
| 84 | ;;; Code: | 84 | ;;; Code: |
| 85 | 85 | ||
| 86 | ;;;###autoload | 86 | ;;;###autoload |
| 87 | (defun regexp-opt (strings &optional paren keep-order) | 87 | (defun regexp-opt (strings &optional paren) |
| 88 | "Return a regexp to match a string in the list STRINGS. | 88 | "Return a regexp to match a string in the list STRINGS. |
| 89 | Each member of STRINGS is treated as a fixed string, not as a regexp. | 89 | Each member of STRINGS is treated as a fixed string, not as a regexp. |
| 90 | Optional PAREN specifies how the returned regexp is surrounded by | 90 | Optional PAREN specifies how the returned regexp is surrounded by |
| @@ -114,11 +114,8 @@ nil | |||
| 114 | necessary to ensure that a postfix operator appended to it will | 114 | necessary to ensure that a postfix operator appended to it will |
| 115 | apply to the whole expression. | 115 | apply to the whole expression. |
| 116 | 116 | ||
| 117 | The optional argument KEEP-ORDER, if non-nil, forces the match to | 117 | The returned regexp is ordered in such a way that it will always |
| 118 | be performed in the order given, as if the strings were made into | 118 | match the longest string possible. |
| 119 | a regexp by joining them with the `\\|' operator. If nil or | ||
| 120 | omitted, the returned regexp is will always match the longest | ||
| 121 | string possible. | ||
| 122 | 119 | ||
| 123 | Up to reordering, the resulting regexp is equivalent to but | 120 | Up to reordering, the resulting regexp is equivalent to but |
| 124 | usually more efficient than that of a simplified version: | 121 | usually more efficient than that of a simplified version: |
| @@ -140,34 +137,12 @@ usually more efficient than that of a simplified version: | |||
| 140 | (completion-ignore-case nil) | 137 | (completion-ignore-case nil) |
| 141 | (completion-regexp-list nil) | 138 | (completion-regexp-list nil) |
| 142 | (open (cond ((stringp paren) paren) (paren "\\("))) | 139 | (open (cond ((stringp paren) paren) (paren "\\("))) |
| 143 | (re | 140 | (re (if strings |
| 144 | (cond | 141 | (regexp-opt-group |
| 145 | ;; No strings: return an unmatchable regexp. | 142 | (delete-dups (sort (copy-sequence strings) 'string-lessp)) |
| 146 | ((null strings) | 143 | (or open t) (not open)) |
| 147 | (concat (or open "\\(?:") regexp-unmatchable "\\)")) | 144 | ;; No strings: return an unmatchable regexp. |
| 148 | 145 | (concat (or open "\\(?:") regexp-unmatchable "\\)")))) | |
| 149 | ;; The algorithm will generate a pattern that matches | ||
| 150 | ;; longer strings in the list before shorter. If the | ||
| 151 | ;; list order matters, then no string must come after a | ||
| 152 | ;; proper prefix of that string. To check this, verify | ||
| 153 | ;; that a straight or-pattern matches each string | ||
| 154 | ;; entirely. | ||
| 155 | ((and keep-order | ||
| 156 | (let* ((case-fold-search nil) | ||
| 157 | (alts (mapconcat #'regexp-quote strings "\\|"))) | ||
| 158 | (and (let ((s strings)) | ||
| 159 | (while (and s | ||
| 160 | (string-match alts (car s)) | ||
| 161 | (= (match-end 0) (length (car s)))) | ||
| 162 | (setq s (cdr s))) | ||
| 163 | ;; If we exited early, we found evidence that | ||
| 164 | ;; regexp-opt-group cannot be used. | ||
| 165 | s) | ||
| 166 | (concat (or open "\\(?:") alts "\\)"))))) | ||
| 167 | (t | ||
| 168 | (regexp-opt-group | ||
| 169 | (delete-dups (sort (copy-sequence strings) 'string-lessp)) | ||
| 170 | (or open t) (not open)))))) | ||
| 171 | (cond ((eq paren 'words) | 146 | (cond ((eq paren 'words) |
| 172 | (concat "\\<" re "\\>")) | 147 | (concat "\\<" re "\\>")) |
| 173 | ((eq paren 'symbols) | 148 | ((eq paren 'symbols) |
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 23fb1effdd4..0964c04b899 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -358,7 +358,8 @@ comment at the start of cc-engine.el for more info." | |||
| 358 | "Go to the end of a preprocessor directive. | 358 | "Go to the end of a preprocessor directive. |
| 359 | More accurately, move the point to the end of the closest following | 359 | More accurately, move the point to the end of the closest following |
| 360 | line that doesn't end with a line continuation backslash - no check is | 360 | line that doesn't end with a line continuation backslash - no check is |
| 361 | done that the point is inside a cpp directive to begin with. | 361 | done that the point is inside a cpp directive to begin with, although |
| 362 | it is assumed that point isn't inside a comment or string. | ||
| 362 | 363 | ||
| 363 | If LIM is provided, it is a limit position at which point is left | 364 | If LIM is provided, it is a limit position at which point is left |
| 364 | if the end of the macro doesn't occur earlier. | 365 | if the end of the macro doesn't occur earlier. |
| @@ -379,35 +380,32 @@ comment at the start of cc-engine.el for more info." | |||
| 379 | c-macro-cache-syntactic nil | 380 | c-macro-cache-syntactic nil |
| 380 | c-macro-cache-no-comment nil)) | 381 | c-macro-cache-no-comment nil)) |
| 381 | (save-match-data | 382 | (save-match-data |
| 382 | (while | 383 | (let ((safe-pos (point))) ; a point ouside any literal. |
| 383 | (progn | 384 | ;; Move over stuff followed by a multiline block comment lacking |
| 384 | (while (progn | 385 | ;; escaped newlines each time around this loop. |
| 385 | (end-of-line) | 386 | (while |
| 386 | (when (and (eq (char-before) ?\\) | 387 | (progn |
| 387 | (not (eobp))) | 388 | (while (progn |
| 388 | (forward-char) | 389 | (end-of-line) |
| 389 | t))) | 390 | (when (and (eq (char-before) ?\\) |
| 390 | (let ((cand-EOM (point))) | 391 | (not (eobp))) |
| 391 | (if (and c-open-c-comment-on-logical-line-re | 392 | (forward-char) |
| 392 | (re-search-backward | 393 | t))) |
| 393 | c-open-c-comment-on-logical-line-re | 394 | (let ((s (parse-partial-sexp safe-pos (point)))) |
| 394 | nil t) | 395 | (when ;; Are we in a block comment? |
| 395 | (match-beginning 1) | 396 | (and (nth 4 s) (not (nth 7 s))) |
| 396 | (progn | 397 | (progn |
| 397 | (goto-char (match-beginning 1)) | 398 | ;; Move to after the block comment. |
| 398 | (and (c-forward-single-comment) | 399 | (parse-partial-sexp |
| 399 | (> (point) cand-EOM)))) | 400 | (point) (point-max) nil nil s 'syntax-table) |
| 400 | t | 401 | (setq safe-pos (point))))))) |
| 401 | (goto-char cand-EOM) | 402 | |
| 402 | nil))))) | 403 | (when (and (car c-macro-cache) |
| 403 | 404 | (> (point) (car c-macro-cache)) ; in case we have a | |
| 404 | (when (and (car c-macro-cache) | 405 | ; zero-sized region. |
| 405 | (> (point) (car c-macro-cache)) ; in case we have a | 406 | (not (eq (char-before (1- (point))) ?\\))) |
| 406 | ; zero-sized region. | 407 | (setcdr c-macro-cache (point)) |
| 407 | (bolp) | 408 | (setq c-macro-cache-syntactic nil))))))) |
| 408 | (not (eq (char-before (1- (point))) ?\\))) | ||
| 409 | (setcdr c-macro-cache (point)) | ||
| 410 | (setq c-macro-cache-syntactic nil))))) | ||
| 411 | 409 | ||
| 412 | (defun c-syntactic-end-of-macro () | 410 | (defun c-syntactic-end-of-macro () |
| 413 | ;; Go to the end of a CPP directive, or a "safe" pos just before. | 411 | ;; Go to the end of a CPP directive, or a "safe" pos just before. |
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 667561719cb..e7e7cfd4b09 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el | |||
| @@ -1706,32 +1706,16 @@ ender." | |||
| 1706 | (c-lang-defvar c-last-c-comment-end-on-line-re | 1706 | (c-lang-defvar c-last-c-comment-end-on-line-re |
| 1707 | (c-lang-const c-last-c-comment-end-on-line-re)) | 1707 | (c-lang-const c-last-c-comment-end-on-line-re)) |
| 1708 | 1708 | ||
| 1709 | (c-lang-defconst c-last-open-c-comment-start-on-line-re | 1709 | ;; The following is no longer used (2020-02-16). |
| 1710 | "Do NOT use this constant any more. Instead use | 1710 | ;; (c-lang-defconst c-last-open-c-comment-start-on-line-re |
| 1711 | `c-open-c-comment-on-logical-line-re' (2020-02-10). | 1711 | ;; "Regexp which matches the last block comment start on the |
| 1712 | 1712 | ;; current ine, if any, or nil in those languages without block | |
| 1713 | Regexp which matches the last block comment start on the | 1713 | ;; comments. When a match is found, submatch 1 contains the comment |
| 1714 | current ine, if any, or nil in those languages without block | 1714 | ;; starter." |
| 1715 | comments. When a match is found, submatch 1 contains the comment | 1715 | ;; t "\\(/\\*\\)\\([^*]\\|\\*+\\([^*/]\\|$\\)\\)*$" |
| 1716 | starter." | 1716 | ;; awk nil) |
| 1717 | t "\\(/\\*\\)\\([^*]\\|\\*+\\([^*/]\\|$\\)\\)*$" | 1717 | ;; (c-lang-defvar c-last-open-c-comment-start-on-line-re |
| 1718 | awk nil) | 1718 | ;; (c-lang-const c-last-open-c-comment-start-on-line-re)) |
| 1719 | (c-lang-defvar c-last-open-c-comment-start-on-line-re | ||
| 1720 | (c-lang-const c-last-open-c-comment-start-on-line-re)) | ||
| 1721 | (make-obsolete-variable 'c-last-open-c-comment-start-on-line-re | ||
| 1722 | 'c-open-c-comment-on-logical-line-re | ||
| 1723 | "5.35") | ||
| 1724 | |||
| 1725 | (c-lang-defconst c-open-c-comment-on-logical-line-re | ||
| 1726 | "Regexp which matches an open block comment on the current logical line. | ||
| 1727 | It is intended for searching backwards from the end of a line. | ||
| 1728 | Such a search will stop at the first encountered non-escaped | ||
| 1729 | newline or open block comment. If the comment is found, submatch | ||
| 1730 | 1 contains the comment starter." | ||
| 1731 | t "[^\\\n][\r\n]\\|\\(/\\*\\)\\([^*]\\|\\*+\\([^*/]\\|$\\)\\)*$" | ||
| 1732 | awk nil) | ||
| 1733 | (c-lang-defvar c-open-c-comment-on-logical-line-re | ||
| 1734 | (c-lang-const c-open-c-comment-on-logical-line-re)) | ||
| 1735 | 1719 | ||
| 1736 | (c-lang-defconst c-literal-start-regexp | 1720 | (c-lang-defconst c-literal-start-regexp |
| 1737 | ;; Regexp to match the start of comments and string literals. | 1721 | ;; Regexp to match the start of comments and string literals. |
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index a7350f42c24..48ac85a73b7 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -391,13 +391,6 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) | |||
| 391 | (mips-2 | 391 | (mips-2 |
| 392 | " in \\([^()\n ]+\\)(\\([0-9]+\\))$" 1 2) | 392 | " in \\([^()\n ]+\\)(\\([0-9]+\\))$" 1 2) |
| 393 | 393 | ||
| 394 | (msft | ||
| 395 | ;; The message may be a "warning", "error", or "fatal error" with | ||
| 396 | ;; an error code, or "see declaration of" without an error code. | ||
| 397 | "^ *\\([0-9]+>\\)?\\(\\(?:[a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) \ | ||
| 398 | : \\(?:see declaration\\|\\(?:warnin\\(g\\)\\|[a-z ]+\\) C[0-9]+:\\)" | ||
| 399 | 2 3 nil (4)) | ||
| 400 | |||
| 401 | (omake | 394 | (omake |
| 402 | ;; "omake -P" reports "file foo changed" | 395 | ;; "omake -P" reports "file foo changed" |
| 403 | ;; (useful if you do "cvs up" and want to see what has changed) | 396 | ;; (useful if you do "cvs up" and want to see what has changed) |
diff --git a/lisp/sort.el b/lisp/sort.el index 40347e6a8b2..e4ff2afb3d7 100644 --- a/lisp/sort.el +++ b/lisp/sort.el | |||
| @@ -544,23 +544,30 @@ Use \\[untabify] to convert tabs to spaces before sorting." | |||
| 544 | ;;;###autoload | 544 | ;;;###autoload |
| 545 | (defun reverse-region (beg end) | 545 | (defun reverse-region (beg end) |
| 546 | "Reverse the order of lines in a region. | 546 | "Reverse the order of lines in a region. |
| 547 | From a program takes two point or marker arguments, BEG and END." | 547 | When called from Lisp, takes two point or marker arguments, BEG and END. |
| 548 | If BEG is not at the beginning of a line, the first line of those | ||
| 549 | to be reversed is the line starting after BEG. | ||
| 550 | If END is not at the end of a line, the last line to be reversed | ||
| 551 | is the one that ends before END." | ||
| 548 | (interactive "r") | 552 | (interactive "r") |
| 549 | (if (> beg end) | 553 | (if (> beg end) |
| 550 | (let (mid) (setq mid end end beg beg mid))) | 554 | (let (mid) (setq mid end end beg beg mid))) |
| 551 | (save-excursion | 555 | (save-excursion |
| 552 | ;; put beg at the start of a line and end and the end of one -- | 556 | (when (or (< (line-beginning-position) beg) |
| 553 | ;; the largest possible region which fits this criteria | 557 | (< end (line-end-position))) |
| 558 | (user-error "There are no full lines in the region")) | ||
| 559 | ;; Put beg at the start of a line and end and the end of one -- | ||
| 560 | ;; the largest possible region which fits this criteria. | ||
| 554 | (goto-char beg) | 561 | (goto-char beg) |
| 555 | (or (bolp) (forward-line 1)) | 562 | (or (bolp) (forward-line 1)) |
| 556 | (setq beg (point)) | 563 | (setq beg (point)) |
| 557 | (goto-char end) | 564 | (goto-char end) |
| 558 | ;; the test for bolp is for those times when end is on an empty line; | 565 | ;; The test for bolp is for those times when end is on an empty line; |
| 559 | ;; it is probably not the case that the line should be included in the | 566 | ;; it is probably not the case that the line should be included in the |
| 560 | ;; reversal; it isn't difficult to add it afterward. | 567 | ;; reversal; it isn't difficult to add it afterward. |
| 561 | (or (and (eolp) (not (bolp))) (progn (forward-line -1) (end-of-line))) | 568 | (or (and (eolp) (not (bolp))) (progn (forward-line -1) (end-of-line))) |
| 562 | (setq end (point-marker)) | 569 | (setq end (point-marker)) |
| 563 | ;; the real work. this thing cranks through memory on large regions. | 570 | ;; The real work. This thing cranks through memory on large regions. |
| 564 | (let (ll (do t)) | 571 | (let (ll (do t)) |
| 565 | (while do | 572 | (while do |
| 566 | (goto-char beg) | 573 | (goto-char beg) |