summaryrefslogtreecommitdiffhomepage
path: root/sys/jao-applescript.el
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2020-12-29 22:06:14 +0000
committerjao <jao@gnu.org>2020-12-29 22:06:14 +0000
commitbad49f39bc06d858bd328603615f9e6291b4c103 (patch)
treecac7d499702710def0464d5c79f269f7520542c7 /sys/jao-applescript.el
parent42c26033db101beb2ccac5342c1cf56f266cadc5 (diff)
downloadelibs-bad49f39bc06d858bd328603615f9e6291b4c103.tar.gz
elibs-bad49f39bc06d858bd328603615f9e6291b4c103.tar.bz2
attic with obsolete stuff
Diffstat (limited to 'sys/jao-applescript.el')
-rw-r--r--sys/jao-applescript.el65
1 files changed, 0 insertions, 65 deletions
diff --git a/sys/jao-applescript.el b/sys/jao-applescript.el
deleted file mode 100644
index 233186c..0000000
--- a/sys/jao-applescript.el
+++ /dev/null
@@ -1,65 +0,0 @@
-;;; AppleScript and some macish bits
-(autoload 'applescript-mode "applescript-mode"
- "major mode for editing AppleScript source." t)
-(setq auto-mode-alist
- (cons '("\\.applescript$" . applescript-mode) auto-mode-alist))
-
-(defun do-applescript (script)
- (with-temp-buffer
- (insert script)
- (shell-command-on-region (point-min) (point-max) "osascript" t)
- (buffer-string)))
-
-(defun jao-as-tell-app (app something)
- (let ((res (do-applescript (format "tell application \"%s\"\n%s\nend tell"
- app something))))
- (or (and (stringp res) (substring res 0 -1)) "")))
-
-(defmacro jao-as-get-doc (name application &optional doc)
- `(defun ,name ()
- (interactive)
- (let ((url (jao-as-tell-app ,application
- ,(format "get the URL of %s 1"
- (or doc "document"))))
- (name (jao-as-tell-app ,application "get the name of document 1")))
- (cons url name))))
-(jao-as-get-doc jao-as-safari-doc "Safari")
-(jao-as-get-doc jao-as-webkit-doc "WebKit")
-(jao-as-get-doc jao-as-camino-doc "Camino" "window")
-
-(defun jao-as-firefox-doc ()
- (interactive)
- (let ((url (shell-command-to-string
- (concat "osascript "
- (expand-file-name "furl.applescript"
- (file-name-directory load-file-name)))))
- (name (jao-as-tell-app "Firefox" "get the name of window 1")))
- (cons (substring url 0 -1) name)))
-
-
-;;; quicksilver
-(defun jao-qs-buffer ()
- "Opens the current file in Quicksilver"
- (interactive)
- (cond ((and buffer-file-name (file-exists-p buffer-file-name))
- (call-process-shell-command (concat "qs \"" buffer-file-name "\"")))
- ;; dired handling
- ((eq major-mode 'dired-mode)
- (dired-do-shell-command "qs * "
- current-prefix-arg
- (dired-get-marked-files t current-prefix-arg)))
- ;; buffer-menu mode
- ((and (eq major-mode 'Buffer-menu-mode)
- (file-exists-p (buffer-file-name (Buffer-menu-buffer nil))))
- (call-process-shell-command
- (concat "qs \"" (buffer-file-name (Buffer-menu-buffer nil)) "\"")))
- (t
- (error "Not visiting a file or file doesn't exist"))))
-
- (defun jao-qs-region (start end)
- "Opens the contents of the region in Quicksilver as text."
- (interactive "r")
- (call-process-region start end "qs" nil 0 nil "-"))
-
-
-(provide 'jao-applescript)