unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#21634: 24.5; Suggested improvement
@ 2015-10-06 12:04 Eli Barzilay
  2015-10-06 14:58 ` Eli Zaretskii
  0 siblings, 1 reply; 29+ messages in thread
From: Eli Barzilay @ 2015-10-06 12:04 UTC (permalink / raw)
  To: 21634

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!





^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2022-07-07 18:04 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-06 12:04 bug#21634: 24.5; Suggested improvement Eli Barzilay
2015-10-06 14:58 ` Eli Zaretskii
2015-10-22  6:06   ` Eli Barzilay
2015-10-23  8:24     ` Eli Zaretskii
2021-09-03 11:02     ` bug#21634: text-scale-adjust suggestion Lars Ingebrigtsen
2021-09-03 16:13       ` Juri Linkov
2021-09-04  6:54         ` Lars Ingebrigtsen
2021-09-05 16:40           ` Juri Linkov
2021-09-06  8:28             ` Lars Ingebrigtsen
2021-09-06 15:34               ` Juri Linkov
2021-09-06 22:15                 ` bug#21634: [External] : " Drew Adams
2021-09-06 22:31                   ` Eli Barzilay
2021-09-06 22:35                     ` Drew Adams
2021-09-07  8:16                     ` martin rudalics
2022-06-30 16:12           ` Juri Linkov
2022-07-01  9:17             ` Lars Ingebrigtsen
2022-07-01 15:40               ` Juri Linkov
2022-07-02 11:59                 ` Lars Ingebrigtsen
2022-07-03 16:36                   ` Juri Linkov
2022-07-04 10:51                     ` Lars Ingebrigtsen
2022-07-04 17:45                       ` Juri Linkov
2022-07-05 11:15                         ` Lars Ingebrigtsen
2022-07-05 13:21                           ` Robert Pluim
2022-07-05 16:38                             ` Lars Ingebrigtsen
2022-07-05 16:39                               ` Lars Ingebrigtsen
2022-07-06 17:42                             ` Juri Linkov
2022-07-07  8:01                               ` Lars Ingebrigtsen
2022-07-07 16:49                                 ` Juri Linkov
2022-07-07 18:04                                   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).