Function: srecode-dictionary-add-section-dictionary
srecode-dictionary-add-section-dictionary is a byte-compiled function
defined in dictionary.el.gz.
Signature
(srecode-dictionary-add-section-dictionary ARG &rest ARGS)
Implementations
(srecode-dictionary-add-section-dictionary (DICT srecode-dictionary) NAME &optional SHOW-ONLY FORCE) in `srecode/dictionary.el'.
In dictionary DICT, add a section dictionary for section macro NAME. Return the new dictionary.
You can add several dictionaries to the same section entry. For each dictionary added to a variable, the block of codes in the template will be repeated.
If optional argument SHOW-ONLY is non-nil, then don't add a new dictionary if there is already one in place. Also, don't add FIRST/LAST entries. These entries are not needed when we are just showing a section.
Each dictionary added will automatically get values for positional macros which will enable SECTIONS to be enabled.
* FIRST - The first entry in the table. * NOTFIRST - Not the first entry in the table. * LAST - The last entry in the table * NOTLAST - Not the last entry in the table.
Adding a new dictionary will alter these values in previously inserted dictionaries.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/srecode/dictionary.el.gz
(cl-defmethod srecode-dictionary-add-section-dictionary ((dict srecode-dictionary)
name &optional show-only force)
"In dictionary DICT, add a section dictionary for section macro NAME.
Return the new dictionary.
You can add several dictionaries to the same section entry.
For each dictionary added to a variable, the block of codes in
the template will be repeated.
If optional argument SHOW-ONLY is non-nil, then don't add a new dictionary
if there is already one in place. Also, don't add FIRST/LAST entries.
These entries are not needed when we are just showing a section.
Each dictionary added will automatically get values for positional macros
which will enable SECTIONS to be enabled.
* FIRST - The first entry in the table.
* NOTFIRST - Not the first entry in the table.
* LAST - The last entry in the table
* NOTLAST - Not the last entry in the table.
Adding a new dictionary will alter these values in previously
inserted dictionaries."
;; Validate inputs
(unless (stringp name)
(signal 'wrong-type-argument (list name 'stringp)))
(let ((new (srecode-create-dictionary dict))
(ov (srecode-dictionary-lookup-name dict name t)))
(when (not show-only)
;; Setup the FIRST/NOTFIRST and LAST/NOTLAST entries.
(if (null ov)
(progn
(srecode-dictionary-show-section new "FIRST")
(srecode-dictionary-show-section new "LAST"))
;; Not the very first one. Let's clean up CAR.
(let ((tail (car (last ov))))
(srecode-dictionary-hide-section tail "LAST")
(srecode-dictionary-show-section tail "NOTLAST")
)
(srecode-dictionary-show-section new "NOTFIRST")
(srecode-dictionary-show-section new "LAST"))
)
(when (or force
(not show-only)
(null ov))
(srecode-dictionary-set-value dict name (append ov (list new))))
;; Return the new sub-dictionary.
new))