@@ -273,12 +273,13 @@ Only understands project root or root/lisp."
273273; ; TODO quite redundant
274274(defun erk--project-root-feature-file ()
275275 " Return the path of the root feature for the project."
276- (let* ((project-elisp-dir (erk--project-elisp-dir))
277- (package-files (directory-files project-elisp-dir nil (rx " .el" string-end)))
278- (package-files (->> package-files
279- (--reject (string-match-p (rx " autoloads.el" string-end) it))))
280- (root-feature-file (car (sort package-files #'string< ))))
281- (concat project-elisp-dir " /" root-feature-file)))
276+ (if-let* ((project-elisp-dir (erk--project-elisp-dir))
277+ (package-files (directory-files project-elisp-dir nil (rx " .el" string-end)))
278+ (package-files (->> package-files
279+ (--reject (string-match-p (rx " autoloads.el" string-end) it))))
280+ (root-feature-file (car (sort package-files #'string< ))))
281+ (concat project-elisp-dir " /" root-feature-file)
282+ (user-error " %s doesn't seem to be an elisp project" (erk--project-root))))
282283
283284; ; Note, these functions are kind of redundant, but just want to consume
284285; ; consistent interfaces internally.
@@ -340,14 +341,17 @@ for development, and being lenient for degenerate cases is fine."
340341(defun erk-jump-features ()
341342 " Jump between the corresponding package and test features."
342343 (interactive )
343- (let ((file (file-name-nondirectory (buffer-file-name (current-buffer )))))
344- (if (string-match-p " .*\\ .el" file)
345- (find-file (if (string-match " \\ (.*\\ )-tests?\\ .el" file)
344+ (let* ((filepath (buffer-file-name (current-buffer )))
345+ (filename (when filepath
346+ (file-name-nondirectory filepath))))
347+ (if (and filename
348+ (string-match-p " .*\\ .el" filename))
349+ (find-file (if (string-match " \\ (.*\\ )-tests?\\ .el" filename)
346350 (concat (erk--lisp-directory)
347- (match-string 1 file ) " .el" )
351+ (match-string 1 filename ) " .el" )
348352 (concat (erk--test-directory)
349- (and (string-match " \\ (.*\\ )\\ .el" file )
350- (match-string 1 file ))
353+ (and (string-match " \\ (.*\\ )\\ .el" filename )
354+ (match-string 1 filename ))
351355 " -test.el" )))
352356 ; ; fallback, go to root feature, convenient shortcut
353357 ; ; back into elisp files
@@ -433,8 +437,17 @@ corresponding `defun' are supported."
433437 (_
434438 (user-error
435439 " No compatible def before point. def: %s name: %s"
436- def name)))))
437-
440+ def name)
441+ (erk-jump-features)))))
442+
443+ (defun erk--last-test ()
444+ " Return test name for last thing.
445+ Note, to expand tests, a type parameter will have to be specified
446+ and configured by the project."
447+ (pcase-let* ((`(, def , name ) (erk--last-defname)))
448+ (pcase def
449+ (`defun (erk--make-test-symbol name))
450+ (`ert-deftest name))))
438451
439452;;;### autoload
440453(defun erk-ert-rerun-this-no-reload ()
@@ -443,11 +456,10 @@ Use this when debugging with external state or debugging elisp
443456repo kit itself, which may behave strangely if reloaded in the
444457middle of a command."
445458 (interactive )
446- (save-excursion
447- (beginning-of-defun )
448- (let* ((form (funcall load-read-function (current-buffer )))
449- (name (elt form 1 )))
450- (ert `(member , name )))))
459+ ; ; TODO make this work off of newer primitive
460+ (when-let ((name (erk--last-test)))
461+ (when (ert-get-test name))
462+ (ert `(member , name ))))
451463
452464;;;### autoload
453465(defun erk-ert-rerun-this ()
@@ -787,7 +799,6 @@ implementation information and more details about argument usage."
787799 (string-trim
788800 (shell-command-to-string " git config user.name" )))))
789801 (read-string " Author: " default )))
790-
791802 (email
792803 (let ((default (when (executable-find " git" )
793804 (string-trim
0 commit comments