all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* problem passing argument to global-set-key
@ 2004-08-27 20:49 Sarir Khamsi
  2004-08-27 21:06 ` Drew Adams
  0 siblings, 1 reply; 2+ messages in thread
From: Sarir Khamsi @ 2004-08-27 20:49 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: problem passing argument to global-set-key
  2004-08-27 20:49 problem passing argument to global-set-key Sarir Khamsi
@ 2004-08-27 21:06 ` Drew Adams
  0 siblings, 0 replies; 2+ messages in thread
From: Drew Adams @ 2004-08-27 21:06 UTC (permalink / raw)


(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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-08-27 21:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-27 20:49 problem passing argument to global-set-key Sarir Khamsi
2004-08-27 21:06 ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.