diff options
| author | Eli Zaretskii | 2024-09-21 07:32:38 -0400 |
|---|---|---|
| committer | Eli Zaretskii | 2024-09-21 07:32:38 -0400 |
| commit | ff2cc0fc23d5564adc230ee8b4e50adabd2042aa (patch) | |
| tree | 08546afb54d491cf5858f5d21a4fdbc565445fad | |
| parent | abc051c431b93d72d0ddfdf0c92192eac8019309 (diff) | |
| parent | ecfebb5abb864d568a90ff4a1420c973781bbef9 (diff) | |
| download | emacs-ff2cc0fc23d5564adc230ee8b4e50adabd2042aa.tar.gz emacs-ff2cc0fc23d5564adc230ee8b4e50adabd2042aa.zip | |
Merge from origin/emacs-30
ecfebb5abb8 ; Always set 'emoji--insert-buffer'
35e356f958a Fix font-lock of last character before EOB under 'whitesp...
01ebe6de895 Fix 'whitespace-mode' with 'missing-newline-at-eof'
| -rw-r--r-- | lisp/international/emoji.el | 2 | ||||
| -rw-r--r-- | lisp/whitespace.el | 32 |
2 files changed, 23 insertions, 11 deletions
diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el index cbf7c547f4c..e8cd869a571 100644 --- a/lisp/international/emoji.el +++ b/lisp/international/emoji.el | |||
| @@ -164,12 +164,12 @@ when the command was invoked." | |||
| 164 | (let ((buf (current-buffer))) | 164 | (let ((buf (current-buffer))) |
| 165 | (emoji--init) | 165 | (emoji--init) |
| 166 | (switch-to-buffer (get-buffer-create "*Emoji*")) | 166 | (switch-to-buffer (get-buffer-create "*Emoji*")) |
| 167 | (setq-local emoji--insert-buffer buf) | ||
| 167 | ;; Don't regenerate the buffer if it already exists -- this will | 168 | ;; Don't regenerate the buffer if it already exists -- this will |
| 168 | ;; leave point where it was the last time it was used. | 169 | ;; leave point where it was the last time it was used. |
| 169 | (when (zerop (buffer-size)) | 170 | (when (zerop (buffer-size)) |
| 170 | (let ((inhibit-read-only t)) | 171 | (let ((inhibit-read-only t)) |
| 171 | (emoji-list-mode) | 172 | (emoji-list-mode) |
| 172 | (setq-local emoji--insert-buffer buf) | ||
| 173 | (emoji--list-generate nil (cons nil emoji--labels)) | 173 | (emoji--list-generate nil (cons nil emoji--labels)) |
| 174 | (goto-char (point-min)))))) | 174 | (goto-char (point-min)))))) |
| 175 | 175 | ||
diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 28d131b054c..cd8cd0450f2 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el | |||
| @@ -739,7 +739,7 @@ This variable is used when `whitespace-style' includes | |||
| 739 | 739 | ||
| 740 | (defcustom whitespace-indentation-regexp | 740 | (defcustom whitespace-indentation-regexp |
| 741 | '("^\t*\\(\\( \\{%d\\}\\)+\\)[^\n\t]" | 741 | '("^\t*\\(\\( \\{%d\\}\\)+\\)[^\n\t]" |
| 742 | . "^ *\\(\t+\\)[^\n]") | 742 | . "^ *\\(\t+\\).") |
| 743 | "Regexps to match indentation whitespace that should be visualized. | 743 | "Regexps to match indentation whitespace that should be visualized. |
| 744 | 744 | ||
| 745 | The value should be a cons whose car specifies the regexp to match | 745 | The value should be a cons whose car specifies the regexp to match |
| @@ -1752,7 +1752,7 @@ cleaning up these problems." | |||
| 1752 | ((eq (car option) 'space-after-tab::space) | 1752 | ((eq (car option) 'space-after-tab::space) |
| 1753 | (whitespace-space-after-tab-regexp 'space)) | 1753 | (whitespace-space-after-tab-regexp 'space)) |
| 1754 | ((eq (car option) 'missing-newline-at-eof) | 1754 | ((eq (car option) 'missing-newline-at-eof) |
| 1755 | "[^\n]\\'") | 1755 | ".\\'") |
| 1756 | (t | 1756 | (t |
| 1757 | (cdr option))))) | 1757 | (cdr option))))) |
| 1758 | (when (re-search-forward regexp rend t) | 1758 | (when (re-search-forward regexp rend t) |
| @@ -2188,14 +2188,14 @@ resultant list will be returned." | |||
| 2188 | 1 whitespace-space-after-tab t))) | 2188 | 1 whitespace-space-after-tab t))) |
| 2189 | ,@(when (memq 'missing-newline-at-eof whitespace-active-style) | 2189 | ,@(when (memq 'missing-newline-at-eof whitespace-active-style) |
| 2190 | ;; Show missing newline. | 2190 | ;; Show missing newline. |
| 2191 | `(("[^\n]\\'" 0 | 2191 | `((".\\'" 0 |
| 2192 | ;; Don't mark the end of the buffer is point is there -- | 2192 | ;; Don't mark the end of the buffer if point is there -- |
| 2193 | ;; it probably means that the user is typing something | 2193 | ;; it probably means that the user is typing something |
| 2194 | ;; at the end of the buffer. | 2194 | ;; at the end of the buffer. |
| 2195 | (and (/= whitespace-point (point-max)) | 2195 | (and (/= whitespace-point (point-max)) |
| 2196 | 'whitespace-missing-newline-at-eof) | 2196 | 'whitespace-missing-newline-at-eof) |
| 2197 | t))))) | 2197 | prepend))))) |
| 2198 | (font-lock-add-keywords nil whitespace-font-lock-keywords t) | 2198 | (font-lock-add-keywords nil whitespace-font-lock-keywords 'append) |
| 2199 | (font-lock-flush))) | 2199 | (font-lock-flush))) |
| 2200 | 2200 | ||
| 2201 | 2201 | ||
| @@ -2333,10 +2333,22 @@ Also refontify when necessary." | |||
| 2333 | (font-lock-flush whitespace-eob-marker (1+ (buffer-size))))) | 2333 | (font-lock-flush whitespace-eob-marker (1+ (buffer-size))))) |
| 2334 | (setq-local whitespace-buffer-changed nil) | 2334 | (setq-local whitespace-buffer-changed nil) |
| 2335 | (setq whitespace-point (point)) ; current point position | 2335 | (setq whitespace-point (point)) ; current point position |
| 2336 | (let ((refontify (and (eolp) ; It is at end of line ... | 2336 | (let ((refontify (or (and (eolp) ; It is at end of line ... |
| 2337 | ;; ... with trailing SPACE or TAB | 2337 | ;; ... with trailing SPACE or TAB |
| 2338 | (or (memq (preceding-char) '(?\s ?\t))) | 2338 | (or (memq (preceding-char) '(?\s ?\t))) |
| 2339 | (line-beginning-position))) | 2339 | (line-beginning-position)) |
| 2340 | (and (memq 'missing-newline-at-eof | ||
| 2341 | ;; If user requested to highlight | ||
| 2342 | ;; EOB without a newline... | ||
| 2343 | whitespace-active-style) | ||
| 2344 | ;; ...and the buffer is not empty... | ||
| 2345 | (not (= (point-min) (point-max))) | ||
| 2346 | (= (point-max) (without-restriction (point-max))) | ||
| 2347 | ;; ...and no newline at EOB... | ||
| 2348 | (not (eq (char-before (point-max)) ?\n)) | ||
| 2349 | ;; ...then refontify the last character in | ||
| 2350 | ;; the buffer | ||
| 2351 | (max (1- (point-max)) (point-min))))) | ||
| 2340 | (ostart (overlay-start whitespace-point--used))) | 2352 | (ostart (overlay-start whitespace-point--used))) |
| 2341 | (cond | 2353 | (cond |
| 2342 | ((not refontify) | 2354 | ((not refontify) |