1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- (require 'srecode)
- (declare-function srecode-create-dictionary "srecode/dictionary")
- (declare-function srecode-dictionary-set-value "srecode/dictionary")
- (declare-function srecode-load-tables-for-mode "srecode/find")
- (declare-function srecode-table "srecode/find")
- (declare-function srecode-template-get-table "srecode/find")
- (declare-function srecode-insert-fcn "srecode/insert")
- (declare-function srecode-resolve-arguments "srecode/insert")
- (declare-function srecode-map-update-map "srecode/map")
- (defun ede-srecode-setup ()
- "Initialize Srecode for EDE."
- (require 'srecode/map)
- (require 'srecode/find)
- (srecode-map-update-map t)
-
- (srecode-load-tables-for-mode 'makefile-mode)
- (srecode-load-tables-for-mode 'makefile-mode 'ede)
- (srecode-load-tables-for-mode 'autoconf-mode)
- (srecode-load-tables-for-mode 'autoconf-mode 'ede))
- (defmacro ede-srecode-insert-with-dictionary (template &rest forms)
- "Insert TEMPLATE after executing FORMS with a dictionary.
- TEMPLATE should specify a context by using a string format of:
- context:templatename
- Locally binds the variable DICT to a dictionary which can be
- updated in FORMS."
- `(let* ((dict (srecode-create-dictionary))
- (temp (srecode-template-get-table (srecode-table)
- ,template
- nil
- 'ede))
- )
- (when (not temp)
- (error "EDE template %s for %s not found!"
- ,template major-mode))
- (srecode-resolve-arguments temp dict)
-
- (progn ,@forms)
- (srecode-insert-fcn temp dict)
- ))
- (defun ede-srecode-insert (template &rest dictionary-entries)
- "Insert at the current point TEMPLATE.
- TEMPLATE should specify a context by using a string format of:
- context:templatename
- Add DICTIONARY-ENTRIES into the dictionary before insertion.
- Note: Just like `srecode-insert', but templates found in 'ede app."
- (require 'srecode/insert)
- (ede-srecode-insert-with-dictionary template
-
- (while dictionary-entries
- (srecode-dictionary-set-value dict
- (car dictionary-entries)
- (car (cdr dictionary-entries)))
- (setq dictionary-entries
- (cdr (cdr dictionary-entries))))
- ))
- (provide 'ede/srecode)
|