2

Here is part of my init.el:

(defun xx-devanagari-script ()
  (interactive)
  (save-excursion
    (face-remap-add-relative 'default :family "Lohit Devanagari")
    (text-scale-increase)
    (text-scale-increase)))
(global-set-key (kbd "C-c d") 'xx-devanagari-script)

All I am trying to do is change the font of the current buffer to 'Lohit Devanagari' and increase the text scale twice.

It changes the font. But the text scale does not increase. It also produces an error:

Wrong number of arguments: (1 . 1), 0

How do I get my first elisp function going?

4

There are a few hints in your description:

  1. It changes the font. So your face-remap-add-relative call is working
  2. It doesn't change the scale, so the text-scale-increase calls are not working
  3. Emacs reports an error: wrong number of arguments.

Look at the help for text-scale-increase (via C-h f text-scale-increase):

(text-scale-increase INC)

Increase the height of the default face in the current buffer by INC steps. If the new height is other than the default, ‘text-scale-mode’ is enabled.

text-scale-increase requires an argument, and you didn't provide it. Also, this argument means you don't need to call it twice, you can call it once with 2 as the argument:

(defun xx-devanagari-script ()
  (interactive)
  (save-excursion
    (face-remap-add-relative 'default :family "Lohit Devanagari")
    (text-scale-increase 2)))
(global-set-key (kbd "C-c d") 'xx-devanagari-script)
  • Thanks. That was perfect. I must remember to look up the extensive documentation provided with emacs. :) – deshmukh May 3 '18 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.