Introduce eaf-keyboard-quit, replacing Emacs keyboard-quit

This will be needed for PDF and also another upcoming PR
master
Matthew 6 years ago
parent d893b9c721
commit c10ab03646
  1. 6
      app/pdf-viewer/buffer.py
  2. 3
      core/buffer.py
  3. 14
      eaf.el
  4. 6
      eaf.py

@ -130,6 +130,12 @@ class AppBuffer(Buffer):
self.buffer_widget.add_mark_jump_link_tips()
self.buffer_widget.send_input_message("EAF PDF Viewer - Jump to Link: ", "jump_link")
def action_quit(self):
if self.buffer_widget.is_mark_search:
self.buffer_widget.cleanup_search()
if self.buffer_widget.is_mark_link:
self.buffer_widget.cleanup_links()
def search_text(self):
if self.buffer_widget.search_flag:
self.buffer_widget.remove_marked_search_text()

@ -239,6 +239,9 @@ class Buffer(QGraphicsScene):
def handle_input_message(self, result_type, result_content):
pass
def action_quit(self):
pass
def cancel_input_message(self, result_type):
pass

@ -96,10 +96,11 @@
(defvar eaf-mode-map*
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-h m") 'eaf-describe-bindings)
(define-key map [remap describe-bindings] 'eaf-describe-bindings)
(define-key map (kbd "C-c b") 'eaf-open-bookmark)
(define-key map (vector 'remap 'self-insert-command) #'eaf-send-key)
(define-key map (kbd "C-g") #'eaf-keyboard-quit)
(define-key map (kbd "C-h m") #'eaf-describe-bindings)
(define-key map [remap describe-bindings] #'eaf-describe-bindings)
(define-key map (kbd "C-c b") #'eaf-open-bookmark)
(define-key map (vector 'remap #'self-insert-command) #'eaf-send-key)
(dolist (single-key '("RET" "DEL" "TAB" "SPC" "<backtab>" "<home>" "<end>" "<left>" "<right>" "<up>" "<down>" "<prior>" "<next>"))
(define-key map (kbd single-key) #'eaf-send-key))
map)
@ -642,6 +643,11 @@ to edit EAF keybindings!" fun fun)))
(eaf-call "update_buffer_with_url" "app.org-previewer.buffer" (buffer-file-name) "")
(message (format "export %s to html" (buffer-file-name))))))
(defun eaf-keyboard-quit ()
"Similar to `keyboard-quit' but signals a ‘quit’ condition to EAF applications."
(interactive)
(eaf-call "action_quit" eaf--buffer-id))
(defun eaf-send-key ()
"Directly send key to EAF Python side."
(interactive)

@ -255,6 +255,12 @@ class EAF(dbus.service.Object):
self.message_to_emacs("Cannot call function: " + function_name)
return ""
@dbus.service.method(EAF_DBUS_NAME, in_signature="s", out_signature="")
def action_quit(self, buffer_id):
if buffer_id in self.buffer_dict:
self.buffer_dict[buffer_id].action_quit()
self.message_to_emacs("Quit")
@dbus.service.method(EAF_DBUS_NAME, in_signature="ss", out_signature="")
def send_key(self, buffer_id, event_string):
# Send event to buffer when found match buffer.

Loading…
Cancel
Save