From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bastien Newsgroups: gmane.emacs.bugs Subject: bug#12345: 24.2.50; doc string of `text-scale-adjust' Date: Tue, 11 Sep 2012 19:36:56 +0200 Message-ID: <87ipbkihqf.fsf@altern.org> References: <703AC3C70837474CADDB99BA7E9E59A1@us.oracle.com> <87vcfkr884.fsf@altern.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1347385053 10138 80.91.229.3 (11 Sep 2012 17:37:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Sep 2012 17:37:33 +0000 (UTC) Cc: 12345@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 11 19:37:34 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TBUOz-0005lm-7f for geb-bug-gnu-emacs@m.gmane.org; Tue, 11 Sep 2012 19:37:33 +0200 Original-Received: from localhost ([::1]:57058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBUOv-00024D-Mt for geb-bug-gnu-emacs@m.gmane.org; Tue, 11 Sep 2012 13:37:29 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBUOo-000241-8o for bug-gnu-emacs@gnu.org; Tue, 11 Sep 2012 13:37:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBUOm-0003lS-Oc for bug-gnu-emacs@gnu.org; Tue, 11 Sep 2012 13:37:22 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBUOm-0003lM-KS for bug-gnu-emacs@gnu.org; Tue, 11 Sep 2012 13:37:20 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TBUPR-0003fx-L7 for bug-gnu-emacs@gnu.org; Tue, 11 Sep 2012 13:38:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Bastien Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 11 Sep 2012 17:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12345 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12345-submit@debbugs.gnu.org id=B12345.134738506214091 (code B ref 12345); Tue, 11 Sep 2012 17:38:01 +0000 Original-Received: (at 12345) by debbugs.gnu.org; 11 Sep 2012 17:37:42 +0000 Original-Received: from localhost ([127.0.0.1]:55034 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TBUP8-0003fD-3S for submit@debbugs.gnu.org; Tue, 11 Sep 2012 13:37:42 -0400 Original-Received: from mail-wi0-f180.google.com ([209.85.212.180]:60197) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TBUP5-0003ew-8I for 12345@debbugs.gnu.org; Tue, 11 Sep 2012 13:37:40 -0400 Original-Received: by wibhm6 with SMTP id hm6so753503wib.15 for <12345@debbugs.gnu.org>; Tue, 11 Sep 2012 10:36:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=nkhRJ1U6Nd8PtFbOPm8J9dZ59qD6tr3yZSrjCvuV/Qw=; b=Z3fxrvY+R3/a9TxODe51++ZzLaR+07bp51An0aD6VVqKgomFfwVd4yF3t8zPZh+0z5 VI0LmksO4zJn39Z46E/jtfyoEz5mjzxL5yhBM6PEt/Ht6G1UCW/iR9Wmob0c6ehcX3Hx U0q3Bx5NrgU8aNFXdiFw0Dth+D0Jd6yO+BWP36PDw6ga4EoZjNm7qOldGJlK9eo7ZibC DuJhNnc8cTm5i2mi6HtkU7zcfuo34nIbX3c1rOJ6tbzm2D/yvPFnL5cbX+cV4mnn+tVe nNipchLmCQtodO+na+AulGZ5s66AdvJ03XKt4v06qtL9ptZbXIaQLCsWUgolHqSRU/Xl qk0Q== Original-Received: by 10.180.109.129 with SMTP id hs1mr26680246wib.0.1347385017205; Tue, 11 Sep 2012 10:36:57 -0700 (PDT) Original-Received: from myhost.localdomain (mar75-2-81-56-68-112.fbx.proxad.net. [81.56.68.112]) by mx.google.com with ESMTPS id j6sm5371345wiy.4.2012.09.11.10.36.55 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Sep 2012 10:36:55 -0700 (PDT) Original-Received: by myhost.localdomain (Postfix, from userid 1000) id 4B9C389A2; Tue, 11 Sep 2012 19:36:57 +0200 (CEST) In-Reply-To: (Stefan Monnier's message of "Tue, 11 Sep 2012 09:48:26 -0400") User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:64144 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Stefan Monnier writes: >> I enhanced the docstring and rewrote the command so that it does >> not use a temporary keymap. > > Not using a temporary keymap means reverting to the old code: please > explain precisely why using a temporary keymap is a problem (there are > good reasons to use it: e.g. it makes key-translation-map and friends > work correctly). Here is another patch, using ̀€set-temporary-overlay-map'. It fixes the problem with the message disappearing. It fixed another problem: the fact that in the current version, INC is always 1 when using the command repeatedly, as we would expect C-u 4 C-x C-+ + to increase by INC = 4 then again by INC = 4 again -- right now it increase by INC = 4 on the first hit, then INC = 1 on the second. It also changes the behavior regarding C-x C-0, which ends the loop. Let me know what you think, --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=face-remap.el.2.patch === modified file 'lisp/face-remap.el' --- lisp/face-remap.el 2012-07-10 11:51:54 +0000 +++ lisp/face-remap.el 2012-09-11 17:20:16 +0000 @@ -285,7 +285,9 @@ ;;;###autoload (define-key ctl-x-map [(control ?0)] 'text-scale-adjust) ;;;###autoload (defun text-scale-adjust (inc) - "Increase or decrease the height of the default face in the current buffer. + "Adjust the height of the default face by INC. + +INC may be passed as a numeric prefix argument. The actual adjustment made depends on the final component of the key-binding used to invoke the command, with all modifiers removed: @@ -294,9 +296,11 @@ - Decrease the default face height by one step 0 Reset the default face height to the global default -Then, continue to read input events and further adjust the face -height as long as the input event read (with all modifiers removed) -is one of the above. +When adjusting with `+' or `-', continue to read input events and +further adjust the face height as long as the input event read +\(with all modifiers removed) is `+' or `-'. + +When adjusting with `0', immediately finish. Each step scales the height of the default face by the variable `text-scale-mode-step' (a negative number of steps decreases the @@ -309,8 +313,7 @@ a top-level keymap, `text-scale-increase' or `text-scale-decrease' may be more appropriate." (interactive "p") - (let ((first t) - (ev last-command-event) + (let ((ev last-command-event) (echo-keystrokes nil)) (let* ((base (event-basic-type ev)) (step @@ -320,23 +323,16 @@ (?0 0) (t inc)))) (text-scale-increase step) - ;; FIXME: do it after every "iteration of the loop". - (message "+,-,0 for further adjustment: ") - (set-temporary-overlay-map - (let ((map (make-sparse-keymap))) - (dolist (mods '(() (control))) - (define-key map (vector (append mods '(?-))) 'text-scale-decrease) - (define-key map (vector (append mods '(?+))) 'text-scale-increase) - ;; = is unshifted + on most keyboards. - (define-key map (vector (append mods '(?=))) 'text-scale-increase) - (define-key map (vector (append mods '(?0))) - (lambda () (interactive) (text-scale-increase 0)))) - map) - t)))) - - -;; ---------------------------------------------------------------- -;; buffer-face-mode + (unless (zerop step) + (message "Use + or - for further adjustment") + (set-temporary-overlay-map + (let ((map (make-sparse-keymap))) + (dolist (mods '(() (control))) + (dolist (key '(?- ?+ ?=)) + (define-key map (vector (append mods (list key))) + `(lambda () (interactive) (text-scale-adjust (abs ,step)))))) + map) + t))))) (defcustom buffer-face-mode-face 'variable-pitch "The face specification used by `buffer-face-mode'. --=-=-= Content-Type: text/plain -- Bastien --=-=-=--