From 6ce34705a62ac8b0a915c8ece6eea8f0e9335ab3 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 6 Aug 2016 20:05:23 -0700 Subject: unposted: fix formatting in module discussion; add mention of widgets and keymaps for modules. --- Etc/zsh-development-guide | 51 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 16 deletions(-) (limited to 'Etc/zsh-development-guide') diff --git a/Etc/zsh-development-guide b/Etc/zsh-development-guide index c4aa1b243..09a34e41f 100644 --- a/Etc/zsh-development-guide +++ b/Etc/zsh-development-guide @@ -327,22 +327,23 @@ in. The next pair are `features_' and `enables_' and deal with enabling module features. Ensure you are familiar with the description of features under -`zmodload -F'. The function features_ takes an argument `char -***featuresp'; *featuresp is to be set to a NULL-terminated array -containing a list of all the features. It should then return zero. -It may return one to indicate features are not supported, but this is -not recommended. The function featuresarray conveniently interrogates -the module's feature structures for all standard features; space -is left for abstract features at the end of the array and the names -must be added by the module. Note that heap memory should -be used for this (zhalloc, etc.) as memory for the features array is not -freed; note also the pointers for the abstract features are not -initialised so setting them is mandatory any time there are any present. - -A structure "struct features" should -be used to contain all standard features as well as the number of -abstract features (those only understood by the module itself). -See below. +`zmodload -F'. + +The function features_ takes an argument `char ***featuresp'; *featuresp +is to be set to a NULL-terminated array containing a list of all the +features. It should then return zero. It may return one to indicate +features are not supported, but this is not recommended. The function +featuresarray conveniently interrogates the module's feature structures +for all standard features; space is left for abstract features at the end +of the array and the names must be added by the module. Note that heap +memory should be used for this (zhalloc, etc.) as memory for the features +array is not freed; note also the pointers for the abstract features are +not initialised so setting them is mandatory any time there are any +present. + +A structure "struct features" should be used to contain all standard +features as well as the number of abstract features (those only understood +by the module itself). See below. enables_ takes an argument `int **enablesp'. If *enablesp is NULL, it should be set to an array of the same length as *featuresp without the @@ -713,6 +714,24 @@ union looking like: The `type' field should be set to `MN_INTEGER' or `MN_FLOAT' and depending on its value either `u.l' or `u.d' contains the value. +Widgets +------- + +As of this writing, widgets are not managed by the features mechanism. +Modules can add builtin widgets by calling `addzlefunction' as defined +in Src/Zle/zle_thingy.c. Typically this is called from the `boot_' +routine. Any widgets so added should be removed by `deletezlefunction' +called from the `cleanup_' routine. + +Keymaps +------- +Keymaps are created with `newkeymap' and exposed for use with bindkey +by `linkkeymap', both defined in Src/Zle/zle_keymap.c. Typically the +same name is used both to create and link the keymap. As with widgets, +there is currently no features mechanism for keymaps, and they should +be initialized in the `boot_' function. In `cleanup_', first remove +linkage with `unlinkkeymap' and then discard with `deletehashtable'. + Hooks ----- -- cgit v1.2.3 From 20de06dfbc69c7d4dbc953f1794b70ed6bc9aa43 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 12 Nov 2016 23:17:36 -0800 Subject: unposted: add list of standard module hooks with corresponding macro names --- ChangeLog | 5 +++++ Etc/zsh-development-guide | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'Etc/zsh-development-guide') diff --git a/ChangeLog b/ChangeLog index d09411848..686bf41cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-11-12 Barton E. Schaefer + + * unposted: Etc/zsh-development-guide: add list of standard + module hooks with corresponding macro names + 2016-11-12 Oliver Kiddle * Paul Seyfert: 39920: Completion/Redhat/Command/_yum: diff --git a/Etc/zsh-development-guide b/Etc/zsh-development-guide index 09a34e41f..fa4b816aa 100644 --- a/Etc/zsh-development-guide +++ b/Etc/zsh-development-guide @@ -810,6 +810,31 @@ that are changed or called very often. These functions, structure defining the hook instead of the name and otherwise behave like their counterparts. +The following hooks are defined by the standard set of modules and may be +referenced by other modules. Each has a corresponding macro name that +points into the definition structure, to avoid repeating the hook names +as strings: + + zsh/main + after_trap AFTERTRAPHOOK + before_trap BEFORETRAPHOOK + exit EXITHOOK + + zsh/complete + compctl_make COMPCTLMAKEHOOK + compctl_cleanup COMPCTLCLEANUPHOOK + insert_match INSERTMATCHHOOK + comp_list_matches COMPLISTMATCHESHOOK + menu_start MENUSTARTHOOK + + zsh/zle + before_complete BEFORECOMPHOOK + complete COMPLETEHOOK + after_complete AFTERCOMPHOOK + accept_completion ACCEPTCOMPHOOK + list_matches LISTMATCHESHOOK + invalidate_list INVALIDATELISTHOOK + Wrappers -------- -- cgit v1.2.3 From 9a09f97b60d0c31d2ef4431be06d5e5503d141d4 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 12 Nov 2016 23:39:14 -0800 Subject: unposted: Addenda to list of module hooks --- Etc/zsh-development-guide | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'Etc/zsh-development-guide') diff --git a/Etc/zsh-development-guide b/Etc/zsh-development-guide index fa4b816aa..ecbd3c081 100644 --- a/Etc/zsh-development-guide +++ b/Etc/zsh-development-guide @@ -813,7 +813,7 @@ like their counterparts. The following hooks are defined by the standard set of modules and may be referenced by other modules. Each has a corresponding macro name that points into the definition structure, to avoid repeating the hook names -as strings: +as strings. zsh/main after_trap AFTERTRAPHOOK @@ -821,19 +821,22 @@ as strings: exit EXITHOOK zsh/complete - compctl_make COMPCTLMAKEHOOK - compctl_cleanup COMPCTLCLEANUPHOOK - insert_match INSERTMATCHHOOK - comp_list_matches COMPLISTMATCHESHOOK - menu_start MENUSTARTHOOK + compctl_make * COMPCTLMAKEHOOK + compctl_cleanup * COMPCTLCLEANUPHOOK + insert_match INSERTMATCHHOOK + comp_list_matches * COMPLISTMATCHESHOOK + menu_start MENUSTARTHOOK zsh/zle - before_complete BEFORECOMPHOOK - complete COMPLETEHOOK - after_complete AFTERCOMPHOOK - accept_completion ACCEPTCOMPHOOK - list_matches LISTMATCHESHOOK - invalidate_list INVALIDATELISTHOOK + before_complete * BEFORECOMPHOOK + complete * COMPLETEHOOK + after_complete * AFTERCOMPHOOK + accept_completion * ACCEPTCOMPHOOK + list_matches * LISTMATCHESHOOK + invalidate_list * INVALIDATELISTHOOK + +Hooks marked with "*" do not use the HOOKF_ALL flag and so are replaced if +another module adds a function to the hook. Use with caution. Wrappers -------- -- cgit v1.2.3