emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 0507841 285/348: Use customizable list of directories when


From: Oleh Krehel
Subject: [elpa] master 0507841 285/348: Use customizable list of directories when looking for linux apps.
Date: Sat, 8 Apr 2017 11:04:16 -0400 (EDT)

branch: master
commit 0507841d6732a1dca231c19c62780650e2488c77
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>

    Use customizable list of directories when looking for linux apps.
    
    * counsel.el (counsel-linux-apps-directories): New variable.
      (counsel-linux-apps-list): Use it.
---
 counsel.el | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/counsel.el b/counsel.el
index b76f938..6c77df3 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2617,16 +2617,23 @@ And insert it into the minibuffer. Useful during
 (defvar counsel-linux-apps-faulty nil
   "List of faulty data located in /usr/share/applications.")
 
+(defcustom counsel-linux-apps-directories
+  '("/usr/local/share/applications/" "/usr/share/applications/")
+  "Directories in which to search for applications (.desktop files)."
+  :group 'counsel
+  :type '(list directory))
+
 (defun counsel-linux-apps-list ()
-  (let ((files
-         (delete
-          ".." (delete
-                "." (file-expand-wildcards 
"/usr/share/applications/*.desktop")))))
+  (let ((files (apply 'append
+                      (mapcar
+                       (lambda (dir)
+                         (directory-files dir t ".*\\.desktop$"))
+                       counsel-linux-apps-directories))))
     (dolist (file (cl-set-difference files (append (mapcar 'car 
counsel-linux-apps-alist)
                                                    counsel-linux-apps-faulty)
                                      :test 'equal))
       (with-temp-buffer
-        (insert-file-contents (expand-file-name file 
"/usr/share/applications"))
+        (insert-file-contents file)
         (let (name comment exec)
           (goto-char (point-min))
           (if (null (re-search-forward "^Name *= *\\(.*\\)$" nil t))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]