aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2019-11-18 23:57:16 +0200
committerJuri Linkov2019-11-18 23:57:16 +0200
commitda00577793f9eff3a4cf11638053f6d3fa07728b (patch)
tree6f300513792f0f71bfcd8b012f081eaa2a4237c0
parent3ba98fb1d735140cb3c6cd5f74674a65d7a45015 (diff)
downloademacs-da00577793f9eff3a4cf11638053f6d3fa07728b.tar.gz
emacs-da00577793f9eff3a4cf11638053f6d3fa07728b.zip
* lisp/tab-line.el (tab-line-auto-hscroll): New defcustom (bug#37667)
(tab-line-auto-hscroll): Use this option in the function.
-rw-r--r--lisp/tab-line.el16
1 files changed, 13 insertions, 3 deletions
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index b99e7263297..0f701842dfa 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -471,13 +471,21 @@ variable `tab-line-tabs-function'."
471 tab-line-new-button))))))) 471 tab-line-new-button)))))))
472 472
473 473
474(defcustom tab-line-auto-hscroll t
475 "Allow or disallow automatic horizontal scrolling of the tab line.
476Non-nil means the tab line are automatically scrolled horizontally to make
477the selected tab visible."
478 :type 'boolean
479 :group 'tab-line
480 :version "27.1")
481
474(defun tab-line-auto-hscroll (strings hscroll) 482(defun tab-line-auto-hscroll (strings hscroll)
475 (with-temp-buffer 483 (with-temp-buffer
476 (let ((truncate-partial-width-windows nil) 484 (let ((truncate-partial-width-windows nil)
485 (truncate-lines nil)
477 (inhibit-modification-hooks t) 486 (inhibit-modification-hooks t)
487 (buffer-undo-list t)
478 show-arrows) 488 show-arrows)
479 (setq truncate-lines nil
480 buffer-undo-list t)
481 (apply 'insert strings) 489 (apply 'insert strings)
482 (goto-char (point-min)) 490 (goto-char (point-min))
483 (add-face-text-property (point-min) (point-max) 'tab-line) 491 (add-face-text-property (point-min) (point-max) 'tab-line)
@@ -486,7 +494,9 @@ variable `tab-line-tabs-function'."
486 (setq show-arrows (> (vertical-motion 1) 0)) 494 (setq show-arrows (> (vertical-motion 1) 0))
487 ;; Try to auto-scroll only when scrolling is needed, 495 ;; Try to auto-scroll only when scrolling is needed,
488 ;; but no manual scrolling was performed before. 496 ;; but no manual scrolling was performed before.
489 (when (and show-arrows (not (and (integerp hscroll) (>= hscroll 0)))) 497 (when (and tab-line-auto-hscroll
498 show-arrows
499 (not (and (integerp hscroll) (>= hscroll 0))))
490 (let ((pos (seq-position strings 'selected 500 (let ((pos (seq-position strings 'selected
491 (lambda (str prop) 501 (lambda (str prop)
492 (get-pos-property 1 prop str))))) 502 (get-pos-property 1 prop str)))))