emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 83d4934 1/3: Merge from origin/emacs-27


From: Glenn Morris
Subject: master 83d4934 1/3: Merge from origin/emacs-27
Date: Wed, 22 Jan 2020 10:55:23 -0500 (EST)

branch: master
commit 83d493426b8b48826d429929053791644a6e9646
Merge: 2d9d62b 3ba0db4
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    Merge from origin/emacs-27
    
    3ba0db41e3 Allow optional truncation of tab names in tab-bar and tab-...
    7dd065fc7b Small fixes in documentation.
    06166aa719 Improve explanation of available font backends under X
    2eb834ead4 Clear output data pointer on NS
---
 doc/emacs/dired.texi    |  4 +--
 doc/emacs/fixit.texi    |  6 ++--
 doc/lispref/frames.texi | 19 +++++++------
 lisp/tab-bar.el         | 25 +++++++++++++++++
 lisp/tab-line.el        | 73 +++++++++++++++++++++++--------------------------
 src/nsterm.m            |  1 +
 6 files changed, 76 insertions(+), 52 deletions(-)

diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index 5a64425..fba4389 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -720,8 +720,8 @@ should create non-existent directories in @var{new}.
 Dired automatically changes the visited file name of buffers associated
 with renamed files so that they refer to the new names.
 
-@vindex dired-vc-rename
-If the value of the variable @code{dired-vc-rename} is non-@code{nil},
+@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
 @code{vc-rename-file} (@pxref{VC Delete/Rename}).
 
diff --git a/doc/emacs/fixit.texi b/doc/emacs/fixit.texi
index 171a9bc..3665faf 100644
--- a/doc/emacs/fixit.texi
+++ b/doc/emacs/fixit.texi
@@ -122,14 +122,14 @@ setting the variables @code{undo-limit}, 
@code{undo-strong-limit}, and
   The variable @code{undo-limit} sets a soft limit: Emacs keeps undo
 data for enough commands to reach this size, and perhaps exceed it,
 but does not keep data for any earlier commands beyond that.  Its
-default value is 80000.  The variable @code{undo-strong-limit} sets a
+default value is 160000.  The variable @code{undo-strong-limit} sets a
 stricter limit: any previous command (though not the most recent one)
 that pushes the size past this amount is forgotten.  The default value
-of @code{undo-strong-limit} is 120000.
+of @code{undo-strong-limit} is 240000.
 
   Regardless of the values of those variables, the most recent change
 is never discarded unless it gets bigger than @code{undo-outer-limit}
-(normally 12,000,000).  At that point, Emacs discards the undo data and
+(normally 24,000,000).  At that point, Emacs discards the undo data and
 warns you about it.  This is the only situation in which you cannot
 undo the last command.  If this happens, you can increase the value of
 @code{undo-outer-limit} to make it even less likely to happen in the
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 9bd8bed..a8d95a2 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -2295,14 +2295,17 @@ variable do not take effect immediately, only when you 
specify the
 @item font-backend
 A list of symbols, specifying the @dfn{font backends} to use for
 drawing characters on the frame, in order of priority.  In Emacs built
-without Cairo drawing on X, there are currently three available font
-backends: @code{x} (the X core font driver), @code{xft} (the Xft font
-driver), and @code{xfthb} (the Xft font driver with HarfBuzz text
-shaping).  If built with the Cairo drawing, there are also three
-available font backends on X: @code{x}, @code{ftcr} (the FreeType font
-driver on Cairo), and @code{ftcrhb} (the FreeType font driver on Cairo
-with HarfBuzz text shaping).  On MS-Windows, there are currently three
-available font backends: @code{gdi} (the core MS-Windows font driver),
+without Cairo drawing on X, there are currently three potentially
+available font backends: @code{x} (the X core font driver), @code{xft}
+(the Xft font driver), and @code{xfthb} (the Xft font driver with
+HarfBuzz text shaping).  If built with Cairo drawing, there are also
+three potentially available font backends on X: @code{x}, @code{ftcr}
+(the FreeType font driver on Cairo), and @code{ftcrhb} (the FreeType
+font driver on Cairo with HarfBuzz text shaping).  Note that the
+@code{ftcr} and @code{ftcrhb} drivers are mutually exclusive (and
+similarly for @code{xft} and @code{xfthb}), with the choice being made
+at build time.  On MS-Windows, there are currently three available
+font backends: @code{gdi} (the core MS-Windows font driver),
 @code{uniscribe} (font driver for OTF and TTF fonts with text shaping
 by the Uniscribe engine), and @code{harfbuzz} (font driver for OTF and
 TTF fonts with HarfBuzz text shaping) (@pxref{Windows Fonts,,, emacs,
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index e4ff732..f70fb6b 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -319,6 +319,8 @@ from all windows in the window configuration."
                         tab-bar-tab-name-current)
                  (const :tag "Selected window buffer with window count"
                         tab-bar-tab-name-current-with-count)
+                 (const :tag "Truncated buffer name"
+                        tab-bar-tab-name-truncated)
                  (const :tag "All window buffers"
                         tab-bar-tab-name-all)
                  (function  :tag "Function"))
