unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Compare recent-keys to [home], [end], etc?
@ 2012-08-05  3:37 rjdtoday
  2012-08-05  7:04 ` Jambunathan K
       [not found] ` <mailman.6342.1344150300.855.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: rjdtoday @ 2012-08-05  3:37 UTC (permalink / raw)
  To: help-gnu-emacs

How can I tell whether a key in recent-keys is the [home] key?

I get the key and test it with the following:

    (let ( (lastkey
             (let* ((recent-keys (recent-keys))
                    (keys-length (length recent-keys))
                   )
                   (aref recent-keys (- keys-length (length (this-command-keys)) 1))
             )
           )
         )
      (if (= lastkey <how do I designate the [home] key here?> )  ... )
      ...
    )

I've experimented by using the letter A instead of [home], i.e. with (if (= lastkey 65) ... ).  That works if lastkey is 'A', but gives the error "Wrong type argument" if lastkey is [home], [end], or similar.

Is there something I can use in that "if" statement so that I can compare anything in recent-keys to [home]?


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

* Re: Compare recent-keys to [home], [end], etc?
  2012-08-05  3:37 Compare recent-keys to [home], [end], etc? rjdtoday
@ 2012-08-05  7:04 ` Jambunathan K
       [not found] ` <mailman.6342.1344150300.855.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Jambunathan K @ 2012-08-05  7:04 UTC (permalink / raw)
  To: rjdtoday; +Cc: help-gnu-emacs


> How can I tell whether a key in recent-keys is the [home] key?
>
> I get the key and test it with the following:
>
>     (let ( (lastkey
>              (let* ((recent-keys (recent-keys))
>                     (keys-length (length recent-keys))
>                    )
>                    (aref recent-keys (- keys-length (length (this-command-keys)) 1))
>              )
>            )
>          )
>       (if (= lastkey <how do I designate the [home] key here?> )  ... )
>       ...
>     )
>
> I've experimented by using the letter A instead of [home], i.e. with (if (= lastkey 65) ... ).  That works if lastkey is 'A', but gives the error "Wrong type argument" if lastkey is [home], [end], or similar.
>
> Is there something I can use in that "if" statement so that I can compare anything in recent-keys to [home]?
>

Have your tried this:

    (eq last-key 'home)

I am guessing here, based on a quick examination with 

   M-x pp-eval-expression RET (recent-keys) RET
-- 



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

* Re: Compare recent-keys to [home], [end], etc?
       [not found] ` <mailman.6342.1344150300.855.help-gnu-emacs@gnu.org>
@ 2012-08-06 23:46   ` daycandle
  0 siblings, 0 replies; 3+ messages in thread
From: daycandle @ 2012-08-06 23:46 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: help-gnu-emacs, rjdtoday

On Sunday, August 5, 2012 3:04:35 AM UTC-4, Jambunathan K wrote:

...

> 
> 
> 
> Have your tried this:
> 
> 
> 
>     (eq last-key 'home)
> 
> 
> 
> I am guessing here, based on a quick examination with 
> 
> 
> 
>    M-x pp-eval-expression RET (recent-keys) RET
> 
> --

I had not tried that.  It works!

Thanks!



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

end of thread, other threads:[~2012-08-06 23:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-05  3:37 Compare recent-keys to [home], [end], etc? rjdtoday
2012-08-05  7:04 ` Jambunathan K
     [not found] ` <mailman.6342.1344150300.855.help-gnu-emacs@gnu.org>
2012-08-06 23:46   ` daycandle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).