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 15:37:31 +0200 Message-ID: <87vcfkr884.fsf@altern.org> References: <703AC3C70837474CADDB99BA7E9E59A1@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1347370713 917 80.91.229.3 (11 Sep 2012 13:38:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Sep 2012 13:38:33 +0000 (UTC) Cc: 12345@debbugs.gnu.org To: "Drew Adams" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 11 15:38:35 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 1TBQfj-0005lb-10 for geb-bug-gnu-emacs@m.gmane.org; Tue, 11 Sep 2012 15:38:35 +0200 Original-Received: from localhost ([::1]:51489 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBQff-0001SJ-G6 for geb-bug-gnu-emacs@m.gmane.org; Tue, 11 Sep 2012 09:38:31 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBQfX-0001Rw-Bu for bug-gnu-emacs@gnu.org; Tue, 11 Sep 2012 09:38:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBQfV-0002R2-T1 for bug-gnu-emacs@gnu.org; Tue, 11 Sep 2012 09:38:23 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44328) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBQfV-0002Qs-PU for bug-gnu-emacs@gnu.org; Tue, 11 Sep 2012 09:38:21 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TBQg9-0005Kb-Pt for bug-gnu-emacs@gnu.org; Tue, 11 Sep 2012 09:39: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 13:39: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.134737069620443 (code B ref 12345); Tue, 11 Sep 2012 13:39:01 +0000 Original-Received: (at 12345) by debbugs.gnu.org; 11 Sep 2012 13:38:16 +0000 Original-Received: from localhost ([127.0.0.1]:53874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TBQfQ-0005Jf-3I for submit@debbugs.gnu.org; Tue, 11 Sep 2012 09:38:16 -0400 Original-Received: from mail-wi0-f180.google.com ([209.85.212.180]:51617) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TBQfM-0005JX-N8 for 12345@debbugs.gnu.org; Tue, 11 Sep 2012 09:38:14 -0400 Original-Received: by wibhm6 with SMTP id hm6so470006wib.15 for <12345@debbugs.gnu.org>; Tue, 11 Sep 2012 06:37:31 -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=KG0aEMGV9DpDNYPf2KASWoAGjIzKnkBgLkrCOqZzy+g=; b=bvwz/4/jCLyxQepSKU/nnZESPvA8EiJMuqfTOmClTg/G6hLfDRbDK45WKQ93Y3Y56t xTFKPHDwWGlH7QHyCbl28sq4+/N9YAA4LQNii9EXBMN3nSVUbOI9Bidu535ps4UoI/Es piG4iOnJUwoieG+ZvLa/Hh8s9dLMPeKecHdXNujnonZqHZS4zMTHrYqK890KbZE8Bs7m eKZEXi2jZmB8mft/t5W5ZfT7WUDndoWEs75jeGrVMwkc5tz8c5SLT5bfCdJTka8F0Kru j1CEgK0m7ztCHD3P9qP1V+0BGlls9Z9jWO0ZIYE2pS2IMQMXRZNrndCrwm+rQuUHEuDr jNqw== Original-Received: by 10.216.197.162 with SMTP id t34mr10872421wen.5.1347370651345; Tue, 11 Sep 2012 06:37:31 -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 w7sm2643943wiz.0.2012.09.11.06.37.29 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Sep 2012 06:37:30 -0700 (PDT) Original-Received: by myhost.localdomain (Postfix, from userid 1000) id 2E69E89A2; Tue, 11 Sep 2012 15:37:31 +0200 (CEST) In-Reply-To: <703AC3C70837474CADDB99BA7E9E59A1@us.oracle.com> (Drew Adams's message of "Mon, 3 Sep 2012 19:54:25 -0700") 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:64102 Archived-At: --=-=-= Content-Type: text/plain "Drew Adams" writes: > 1. Describe the parameter, INC. > > 2. Describe the use of a prefix argument. > > In general, describe this as a user command, from a user point of view, > and not just as a function to be called from code. See attached patch. I enhanced the docstring and rewrote the command so that it does not use a temporary keymap. When I tried `C-x C-+' I was left with the `+' and `-' keys not usable anymore. The patch also removes the redundant keybinding `C-x C-='. And C-x C-0 does not allow adjusting further. My feeling is that it is not useful. I'll apply this patch within a week if nobody is against it. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=face-remap.el.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 13:18:59 +0000 @@ -281,22 +281,26 @@ ;;;###autoload (define-key ctl-x-map [(control ?+)] 'text-scale-adjust) ;;;###autoload (define-key ctl-x-map [(control ?-)] 'text-scale-adjust) -;;;###autoload (define-key ctl-x-map [(control ?=)] 'text-scale-adjust) ;;;###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. +(defun text-scale-adjust (inc &optional mod) + "Adjust the height of the default face by INC. + +INC may be passed as a numeric prefix argument. + +The optional argument MOD is used internally to pass the previous +modifier to the command, when used repeatedly. The actual adjustment made depends on the final component of the -key-binding used to invoke the command, with all modifiers removed: +keybinding used to invoke the command. - +, = Increase the default face height by one step + + Increase the default face height by one step - 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. +After the first invokation, continue to read input events and +further adjust the face height as long as the input event read +is `+' or `-'. Each step scales the height of the default face by the variable `text-scale-mode-step' (a negative number of steps decreases the @@ -309,30 +313,15 @@ a top-level keymap, `text-scale-increase' or `text-scale-decrease' may be more appropriate." (interactive "p") - (let ((first t) - (ev last-command-event) - (echo-keystrokes nil)) - (let* ((base (event-basic-type ev)) - (step - (pcase base - ((or ?+ ?=) inc) - (?- (- inc)) - (?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)))) + (let* ((ev (or (event-basic-type (or mod last-command-event)))) + (step (pcase ev (?+ inc) (?- (- inc)) (?0 0) (t inc))) + c) + (text-scale-increase step) + (when (and (not (zerop step)) + (setq c (read-event "Hit + or - for further adjustment, RET to finish"))) + (cond ((member (event-basic-type c) '(?+ ?-)) + (text-scale-adjust (abs step) c)) + (t (message "Done")))))) ;; ---------------------------------------------------------------- --=-=-= Content-Type: text/plain -- Bastien --=-=-=--