help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: problem passing argument to global-set-key


From: Drew Adams
Subject: RE: problem passing argument to global-set-key
Date: Fri, 27 Aug 2004 14:06:18 -0700

(global-set-key [C-M-down] (lambda () (interactive) (sk-grow-frame -1)))

 - Drew

P.S. See also http://www.emacswiki.org/cgi-bin/wiki/Shrink-Wrapping_Frames
for command resize-frame, which resizes a frame to the "right size".


-----Original Message-----
From: help-gnu-emacs-bounces+drew.adams=oracle.com@gnu.org
[mailto:help-gnu-emacs-bounces+drew.adams=oracle.com@gnu.org]On Behalf
Of Sarir Khamsi
Sent: Friday, August 27, 2004 1:50 PM
To: help-gnu-emacs@gnu.org
Subject: problem passing argument to global-set-key


I am trying to write a function that will grow or shrink a frame
using:

(defun sk-grow-frame (&optional n)
  "Grow or shrink the current frame."
  (interactive "p")
  (let ((my-arg n))
    (message (format "%d" my-arg)) ; some debug
    (set-frame-height nil (+ (screen-height) my-arg))))

and assigning it to some keys with:

(global-set-key (quote [C-M-up]) (quote sk-grow-frame))
(global-set-key (quote [C-M-down]) (quote sk-grow-frame -1))

The first keyboard shortcut works, ie, growing the frame by one, but
the second does not...it still increases the frame by one (instead of
decreasing it, which is what I want). What am I missing? I'm sure it's
something simple. Thanks.

Sarir





reply via email to

[Prev in Thread] Current Thread [Next in Thread]