add bulk mimetype app search

This commit is contained in:
petrucci4prez 2018-08-22 01:53:36 -04:00
parent fd7a972eea
commit 54a8083914
1 changed files with 8 additions and 1 deletions

View File

@ -264,7 +264,8 @@ event of an error or nonlocal exit."
"Return all applications that can open a given MIMETYPE. The list "Return all applications that can open a given MIMETYPE. The list
is comprised of lists of two elements, the first of which is the is comprised of lists of two elements, the first of which is the
command (Exec) and the second which is the application name" command (Exec) and the second which is the application name"
(let* ((mime-regex (concat "^MimeType=.*" mimetype ".*$")) (let* ((case-fold-search nil)
(mime-regex (concat "^MimeType=.*" mimetype ";.*$"))
(app-regex ) (app-regex )
(desktop-dirs '("/usr/share/applications" (desktop-dirs '("/usr/share/applications"
"/usr/local/share/applications" "/usr/local/share/applications"
@ -283,6 +284,12 @@ command (Exec) and the second which is the application name"
(match-string 1 tb)) (match-string 1 tb))
exec))) exec)))
(setq app-list (cons (list exec name) app-list))))))))) (setq app-list (cons (list exec name) app-list)))))))))
(defun nd/get-apps-bulk-from-mime (mimetype)
"Like `nd/get-apps-from-mime' but only includes apps that can open
multiple files at once for given MIMETYPE."
(let ((case-fold-search nil))
(seq-filter (lambda (a) (string-match ".*%[FU].*" (car a))) (nd/get-apps-from-mime mimetype))))
#+END_SRC #+END_SRC
** interactive ** interactive
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp