[137701] users/chunyang/port.el/port.el
chunyang at macports.org
chunyang at macports.org
Wed Jun 17 12:24:58 PDT 2015
Revision: 137701
https://trac.macports.org/changeset/137701
Author: chunyang at macports.org
Date: 2015-06-17 12:24:58 -0700 (Wed, 17 Jun 2015)
Log Message:
-----------
users/chunyang: port.el: Add helm-port, new command
Modified Paths:
--------------
users/chunyang/port.el/port.el
Modified: users/chunyang/port.el/port.el
===================================================================
--- users/chunyang/port.el/port.el 2015-06-17 19:16:39 UTC (rev 137700)
+++ users/chunyang/port.el/port.el 2015-06-17 19:24:58 UTC (rev 137701)
@@ -51,5 +51,26 @@
(tabulated-list-print t)
(switch-to-buffer buf))))
+;;;###autoload
+(defun helm-port ()
+ (interactive)
+ (and
+ (require 'helm nil t)
+ (require 'subr-x nil t)
+ (helm :sources
+ (helm-build-sync-source "MacPorts"
+ :candidates (lambda ()
+ (mapcar
+ #'string-trim
+ (split-string
+ (shell-command-to-string "port -q installed requested")
+ "\n")))
+ :action '(("Go to home page" .
+ (lambda (candidate)
+ (when-let ((string candidate) (regexp " (active)")
+ (index (string-match regexp string)))
+ (setq candidate (substring string 0 index)))
+ (shell-command (concat "port gohome " candidate)))))))))
+
(provide 'port)
;;; port.el ends here
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150617/5dfe692e/attachment.html>
More information about the macports-changes
mailing list