[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [STUMP] [PATCH] command-mode-hook
From: |
Matt Spear |
Subject: |
Re: [STUMP] [PATCH] command-mode-hook |
Date: |
Wed, 9 Mar 2011 22:11:06 -0800 |
Okay, second try. Have a *command-mode-start-hook* and a
*command-mode-end-hook*. I switched the *in-command-mode* to (eq
*top-map* *root-map*) (move the defvar *root-map* to primitives).
Also changed the grab/ungrab pointer to use a counter so that things
work right when not making the pointer grabbed during command-mode.
I made the (message "Exited") not appear when in command-mode as the
command-mode-end-hook may want to do a message (in my case it is
distracting as the pointer changes shape). If desired
command-mode-end-hook can do it.
Thank for the help!!!
Matt Spear
address@hidden
On Wed, Mar 9, 2011 at 11:06 AM, Ben Spencer <address@hidden> wrote:
> Hi Matt,
>
> On Mon, Mar 07, 2011 at 10:51:52PM -0800, Matt Spear wrote:
>> I really like command-mode, but I found I make the mistake of thinking
>> I am not in command mode when I am. I have attached a patch to add a
>> *commond-mode-hook*, and a var *in-command-mode* (I'd like to remove
>> this var if the list has any pointers on how to do it).
>
> I think it might be more useful to have a separate
> *enter-command-mode-hook* and *exit-command-mode-hook* than a single
> hook with an argument, since the user is inevitably going to do one of
> two different things depending on whether they are entering or leaving
> command mode.
>
> You could avoid *in-command-mode* by using (eq *top-map* *root-map*).
>
>
>> I also added
>> a check in ungrab to ensure it was not in command-mode as this can be
>> confusing.
>
> Not sure about this. I assume you want the pointer permanently
> grabbed while in command mode? Problem is that this causes weird
> behaviour for those that don't - for example, try entering command
> mode (without your hook to grab the pointer) and using help commands
> like h k <whatever> - the pointer gets grabbed and stays like that
> even though it wasn't originally.
>
>
>> +(defvar *command-mode-hook* (list #'(lambda (start)
>> + (when (eq start T)
>> + (message "Press C-g to exit
>> command-mode."))))
>> + "A hook called whenever command mode is started or exited
>> + it is givet nil on exit, T on start")
>> +
>
> I believe it's more normal to keep this sort of behaviour in the core
> program and leave the hook empty for the user to do what they please
> with.
>
>
>> ;; This way you can exit from command mode
>> (when (pop-top-map)
>> - (message "Exited.")))
>> + (if *in-command-mode*
>> + (progn
>> + (run-hook-with-args *command-mode-hook* nil)
>> + (setf *in-command-mode* nil))
>> + (message "Exited."))))
>
> Any reason for removing the Exited message when exiting command mode?
>
>
> Ben
>
> _______________________________________________
> Stumpwm-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/stumpwm-devel
>
command-hook.patch
Description: Text Data