stumpwm-devel
[Top][All Lists]
Advanced

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

Re: [STUMP] [PATCH] command-mode-hook


From: Ben Spencer
Subject: Re: [STUMP] [PATCH] command-mode-hook
Date: Wed, 9 Mar 2011 19:06:18 +0000
User-agent: Mutt/1.5.20 (2009-06-14)

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



reply via email to

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