emacs-diffs
[Top][All Lists]
Advanced

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

master da00577: * lisp/tab-line.el (tab-line-auto-hscroll): New defcusto


From: Juri Linkov
Subject: master da00577: * lisp/tab-line.el (tab-line-auto-hscroll): New defcustom (bug#37667)
Date: Mon, 18 Nov 2019 16:57:24 -0500 (EST)

branch: master
commit da00577793f9eff3a4cf11638053f6d3fa07728b
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * lisp/tab-line.el (tab-line-auto-hscroll): New defcustom (bug#37667)
    
    (tab-line-auto-hscroll): Use this option in the function.
---
 lisp/tab-line.el | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index b99e726..0f70184 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -471,13 +471,21 @@ variable `tab-line-tabs-function'."
                                  tab-line-new-button)))))))
 
 
+(defcustom tab-line-auto-hscroll t
+  "Allow or disallow automatic horizontal scrolling of the tab line.
+Non-nil means the tab line are automatically scrolled horizontally to make
+the selected tab visible."
+  :type 'boolean
+  :group 'tab-line
+  :version "27.1")
+
 (defun tab-line-auto-hscroll (strings hscroll)
   (with-temp-buffer
     (let ((truncate-partial-width-windows nil)
+          (truncate-lines nil)
           (inhibit-modification-hooks t)
+          (buffer-undo-list t)
           show-arrows)
-      (setq truncate-lines nil
-            buffer-undo-list t)
       (apply 'insert strings)
       (goto-char (point-min))
       (add-face-text-property (point-min) (point-max) 'tab-line)
@@ -486,7 +494,9 @@ variable `tab-line-tabs-function'."
       (setq show-arrows (> (vertical-motion 1) 0))
       ;; Try to auto-scroll only when scrolling is needed,
       ;; but no manual scrolling was performed before.
-      (when (and show-arrows (not (and (integerp hscroll) (>= hscroll 0))))
+      (when (and tab-line-auto-hscroll
+                 show-arrows
+                 (not (and (integerp hscroll) (>= hscroll 0))))
         (let ((pos (seq-position strings 'selected
                                  (lambda (str prop)
                                    (get-pos-property 1 prop str)))))



reply via email to

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