diff options
| author | jao <jao@gnu.org> | 2026-09-06 15:36:38 +0100 |
|---|---|---|
| committer | jao <jao@gnu.org> | 2026-09-06 15:36:38 +0100 |
| commit | 0f8eb65fb807a125dd601cd6b3ee746e6c7b6020 (patch) | |
| tree | 1d394cf0023d0d4e9df41a28c1d4376769c91d77 /lib/doc/jao-mac.el | |
| parent | 21c34f24c110e57a6c90126c87fee9cd71e85817 (diff) | |
| download | elibs-0f8eb65fb807a125dd601cd6b3ee746e6c7b6020.tar.gz elibs-0f8eb65fb807a125dd601cd6b3ee746e6c7b6020.tar.bz2 | |
a slew of little fixes courtesy of the byte compiler
Diffstat (limited to 'lib/doc/jao-mac.el')
| -rw-r--r-- | lib/doc/jao-mac.el | 67 |
1 files changed, 42 insertions, 25 deletions
diff --git a/lib/doc/jao-mac.el b/lib/doc/jao-mac.el index 269e853..916a84d 100644 --- a/lib/doc/jao-mac.el +++ b/lib/doc/jao-mac.el @@ -18,6 +18,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see <https://www.gnu.org/licenses/>. +(require 'thingatpt) (require 'jao-shell) ;;; applescript @@ -51,7 +52,9 @@ "Invoke open after formatting thing with args, using `format'" (jao-shell-exec (format "open %s" (apply #'format thing args)))) -(defun jao-mac-open-in-skim (&optional file page height) +(declare-function 'doc-view-current-page "doc-view") + +(defun jao-mac-open-in-skim (&optional file page _height) (interactive) (let* ((file (if file (expand-file-name file) (buffer-file-name))) (page (or page (and (derived-mode-p 'doc-view-mode) @@ -60,7 +63,7 @@ ;; https://alvinalexander.com/macos/applescript-how-to-open-pdf-file-in-preview-go-to-page/ ;; This will work as long as Preview is the default app for the file at hand. -(defun jao-mac-open-in-preview (&optional file page height) +(defun jao-mac-open-in-preview (&optional file page _height) (interactive) (let ((file (if file (expand-file-name file) (buffer-file-name))) (page (or page (and (derived-mode-p 'doc-view-doc) @@ -88,6 +91,21 @@ (when (string-match ".*=\"\\([0-9]+\\)\" ." s) (string-to-number (match-string 1 s)))) ) +;;; dict + +(defvar jao-mac-dict-history nil) + +(defun jao-mac-dict (&optional word) + (interactive (list (thing-at-point 'word))) + (jao-mac-open "dict://%S" + (read-string (format "Look up (%s): " word) + nil + 'jao-mac-dict-history + (substring-no-properties word) + t))) + +;;(setq completion-auto-help nil) + ;;; Skim (defvar jao-skim--current-file-script (jao-mac-applescript-prepare @@ -204,29 +222,28 @@ ;;; DevonThink -(defun jao-devon-tell (&rest script-lines) - (apply #'jao-mac-tell-app "id DNtp" script-lines )) - -(defun jao-devon-find-url (file) - (jao-devon-tell - "repeat with db in databases" - (format "set res to lookup records with path %S in db" - (file-truename file)) - "if res /= {} then return the reference URL of (item 1 of res)" - "end repeat" - "return \"\"")) - -(defun jao-devon-show-search (s) - (jao-devon-tell (format "show search %S" s) "activate")) - -(defun jao-devon-open (file &optional page height) - (let ((url (jao-devon-find-url file))) - (if (string-empty-p (or url "")) - (let ((jao-pdf-open-in-emacs t)) - (jao-find-or-open file page height)) - (let* ((p (if page (format "?page=%s" (- page 1)) "")) - (u (format "%s%s" url p))) - (jao-mac-open "%s%s" url p))))) +;; (defun jao-devon-tell (&rest script-lines) +;; (apply #'jao-mac-tell-app "id DNtp" script-lines )) + +;; (defun jao-devon-find-url (file) +;; (jao-devon-tell +;; "repeat with db in databases" +;; (format "set res to lookup records with path %S in db" +;; (file-truename file)) +;; "if res /= {} then return the reference URL of (item 1 of res)" +;; "end repeat" +;; "return \"\"")) + +;; (defun jao-devon-show-search (s) +;; (jao-devon-tell (format "show search %S" s) "activate")) + +;; (defun jao-devon-open (file &optional page height) +;; (let ((url (jao-devon-find-url file))) +;; (if (string-empty-p (or url "")) +;; (let ((jao-pdf-open-in-emacs t)) +;; (jao-find-or-open file page height)) +;; (let ((p (if page (format "?page=%s" (- page 1)) ""))) +;; (jao-mac-open "%s%s" url p))))) (provide 'jao-mac) ;;; jao-mac.el ends here |
