emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Maus <dmaus@ictsoc.de>
To: Du Yanning <duyanning@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: bug with org-mode-hook and text-scale-set
Date: Wed, 14 Mar 2012 06:41:09 +0100	[thread overview]
Message-ID: <87r4wveo3u.wl%dmaus@ictsoc.de> (raw)
In-Reply-To: <CALr_ej1jNO4VAmORstci+O+-ZKf4OGpzs5s3q5fbL+47zv9UWQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1827 bytes --]

Hi,

At Tue, 13 Mar 2012 14:49:41 +0800,
Du Yanning wrote:
> org-mode 7.8.03
> emacs 23.3, 23.4, 24.0.94
> 
> steps to recreate:
> 
> emacs -q
> 
> copy the following code and paste it into the *scratch* buffer:
> (add-to-list 'auto-mode-alist '("\\.txt\\'" . org-mode))
> (add-hook 'org-mode-hook '(lambda () (text-scale-set 4))) 
> 
> M-x eval-buffer
> 
> then C-x C-f to open a .txt file, and then C-x C-f to open another .txt file.
> Every time a .txt is opened, the font size become larger and larger.
> However, the indicator in the mode line remains +4.

I can confirm this behaviour but I don't think this is an error. The
description of `text-scale-set' reads:

C-h f text-scale-set RET

,----
| text-scale-set is an interactive autoloaded Lisp function in
| `face-remap.el'.
| 
| (text-scale-set LEVEL)
| 
| Set the scale factor of the default face in the current buffer to LEVEL.
| If LEVEL is non-zero, `text-scale-mode' is enabled, otherwise it is disabled.
| 
| LEVEL is a number of steps, with 0 representing the default size.
| Each step scales the height of the default face by the variable
|           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| `text-scale-mode-step' (a negative number decreases the height by
| the same amount).
`----

The first time `org-mode-hook' is run the height of default font is
scaled by 4 levels, i.e. the height of default font is set to a new
value. The second time `org-mode-hook' is run the height is scaled
again, this time based on the new value. And so on.

If you want to set the face height you might use:

(set-face-attribute 'default nil :height 100)

Here `100' means 100% of the font size in pt (afaik).

Best,
  -- David
-- 
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #2: OpenPGP Digital Signature --]
[-- Type: application/pgp-signature, Size: 230 bytes --]

  reply	other threads:[~2012-03-14  5:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-13  6:49 bug with org-mode-hook and text-scale-set Du Yanning
2012-03-14  5:41 ` David Maus [this message]
2012-03-14  7:46   ` Du Yanning
2012-03-29 10:45     ` Bastien
2012-04-12 15:06       ` Matt Lundin
2012-04-12 18:28         ` Matt Lundin
2012-04-13  5:09           ` Bastien
2012-04-20 13:00           ` Bastien
2012-04-22  0:46             ` Matt Lundin
2012-04-13  5:09         ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r4wveo3u.wl%dmaus@ictsoc.de \
    --to=dmaus@ictsoc.de \
    --cc=duyanning@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).