GNU bug report logs - #21634
text-scale-adjust suggestion

Previous Next

Package: emacs;

Reported by: Eli Barzilay <eli <at> barzilay.org>

Date: Tue, 6 Oct 2015 12:05:01 UTC

Severity: wishlist

Found in version 24.5

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eli Barzilay <eli <at> barzilay.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5; Suggested improvement
Date: Tue, 6 Oct 2015 08:04:03 -0400
Would it make sense to implement `text-scale-adjust' as follows?  One
minor change is using the `keep-pred' argument to avoid re-setting the
map repeatedly, but the important change is having it timeout after a
few seconds.  This avoids the kind of mode-ish interaction that feels
weird in Emacs.

In fact, I find this useful in other cases too (a command that allows
you to resize the current window with the arrow keys), so I think that
it's useful to either add an additional timeout argument -- or perhaps
an extension where `keep-pred' can be a number of seconds and will do
the timeout thing.

-------------------------------------------------------------------------------
(defun text-scale-adjust (inc)
  "..."
  (interactive "p")
  (let ((ev last-command-event)
	(echo-keystrokes nil))
    (let* ((base (event-basic-type ev))
           (step
            (pcase base
              ((or ?+ ?=) inc)
              (?- (- inc))
              (?0 0)
              (_ inc))))
      (text-scale-increase step)
      (message "Use +,-,0 for further adjustment")
      (run-with-idle-timer 2 nil
        (set-transient-map
         (let ((map (make-sparse-keymap)))
           (dolist (mods '(() (control)))
             (dolist (key '(?- ?+ ?= ?0)) ;; = is often unshifted +.
               (define-key map (vector (append mods (list key)))
                 (lambda () (interactive) (text-scale-adjust (abs inc))))))
           map)
         t (lambda () (message "done")))))))
-------------------------------------------------------------------------------

-- 
                    ((x=>x(x))(x=>x(x)))                   Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!




This bug report was last modified 2 years and 345 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.