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

Re: adding command to dired comtab

    Date: Tue, 23 Apr 91 17:49:30 CDT
    From: lsmith@CLI.COM (Larry Smith)

    Here's a scrap of code I wrote about 10 years ago. I hope the comment
    is correct and does what you want.

    ;;; when you enter the mode, zmacs magically executes these.
    ;;; Well there is a way to clear mode forms (as far as I know undocmumented).  If
    ;;; you change the :mode-forms method, do
      '((SET-CHAR-SYNTAX WORD-ALPHABETIC *MODE-WORD-SYNTAX-TABLE* #/_) ;; these are required for forward-word.
	(SET-CHAR-SYNTAX WORD-ALPHABETIC *MODE-WORD-SYNTAX-TABLE* #/') ;; word-table as opposed to list-table.

Rather than redefining :MODE-FORMS, you can set the user mode forms,
which I believe are there specifically to allow the user to extend the
mode forms.  So, if you want to add a binding, you do:

(send (zwei:mode-of-flavor 'zwei:dired-mode)
      '((zwei:set-comtab zwei:*mode-comtab*
			 ;;; Just list your additions here

You can also use the mode hook (a global variable with the name
ZWEI:<mode-name>-HOOK) to augment the mode.  However, ZWEI:*MODE-COMTAB*
cannot be augmented in this way.  The mode forms and user mode forms are
executed in such a way that "undo" forms are recorded, so that their
effects will be undone when changing modes (which happens when changing
buffers).  The hook forms are simply EVALed, so no undo information is
recorded.  Thus, changes to *MODE-COMTAB* done from a hook would stick
around forever, rather than being just in buffers in that mode.