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

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

Re: How to detect C-u supplied arguments from other prefix arguments


From: Kevin Rodgers
Subject: Re: How to detect C-u supplied arguments from other prefix arguments
Date: Tue, 07 Aug 2007 23:06:38 -0600
User-agent: Thunderbird 1.5.0.12 (Macintosh/20070509)

Dieter Wilhelm wrote:
Hi

I'd like to detect whether prefix arguments of a command are supplied
by C-u or otherwise.

My idea is to use this-command-keys and compare it to some string,
like the following pseudo code:

(defun bla (arg)
  (interactive "p")
  (when (string= "C-u" (substring (this-command-keys) 0 2))
    (message "hurray")))

I just don't understand how to compare key sequences.  Or maybe
there's better way of doing it?

Yuck.  If all you're concerned about is whether the prefix arg was
specified by 1 or more C-u keys (with no minus sign or digits), you
can use (consp current-prefix-arg).

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

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