(require 'rustic-flycheck) ;; Adds (/tmp/test/foo /tmp/test) unless native-compiled ;; Segfaults when native-compiled (message "%s" (rustic-flycheck-dirs-list "/tmp/test/foo" "/tmp")) ;; The code ;; (defun rustic-flycheck-dirs-list (start end) ;; "Return a list of directories from START (inclusive) to END (exclusive). ;; E.g., if START is '/a/b/c/d' and END is '/a', return the list ;; '(/a/b/c/d /a/b/c /a/b) in this order. ;; START and END are strings representing file paths. END should be ;; above START in the file hierarchy; if not, the list stops at the ;; root of the file hierarchy." ;; (let ((dirlist) ;; (dir (expand-file-name start)) ;; (end (expand-file-name end))) ;; (while (not (or (equal dir (car dirlist)) ; avoid infinite loop ;; (file-equal-p dir end))) ;; (push dir dirlist) ;; (setq dir (directory-file-name (file-name-directory dir)))) ;; (nreverse dirlist)))