Skip to content

Commit 83d4934

Browse files
committed
Merge from origin/emacs-27
3ba0db4 Allow optional truncation of tab names in tab-bar and tab-... 7dd065f Small fixes in documentation. 06166aa Improve explanation of available font backends under X 2eb834e Clear output data pointer on NS
2 parents 2d9d62b + 3ba0db4 commit 83d4934

File tree

6 files changed

+76
-52
lines changed

6 files changed

+76
-52
lines changed

doc/emacs/dired.texi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,8 +720,8 @@ should create non-existent directories in @var{new}.
720720
Dired automatically changes the visited file name of buffers associated
721721
with renamed files so that they refer to the new names.
722722

723-
@vindex dired-vc-rename
724-
If the value of the variable @code{dired-vc-rename} is non-@code{nil},
723+
@vindex dired-vc-rename-file
724+
If the value of the variable @code{dired-vc-rename-file} is non-@code{nil},
725725
files are renamed using the commands of the underlying VCS, via
726726
@code{vc-rename-file} (@pxref{VC Delete/Rename}).
727727

doc/emacs/fixit.texi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ setting the variables @code{undo-limit}, @code{undo-strong-limit}, and
122122
The variable @code{undo-limit} sets a soft limit: Emacs keeps undo
123123
data for enough commands to reach this size, and perhaps exceed it,
124124
but does not keep data for any earlier commands beyond that. Its
125-
default value is 80000. The variable @code{undo-strong-limit} sets a
125+
default value is 160000. The variable @code{undo-strong-limit} sets a
126126
stricter limit: any previous command (though not the most recent one)
127127
that pushes the size past this amount is forgotten. The default value
128-
of @code{undo-strong-limit} is 120000.
128+
of @code{undo-strong-limit} is 240000.
129129

130130
Regardless of the values of those variables, the most recent change
131131
is never discarded unless it gets bigger than @code{undo-outer-limit}
132-
(normally 12,000,000). At that point, Emacs discards the undo data and
132+
(normally 24,000,000). At that point, Emacs discards the undo data and
133133
warns you about it. This is the only situation in which you cannot
134134
undo the last command. If this happens, you can increase the value of
135135
@code{undo-outer-limit} to make it even less likely to happen in the

doc/lispref/frames.texi

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,14 +2295,17 @@ variable do not take effect immediately, only when you specify the
22952295
@item font-backend
22962296
A list of symbols, specifying the @dfn{font backends} to use for
22972297
drawing characters on the frame, in order of priority. In Emacs built
2298-
without Cairo drawing on X, there are currently three available font
2299-
backends: @code{x} (the X core font driver), @code{xft} (the Xft font
2300-
driver), and @code{xfthb} (the Xft font driver with HarfBuzz text
2301-
shaping). If built with the Cairo drawing, there are also three
2302-
available font backends on X: @code{x}, @code{ftcr} (the FreeType font
2303-
driver on Cairo), and @code{ftcrhb} (the FreeType font driver on Cairo
2304-
with HarfBuzz text shaping). On MS-Windows, there are currently three
2305-
available font backends: @code{gdi} (the core MS-Windows font driver),
2298+
without Cairo drawing on X, there are currently three potentially
2299+
available font backends: @code{x} (the X core font driver), @code{xft}
2300+
(the Xft font driver), and @code{xfthb} (the Xft font driver with
2301+
HarfBuzz text shaping). If built with Cairo drawing, there are also
2302+
three potentially available font backends on X: @code{x}, @code{ftcr}
2303+
(the FreeType font driver on Cairo), and @code{ftcrhb} (the FreeType
2304+
font driver on Cairo with HarfBuzz text shaping). Note that the
2305+
@code{ftcr} and @code{ftcrhb} drivers are mutually exclusive (and
2306+
similarly for @code{xft} and @code{xfthb}), with the choice being made
2307+
at build time. On MS-Windows, there are currently three available
2308+
font backends: @code{gdi} (the core MS-Windows font driver),
23062309
@code{uniscribe} (font driver for OTF and TTF fonts with text shaping
23072310
by the Uniscribe engine), and @code{harfbuzz} (font driver for OTF and
23082311
TTF fonts with HarfBuzz text shaping) (@pxref{Windows Fonts,,, emacs,

lisp/tab-bar.el

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ from all windows in the window configuration."
319319
tab-bar-tab-name-current)
320320
(const :tag "Selected window buffer with window count"
321321
tab-bar-tab-name-current-with-count)
322+
(const :tag "Truncated buffer name"
323+
tab-bar-tab-name-truncated)
322324
(const :tag "All window buffers"
323325
tab-bar-tab-name-all)
324326
(function :tag "Function"))
@@ -350,6 +352,29 @@ Also add the number of windows in the window configuration."
350352
'nomini)))
351353
", "))
352354

