From 7e96ff83aa62409ceacb29bdb509b7dc8c409ab2 Mon Sep 17 00:00:00 2001 From: jao Date: Tue, 2 Feb 2021 04:46:08 +0000 Subject: no attic --- attic/jao-applescript.el | 65 ------------------------------------------------ 1 file changed, 65 deletions(-) delete mode 100644 attic/jao-applescript.el (limited to 'attic/jao-applescript.el') diff --git a/attic/jao-applescript.el b/attic/jao-applescript.el deleted file mode 100644 index 233186c..0000000 --- a/attic/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) -- cgit v1.2.3