@@ -350,6 +352,29 @@ Also add the number of windows in the window 
configuration."
                                                  'nomini)))
              ", "))
 
+(defcustom tab-bar-tab-name-truncated-max 20
+  "Maximum length of the tab name from the current buffer.
+Effective when `tab-bar-tab-name-function' is customized
+to `tab-bar-tab-name-truncated'."
+  :type 'integer
+  :group 'tab-bar
+  :version "27.1")
+
+(defvar tab-bar-tab-name-truncated-ellipsis
+  (if (char-displayable-p ?…) "…" "..."))
+
+(defun tab-bar-tab-name-truncated ()
+  "Generate tab name from the buffer of the selected window.
+Truncate it to the length specified by `tab-bar-tab-name-truncated-max'.
+Append ellipsis `tab-bar-tab-name-truncated-ellipsis' in this case."
+  (let ((tab-name (buffer-name (window-buffer (minibuffer-selected-window)))))
+    (if (< (length tab-name) tab-bar-tab-name-truncated-max)
+        tab-name
+      (propertize (truncate-string-to-width
+                   tab-name tab-bar-tab-name-truncated-max nil nil
+                   tab-bar-tab-name-truncated-ellipsis)
+                  'help-echo tab-name))))
+
 
 (defvar tab-bar-tabs-function #'tab-bar-tabs
   "Function to get a list of tabs to display in the tab bar.
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 5bbc45b..ad4050f 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -213,9 +213,6 @@ If nil, don't show it at all."
 
 (defvar tab-line-separator nil)
 
-(defvar tab-line-tab-name-ellipsis
-  (if (char-displayable-p ?…) "…" "..."))
-
 
 (defcustom tab-line-tab-name-function #'tab-line-tab-name-buffer
   "Function to get a tab name.
@@ -240,23 +237,30 @@ This function can be overridden by changing the default 
value of the
 variable `tab-line-tab-name-function'."
   (buffer-name buffer))
 
-(defun tab-line-tab-name-truncated-buffer (buffer &optional buffers)
+(defcustom tab-line-tab-name-truncated-max 20
+  "Maximum length of the tab name from the current buffer.
+Effective when `tab-line-tab-name-function' is customized
+to `tab-line-tab-name-truncated-buffer'."
+  :type 'integer
+  :group 'tab-line
+  :version "27.1")
+
+(defvar tab-line-tab-name-ellipsis
+  (if (char-displayable-p ?…) "…" "..."))
+
+(defun tab-line-tab-name-truncated-buffer (buffer &optional _buffers)
   "Generate tab name from BUFFER.
-Reduce tab width proportionally to space taken by other tabs."
-  (let ((tab-name (buffer-name buffer))
-        (limit (when buffers
-                 (max 1 (- (/ (window-width) (length buffers)) 3)))))
-    (if (or (not limit) (< (length tab-name) limit))
+Truncate it to the length specified by `tab-line-tab-name-truncated-max'.
+Append ellipsis `tab-line-tab-name-ellipsis' in this case."
+  (let ((tab-name (buffer-name buffer)))
+    (if (< (length tab-name) tab-line-tab-name-truncated-max)
         tab-name
-      (propertize (truncate-string-to-width tab-name limit nil nil
-                                            tab-line-tab-name-ellipsis)
+      (propertize (truncate-string-to-width
+                   tab-name tab-line-tab-name-truncated-max nil nil
+                   tab-line-tab-name-ellipsis)
                   'help-echo tab-name))))
 
 
-(defvar tab-line-tabs-limit nil
-  "Maximum number of buffer tabs displayed in the tab line.
-If nil, no limit.")
-
 (defcustom tab-line-tabs-function #'tab-line-tabs-window-buffers
   "Function to get a list of tabs to display in the tab line.
 This function should return either a list of buffers whose names will
@@ -395,22 +399,9 @@ variable `tab-line-tabs-function'."
          (prev-buffers (seq-filter #'buffer-live-p prev-buffers))
          ;; Remove next-buffers from prev-buffers
          (prev-buffers (seq-difference prev-buffers next-buffers)))
-    (if (natnump tab-line-tabs-limit)
-        (let* ((half-limit (/ tab-line-tabs-limit 2))
-               (prev-buffers-limit
-                (if (> (length prev-buffers) half-limit)
-                    (if (> (length next-buffers) half-limit)
-                        half-limit
-                      (+ half-limit (- half-limit (length next-buffers))))
-                  (length prev-buffers)))
-               (next-buffers-limit
-                (- tab-line-tabs-limit prev-buffers-limit)))
-          (append (reverse (seq-take prev-buffers prev-buffers-limit))
-                  (list buffer)
-                  (seq-take next-buffers next-buffers-limit)))
-      (append (reverse prev-buffers)
-              (list buffer)
-              next-buffers))))
+    (append (reverse prev-buffers)
+            (list buffer)
+            next-buffers)))
 
 
 (defun tab-line-format-template (tabs)
@@ -681,15 +672,17 @@ Its effect is the same as using the `next-buffer' command
             (switch-to-buffer buffer)))))))
 
 
-(defcustom tab-line-close-tab-action 'bury-buffer
+(defcustom tab-line-close-tab-function 'bury-buffer
   "Defines what to do on closing the tab.
 If `bury-buffer', put the tab's buffer at the end of the list of all
 buffers that effectively hides the buffer's tab from the tab line.
 If `kill-buffer', kills the tab's buffer.
+When a function, it is called with the tab as its argument.
 This option is useful when `tab-line-tabs-function' has the value
 `tab-line-tabs-window-buffers'."
   :type '(choice (const :tag "Bury buffer" bury-buffer)
-                 (const :tag "Kill buffer" kill-buffer))
+                 (const :tag "Kill buffer" kill-buffer)
+                 (function :tag "Function"))
   :group 'tab-line
   :version "27.1")
 
@@ -703,18 +696,20 @@ from the tab line."
          (window (and posnp (posn-window posnp)))
          (tab (get-pos-property 1 'tab (car (posn-string posnp))))
          (buffer (if (bufferp tab) tab (cdr (assq 'buffer tab))))
-         (close-action (unless (bufferp tab) (cdr (assq 'close tab)))))
+         (close-function (unless (bufferp tab) (cdr (assq 'close tab)))))
     (with-selected-window (or window (selected-window))
       (cond
-       ((functionp close-action)
-        (funcall close-action))
-       ((eq tab-line-close-tab-action 'kill-buffer)
+       ((functionp close-function)
+        (funcall close-function))
+       ((eq tab-line-close-tab-function 'kill-buffer)
         (kill-buffer buffer))
-       ((eq tab-line-close-tab-action 'bury-buffer)
+       ((eq tab-line-close-tab-function 'bury-buffer)
         (if (eq buffer (current-buffer))
             (bury-buffer)
           (set-window-prev-buffers nil (assq-delete-all buffer 
(window-prev-buffers)))
-          (set-window-next-buffers nil (delq buffer (window-next-buffers))))))
+          (set-window-next-buffers nil (delq buffer (window-next-buffers)))))
+       ((functionp tab-line-close-tab-function)
+        (funcall tab-line-close-tab-function)))
       (force-mode-line-update))))
 
 
diff --git a/src/nsterm.m b/src/nsterm.m
index 57573ef..fd23bf6 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1644,6 +1644,7 @@ ns_free_frame_resources (struct frame *f)
   [view release];
 
   xfree (f->output_data.ns);
+  f->output_data.ns = NULL;
 
   unblock_input ();
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]