Function: hyrolo-any-file-type-problem-p

hyrolo-any-file-type-problem-p is a byte-compiled function defined in hyrolo.el.

Signature

(hyrolo-any-file-type-problem-p)

Documentation

Return t if any file from hyrolo-file-list has an unusable format.

The list of unusable files is displayed in a HyRolo error window unless hyrolo-boolean-only-flag is set to t (used for testing).

This will install markdown-mode if any Markdown files are specified and the package is not installed.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hyrolo.el
(defun hyrolo-any-file-type-problem-p ()
  "Return t if any file from `hyrolo-file-list' has an unusable format.

The list of unusable files is displayed in a HyRolo error window
unless `hyrolo-boolean-only-flag' is set to t (used for testing).

This will install `markdown-mode' if any Markdown files are specified and the
package is not installed."
  ;;  1. Ignore files without suffixes in step 2
  (let ((file-suffixes
	 (delq nil (mapcar (lambda (filename) (file-name-extension filename))
			   (hyrolo-get-file-list))))
	file-and-major-mode-list
	files-no-mode-list
	files-invalid-suffix-list
	package-archives)

    ;;  2. Skip this if the markdown-mode package is installed
    (unless (package-installed-p 'markdown-mode)
    ;;  3. If any `hyrolo-file-list' file has a markdown file suffix,
      (when (delq nil (mapcar (lambda (suffix)
				(string-match-p (concat "\\(?:" hyrolo-markdown-suffix-regexp "\\)$")
						suffix))
			      file-suffixes))

	;;  4. if not, ensure nongnu is temporarily added to package
	;;     source list and then install markdown-mode.
	(hyrolo-install-markdown-mode)))

    ;;  5. Check that each file has an entry in `hyrolo-auto-mode-alist' or `auto-mode-alist',
    (setq file-and-major-mode-list
	  (mapcar (lambda (filename) (cons filename
					   (hyrolo-major-mode-from-file-name filename)))
		  (hyrolo-get-file-list))

	  files-invalid-suffix-list
	  (delq nil (mapcar (lambda (item) (when (not (string-match-p hyrolo-file-suffix-regexp (car item)))
					     (car item)))
			    file-and-major-mode-list))

	  files-no-mode-list
	  (cl-set-difference
	   (delq nil (mapcar (lambda (item) (when (null (cdr item)) (car item)))
			     file-and-major-mode-list))
	   files-invalid-suffix-list))

    ;;  6. if not, display a buffer with the invalid file types and return t
    (when (or files-invalid-suffix-list files-no-mode-list)
      (unless (and (boundp 'hyrolo-boolean-only-flag) hyrolo-boolean-only-flag)
	(with-help-window "*HyRolo Errors*"
	  (princ "`hyrolo-file-list' gets its files from these patterns:\n")
	  (mapc (lambda (spec) (princ (format "\t%S\n" spec)))
		hyrolo-file-list)
	  (terpri)
	  (princ "When expanded, it includes the following files that HyRolo cannot process:\n\n")

	  (when files-invalid-suffix-list
	    (princ (format "Files with invalid or no suffixes:\n  (valid suffixes: %S)\n"
			   hyrolo-file-suffix-regexp))
	    (mapc (lambda (file) (princ (format "\t%S\n" file)))
		  files-invalid-suffix-list)
	    (terpri)
	    (princ "Please remove the above files from `hyrolo-file-list'.\n")
	    (terpri))

	  (when files-no-mode-list
	    (princ "Files with invalid modes (file suffixes not in `auto-mode-alist'):\n")
	    (mapc (lambda (file) (princ (format "\t%S\n" file)))
		  files-no-mode-list)
	    (terpri)
	    (princ "Please add appropriate entries for the above files to `auto-mode-alist'.\n")
	    (terpri))

	  (when (hyperb:stack-frame '(hyrolo-file-list-changed))
	    ;; Errors occurred with a let of `hyrolo-file-list' so
	    ;; include backtrace of where this occurred.
	    (princ "Stack trace of where invalid files were referenced:\n")
	    (terpri)
            ;; (setq backtrace-view (plist-put backtrace-view :show-locals t))
	    (backtrace))

	  (when noninteractive
	    (princ (buffer-string)))))
      t)))