&ato, &gmod, &bmo, &ind, &inw, &exi - Miscellaneous functions
&nbmode buffer mode
These are a selection of miscellaneous functions providing tests and exchanging of information.
The functions may all be abbreviated to their three letter abbreviation (i.e. &indirect may be expressed as &ind). In all cases the first argument is completely evaluated before the second argument.
&nbmode buffer mode
The &exi function is etremely useful in initializing, for example:
!if ¬ &exi %my-init ; %my-init is not yet defined so this is the first call set-variable %my-init 1 . .
Or in all the file hooks a user defined extension is checked for and executed if defined:
define-macro fhook-c . . ; execute user extensions if macro is defined !if &exi my-fhook-c my-fhook-c !endif !emacro
The &ind function deserves more explanation. &ind evaluates its string argument str, takes the resulting string and then uses it as a variable name. For example, given the following code sequence:
; set up reference table set-variable %one "elephant" set-variable %two "giraffe" set-variable %three "donkey" set-variable %index "%two" insert-string &ind %index
the string "giraffe" would have been inserted at the point in the current buffer.
The &bmode invocation allows a calling macro to determine the buffer mode state (see Operating Modes). Consider the following example which is a macro to perform a case insensitive alphabetic sort using the sort-lines(2) function. sort-list sorts according to the state of the exact(2m) mode, hence the macro has to determine the buffer state in order to be able to do the sort.
define-macro sort-lines-ignore-case set-variable #l0 &bmod exact -1 buffer-mode "exact" !if @? @# sort-lines !else sort-lines !endif &cond #l0 1 -1 buffer-mode "exact" !emacro
The &inword function is shown in the following example. In this case the mouse is positioned over a word. The &inword function is used to determine if the cursor is on a valid word character, if so the cursor is placed at the start of the word.
define-macro mouse-control-drop-left set-cursor-to-mouse !if &inword @wc backward-word set-mark forward-word !else ... !endif copy-region set-cursor-to-mouse !emacro
Copyright (c) 1998-2006 JASSPA
Last Modified: 2002/01/11
Generated On: 2006/10/07