Rename all non-external symbols to yas--.

Maitain list of external symbols in `yas--exported-syms`
This commit is contained in:
João Távora 2012-07-19 02:39:12 +01:00
parent 96638af80e
commit 90cd855c14
3 changed files with 1163 additions and 1127 deletions

View File

@ -35,39 +35,39 @@
(princ (format "\nPost command hook: %s\n" post-command-hook))
(princ (format "\nPre command hook: %s\n" pre-command-hook))
(princ (format "%s live snippets in total\n" (length (yas-snippets-at-point (quote all-snippets)))))
(princ (format "%s live snippets in total\n" (length (yas--snippets-at-point (quote all-snippets)))))
(princ (format "%s overlays in buffer:\n\n" (length (overlays-in (point-min) (point-max)))))
(princ (format "%s live snippets at point:\n\n" (length (yas-snippets-at-point))))
(princ (format "%s live snippets at point:\n\n" (length (yas--snippets-at-point))))
(dolist (snippet (yas-snippets-at-point))
(dolist (snippet (yas--snippets-at-point))
(princ (format "\tsid: %d control overlay from %d to %d\n"
(yas-snippet-id snippet)
(overlay-start (yas-snippet-control-overlay snippet))
(overlay-end (yas-snippet-control-overlay snippet))))
(yas--snippet-id snippet)
(overlay-start (yas--snippet-control-overlay snippet))
(overlay-end (yas--snippet-control-overlay snippet))))
(princ (format "\tactive field: %d from %s to %s covering \"%s\"\n"
(yas-field-number (yas-snippet-active-field snippet))
(marker-position (yas-field-start (yas-snippet-active-field snippet)))
(marker-position (yas-field-end (yas-snippet-active-field snippet)))
(buffer-substring-no-properties (yas-field-start (yas-snippet-active-field snippet)) (yas-field-end (yas-snippet-active-field snippet)))))
(when (yas-snippet-exit snippet)
(yas--field-number (yas--snippet-active-field snippet))
(marker-position (yas--field-start (yas--snippet-active-field snippet)))
(marker-position (yas--field-end (yas--snippet-active-field snippet)))
(buffer-substring-no-properties (yas--field-start (yas--snippet-active-field snippet)) (yas--field-end (yas--snippet-active-field snippet)))))
(when (yas--snippet-exit snippet)
(princ (format "\tsnippet-exit: at %s next: %s\n"
(yas-exit-marker (yas-snippet-exit snippet))
(yas-exit-next (yas-snippet-exit snippet)))))
(dolist (field (yas-snippet-fields snippet))
(yas--exit-marker (yas--snippet-exit snippet))
(yas--exit-next (yas--snippet-exit snippet)))))
(dolist (field (yas--snippet-fields snippet))
(princ (format "\tfield: %d from %s to %s covering \"%s\" next: %s%s\n"
(yas-field-number field)
(marker-position (yas-field-start field))
(marker-position (yas-field-end field))
(buffer-substring-no-properties (yas-field-start field) (yas-field-end field))
(yas-debug-format-fom-concise (yas-field-next field))
(if (yas-field-parent-field field) "(has a parent)" "")))
(dolist (mirror (yas-field-mirrors field))
(yas--field-number field)
(marker-position (yas--field-start field))
(marker-position (yas--field-end field))
(buffer-substring-no-properties (yas--field-start field) (yas--field-end field))
(yas--debug-format-fom-concise (yas--field-next field))
(if (yas--field-parent-field field) "(has a parent)" "")))
(dolist (mirror (yas--field-mirrors field))
(princ (format "\t\tmirror: from %s to %s covering \"%s\" next: %s\n"
(marker-position (yas-mirror-start mirror))
(marker-position (yas-mirror-end mirror))
(buffer-substring-no-properties (yas-mirror-start mirror) (yas-mirror-end mirror))
(yas-debug-format-fom-concise (yas-mirror-next mirror)))))))
(marker-position (yas--mirror-start mirror))
(marker-position (yas--mirror-end mirror))
(buffer-substring-no-properties (yas--mirror-start mirror) (yas--mirror-end mirror))
(yas--debug-format-fom-concise (yas--mirror-next mirror)))))))
(princ (format "\nUndo is %s and point-max is %s.\n"
(if (eq buffer-undo-list t)
@ -80,20 +80,20 @@
(dolist (undo-elem first-ten)
(princ (format "%2s: %s\n" (position undo-elem first-ten) (truncate-string-to-width (format "%s" undo-elem) 70))))))))
(defun yas-debug-format-fom-concise (fom)
(defun yas--debug-format-fom-concise (fom)
(when fom
(cond ((yas-field-p fom)
(cond ((yas--field-p fom)
(format "field %d from %d to %d"
(yas-field-number fom)
(marker-position (yas-field-start fom))
(marker-position (yas-field-end fom))))
((yas-mirror-p fom)
(yas--field-number fom)
(marker-position (yas--field-start fom))
(marker-position (yas--field-end fom))))
((yas--mirror-p fom)
(format "mirror from %d to %d"
(marker-position (yas-mirror-start fom))
(marker-position (yas-mirror-end fom))))
(marker-position (yas--mirror-start fom))
(marker-position (yas--mirror-end fom))))
(t
(format "snippet exit at %d"
(marker-position (yas-fom-start fom)))))))
(marker-position (yas--fom-start fom)))))))
(defun yas-exterminate-package ()
@ -101,8 +101,8 @@
(yas-global-mode -1)
(yas-minor-mode -1)
(mapatoms #'(lambda (atom)
(when (string-match "yas-" (symbol-name atom))
(unintern atom)))))
(when (string-match "yas[-/]" (symbol-name atom))
(unintern atom obarray)))))
(defun yas-debug-test (&optional quiet)
(interactive "P")
@ -111,7 +111,7 @@
yas-snippet-dirs
"~/Source/yasnippet/snippets/"))
(set-buffer (switch-to-buffer "*YAS TEST*"))
(mapc #'yas-commit-snippet (yas-snippets-at-point 'all-snippets))
(mapc #'yas--commit-snippet (yas--snippets-at-point 'all-snippets))
(erase-buffer)
(setq buffer-undo-list nil)
(setq undo-in-progress nil)

View File

@ -114,7 +114,7 @@ TODO: correct this bug!"
;;;
(defmacro with-some-interesting-snippet-dirs (&rest body)
`(yas-saving-variables
(with-snippet-dirs
(yas-with-snippet-dirs
'((".emacs.d/snippets"
("c-mode"
(".yas-parents" . "cc-mode")
@ -132,38 +132,38 @@ TODO: correct this bug!"
"Test basic loading and expansion of snippets"
(with-some-interesting-snippet-dirs
(yas-reload-all)
(yas-basic-jit-loading-1)))
(yas--basic-jit-loading-1)))
(ert-deftest basic-jit-loading-with-compiled-snippets ()
"Test basic loading and expansion of snippets"
(with-some-interesting-snippet-dirs
(yas-reload-all)
(yas-recompile-all)
(flet ((yas-load-directory-2
(flet ((yas--load-directory-2
(&rest dummies)
(ert-fail "yas-load-directory-2 shouldn't be called when snippets have been compiled")))
(ert-fail "yas--load-directory-2 shouldn't be called when snippets have been compiled")))
(yas-reload-all)
(yas-basic-jit-loading-1))))
(yas--basic-jit-loading-1))))
(defun yas-basic-jit-loading-1 (&optional compile)
(defun yas--basic-jit-loading-1 (&optional compile)
(with-temp-buffer
(should (= 4 (hash-table-count yas-scheduled-jit-loads)))
(should (= 0 (hash-table-count yas-tables)))
(should (= 4 (hash-table-count yas--scheduled-jit-loads)))
(should (= 0 (hash-table-count yas--tables)))
(lisp-interaction-mode)
(yas-minor-mode 1)
(should (= 2 (hash-table-count yas-scheduled-jit-loads)))
(should (= 2 (hash-table-count yas-tables)))
(should (= 1 (hash-table-count (yas-table-uuidhash (gethash 'lisp-interaction-mode yas-tables)))))
(should (= 2 (hash-table-count (yas-table-uuidhash (gethash 'emacs-lisp-mode yas-tables)))))
(should (= 2 (hash-table-count yas--scheduled-jit-loads)))
(should (= 2 (hash-table-count yas--tables)))
(should (= 1 (hash-table-count (yas--table-uuidhash (gethash 'lisp-interaction-mode yas--tables)))))
(should (= 2 (hash-table-count (yas--table-uuidhash (gethash 'emacs-lisp-mode yas--tables)))))
(yas-should-expand '(("sc" . "brother from another mother")
("dolist" . "(dolist)")
("ert-deftest" . "(ert-deftest name () )")))
(c-mode)
(yas-minor-mode 1)
(should (= 0 (hash-table-count yas-scheduled-jit-loads)))
(should (= 4 (hash-table-count yas-tables)))
(should (= 1 (hash-table-count (yas-table-uuidhash (gethash 'c-mode yas-tables)))))
(should (= 1 (hash-table-count (yas-table-uuidhash (gethash 'cc-mode yas-tables)))))
(should (= 0 (hash-table-count yas--scheduled-jit-loads)))
(should (= 4 (hash-table-count yas--tables)))
(should (= 1 (hash-table-count (yas--table-uuidhash (gethash 'c-mode yas--tables)))))
(should (= 1 (hash-table-count (yas--table-uuidhash (gethash 'cc-mode yas--tables)))))
(yas-should-expand '(("printf" . "printf();")
("def" . "# define")))
(yas-should-not-expand '("sc" "dolist" "ert-deftest"))))
@ -238,7 +238,7 @@ TODO: correct this bug!"
(when (>= emacs-major-version 23)
(delete-directory default-directory 'recursive))))))
(defmacro with-snippet-dirs (dirs &rest body)
(defmacro yas-with-snippet-dirs (dirs &rest body)
`(yas-call-with-snippet-dirs ,dirs
#'(lambda ()
,@body)))

File diff suppressed because it is too large Load Diff