355+
(defcustom tab-bar-tab-name-truncated-max 20
356+
"Maximum length of the tab name from the current buffer.
357+
Effective when `tab-bar-tab-name-function' is customized
358+
to `tab-bar-tab-name-truncated'."
359+
:type 'integer
360+
:group 'tab-bar
361+
:version "27.1")
362+
363+
(defvar tab-bar-tab-name-truncated-ellipsis
364+
(if (char-displayable-p ?…) "" "..."))
365+
366+
(defun tab-bar-tab-name-truncated ()
367+
"Generate tab name from the buffer of the selected window.
368+
Truncate it to the length specified by `tab-bar-tab-name-truncated-max'.
369+
Append ellipsis `tab-bar-tab-name-truncated-ellipsis' in this case."
370+
(let ((tab-name (buffer-name (window-buffer (minibuffer-selected-window)))))
371+
(if (< (length tab-name) tab-bar-tab-name-truncated-max)
372+
tab-name
373+
(propertize (truncate-string-to-width
374+
tab-name tab-bar-tab-name-truncated-max nil nil
375+
tab-bar-tab-name-truncated-ellipsis)
376+
'help-echo tab-name))))
377+
353378

354379
(defvar tab-bar-tabs-function #'tab-bar-tabs
355380
"Function to get a list of tabs to display in the tab bar.

lisp/tab-line.el

Lines changed: 34 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,6 @@ If nil, don't show it at all."
213213

214214
(defvar tab-line-separator nil)
215215

216-
(defvar tab-line-tab-name-ellipsis
217-
(if (char-displayable-p ?…) "" "..."))
218-
219216

220217
(defcustom tab-line-tab-name-function #'tab-line-tab-name-buffer
221218
"Function to get a tab name.
@@ -240,23 +237,30 @@ This function can be overridden by changing the default value of the
240237
variable `tab-line-tab-name-function'."
241238
(buffer-name buffer))
242239

243-
(defun tab-line-tab-name-truncated-buffer (buffer &optional buffers)
240+
(defcustom tab-line-tab-name-truncated-max 20
241+
"Maximum length of the tab name from the current buffer.
242+
Effective when `tab-line-tab-name-function' is customized
243+
to `tab-line-tab-name-truncated-buffer'."
244+
:type 'integer
245+
:group 'tab-line
246+
:version "27.1")
247+
248+
(defvar tab-line-tab-name-ellipsis
249+
(if (char-displayable-p ?…) "" "..."))
250+
251+
(defun tab-line-tab-name-truncated-buffer (buffer &optional _buffers)
244252
"Generate tab name from BUFFER.
245-
Reduce tab width proportionally to space taken by other tabs."
246-
(let ((tab-name (buffer-name buffer))
247-
(limit (when buffers
248-
(max 1 (- (/ (window-width) (length buffers)) 3)))))
249-
(if (or (not limit) (< (length tab-name) limit))
253+
Truncate it to the length specified by `tab-line-tab-name-truncated-max'.
254+
Append ellipsis `tab-line-tab-name-ellipsis' in this case."
255+
(let ((tab-name (buffer-name buffer)))
256+
(if (< (length tab-name) tab-line-tab-name-truncated-max)
250257
tab-name
251-
(propertize (truncate-string-to-width tab-name limit nil nil
252-
tab-line-tab-name-ellipsis)
258+
(propertize (truncate-string-to-width
259+
tab-name tab-line-tab-name-truncated-max nil nil
260+
tab-line-tab-name-ellipsis)
253261
'help-echo tab-name))))
254262

255263

256-
(defvar tab-line-tabs-limit nil
257-
"Maximum number of buffer tabs displayed in the tab line.
258-
If nil, no limit.")
259-
260264
(defcustom tab-line-tabs-function #'tab-line-tabs-window-buffers
261265
"Function to get a list of tabs to display in the tab line.
262266
This function should return either a list of buffers whose names will
@@ -395,22 +399,9 @@ variable `tab-line-tabs-function'."
395399
(prev-buffers (seq-filter #'buffer-live-p prev-buffers))
396400
;; Remove next-buffers from prev-buffers
397401
(prev-buffers (seq-difference prev-buffers next-buffers)))
398-
(if (natnump tab-line-tabs-limit)
399-
(let* ((half-limit (/ tab-line-tabs-limit 2))
400-
(prev-buffers-limit
401-
(if (> (length prev-buffers) half-limit)
402-
(if (> (length next-buffers) half-limit)
403-
half-limit
404-
(+ half-limit (- half-limit (length next-buffers))))
405-
(length prev-buffers)))
406-
(next-buffers-limit
407-
(- tab-line-tabs-limit prev-buffers-limit)))
408-
(append (reverse (seq-take prev-buffers prev-buffers-limit))
409-
(list buffer)
410-
(seq-take next-buffers next-buffers-limit)))
411-
(append (reverse prev-buffers)
412-
(list buffer)
413-
next-buffers))))
402+
(append (reverse prev-buffers)
403+
(list buffer)
404+
next-buffers)))
414405

415406

416407
(defun tab-line-format-template (tabs)
@@ -681,15 +672,17 @@ Its effect is the same as using the `next-buffer' command
681672
(switch-to-buffer buffer)))))))
682673

683674

684-
(defcustom tab-line-close-tab-action 'bury-buffer
675+
(defcustom tab-line-close-tab-function 'bury-buffer
685676
"Defines what to do on closing the tab.
686677
If `bury-buffer', put the tab's buffer at the end of the list of all
687678
buffers that effectively hides the buffer's tab from the tab line.
688679
If `kill-buffer', kills the tab's buffer.
680+
When a function, it is called with the tab as its argument.
689681
This option is useful when `tab-line-tabs-function' has the value
690682
`tab-line-tabs-window-buffers'."
691683
:type '(choice (const :tag "Bury buffer" bury-buffer)
692-
(const :tag "Kill buffer" kill-buffer))
684+
(const :tag "Kill buffer" kill-buffer)
685+
(function :tag "Function"))
693686
:group 'tab-line
694687
:version "27.1")
695688

@@ -703,18 +696,20 @@ from the tab line."
703696
(window (and posnp (posn-window posnp)))
704697
(tab (get-pos-property 1 'tab (car (posn-string posnp))))
705698
(buffer (if (bufferp tab) tab (cdr (assq 'buffer tab))))
706-
(close-action (unless (bufferp tab) (cdr (assq 'close tab)))))
699+
(close-function (unless (bufferp tab) (cdr (assq 'close tab)))))
707700
(with-selected-window (or window (selected-window))
708701
(cond
709-
((functionp close-action)
710-
(funcall close-action))
711-
((eq tab-line-close-tab-action 'kill-buffer)
702+
((functionp close-function)
703+
(funcall close-function))
704+
((eq tab-line-close-tab-function 'kill-buffer)
712705
(kill-buffer buffer))
713-
((eq tab-line-close-tab-action 'bury-buffer)
706+
((eq tab-line-close-tab-function 'bury-buffer)
714707
(if (eq buffer (current-buffer))
715708
(bury-buffer)
716709
(set-window-prev-buffers nil (assq-delete-all buffer (window-prev-buffers)))
717-
(set-window-next-buffers nil (delq buffer (window-next-buffers))))))
710+
(set-window-next-buffers nil (delq buffer (window-next-buffers)))))
711+
((functionp tab-line-close-tab-function)
712+
(funcall tab-line-close-tab-function)))
718713
(force-mode-line-update))))
719714

720715

src/nsterm.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,6 +1644,7 @@ Hide the window (X11 semantics)
16441644
[view release];
16451645

16461646
xfree (f->output_data.ns);
1647+
f->output_data.ns = NULL;
16471648

16481649
unblock_input ();
16491650
}

0 commit comments

Comments
 (0)