Merge pull request #171 from MatthewZMD/eaf-markdown-share

Add browser bindings to md + org previewer, better messages
master
Andy Stewart 6 years ago committed by GitHub
commit 7fd942dffe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      eaf.el

@ -7,7 +7,7 @@
;; Copyright (C) 2018, Andy Stewart, all rights reserved. ;; Copyright (C) 2018, Andy Stewart, all rights reserved.
;; Created: 2018-06-15 14:10:12 ;; Created: 2018-06-15 14:10:12
;; Version: 0.5 ;; Version: 0.5
;; Last-Updated: Fri Dec 20 02:21:29 2019 (-0500) ;; Last-Updated: Fri Dec 20 02:42:51 2019 (-0500)
;; By: Mingde (Matthew) Zeng ;; By: Mingde (Matthew) Zeng
;; URL: http://www.emacswiki.org/emacs/download/eaf.el ;; URL: http://www.emacswiki.org/emacs/download/eaf.el
;; Keywords: ;; Keywords:
@ -306,7 +306,9 @@ Try not to modify this alist directly. Use `eaf-setq' to modify instead."
("video-player" . eaf-video-player-keybinding) ("video-player" . eaf-video-player-keybinding)
("image-viewer" . eaf-image-viewer-keybinding) ("image-viewer" . eaf-image-viewer-keybinding)
("camera" . eaf-camera-keybinding) ("camera" . eaf-camera-keybinding)
("terminal" . eaf-terminal-keybinding)) ("terminal" . eaf-terminal-keybinding)
("markdown-previewer" . eaf-browser-keybinding)
("org-previewer" . eaf-browser-keybinding))
"Mapping app names to keybinding variables. "Mapping app names to keybinding variables.
Any new app should add the its name and the corresponding Any new app should add the its name and the corresponding
@ -459,8 +461,10 @@ Don't call this function if you not EAF developer."
(interactive) (interactive)
(if (process-live-p eaf-process) (if (process-live-p eaf-process)
;; Delete EAF server process. ;; Delete EAF server process.
(delete-process eaf-process) (progrn
(message "EAF process has dead."))) (delete-process eaf-process)
(message "EAF - Process terminated."))
(message "EAF - Process already terminated.")))
(defun eaf-restart-process () (defun eaf-restart-process ()
(interactive) (interactive)
@ -882,7 +886,7 @@ This is used to bind key to EAF Python applications."
(string-prefix-p "https://" url)) (string-prefix-p "https://" url))
(setq url (concat "http://" url))) (setq url (concat "http://" url)))
(eaf-open url "browser" arguments)) (eaf-open url "browser" arguments))
(message (format "EAF: %s is an invalid URL." url)))) (message (format "EAF - %s is an invalid URL." url))))
;;;###autoload ;;;###autoload
(defalias 'eaf-open-url #'eaf-open-browser) (defalias 'eaf-open-url #'eaf-open-browser)
@ -921,7 +925,7 @@ This is used to bind key to EAF Python applications."
"Open an EAF application with URL, optional APP-NAME and ARGUMENTS. "Open an EAF application with URL, optional APP-NAME and ARGUMENTS.
When called interactively, URL accepts a file that can be opened by EAF." When called interactively, URL accepts a file that can be opened by EAF."
(interactive "FOpen with EAF: ") (interactive "FEAF - Open with EAF App: ")
;; Try to set app-name along with url if app-name is unset. ;; Try to set app-name along with url if app-name is unset.
(when (and (not app-name) (file-exists-p url)) (when (and (not app-name) (file-exists-p url))
(setq url (expand-file-name url)) (setq url (expand-file-name url))
@ -934,7 +938,7 @@ When called interactively, URL accepts a file that can be opened by EAF."
;; Try get user's github token if `eaf-grip-token' is nil. ;; Try get user's github token if `eaf-grip-token' is nil.
(setq arguments (setq arguments
(or eaf-grip-token (or eaf-grip-token
(read-string "Fill your own github token (or set `eaf-grip-token' with token string): ")))) (read-string "EAF - Fill your own Github token (or set `eaf-grip-token' with token string): "))))
(when (equal app-name "browser") (when (equal app-name "browser")
(setq url (concat "file://" url))))) (setq url (concat "file://" url)))))
(unless arguments (setq arguments "")) (unless arguments (setq arguments ""))
@ -965,15 +969,15 @@ When called interactively, URL accepts a file that can be opened by EAF."
(setq eaf-first-start-app-name app-name) (setq eaf-first-start-app-name app-name)
(setq eaf-first-start-arguments arguments) (setq eaf-first-start-arguments arguments)
(eaf-start-process) (eaf-start-process)
(message "Opening %s with EAF-%s..." url app-name)) (message "EAF - Opening %s with EAF-%s..." url app-name))
;; Output something to user if app-name is empty string. ;; Output something to user if app-name is empty string.
(message (cond (message (cond
((not (or (string-prefix-p "/" url) ((not (or (string-prefix-p "/" url)
(string-prefix-p "~" url))) (string-prefix-p "~" url)))
"EAF doesn't know how to open %s.") "EAF - Cannot open %s.")
((file-exists-p url) ((file-exists-p url)
"EAF doesn't know how to open %s.") "EAF - Cannot open %s.")
(t "EAF: %s does not exist.")) (t "EAF - %s does not exist."))
url))) url)))
(defun eaf--display-app-buffer (app-name buffer) (defun eaf--display-app-buffer (app-name buffer)

Loading…
Cancel
Save