Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've been using emacs for years, but I'm relatively new to customizing lisp (beyond plugging in lines from other emacs scripts / package installation instructions). I programmed scheme before, so I'm somewhat familiar, but that was also a long time ago.

How do I map a key to more than one operation? I'm adapting the cycle font sizes lisp code form: http://www.emacswiki.org/emacs/CycleFontSizes

except that I would like to maximize the window (I'm using mac OSX) after font resizing.

I can maximize the window using maxframe:

(require 'maxframe)
(add-hook 'window-setup-hook 'maximize-frame t)

How do I add this to the font size key bindings. I'd like to do something like:

(define-key global-map (read-kbd-macro "C-0")   
  (lambda()
    'font-zoom-reset-font-size
    (add-hook 'window-setup-hook 'maximize-frame t))
)

This isn't correct because define-key is expecting a different type. This is probably pretty trivial after seeing an example...

share|improve this question
add comment

1 Answer

Update

You're very close -- just need to define your function as being interactive by including the one line (interactive) and make the call to font-zoom-reset-font-size actually call the function, not just a reference to the function:

(define-key global-map (read-kbd-macro "C-0")   
  (lambda()
    (interactive)
    (font-zoom-reset-font-size)
    (add-hook 'window-setup-hook 'maximize-frame t))
)

Original (and still valid) answer

You can define a function with your multiple steps and then bind the key to that function. Something like:

(defun zoom-font-and-max()
  (interactive)
  (font-zoom-reset-font-size)
  (add-hook 'window-setup-hook 'maximize-frame t))


(global-set-key (kbd "C-0") 'zoom-font-and-max)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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