]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
added helm-safari.
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Mon, 1 Feb 2016 10:53:43 +0000 (11:53 +0100)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Mon, 1 Feb 2016 10:53:43 +0000 (11:53 +0100)
bba.org
elpa/helm-safari-20160115.2334/helm-safari-autoloads.el [new file with mode: 0644]
elpa/helm-safari-20160115.2334/helm-safari-pkg.el [new file with mode: 0644]
elpa/helm-safari-20160115.2334/helm-safari.el [new file with mode: 0644]
elpa/helm-safari-readme.txt [new file with mode: 0644]

diff --git a/bba.org b/bba.org
index f32487ca2096ac4941130363e5669d771f589270..9acddd2a0d5078b569fdf2fa8e756a18cbb319d1 100644 (file)
--- a/bba.org
+++ b/bba.org
@@ -2166,6 +2166,8 @@ function to convert groups of spaces to hard tabs.
   (define-key bba/launcher "!" 'eshell-here)
   (define-key bba/launcher "b" 'browse-url-at-point)
   (define-key bba/launcher "B" 'eww)
+  (define-key bba/launcher "\C-b" 'helm-safari-bookmarks)
+  (define-key bba/launcher "\C-h" 'helm-safari-history)
   (define-key bba/launcher "c" 'helm-calcul-expression)
   (define-key bba/launcher "d" 'ediff-buffers)
   (define-key bba/launcher "e" 'elfeed)
diff --git a/elpa/helm-safari-20160115.2334/helm-safari-autoloads.el b/elpa/helm-safari-20160115.2334/helm-safari-autoloads.el
new file mode 100644 (file)
index 0000000..a0c3819
--- /dev/null
@@ -0,0 +1,27 @@
+;;; helm-safari-autoloads.el --- automatically extracted autoloads
+;;
+;;; Code:
+(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
+\f
+;;;### (autoloads nil "helm-safari" "helm-safari.el" (22184 48066
+;;;;;;  0 0))
+;;; Generated autoloads from helm-safari.el
+
+(autoload 'helm-safari-bookmarks "helm-safari" "\
+Search Safari Bookmark using `helm'.
+
+\(fn)" t nil)
+
+(autoload 'helm-safari-history "helm-safari" "\
+Search Safari Bookmark using `helm'.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; End:
+;;; helm-safari-autoloads.el ends here
diff --git a/elpa/helm-safari-20160115.2334/helm-safari-pkg.el b/elpa/helm-safari-20160115.2334/helm-safari-pkg.el
new file mode 100644 (file)
index 0000000..eb3fce1
--- /dev/null
@@ -0,0 +1 @@
+(define-package "helm-safari" "20160115.2334" "Helm interface for Safari Bookmarks and History" '((helm "1.9.1") (emacs "24")) :keywords '("tools"))
diff --git a/elpa/helm-safari-20160115.2334/helm-safari.el b/elpa/helm-safari-20160115.2334/helm-safari.el
new file mode 100644 (file)
index 0000000..b12ea49
--- /dev/null
@@ -0,0 +1,94 @@
+;;; helm-safari.el --- Helm interface for Safari Bookmarks and History  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2016  Chunyang Xu
+
+;; Author: Chunyang Xu <xuchunyang56NOSPAMgmail.com>
+;; Package-Requires: ((helm "1.9.1") (emacs "24"))
+;; Version: 0.1
+;; Package-Version: 20160115.2334
+;; Keywords: tools
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'helm)
+
+(defgroup helm-safari nil
+  "Helm interface for Safari Bookmarks and History."
+  :group 'helm)
+
+(defun helm-safari-list-to-alist (list)
+  ;; '(1 2 3 4) ⇒ ((2 . 1) (4 . 3))
+  (let* ((idx 0)
+         res)
+    (while (< idx (length list))
+      (push (cons (nth (1+ idx) list)
+                  (nth idx list))
+            res)
+      (setq idx (+ idx 2)))
+    (nreverse res)))
+
+(defvar helm-safari-bookmarks-alist nil)
+(defvar helm-source-safari-bookmarks
+  (helm-build-sync-source "Safari Bookmarks"
+    :init
+    (lambda ()
+      (setq helm-safari-bookmarks-alist
+            (let ((bookmarks-list
+                   (split-string
+                    (shell-command-to-string
+                     "plutil -p ~/Library/Safari/Bookmarks.plist | grep 'URLString\\|title' | sed 's/.* => \"\\(.*\\)\"/\\1/'")
+                    "\n" t)))
+              (helm-safari-list-to-alist bookmarks-list))))
+    :candidates 'helm-safari-bookmarks-alist
+    :action '(("Browse Url" . browse-url))))
+
+;;;###autoload
+(defun helm-safari-bookmarks ()
+  "Search Safari Bookmark using `helm'."
+  (interactive)
+  (helm :sources 'helm-source-safari-bookmarks
+        :prompt "Find Bookmark: "
+        :buffer "*Helm Safari Bookmarks*"))
+
+(defvar helm-safari-history-alist nil)
+(defvar helm-source-safari-history
+  (helm-build-sync-source "Safari History"
+    :init
+    (lambda ()
+      (setq helm-safari-history-alist
+            (let ((history-list
+                   (split-string
+                    (shell-command-to-string
+                     "plutil -p ~/Library/Safari/History.plist | grep '\"title\"\\|\"\" ' | sed 's/.* => \"\\(.*\\)\"$/\\1/'")
+                    "\n" t)))
+              (helm-safari-list-to-alist history-list))))
+    :candidates 'helm-safari-history-alist
+    :action '(("Browse Url" . browse-url))))
+
+;;;###autoload
+(defun helm-safari-history ()
+  "Search Safari Bookmark using `helm'."
+  (interactive)
+  (helm :sources 'helm-source-safari-history
+        :prompt "Find Bookmark: "
+        :buffer "*Helm Safari History*"))
+
+(provide 'helm-safari)
+;;; helm-safari.el ends here
diff --git a/elpa/helm-safari-readme.txt b/elpa/helm-safari-readme.txt
new file mode 100644 (file)
index 0000000..e69de29