1 ;;; semantic/analyze.el --- Analyze semantic tags against local context
3 ;;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
4 ;;; Free Software Foundation, Inc.
6 ;; Author: Eric M. Ludlam <zappo@gnu.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;; Semantic, as a tool, provides a nice list of searchable tags.
26 ;; That information can provide some very accurate answers if the current
27 ;; context of a position is known.
29 ;; Semantic-ctxt provides ways of analyzing, and manipulating the
30 ;; semantic context of a language in code.
32 ;; This library provides routines for finding intelligent answers to
33 ;; tough problems, such as if an argument to a function has the correct
34 ;; return type, or all possible tags that fit in a given local context.
39 ;; Here are some words used to describe different things in the analyzer:
41 ;; tag - A single entity
42 ;; prefix - The beginning of a symbol, usually used to look up something
44 ;; type - The name of a datatype in the langauge.
45 ;; metatype - If a type is named in a declaration like:
46 ;; struct moose somevariable;
47 ;; that name "moose" can be turned into a concrete type.
48 ;; tag sequence - In C code, a list of dereferences, such as:
49 ;; this.that.theother();
50 ;; parent - For a datatype in an OO language, another datatype
51 ;; inherited from. This excludes interfaces.
52 ;; scope - A list of tags that can be dereferenced that cannot
53 ;; be found from the global namespace.
54 ;; scopetypes - A list of tags which are datatype that contain
55 ;; the scope. The scopetypes need to have the scope extracted
56 ;; in a way that honors the type of inheritance.
57 ;; nest/nested - When one tag is contained entirely in another.
59 ;; context - A semantic datatype representing a point in a buffer.
61 ;; constriant - If a context specifies a specific datatype is needed,
62 ;; that is a constraint.
63 ;; constants - Some datatypes define elements of themselves as a
64 ;; constant. These need to be returned as there would be no
65 ;; other possible completions.
68 (require 'semantic/format)
69 (require 'semantic/ctxt)
70 (require 'semantic/sort)
71 (eval-when-compile (require 'semantic/find))
72 (require 'semantic/scope)
73 (require 'semantic/analyze/fcn)
76 (defvar semantic-analyze-error-stack nil
77 "Collection of any errors thrown during analysis.")
79 (defun semantic-analyze-push-error (err)
80 "Push the error in ERR-DATA onto the error stack.
82 (push err semantic-analyze-error-stack))
86 ;; These classes represent what a context is. Different types
87 ;; of contexts provide differing amounts of information to help
88 ;; provide completions.
90 (defclass semantic-analyze-context ()
91 ((bounds :initarg :bounds
93 :documentation "The bounds of this context.
94 Usually bound to the dimension of a single symbol or command.")
95 (prefix :initarg :prefix
97 :documentation "List of tags defining local text.
98 This can be nil, or a list where the last element can be a string
99 representing text that may be incomplete. Preceeding elements
100 must be semantic tags representing variables or functions
101 called in a dereference sequence.")
102 (prefixclass :initarg :prefixclass
104 :documentation "Tag classes expected at this context.
105 These are clases for tags, such as 'function, or 'variable.")
106 (prefixtypes :initarg :prefixtypes
108 :documentation "List of tags defining types for :prefix.
109 This list is one shorter than :prefix. Each element is a semantic
110 tag representing a type matching the semantic tag in the same
111 position in PREFIX.")
112 (scope :initarg :scope
113 :type (or null semantic-scope-cache)
114 :documentation "List of tags available in scopetype.
115 See `semantic-analyze-scoped-tags' for details.")
116 (buffer :initarg :buffer
118 :documentation "The buffer this context is derived from.")
119 (errors :initarg :errors
120 :documentation "Any errors thrown an caught during analysis.")
122 "Base analysis data for a any context.")
124 (defclass semantic-analyze-context-assignment (semantic-analyze-context)
125 ((assignee :initarg :assignee
127 :documentation "A sequence of tags for an assignee.
128 This is a variable into which some value is being placed. The last
129 item in the list is the variable accepting the value. Earlier
130 tags represent the variables being derefernece to get to the
132 "Analysis class for a value in an assignment.")
134 (defclass semantic-analyze-context-functionarg (semantic-analyze-context)
135 ((function :initarg :function
137 :documentation "A sequence of tags for a function.
138 This is a function being called. The cursor will be in the position
140 The last tag in :function is the function being called. Earlier
141 tags represent the variables being dereferenced to get to the
143 (index :initarg :index
145 :documentation "The index of the argument for this context.
146 If a function takes 4 arguments, this value should be bound to
147 the values 1 through 4.")
148 (argument :initarg :argument
150 :documentation "A sequence of tags for the :index argument.
151 The argument can accept a value of some type, and this contains the
152 tag for that definition. It should be a tag, but might
153 be just a string in some circumstances.")
155 "Analysis class for a value as a function argument.")
157 (defclass semantic-analyze-context-return (semantic-analyze-context)
159 "Analysis class for return data.
160 Return data methods identify the requred type by the return value
161 of the parent function.")
165 ;; Simple methods against the context classes.
167 (defmethod semantic-analyze-type-constraint
168 ((context semantic-analyze-context) &optional desired-type)
169 "Return a type constraint for completing :prefix in CONTEXT.
170 Optional argument DESIRED-TYPE may be a non-type tag to analyze."
171 (when (semantic-tag-p desired-type)
172 ;; Convert the desired type if needed.
173 (if (not (eq (semantic-tag-class desired-type) 'type))
174 (setq desired-type (semantic-tag-type desired-type)))
175 ;; Protect against plain strings
176 (cond ((stringp desired-type)
177 (setq desired-type (list desired-type 'type)))
178 ((and (stringp (car desired-type))
179 (not (semantic-tag-p desired-type)))
180 (setq desired-type (list (car desired-type) 'type)))
181 ((semantic-tag-p desired-type)
182 ;; We have a tag of some sort. Yay!
184 (t (setq desired-type nil))
188 (defmethod semantic-analyze-type-constraint
189 ((context semantic-analyze-context-functionarg))
190 "Return a type constraint for completing :prefix in CONTEXT."
191 (call-next-method context (car (oref context argument))))
193 (defmethod semantic-analyze-type-constraint
194 ((context semantic-analyze-context-assignment))
195 "Return a type constraint for completing :prefix in CONTEXT."
196 (call-next-method context (car (reverse (oref context assignee)))))
198 (defmethod semantic-analyze-interesting-tag
199 ((context semantic-analyze-context))
200 "Return a tag from CONTEXT that would be most interesting to a user."
201 (let ((prefix (reverse (oref context :prefix))))
202 ;; Go back through the prefix until we find a tag we can return.
203 (while (and prefix (not (semantic-tag-p (car prefix))))
204 (setq prefix (cdr prefix)))
205 ;; Return the found tag, or nil.
208 (defmethod semantic-analyze-interesting-tag
209 ((context semantic-analyze-context-functionarg))
210 "Try the base, and if that fails, return what we are assigning into."
211 (or (call-next-method) (car-safe (oref context :function))))
213 (defmethod semantic-analyze-interesting-tag
214 ((context semantic-analyze-context-assignment))
215 "Try the base, and if that fails, return what we are assigning into."
216 (or (call-next-method) (car-safe (oref context :assignee))))
220 ;; Start out with routines that will calculate useful parts of
221 ;; the general analyzer function. These could be used directly
222 ;; by an application that doesn't need to calculate the full
225 (define-overloadable-function semantic-analyze-find-tag-sequence (sequence &optional
226 scope typereturn throwsym)
227 "Attempt to find all tags in SEQUENCE.
228 Optional argument LOCALVAR is the list of local variables to use when
229 finding the details on the first element of SEQUENCE in case
230 it is not found in the global set of tables.
231 Optional argument SCOPE are additional terminals to search which are currently
232 scoped. These are not local variables, but symbols available in a structure
233 which doesn't need to be dereferneced.
234 Optional argument TYPERETURN is a symbol in which the types of all found
235 will be stored. If nil, that data is thrown away.
236 Optional argument THROWSYM specifies a symbol the throw on non-recoverable error.")
238 (defun semantic-analyze-find-tag-sequence-default (sequence &optional
241 "Attempt to find all tags in SEQUENCE.
242 SCOPE are extra tags which are in scope.
243 TYPERETURN is a symbol in which to place a list of tag classes that
244 are found in SEQUENCE.
245 Optional argument THROWSYM specifies a symbol the throw on non-recoverable error."
246 (let ((s sequence) ; copy of the sequence
247 (tmp nil) ; tmp find variable
248 (tag nil) ; tag return list
249 (tagtype nil) ; tag types return list
251 (miniscope (clone scope))
253 ;; First order check. Is this wholely contained in the typecache?
254 (setq tmp (semanticdb-typecache-find sequence))
258 ;; We are effectively done...
260 (setq tag (list tmp)))
262 ;; For the first entry, it better be a variable, but it might
263 ;; be in the local context too.
264 ;; NOTE: Don't forget c++ namespace foo::bar.
266 ;; Is this tag within our scope. Scopes can sometimes
267 ;; shadow other things, so it goes first.
268 (and scope (semantic-scope-find (car s) nil scope))
269 ;; Find the tag out there... somewhere, but not in scope
270 (semantic-analyze-find-tag (car s))
273 (if (and (listp tmp) (semantic-tag-p (car tmp)))
274 (setq tmp (semantic-analyze-select-best-tag tmp)))
275 (if (not (semantic-tag-p tmp))
277 (throw throwsym "Cannot find definition")
278 (error "Cannot find definition for \"%s\"" (car s))))
280 (setq tag (cons tmp tag)) ; tag is nil here...
281 (setq fname (semantic-tag-file-name tmp))
284 ;; For the middle entries
286 ;; Using the tag found in TMP, lets find the tag
287 ;; representing the full typeographic information of its
288 ;; type, and use that to determine the search context for
291 ;; In some cases the found TMP is a type,
292 ;; and we can use it directly.
293 (cond ((semantic-tag-of-class-p tmp 'type)
294 ;; update the miniscope when we need to analyze types directly.
297 (mapcar 'semantic-tag-type-members
299 (oset miniscope fullscope rawscope))
300 ;; Now analayze the type to remove metatypes.
301 (or (semantic-analyze-type tmp miniscope)
304 (semantic-analyze-tag-type tmp scope))))
307 (semantic-tag-file-name tmptype)))
311 (setq slots (semantic-analyze-scoped-type-parts tmptype scope))
313 ;; find (car s) in the list o slots
314 (setq tmp (semantic-find-tags-by-name (car s) slots))
317 (if (and (listp tmp) (semantic-tag-p (car tmp)))
318 (setq tmp (semantic-analyze-select-best-tag tmp)))
320 ;; Make sure we have a tag.
321 (if (not (semantic-tag-p tmp))
323 ;; In the middle, we need to keep seeking our types out.
324 (error "Cannot find definition for \"%s\"" (car s))
325 ;; Else, it's ok to end with a non-tag
328 (setq fname (or typefile fname))
329 (when (and fname (semantic-tag-p tmp)
330 (not (semantic-tag-in-buffer-p tmp)))
331 (semantic--tag-put-property tmp :filename fname))
332 (setq tag (cons tmp tag))
333 (setq tagtype (cons tmptype tagtype))
337 (if typereturn (set typereturn (nreverse tagtype)))
341 (defun semantic-analyze-find-tag (name &optional tagclass scope)
342 "Return the first tag found with NAME or nil if not found.
343 Optional argument TAGCLASS specifies the class of tag to return, such
344 as 'function or 'variable.
345 Optional argument SCOPE specifies a scope object which has
346 additional tags which are in SCOPE and do not need prefixing to
349 This is a wrapper on top of semanticdb, semanticdb-typecache,
350 semantic-scope, and semantic search functions. Almost all
351 searches use the same arguments."
352 (let ((namelst (if (consp name) name ;; test if pre-split.
353 (semantic-analyze-split-name name))))
355 ;; If the splitter gives us a list, use the sequence finder
356 ;; to get the list. Since this routine is expected to return
357 ;; only one tag, return the LAST tag found from the sequence
358 ;; which is supposedly the nested reference.
360 ;; Of note, the SEQUENCE function below calls this function
361 ;; (recursively now) so the names that we get from the above
362 ;; fcn better not, in turn, be splittable.
364 ;; If we had a split, then this is likely a c++ style namespace::name sequence,
365 ;; so take a short-cut through the typecache.
366 (or (semanticdb-typecache-find namelst)
367 ;; Ok, not there, try the usual...
368 (let ((seq (semantic-analyze-find-tag-sequence
370 (semantic-analyze-select-best-tag seq tagclass)
372 ;; If NAME is solo, then do our searches for it here.
374 (let ((retlist (and scope (semantic-scope-find name tagclass scope))))
376 (semantic-analyze-select-best-tag
378 (if (eq tagclass 'type)
379 (semanticdb-typecache-find name)
380 ;; Search in the typecache. First entries in a sequence are
382 (setq retlist (semanticdb-typecache-find name))
385 (semantic-analyze-select-best-tag
386 (semanticdb-strip-find-results
387 (semanticdb-find-tags-by-name name)
395 ;; Create a mini-analysis of just the symbol under point.
397 (define-overloadable-function semantic-analyze-current-symbol
398 (analyzehookfcn &optional position)
399 "Call ANALYZEHOOKFCN after analyzing the symbol under POSITION.
400 The ANALYZEHOOKFCN is called with the current symbol bounds, and the
401 analyzed prefix. It should take the arguments (START END PREFIX).
402 The ANALYZEHOOKFCN is only called if some sort of prefix with bounds was
403 found under POSITION.
405 The results of ANALYZEHOOKFCN is returned, or nil if there was nothing to
408 For regular analysis, you should call `semantic-analyze-current-context'
409 to calculate the context information. The purpose for this function is
410 to provide a large number of non-cached analysis for filtering symbols."
411 ;; Only do this in a Semantic enabled buffer.
412 (when (not (semantic-active-p))
413 (error "Cannot analyze buffers not supported by Semantic."))
414 ;; Always refresh out tags in a safe way before doing the
416 (semantic-refresh-tags-safe)
417 ;; Do the rest of the analysis.
423 (defun semantic-analyze-current-symbol-default (analyzehookfcn position)
424 "Call ANALYZEHOOKFCN on the analyzed symbol at POSITION."
425 (let* ((semantic-analyze-error-stack nil)
426 (LLstart (current-time))
427 (prefixandbounds (semantic-ctxt-current-symbol-and-bounds (or position (point))))
428 (prefix (car prefixandbounds))
429 (bounds (nth 2 prefixandbounds))
430 (scope (semantic-calculate-scope position))
433 ;; Only do work if we have bounds (meaning a prefix to complete)
438 ;; If debug on error is on, allow debugging in this fcn.
439 (setq prefix (semantic-analyze-find-tag-sequence
440 prefix scope 'prefixtypes 'unfindable)))
441 ;; Debug on error is off. Capture errors and move on
443 ;; NOTE: This line is duplicated in
444 ;; semantic-analyzer-debug-global-symbol
445 ;; You will need to update both places.
446 (setq prefix (semantic-analyze-find-tag-sequence
447 prefix scope 'prefixtypes))
448 (error (semantic-analyze-push-error err))))
450 (setq end (current-time))
451 ;;(message "Analysis took %.2f sec" (semantic-elapsed-time LLstart end))
456 (funcall analyzehookfcn (car bounds) (cdr bounds) prefix)
457 ;;(setq end (current-time))
458 ;;(message "hookfcn took %.5f sec" (semantic-elapsed-time LLstart end))
465 ;; Create a full-up context analysis.
468 (define-overloadable-function semantic-analyze-current-context (&optional position)
469 "Analyze the current context at optional POSITION.
470 If called interactively, display interesting information about POSITION
471 in a separate buffer.
472 Returns an object based on symbol `semantic-analyze-context'.
474 This function can be overriden with the symbol `analyze-context'.
475 When overriding this function, your override will be called while
476 cursor is at POSITION. In addition, your function will not be called
477 if a cached copy of the return object is found."
479 ;; Only do this in a Semantic enabled buffer.
480 (when (not (semantic-active-p))
481 (error "Cannot analyze buffers not supported by Semantic."))
482 ;; Always refresh out tags in a safe way before doing the
484 (semantic-refresh-tags-safe)
485 ;; Do the rest of the analysis.
486 (if (not position) (setq position (point)))
489 (let* ((answer (semantic-get-cache-data 'current-context)))
490 (with-syntax-table semantic-lex-syntax-table
492 (setq answer (:override))
493 (when (and answer (oref answer bounds))
494 (with-slots (bounds) answer
495 (semantic-cache-data-to-buffer (current-buffer)
501 ;; Check for interactivity
502 (when (interactive-p)
504 (semantic-analyze-pop-to-context answer)
505 (message "No Context."))
510 (defun semantic-analyze-current-context-default (position)
511 "Analyze the current context at POSITION.
512 Returns an object based on symbol `semantic-analyze-context'."
513 (let* ((semantic-analyze-error-stack nil)
515 (prefixandbounds (semantic-ctxt-current-symbol-and-bounds (or position (point))))
516 (prefix (car prefixandbounds))
517 (bounds (nth 2 prefixandbounds))
518 ;; @todo - vv too early to really know this answer! vv
519 (prefixclass (semantic-ctxt-current-class-list))
521 (scope (semantic-calculate-scope position))
528 ;; Pattern for Analysis:
530 ;; Step 1: Calculate DataTypes in Scope:
532 ;; a) Calculate the scope (above)
534 ;; Step 2: Parse context
536 ;; a) Identify function being called, or variable assignment,
537 ;; and find source tags for those references
538 ;; b) Identify the prefix (text cursor is on) and find the source
539 ;; tags for those references.
541 ;; Step 3: Assemble an object
546 (setq function (semantic-ctxt-current-function))
549 ;; Calculate the argument for the function if there is one.
550 (setq arg (semantic-ctxt-current-argument))
552 ;; Find a tag related to the function name.
555 (semantic-analyze-find-tag-sequence function scope))
556 (error (semantic-analyze-push-error err)))
558 ;; fntag can have the last entry as just a string, meaning we
559 ;; could not find the core datatype. In this case, the searches
560 ;; below will not work.
561 (when (stringp (car (last fntag)))
562 ;; Take a wild guess!
563 (setcar (last fntag) (semantic-tag (car (last fntag)) 'function))
567 (let ((fcn (semantic-find-tags-by-class 'function fntag)))
569 (let ((ty (semantic-find-tags-by-class 'type fntag)))
571 ;; We might have a constructor with the same name as
572 ;; the found datatype.
573 (setq fcn (semantic-find-tags-by-name
574 (semantic-tag-name (car ty))
575 (semantic-tag-type-members (car ty))))
579 (when (semantic-tag-get-attribute (car lp)
581 (setq fcn (cons (car lp) fcn)))
583 ;; Give up, go old school
586 (setq fntagend (car (reverse fcn))
588 (when (semantic-tag-p fntagend)
589 (nth (1- arg) (semantic-tag-function-arguments fntagend)))
594 ;; Only do work if we have bounds (meaning a prefix to complete)
599 ;; If debug on error is on, allow debugging in this fcn.
600 (setq prefix (semantic-analyze-find-tag-sequence
601 prefix scope 'prefixtypes 'unfindable)))
602 ;; Debug on error is off. Capture errors and move on
604 ;; NOTE: This line is duplicated in
605 ;; semantic-analyzer-debug-global-symbol
606 ;; You will need to update both places.
607 (setq prefix (semantic-analyze-find-tag-sequence
608 prefix scope 'prefixtypes))
609 (error (semantic-analyze-push-error err))))
616 ;; If we found a tag for our function, we can go into
617 ;; functional context analysis mode, meaning we have a type
620 (semantic-analyze-context-functionarg
622 :buffer (current-buffer)
625 :argument (list argtag)
628 :prefixclass prefixclass
630 :prefixtypes prefixtypes
631 :errors semantic-analyze-error-stack)))
633 ;; No function, try assignment
634 ((and (setq assign (semantic-ctxt-current-assignment))
635 ;; We have some sort of an assignment
637 (setq asstag (semantic-analyze-find-tag-sequence
639 (error (semantic-analyze-push-error err)
643 (semantic-analyze-context-assignment
645 :buffer (current-buffer)
650 :prefixclass prefixclass
651 :prefixtypes prefixtypes
652 :errors semantic-analyze-error-stack)))
654 ;; TODO: Identify return value condition.
655 ;;((setq return .... what to do?)
659 ;; Nothing in particular
661 (semantic-analyze-context
663 :buffer (current-buffer)
667 :prefixclass prefixclass
668 :prefixtypes prefixtypes
669 :errors semantic-analyze-error-stack)))
671 (t (setq context-return nil))
674 ;; Return our context.
680 ;; Friendly output of a context analysis.
682 (declare-function pulse-momentary-highlight-region "pulse")
684 (defmethod semantic-analyze-pulse ((context semantic-analyze-context))
685 "Pulse the region that CONTEXT affects."
688 (set-buffer (oref context :buffer))
689 (let ((bounds (oref context :bounds)))
691 (pulse-momentary-highlight-region (car bounds) (cdr bounds))))))
693 (defcustom semantic-analyze-summary-function 'semantic-format-tag-prototype
694 "*Function to use when creating items in Imenu.
695 Some useful functions are found in `semantic-format-tag-functions'."
697 :type semantic-format-tag-custom-list)
699 (defun semantic-analyze-princ-sequence (sequence &optional prefix buff)
700 "Send the tag SEQUENCE to standard out.
701 Use PREFIX as a label.
702 Use BUFF as a source of override methods."
706 ((semantic-tag-p (car sequence))
707 (princ (funcall semantic-analyze-summary-function
709 ((stringp (car sequence))
711 (princ (semantic--format-colorize-text (car sequence) 'variable))
714 (princ (format "'%S" (car sequence)))))
716 (setq sequence (cdr sequence))
717 (setq prefix (make-string (length prefix) ? ))
720 (defmethod semantic-analyze-show ((context semantic-analyze-context))
721 "Insert CONTEXT into the current buffer in a nice way."
722 (semantic-analyze-princ-sequence (oref context prefix) "Prefix: " )
723 (semantic-analyze-princ-sequence (oref context prefixclass) "Prefix Classes: ")
724 (semantic-analyze-princ-sequence (oref context prefixtypes) "Prefix Types: ")
725 (semantic-analyze-princ-sequence (oref context errors) "Encountered Errors: ")
727 ;(semantic-analyze-princ-sequence (oref context scopetypes) "Scope Types: ")
728 ;(semantic-analyze-princ-sequence (oref context scope) "Scope: ")
729 ;(semantic-analyze-princ-sequence (oref context localvariables) "LocalVars: ")
730 (when (oref context scope)
731 (semantic-analyze-show (oref context scope)))
734 (defmethod semantic-analyze-show ((context semantic-analyze-context-assignment))
735 "Insert CONTEXT into the current buffer in a nice way."
736 (semantic-analyze-princ-sequence (oref context assignee) "Assignee: ")
739 (defmethod semantic-analyze-show ((context semantic-analyze-context-functionarg))
740 "Insert CONTEXT into the current buffer in a nice way."
741 (semantic-analyze-princ-sequence (oref context function) "Function: ")
742 (princ "Argument Index: ")
743 (princ (oref context index))
745 (semantic-analyze-princ-sequence (oref context argument) "Argument: ")
748 (defun semantic-analyze-pop-to-context (context)
749 "Display CONTEXT in a temporary buffer.
750 CONTEXT's content is described in `semantic-analyze-current-context'."
751 (semantic-analyze-pulse context)
752 (with-output-to-temp-buffer "*Semantic Context Analysis*"
753 (princ "Context Type: ")
754 (princ (object-name context))
757 (princ (oref context bounds))
759 (semantic-analyze-show context)
761 (shrink-window-if-larger-than-buffer
762 (get-buffer-window "*Semantic Context Analysis*"))
765 (provide 'semantic/analyze)
768 ;; generated-autoload-file: "loaddefs.el"
769 ;; generated-autoload-feature: semantic/loaddefs
770 ;; generated-autoload-load-name: "semantic/analyze"
773 ;;; semantic/analyze.el ends here