Unverified Commit bc90d892 authored by Andy Stewart's avatar Andy Stewart Committed by GitHub
Browse files

Merge pull request #69 from MatthewZMD/eaf-separate-function

Create eaf-open-demo, eaf-open-camera, eaf-open-qutebrowser functions
parents 1f80954a 9f764463
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -24,10 +24,10 @@ Python is a perfect language to develop Qt program and it can call pretty much i

## Let me run hello word
```
M-x eaf-open
M-x eaf-open-demo
```

    Then type "eaf-demo" as input, will pop hello world window in emacs like below:
    This will pop hello world window in emacs like below:

| Demo                                                  |
| :--------:                                            |
+51 −42
Original line number Diff line number Diff line
@@ -553,19 +553,28 @@ We need calcuate render allocation to make sure no black border around render co

(defalias 'eaf-open-url 'eaf-open-browser)

(defun eaf-open-demo ()
  "Open EAF demo screen to verify that EAF is working properly."
  (interactive)
  (eaf-open "eaf-demo" "demo"))

(defun eaf-open-camera ()
  "Open EAF camera application."
  (interactive)
  (eaf-open "eaf-camera" "camera"))

(defun eaf-open-qutebrowser ()
  "Open EAF Qutebrowser application."
  (interactive)
  (eaf-open "eaf-qutebrowser" "qutebrowser"))

(defun eaf-open (url &optional app-name arguments)
  "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."
  (interactive "FOpen with EAF: ")
  ;; Try to set app-name along with url if app-name is unset.
  (unless app-name
    (cond ((string-equal url "eaf-demo")
           (setq app-name "demo"))
          ((string-equal url "eaf-camera")
           (setq app-name "camera"))
          ((string-equal url "eaf-qutebrowser")
           (setq app-name "qutebrowser"))
          ((file-exists-p url)
           ;;(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 extension-name (file-name-extension url))
    (cond ((member extension-name '("pdf" "xps" "oxps" "cbz" "epub" "fb2" "fbz"))
@@ -597,7 +606,7 @@ We need calcuate render allocation to make sure no black border around render co
             (push url eaf-org-file-list))
           ;; Split window to show file and previewer.
           (eaf-split-preview-windows)
                  (setq app-name "orgpreviewer"))))))
           (setq app-name "orgpreviewer"))))

  (unless arguments
    (setq arguments ""))